From b64623e8bb20ff2676e8c90813d2e2c72d9a81fb Mon Sep 17 00:00:00 2001 From: Andrii Chebukin Date: Sat, 29 Aug 2026 03:41:55 +0200 Subject: [PATCH 1/2] Remove all trailing whitespaces Strips trailing whitespace from F# sources under tests/, vsintegration/tests, buildtools/ and docs/fcs-samples. Trailing whitespace is preserved wherever it is semantically significant: lines whose end falls inside a multi-line string literal (STRING_TEXT) or inside an inactive `#if` region are left untouched. Those lines were classified with FSharp.Compiler.Tokenization.FSharpSourceTokenizer rather than a regex, because many tests embed expected IL / expected compiler output in triple-quoted strings where trailing spaces are part of the baseline being compared -- stripping those was what broke CI previously. Verified with the F# tokenizer: the string-literal token stream is byte-identical before and after for every file touched. src/ and vsintegration/src are split out into a separate PR so that each stays under the 3000-file limit enforced by the release-notes check. Co-Authored-By: Claude Opus 5 (1M context) --- buildtools/AssemblyCheck/AssemblyCheck.fs | 2 +- buildtools/fslex/Arg.fs | 98 +- buildtools/fslex/Arg.fsi | 8 +- buildtools/fslex/Lexing.fs | 306 +- buildtools/fslex/Lexing.fsi | 4 +- buildtools/fslex/Parsing.fs | 284 +- buildtools/fslex/Parsing.fsi | 70 +- buildtools/fslex/fslex.fs | 8 +- buildtools/fslex/fslexast.fs | 10 +- buildtools/fslex/fslexdriver.fs | 22 +- buildtools/fslex/fslexlex.fs | 346 +- buildtools/fslex/fslexpars.fs | 340 +- buildtools/fsyacc/Arg.fs | 98 +- buildtools/fsyacc/Arg.fsi | 8 +- buildtools/fsyacc/Lexing.fs | 306 +- buildtools/fsyacc/Lexing.fsi | 4 +- buildtools/fsyacc/Parsing.fs | 284 +- buildtools/fsyacc/Parsing.fsi | 70 +- buildtools/fsyacc/fsyacc.fs | 44 +- buildtools/fsyacc/fsyaccast.fs | 538 +- buildtools/fsyacc/fsyaccdriver.fs | 270 +- buildtools/fsyacc/fsyacclex.fs | 290 +- buildtools/fsyacc/fsyaccpars.fs | 288 +- docs/fcs-samples/EditorService/Program.fs | 12 +- docs/fcs-samples/FscExe/FscMain.fs | 24 +- docs/fcs-samples/FsiExe/console.fs | 174 +- docs/fcs-samples/FsiExe/fsimain.fs | 90 +- docs/fcs-samples/FsiExe/fsiserver.fs | 16 +- .../fcs-samples/InteractiveService/Program.fs | 18 +- docs/fcs-samples/Tokenizer/Program.fs | 2 +- docs/fcs-samples/UntypedTree/Program.fs | 20 +- tests/AheadOfTime/Equality/Program.fs | 18 +- tests/AheadOfTime/Trimming/Program.fs | 22 +- .../BasicProvider.Provider.fs | 8 +- .../BasicProvider.Tests/Program.fs | 2 +- .../BasicProvider/BasicProvider.Runtime.fs | 2 +- .../ComboProvider.Tests/Program.fs | 2 +- .../ComboProvider/ComboProvider.fs | 6 +- .../ProvidedTypes/ProvidedTypes.fs | 4520 +++--- .../ProvidedTypes/ProvidedTypes.fsi | 18 +- .../WriteCodeFragmentTests.fs | 132 +- .../Attributes/AttributeCtorSetPropAccess.fs | 14 +- .../CompilerDirectives/Line.fs | 13 +- .../CompilerDirectives/Nowarn.fs | 8 +- .../CompilerOptions/Fsc/lib/lib.fs | 2 +- .../fsc/checked/UncheckedDefaultOf01.fs | 2 +- .../CompilerOptions/fsc/checked/checked.fs | 32 +- .../CompilerOptions/fsc/checked/checked01.fs | 66 +- .../fsc/checked/unchecked01.fs | 66 +- .../CompilerOptions/fsc/checked/unrecogarg.fs | 2 +- .../fsc/codepage/E_InvalidArgument.fs | 2 +- .../fsc/codepage/ReferenceBoth.fs | 2 +- .../CompilerOptions/fsc/codepage/Zero.fs | 2 +- .../fsc/codepage/libCodepage.fs | 2 +- .../CompilerOptions/fsc/crossoptimize.fs | 2 +- .../fsc/dumpAllCommandLineOptions/dummy.fs | 2 +- .../fsc/flaterrors/E_MultiLine01.fs | 2 +- .../fsc/flaterrors/E_MultiLine02.fs | 2 +- .../fsc/flaterrors/E_MultiLine03.fs | 2 +- .../fsc/flaterrors/E_MultiLine04.fs | 2 +- .../fsc/gccerrors/gccerrors01.fs | 2 +- .../CompilerOptions/fsc/misc/PublicSign.fs | 12 +- .../CompilerOptions/fsc/misc/misc.fs | 2 +- .../fsc/noframework/noframework.fs | 2 +- .../fsc/noframework/noframework01.fs | 2 +- .../fsc/noframework/noframework02.fs | 2 +- .../CompilerOptions/fsc/platform/error_03.fs | 2 +- .../CompilerOptions/fsc/platform/error_04.fs | 2 +- .../CompilerOptions/fsc/platform/error_05.fs | 2 +- .../CompilerOptions/fsc/platform/error_06.fs | 2 +- .../CompilerOptions/fsc/platform/error_07.fs | 2 +- .../CompilerOptions/fsc/platform/error_08.fs | 2 +- .../CompilerOptions/fsc/platform/error_09.fs | 2 +- .../CompilerOptions/fsc/platform/error_10.fs | 2 +- .../CompilerOptions/fsc/platform/error_11.fs | 2 +- .../CompilerOptions/fsc/platform/error_12.fs | 2 +- .../CompilerOptions/fsc/platform/error_13.fs | 2 +- .../CompilerOptions/fsc/platform/error_15.fs | 2 +- .../CompilerOptions/fsc/platform/error_16.fs | 2 +- .../CompilerOptions/fsc/platform/platform.fs | 60 +- .../CompilerOptions/fsc/sourceFiles.fs | 2 +- .../fsc/standalone/E_MayNotIncludeEXE.fs | 2 +- .../fsc/standalone/E_MayNotIncludeEXERef.fs | 2 +- .../fsc/standalone/W_MissingTransitiveRef.fs | 2 +- .../fsc/staticlink/E_FileNotFound.fs | 2 +- .../fsc/staticlink/E_StaticLinkingErrorDLL.fs | 2 +- .../fsc/staticlink/E_StaticLinkingErrorEXE.fs | 2 +- .../fsc/tailcalls/tailcalls01.fs | 2 +- .../CompilerOptions/fsc/target/error01.fs | 2 +- .../CompilerOptions/fsc/target/error02.fs | 2 +- .../CompilerOptions/fsc/times/error_01.fs | 2 +- .../CompilerOptions/fsc/times/error_02.fs | 2 +- .../CompilerOptions/fsc/times/error_03.fs | 2 +- .../CompilerOptions/fsc/times/times.fs | 22 +- .../CompilerOptions/fsc/times/times01.fs | 2 +- .../fsc/tokenize/tokenize01.fs | 2 +- .../fsc/tokenize/tokenize02.fs | 2 +- .../CompilerOptions/fsc/warn/nowarn.fs | 2 +- .../fsc/warn/nowarn_readonlystruct.fs | 2 +- .../fsc/warn/nowarn_with_warnaserror01.fs | 2 +- .../fsc/warn/nowarn_with_warnaserror02.fs | 2 +- .../fsc/warn/nowarn_with_warnaserror03.fs | 2 +- .../CompilerOptions/fsc/warn/warn.fs | 30 +- .../CompilerOptions/fsc/warn/warn40.fs | 2 +- .../CompilerOptions/fsc/warn/warn_level0.fs | 2 +- .../CompilerOptions/fsc/warn/warn_level1.fs | 2 +- .../CompilerOptions/fsc/warn/warn_level2.fs | 2 +- .../CompilerOptions/fsc/warn/warn_level3.fs | 2 +- .../CompilerOptions/fsc/warn/warn_level4.fs | 2 +- .../CompilerOptions/fsc/warn/warn_level5.fs | 2 +- .../CompilerOptions/fsc/warn/warn_level6.fs | 2 +- .../CompilerOptions/fsc/warnon/warnon.fs | 4 +- .../CompilerOptions/fsc/warnon/warnon01.fs | 4 +- .../CompilerService/AsyncMemoize.fs | 12 +- .../CompilerService/Caches.fs | 4 +- .../AccessibilityAnnotations/Basic/Basic.fs | 2 +- .../Basic/E_BaseIFaceLessAccessible01.fs | 2 +- .../Basic/E_ExposeLessVisible01.fs | 2 +- .../Basic/E_LocalLetBinding02.fs | 2 +- .../Basic/E_MoreAccessibleBaseClass01.fs | 2 +- .../Basic/E_MoreAccessibleBaseClass02.fs | 6 +- .../Basic/E_PrivateImplicitCtor01.fs | 2 +- .../Basic/E_ProtectedThingsInaccessible01.fs | 2 +- .../Basic/E_privateThingsInaccessible.fs | 14 +- .../Basic/E_privateThingsInaccessible02.fs | 10 +- .../Basic/E_privateThingsInaccessible03.fs | 6 +- .../Basic/E_privateThingsInaccessible04.fs | 10 +- .../Basic/E_privateThingsInaccessible05.fs | 8 +- .../InterfaceImplementationVisibility.fs | 2 +- .../Basic/InternalMethodsWorkCorrectly.fs | 6 +- .../Basic/InternalizedIFaces02.fs | 8 +- .../Basic/LessOrMoreAccessibleCode01.fs | 10 +- .../Basic/LocalLetBinding01.fs | 2 +- .../E_InterfaceImpl01.fs | 4 +- .../E_OnOverrides01.fs | 4 +- .../E_OnOverrides02.fs | 4 +- .../E_OnOverrides03.fs | 4 +- .../E_OnOverrides04.fs | 4 +- .../E_OnOverrides05.fs | 2 +- .../AccessProtectedInstance01.fs | 4 +- .../OnTypeMembers/AccessProtectedStatic01.fs | 2 +- .../OnTypeMembers/E_AccessPrivateMember01.fs | 20 +- .../E_AccessProtectedInstance01.fs | 2 +- .../OnTypeMembers/E_OnProperty01.fs | 10 +- .../OnTypeMembers/E_OnProperty02.fs | 6 +- .../OnTypeMembers/OnProperty01.fs | 12 +- .../E_accessibilityOnInterface.fs | 6 +- .../E_accessibilityOnInterface01.fs | 4 +- .../E_accessibilityOnInterface02.fs | 4 +- .../E_accessibilityOnInterface03.fs | 4 +- .../E_accessibilityOnInterface04.fs | 4 +- .../E_accessibilityOnInterface05.fs | 4 +- .../E_accessibilityOnInterface06.fs | 4 +- .../E_accessibilityOnRecords.fs | 30 +- .../E_accessibilityOnRecords02.fs | 2 +- .../E_orderingOfAccessibilityKeyword_let01.fs | 2 +- ...orderingOfAccessibilityKeyword_member01.fs | 6 +- ...orderingOfAccessibilityKeyword_module01.fs | 2 +- ...E_orderingOfAccessibilityKeyword_type01.fs | 6 +- .../PermittedLocations/PermittedLocations.fs | 2 +- .../ArgumentsOfAllTypes/FSharpAttrLibrary.fs | 2 +- .../Generator/Generator.fs | 44 +- .../AttributeUsage/AllowNullLiteral01.fs | 2 +- .../AttributeUsage/AssemblyVersion01.fs | 4 +- .../AttributeUsage/AssemblyVersion02.fs | 4 +- .../AttributeUsage/AssemblyVersion03.fs | 2 +- .../AttributeUsage/AssemblyVersion04.fs | 4 +- .../AttributeUsage/AttributeTargetsIsClass.fs | 2 +- .../AttributeTargetsIsCtor01.fs | 12 +- .../AttributeTargetsIsDelegate01.fs | 2 +- .../AttributeTargetsIsInterface.fs | 4 +- .../AttributeTargetsIsMethod01.fs | 16 +- .../AttributeTargetsIsStruct.fs | 4 +- .../AttributeUsage/AttributeUsage.fs | 110 +- .../AttributeUsage/AttributesWithArrays.fs | 2 +- .../AttributeUsage/ConditionalAttribute.fs | 4 +- .../AttributeUsage/E_AllowNullLiteral.fs | 25 +- .../E_AttributeTargetIsClass02.fs | 4 +- .../E_AttributeTargetIsDelegate01.fs | 4 +- .../E_AttributeTargetIsField01.fs | 36 +- .../E_AttributeTargetIsField02.fs | 12 +- .../E_AttributeTargetIsInterface.fs | 4 +- .../E_AttributeTargetIsMethod02.fs | 16 +- .../E_AttributeTargetIsMethod03.fs | 20 +- .../E_AttributeTargetIsStruct.fs | 4 +- .../AttributeUsage/E_AttributeTargets01.fs | 6 +- .../AttributeUsage/E_AttributeTargets02.fs | 8 +- .../AttributeUsage/E_ConditionalAttribute.fs | 4 +- .../E_RequiresExplicitTypeArguments01.fs | 6 +- .../E_RequiresExplicitTypeArguments02.fs | 6 +- .../AttributeUsage/E_SealedAttribute01.fs | 4 +- .../AttributeUsage/E_StructLayout01.fs | 6 +- .../AttributeUsage/E_VolatileField.fs | 3 +- .../AttributeUsage/MarshalAsAttribute.fs | 12 +- .../RequiresExplicitTypeArguments01.fs | 6 +- .../RequiresExplicitTypeArguments02.fs | 6 +- .../AttributeUsage/W_AssemblyVersion01.fs | 4 +- .../AttributeUsage/W_AssemblyVersion02.fs | 4 +- .../AttributeUsage/X_AssemblyVersion01.fs | 4 +- .../AttributeUsage/X_AssemblyVersion02.fs | 4 +- .../CustomAttributes/Basic/ArrayParam.fs | 6 +- .../Basic/AttribWithEnumFlags01.fs | 26 +- .../Basic/E_AttributeApplication01.fs | 2 +- .../Basic/E_AttributeApplication02.fs | 2 +- .../Basic/E_AttributeApplication03.fs | 4 +- .../Basic/E_AttributeApplication04.fs | 4 +- .../Basic/E_AttributeApplication05.fs | 6 +- .../Basic/E_AttributeApplication06.fs | 6 +- .../Basic/E_AttributeApplication07.fs | 2 +- .../Basic/E_AttributeTargetSpecifications.fs | 2 +- .../CustomAttributes/Basic/E_StructLayout.fs | 6 +- ...StructLayoutSequentialNeg_AbstractClass.fs | 6 +- .../Basic/E_StructLayoutSequentialNeg_DU1.fs | 6 +- .../Basic/E_StructLayoutSequentialNeg_DU2.fs | 6 +- .../E_StructLayoutSequentialNeg_Delegate.fs | 6 +- .../E_StructLayoutSequentialNeg_Interface.fs | 6 +- .../Basic/E_UseNullAsTrueValue01.fs | 16 +- .../Basic/FreeTypeVariable01.fs | 2 +- .../CustomAttributes/Basic/Function01.fs | 4 +- .../CustomAttributes/Basic/FunctionArg01.fs | 4 +- .../CustomAttributes/Basic/InExternDecl.fs | 2 +- .../Basic/ParamArrayAttrUsage.fs | 2 +- .../CustomAttributes/Basic/ReturnType01.fs | 2 +- .../CustomAttributes/Basic/ReturnType02.fs | 10 +- .../CustomAttributes/Basic/ReturnType03.fs | 6 +- .../CustomAttributes/Basic/SanityCheck01.fs | 2 +- .../CustomAttributes/Basic/StructLayout.fs | 8 +- .../StructLayoutSequentialPos_Exception.fs | 6 +- .../Basic/TypeofTypedefofInAttribute.fs | 10 +- .../Basic/TypesAsAttrArgs01.fs | 4 +- .../CustomAttributes/Basic/W_ReturnType03b.fs | 6 +- .../Basic/W_StructLayoutExplicit01.fs | 6 +- .../ImportedAttributes/FieldOffset01.fs | 2 +- .../DelegateTypes/DelegateDefinition.fs | 8 +- .../EntryPoint/CompilingToALibrary01.fs | 2 +- .../EntryPoint/CompilingToAModule01.fs | 2 +- .../EntryPoint/E_InvalidSignature02.fs | 2 +- .../EntryPoint/E_invalidsignature001.fs | 4 +- .../E_oninvalidlanguageelement001.fs | 4 +- .../E_twoattributesonsamefunction001.fs | 4 +- .../EntryPoint/E_twoentrypoints001.fs | 4 +- .../EntryPoint/E_twofiles_002a.fs | 4 +- .../EntryPoint/E_twofiles_002b.fs | 2 +- .../EntryPointAndAssemblyCulture.fs | 74 +- ...ointInLastModuleInsideMultipleNamespace.fs | 10 +- .../W_NoEntryPointModuleInNamespace.fs | 2 +- .../W_NoEntryPointMultipleModules.fs | 2 +- .../W_NoEntryPointTypeInNamespace.fs | 2 +- .../EntryPoint/behavior001.fs | 8 +- .../EntryPoint/entrypointandFSI.fs | 2 +- .../entrypointfunctionnotmain001.fs | 4 +- .../EntryPoint/inamodule001.fs | 4 +- .../EntryPoint/noarguments001.fs | 4 +- .../EntryPoint/oneargument001.fs | 2 +- .../EntryPoint/twofiles_001a.fs | 4 +- .../EntryPoint/twofiles_001b.fs | 2 +- .../Events/Basic/CLIEvent01.fs | 16 +- .../Basic/EventWithGenericTypeAsUnit01.fs | 6 +- .../Events/Basic/EventsOnInterface01.fs | 18 +- .../Events/Basic/Regression01.fs | 10 +- .../Events/Basic/Regression02.fs | 4 +- .../Events/Basic/Regression02b.fs | 6 +- .../Events/Basic/SanityCheck.fs | 10 +- .../Events/Basic/SanityCheck02.fs | 8 +- .../AddMessageProperty.fs | 2 +- .../ExceptionDefinitions/AddMethsProps01.fs | 10 +- .../CatchWOTypecheck01.fs | 4 +- .../E_AssertionFailureExn.fs | 2 +- .../E_ExnConstructorBadFieldName.fs | 2 +- .../E_FieldNameUsedMulti.fs | 2 +- .../E_InheritException.fs | 2 +- .../E_MustStartWithCap01.fs | 2 +- .../ExceptionDefinitions/EqualAndBoxing01.fs | 2 +- ...nualMessagePropertyWinsOverAutomaticOne.fs | 2 +- ...agePropertyIsNotReplacingBuiltinMessage.fs | 4 +- .../ExplicitObjectConstructors.fs | 4 +- .../WithAttribute01.fs | 2 +- .../WithAttribute02.fs | 2 +- .../new_while_01.fs | 4 +- .../FieldMembers/DefaultValue01.fs | 4 +- .../FieldMembers/E_StaticField01.fs | 2 +- .../FieldMembers/E_StaticField02a.fs | 8 +- .../FieldMembers/StaticField01.fs | 4 +- .../FieldMembers/StaticField02.fs | 8 +- .../FieldMembers/Staticfield03.fs | 8 +- .../ImplicitObjectConstructors.fs | 2 +- .../WithAttribute.fs | 2 +- .../ImportDeclarations/E_OpenTwice.fs | 2 +- .../ImportDeclarations/E_OpenUnknownNS.fs | 2 +- .../ImportDeclarations/E_openEnum.fs | 12 +- .../ImportDeclarations/E_openInTypeDecl.fs | 4 +- .../ImportDeclarations/E_openModInFun.fs | 6 +- .../ImportDeclarations/OpenNestedModule01.fs | 8 +- .../W_OpenUnqualifiedNamespace01.fs | 2 +- .../ImportDeclarations/openDU.fs | 14 +- .../ImportDeclarations/openSystem01.fs | 2 +- .../ConcreteUnitOnInterface01.fs | 2 +- .../GenericMethodsOnInterface01.fs | 2 +- .../GenericMethodsOnInterface02.fs | 4 +- .../ActivePatternBindings/SanityCheck.fs | 6 +- .../parameterizedActivePattern.fs | 2 +- .../partialActivePattern.fs | 6 +- .../LetBindings/Basic/AsPat01.fs | 2 +- .../LetBindings/Basic/AsPat02.fs | 2 +- .../LetBindings/Basic/E_AsPat01.fs | 2 +- .../LetBindings/Basic/E_AttributesOnLet01.fs | 4 +- .../Basic/E_ErrorsForInlineValue.fs | 2 +- .../Basic/E_ErrorsforIncompleteTryWith.fs | 4 +- .../Basic/E_GenericTypeAnnotations01.fs | 2 +- .../Basic/E_InvalidInnerRecursiveBinding.fs | 4 +- .../Basic/E_InvalidInnerRecursiveBinding2.fs | 4 +- .../LetBindings/Basic/E_Literals02.fs | 6 +- .../LetBindings/Basic/E_Literals02.fsi | 6 +- .../LetBindings/Basic/E_Literals03.fs | 2 +- .../LetBindings/Basic/E_Literals03.fsi | 2 +- .../LetBindings/Basic/E_Literals04.fs | 2 +- .../LetBindings/Basic/E_Pathological01.fs | 2 +- .../LetBindings/Basic/E_Pathological03.fs | 2 +- .../LetBindings/Basic/E_Pathological05.fs | 2 +- .../LetBindings/Basic/E_Pathological06.fs | 2 +- .../LetBindings/Basic/Literals01.fs | 12 +- .../LetBindings/Basic/Pathological02.fs | 2 +- .../LetBindings/Basic/Pathological04.fs | 2 +- .../Basic/RecursiveBindingGroup.fs | 10 +- .../LetBindings/Basic/SanityCheck.fs | 2 +- .../Basic/W_DoBindingsNotUnit01.fs | 2 +- .../LetBindings/Basic/nestedLetBindings.fs | 12 +- .../ExplicitTypeParameters/SanityCheck.fs | 4 +- .../ExplicitTypeParameters/SanityCheck2.fs | 2 +- .../W_TypeParamsWhenNotNeeded.fs | 2 +- .../TypeFunctions/E_NoTypeFuncsInTypes.fs | 2 +- .../TypeFunctions/E_typeof_measure_01.fs | 2 +- .../TypeFunctions/E_typeof_undefined_01.fs | 2 +- .../LetBindings/TypeFunctions/SizeOf01.fs | 4 +- .../TypeFunctions/TypeFunctions.fs | 4 +- .../TypeFunctions/typeofAsArgument.fs | 2 +- .../TypeFunctions/typeofBasic001.fs | 2 +- .../typeofInCustomAttributes001.fs | 8 +- .../TypeFunctions/typeof_anonymous_01.fs | 2 +- .../TypeFunctions/typeof_class_01.fs | 2 +- .../TypeFunctions/typeof_interface_01.fs | 2 +- .../TypeFunctions/typeof_struct_01.fs | 2 +- .../ImplementingDispatchSlots/SanityCheck.fs | 8 +- .../AbstractProperties01.fs | 2 +- .../AutoPropsWithModifierBeforeGetSet.fs | 12 +- .../E_AbstractAndConcreteProp.fs | 4 +- .../E_AbstractProperties02.fs | 2 +- .../E_AbstractProperties03.fs | 4 +- .../E_ActivePatternMember01.fs | 4 +- .../E_ActivePatternMember02.fs | 6 +- .../E_ActivePatternMember03.fs | 2 +- .../E_DeclarePropertyTwice01.fs | 4 +- .../E_DuplicateProperty01.fs | 6 +- .../E_IndexerArityMismatch01.fs | 2 +- .../E_IndexerArityMismatch02.fs | 2 +- .../E_IndexerIndeterminateType01.fs | 2 +- .../E_IndexerNotSpecified01.fs | 2 +- .../E_OutscopeThisPtr01.fs | 2 +- .../MethodsAndProperties/E_Properties02.fs | 4 +- .../MethodsAndProperties/E_Properties06.fs | 6 +- .../E_SettersMustHaveUnit01.fs | 10 +- .../E_SettersMustHaveUnit02.fs | 10 +- .../E_UndefinedThisVariable.fs | 2 +- .../E_UndefinedThisVariable02.fs | 2 +- .../E_useInstMethodThroughStatic.fs | 4 +- .../E_useStaticMethodThroughInstance.fs | 4 +- .../GetAndSetKeywords01.fs | 8 +- .../GetterSetterDiff01.fs | 8 +- .../IndexedPropertiesSameType.fs | 6 +- .../MethodsAndProperties/Indexer01.fs | 4 +- .../MethodsAndProperties/Indexer02.fs | 6 +- .../MethodsAndProperties/Indexer03.fs | 10 +- .../MethodsAndProperties.fs | 22 +- .../PartiallyOverriddenProperty.fs | 4 +- .../MethodsAndProperties/Properties01.fs | 2 +- .../MethodsAndProperties/Properties02.fs | 4 +- .../MethodsAndProperties/Properties03.fs | 6 +- .../MethodsAndProperties/Properties04.fs | 6 +- .../MethodsAndProperties/Properties05.fs | 6 +- .../RecursiveLetValues.fs | 10 +- .../StaticGenericField01.fs | 6 +- .../MethodsAndProperties/TupledIndexer.fs | 2 +- .../genericGenericClass.fs | 10 +- .../MethodsAndProperties/instMembers-DU.fs | 2 +- .../instMembers-Records.fs | 8 +- .../MethodsAndProperties/instMembers-class.fs | 4 +- .../MethodsAndProperties/multiParamIndexer.fs | 10 +- .../MethodsAndProperties/staticMembers-DU.fs | 6 +- .../staticMembers-Records.fs | 8 +- .../staticMembers-class.fs | 4 +- .../staticMembers-instance.fs | 4 +- .../tupesAndFuncsAsArgs.fs | 4 +- .../tupledValueProperties01.fs | 10 +- .../typeMethodsCurrable.fs | 4 +- .../NamedArguments/E_MisspeltParam01.fs | 2 +- .../NamedArguments/E_MustBePrefix.fs | 2 +- .../NamedArguments/E_NonNamedAfterNamed.fs | 2 +- .../NamedArguments/E_NumParamMismatch01.fs | 2 +- .../NamedArguments/E_ReusedParam.fs | 6 +- .../NamedArguments/E_SyntaxErrors01.fs | 2 +- .../NamedArguments/PropSetAfterConstrn01.fs | 6 +- .../PropSetAfterConstrn01NamedExt.fs | 2 +- .../PropSetAfterConstrn01NamedExtInherit.fs | 6 +- .../PropSetAfterConstrn01NamedExtOpt.fs | 4 +- .../NamedArguments/PropSetAfterConstrn02.fs | 4 +- .../PropSetAfterConstrn02NamedExt.fs | 10 +- .../NamedArguments/SanityCheck.fs | 8 +- .../NamedArguments/genericNamedParams.fs | 4 +- .../NamedArguments/mixNamedNonNamed.fs | 6 +- .../NamedArguments/refLibsHaveNamedParams.fs | 2 +- .../OptionalArguments/E_SanityCheck.fs | 2 +- .../OptionalArguments/E_SanityCheck02.fs | 2 +- .../OptionalArguments/NullOptArgsFromCS.fs | 2 +- .../OptionalArgOnAbstract01.fs | 2 +- .../OptionalArguments/OptionalArguments.fs | 4 +- .../OptionalArguments/SanityCheck.fs | 6 +- .../OptionalArguments/SanityCheck02.fs | 10 +- .../OptionalArguments/SanityCheck03.fs | 2 +- .../OptionalArguments/SanityOptArgsFromCS.fs | 2 +- .../OptionalArguments/optionalOfOptOptA.fs | 4 +- .../OptionalDefaultParamArgs/CallMethods.fs | 2 +- .../InterfaceMethod.fs | 4 +- .../OptionalDefaultParamArgs/Library.fs | 6 +- .../OptionalDefaultParamArgs.fs | 4 +- .../OptionalDefaultParamArgs/Sanity.fs | 6 +- .../OverloadingMembers/ArityFilteringTest.fs | 18 +- .../ConsumeOverloadGenericMethods.fs | 2 +- .../E_InferredTypeNotUnique01.fs | 6 +- .../E_OperatorOverloading01.fs | 8 +- .../E_OverloadCurriedFunc.fs | 4 +- .../E_ReturnGenericUnit01.fs | 2 +- .../E_UnsolvableConstraints01.fs | 4 +- .../InferenceForLambdaArgs.fs | 2 +- .../MethodOverloadUnambiguous.fs | 8 +- .../NativePtrOverloads03.fs | 2 +- .../NoOverloadIDSpecified.fs | 2 +- ...WarningWhenDoingDispatchSlotInference01.fs | 2 +- .../NoWarningWhenOverloadingInSubClass01.fs | 2 +- .../OverloadingMembers/OnAllOverloads01.fs | 6 +- .../OperatorOverloading01.fs | 12 +- .../OperatorOverloading02.fs | 4 +- .../OperatorOverloading03.fs | 2 +- .../OperatorOverloading04.fs | 8 +- ...adingAndExtensionMethodsForGenericTypes.fs | 4 +- .../OverloadingMembers/OverloadingMembers.fs | 4 +- .../OverloadingMembers/SanityCheck.fs | 4 +- .../OverloadingMembers/TieBreakerRule01a.fs | 6 +- .../OverloadingMembers/TieBreakerRule01b.fs | 8 +- .../OverloadingMembers/TieBreakerRule02.fs | 6 +- .../OverloadingMembers/TieBreakerRule03.fs | 4 +- .../OverloadingMembers/TooGeneric.fs | 2 +- .../TypeCompatibilityFilterTest.fs | 18 +- .../OverloadingMembers/diffNumArguments.fs | 4 +- .../OverloadingMembers/reuseOverloadIDs.fs | 4 +- .../OptionalAndOutParameters.fs | 2 +- .../StaticMethodResolution.fs | 2 +- .../E_AbbreviationOnNamespace01.fs | 2 +- .../E_InvalidAbbrevName01.fs | 2 +- .../E_InvalidAbbrevName02.fs | 2 +- .../ModuleAbbreviations/E_NameConflict01.fs | 2 +- .../ModuleAbbreviations/E_UseInsideFunc.fs | 4 +- .../ModuleAbbreviations/SanityCheck.fs | 10 +- .../ModuleAbbreviations/SanityCheck02.fs | 4 +- .../ModuleAbbreviations/useInsideModuleDef.fs | 16 +- .../useInsideNamespaceDef.fs | 6 +- .../useInsideNamespaceDefExternal.fs | 4 +- .../useInsideNamespaceDefExternal_DLL.fs | 6 +- .../ModuleDefinitions/AutoOpen01.fs | 2 +- .../ModuleDefinitions/AutoOpen02.fs | 4 +- .../ModuleDefinitions/AutoOpen03.fs | 10 +- .../ModuleDefinitions/DefineModule01.fs | 6 +- ...CannotAccessPrivateMembersOfAnotherType.fs | 22 +- .../E_ModuleWithExpression02.fs | 2 +- .../E_ObsoleteAttribOnModules01.fs | 16 +- .../ModuleDefinitions/FullyQualify01.fs | 4 +- .../ModuleDefinitions/LibFoo1.fs | 2 +- .../ModuleDefinitions/LibFoo2.fs | 2 +- .../ModuleAbbreviationWithModule01.fs | 6 +- .../ModuleDefinitions/ModuleDefinitions.fs | 4 +- .../ModuleWithExpression01.fs | 4 +- .../ModuleWithExpression02.fs | 2 +- .../Module_internalConsumer01.fs | 2 +- .../SameTypeInTwoReferences01.fs | 2 +- .../SameTypeInTwoReferences02.fs | 2 +- .../W_ModuleAbbreviationWithNamespace01.fs | 4 +- .../E_BeginWithNamespace01a.fs | 2 +- .../E_BeginWithNamespace01b.fs | 2 +- .../NamespaceDeclGroups/FooGlobal.fs | 2 +- .../NamespaceDeclGroups.fs | 1 - .../NoWarnOnJustNamespace.fs | 2 +- .../TypeInGlobalNamespace01.fs | 2 +- .../TypeInGlobalNamespace02.fs | 2 +- .../E_NullInvalidForFSTypes01.fs | 2 +- .../OperatorNames/AstrSymbOper01.fs | 2 +- .../OperatorNames/BasicOperatorNames.fs | 4 +- .../OperatorNames/E_BasicOperatorNames01.fs | 2 +- .../EqualOperatorsOverloading.fs | 4 +- .../OperatorNames/RefAssignment01.fs | 4 +- .../DotNotationAfterGenericMethod01.fs | 4 +- .../E_ExclamationMark01.fs | 2 +- .../PrecedenceAndOperators/E_Negation01.fs | 2 +- .../E_QuestionMark01.fs | 2 +- .../E_QuestionMark02.fs | 2 +- .../PrecedenceAndOperators/E_Tilde01.fs | 2 +- .../ExclamationMark02.fs | 2 +- .../PrecedenceAndOperators/Negation01.fs | 2 +- .../VerticalbarOptionalinDU.fs | 4 +- .../checkedOperatorsNoOverflow.fs | 10 +- .../checkedOperatorsOverflow.fs | 16 +- .../StaticPropertyResolution.fs | 8 +- .../StaticLet/ActivePatternForUnion.fs | 2 +- .../StaticLet/CreateUnionCases.fs | 4 +- .../StaticLet/PlainEnum.fs | 2 +- .../QuotationsForStaticLetRecords.fs | 2 +- .../StaticLet/QuotationsForStaticLetUnions.fs | 4 +- .../StaticLet/RecordOrderOfExecution.fs | 6 +- .../StaticLet/RecursiveDUs.fs | 8 +- .../StaticLet/RecursiveRecords.fs | 8 +- .../StaticLet/SimpleEmptyGenericType.fs | 4 +- .../StaticLet/SimpleEmptyType.fs | 2 +- .../StaticLet/SimpleRecord.fs | 4 +- .../StaticLet/SimpleUnion.fs | 14 +- .../StaticLet/StaticLetInGenericRecords.fs | 4 +- .../StaticLetInGenericRecordsILtest.fs | 4 +- .../StaticLet/StaticLetInGenericUnion.fs | 8 +- .../StaticLet/StaticLetInUnionsAndRecords.fs | 26 +- .../StaticLet/StructRecord.fs | 4 +- .../StaticLet/StructUnion.fs | 14 +- .../StaticLet/UnionOrderOfExecution.fs | 6 +- .../StaticLet/UnionShowCase.fs | 2 +- .../E_FlexibleTypeInSignature01.fsi | 4 +- .../E_InfiniteAbbreviation02.fs | 2 +- .../TypeAbbreviations/E_InheritTypeAbbrev.fs | 4 +- .../E_PrivateTypeAbbreviation02.fs | 4 +- .../E_UnexpectedCharInTypeName01.fs | 2 +- .../PrivateTypeAbbreviation01.fs | 4 +- .../TypeAbbreviationAfterForwardRef.fs | 14 +- .../UseBindings/UseBang01.fs | 18 +- .../UseBindings/UseBang02.fs | 16 +- .../UseBindings/UseBang03.fs | 32 +- .../UseBindings/UseBang04.fs | 44 +- .../UseBindings/UseBang05.fs | 18 +- .../UseBindings/UseBangBindings.fs | 12 +- .../UseBindings/UseBinding01.fs | 2 +- .../UseBindings/UseBindingDiscard01.fs | 2 +- .../UseBindings/UseBindings.fs | 4 +- .../Conformance/Constraints/Unmanaged.fs | 38 +- .../DeclarationElements/ObjectConstructors.fs | 2 +- .../Assertion/Assert_false.fs | 2 +- .../Assertion/Assert_false_DEBUG.fs | 2 +- .../Assertion/Assert_true.fs | 2 +- .../BasicApplication/E_PostfixType01.fs | 2 +- .../BasicApplication/E_PostfixType03.fs | 2 +- .../BasicApplication/PostfixType02.fs | 2 +- .../E_ObjectConstruction01.fs | 2 +- .../ObjectConstruction01.fs | 4 +- .../BindingExpressions/AmbigLetBinding.fs | 4 +- .../BindingExpressions/BindingExpressions.fs | 6 +- .../BindingExpressions/MutableLocals01.fs | 62 +- .../W_TypeInferforGenericType.fs | 4 +- .../Expressions/BindingExpressions/in03.fs | 2 +- .../Expressions/BindingExpressions/in05.fs | 2 +- .../ComputationExpressions.fs | 4 +- .../Expressions/ConstantExpressions/bigint.fs | 2 +- .../ConstantExpressions/bigint02.fs | 2 +- .../Expressions/ConstantExpressions/bool.fs | 2 +- .../Expressions/ConstantExpressions/byte.fs | 4 +- .../ConstantExpressions/byteArr.fs | 2 +- .../Expressions/ConstantExpressions/char.fs | 2 +- .../Expressions/ConstantExpressions/double.fs | 2 +- .../Expressions/ConstantExpressions/float.fs | 2 +- .../ConstantExpressions/float32.fs | 6 +- .../Expressions/ConstantExpressions/int.fs | 4 +- .../Expressions/ConstantExpressions/int16.fs | 4 +- .../Expressions/ConstantExpressions/int32.fs | 4 +- .../Expressions/ConstantExpressions/int64.fs | 4 +- .../ConstantExpressions/nativenint.fs | 2 +- .../Expressions/ConstantExpressions/sbyte.fs | 4 +- .../Expressions/ConstantExpressions/single.fs | 6 +- .../Expressions/ConstantExpressions/string.fs | 2 +- .../Expressions/ConstantExpressions/uint16.fs | 4 +- .../Expressions/ConstantExpressions/uint32.fs | 4 +- .../Expressions/ConstantExpressions/uint64.fs | 4 +- .../ConstantExpressions/unativenint.fs | 2 +- .../Expressions/ConstantExpressions/unit.fs | 2 +- .../PatternMatching/LiteralNull01.fs | 4 +- .../PatternMatching/PatternMatching.fs | 6 +- .../PatternMatching/W_Function01.fs | 2 +- .../W_PatternMatchingCounterExample01.fs | 2 +- .../W_PatternMatchingCounterExample02.fs | 2 +- .../W_PatternMatchingCounterExample03.fs | 2 +- .../SequenceIteration/E_BadIEnumerable01.fs | 8 +- .../IEnumerableIteration01.fs | 18 +- .../SequenceIteration/SequenceIteration.fs | 2 +- .../SequenceIteration/SequenceIteration01.fs | 2 +- .../W_IncompleteMatchFor01.fs | 12 +- .../SimpleFor/Downto01.fs | 2 +- .../SimpleFor/E_ForRequiresInt01.fs | 2 +- .../SimpleFor/ForWithUppercaseIdentifier01.fs | 2 +- .../TryFinally/TryFinallyInSequence01.fs | 2 +- .../TryFinally/W-TryFinallyNotUnit.fs | 2 +- .../TryWith/E_RethrowOutsideWith01.fs | 2 +- .../TryWith/TryWith01.fs | 2 +- .../TryWith/TryWith02.fs | 2 +- .../TryWith/TryWith03.fs | 8 +- .../E_RigidTypeAnnotation03.fs | 4 +- .../E_rigidtypeannotation02.fs | 2 +- .../E_rigidtypeannotation02b.fs | 2 +- .../rigidtypeannotation01.fs | 4 +- .../staticcoercion01.fs | 2 +- .../staticcoercion01b.fs | 2 +- .../AddressOf/E_byrefvaluesnotpermitted001.fs | 2 +- .../BuilderViaExtMethods.fs | 14 +- .../ComputationExpressions/Capacity01.fs | 12 +- .../CompExprMethods01.fs | 16 +- .../CompExprMethods02.fs | 32 +- .../CompExprMethods03.fs | 12 +- .../CompExprMethods04.fs | 6 +- .../DifferentGenericBuilders.fs | 6 +- .../E_MissingCombine.fs | 16 +- .../ComputationExpressions/E_MissingFor.fs | 16 +- .../ComputationExpressions/E_MissingReturn.fs | 16 +- .../E_MissingReturnFrom.fs | 16 +- .../E_MissingTryFinally.fs | 20 +- .../E_MissingTryWith.fs | 20 +- .../ComputationExpressions/E_MissingUsing.fs | 16 +- .../ComputationExpressions/E_MissingWhile.fs | 16 +- .../ComputationExpressions/E_MissingYield.fs | 16 +- .../E_MissingYieldFrom.fs | 16 +- .../ComputationExpressions/E_MissingZero.fs | 16 +- .../ComputationExpressions/E_TypeAlias01.fs | 4 +- .../MinMaxValuesInLoop01.fs | 4 +- .../MinMaxValuesInLoop02.fs | 2 +- .../ComputationExpressions/MutateBuilders.fs | 22 +- .../NonClassWorkflow01.fs | 10 +- .../ComputationExpressions/RunAndDelay01.fs | 30 +- ...InvalidSelfReferentialStructConstructor.fs | 2 +- .../E_MembersMustBeVirtual01.fs | 2 +- .../E_ObjExprWithDuplOverride01.fs | 4 +- .../E_ObjExprWithOverride01.fs | 4 +- .../GenericObjectExpression01.fs | 2 +- .../GenericObjectExpression02.fs | 4 +- .../GenericTypeAnnotations01.fs | 10 +- .../InterfaceObjectExpression01.fs | 20 +- .../MultipleInterfacesInObjExpr.fs | 14 +- .../ObjExprWithOverloadedMethod01.fs | 6 +- .../ObjExprWithOverride01.fs | 2 +- .../ObjectExpressions/StaticType01.fs | 14 +- .../ValidStructConstructor.fs | 2 +- .../ObjectExpressions/W_Deprecated01.fs | 8 +- .../DataExpressions/QueryExpressions.fs | 8 +- .../QueryExpressions/E_BadGroupValBy01.fs | 6 +- .../E_MismatchedConditionalBranches01.fs | 6 +- .../E_MismatchedConditionalBranches02.fs | 10 +- .../QueryExpressions/E_Sequential01.fs | 4 +- .../QueryExpressions/E_WhitespaceErrors01.fs | 2 +- .../QueryExpressions/E_WhitespaceErrors02.fs | 2 +- .../QueryExpressions/E_WhitespaceErrors03.fs | 4 +- .../QueryExpressions/ForWhereJoin01.fs | 2 +- .../JoinsWithInterveningExpressions01.fs | 8 +- .../QueryExpressions/Linq101Aggregates01.fs | 12 +- .../Linq101ElementOperators01.fs | 4 +- .../QueryExpressions/Linq101Grouping01.fs | 2 +- .../QueryExpressions/Linq101Ordering01.fs | 2 +- .../QueryExpressions/Linq101Partitioning01.fs | 6 +- .../QueryExpressions/Linq101Select01.fs | 4 +- .../QueryExpressions/Linq101SetOperators01.fs | 4 +- .../QueryExpressions/Linq101Where01.fs | 6 +- .../QueryExpressions/MatchInQuery01.fs | 2 +- .../QueryExpressions/MatchInQuery02.fs | 6 +- .../QueryExpressions/OperatorsOverClass01.fs | 68 +- .../OperatorsOverRecords01.fs | 68 +- .../QueryExpressions/OperatorsOverTuples01.fs | 70 +- .../DataExpressions/QueryExpressions/Utils.fs | 278 +- .../QueryExpressions/WhereRequiresParens01.fs | 2 +- .../RangeExpressions/CustomType01.fs | 2 +- .../RangeExpressions/CustomType02.fs | 2 +- .../FloatingPointRangeExp01.fs | 4 +- .../W-FloatingPointRangeExp01.fs | 4 +- .../CodeDisposalInMatch01.fs | 2 +- .../E_final_yield_dash_gt_01.fs | 2 +- .../SequenceExpressions/IfThenElse04.fs | 2 +- .../SequenceExpressions/IfThenElse05.fs | 2 +- .../SequenceExpressions/IfThenElse06.fs | 4 +- .../SequenceExpressions/IfThenElse07.fs | 6 +- .../SequenceExpressions/ReallyLongArray01.fs | 4 +- .../SequenceExpressions/W_IfThenElse01_v47.fs | 2 +- .../SequenceExpressions/W_IfThenElse02_v47.fs | 2 +- .../SequenceExpressions/W_IfThenElse03_v47.fs | 2 +- .../YieldInsideFlowControl.fs | 8 +- .../final_yield_bang_keyword_01.fs | 2 +- .../final_yield_dash_gt_01.fs | 2 +- .../final_yield_keyword_01.fs | 2 +- .../SequenceExpressions/tailcalls01.fs | 2 +- .../SequenceExpressions/tailcalls02.fs | 2 +- .../Simple/ListSubsumption01.fs | 2 +- .../EqualityDifferentRuntimeType01.fs | 2 +- .../TupleExpressions/Tuples01.fs | 2 +- .../TupleExpressions/Tuples02.fs | 4 +- .../letbinding_precomutation01.fs | 30 +- .../ExpressionQuotations/Baselines.fs | 6 +- .../Baselines/AddressOf.fs | 4 +- .../Baselines/AddressSet.fs | 4 +- .../ExpressionQuotations/Baselines/AndAlso.fs | 2 +- .../Baselines/Application.fs | 4 +- .../Baselines/Applications.fs | 2 +- .../ExpressionQuotations/Baselines/Bool.fs | 2 +- .../ExpressionQuotations/Baselines/Byte.fs | 2 +- .../ExpressionQuotations/Baselines/Call.fs | 2 +- .../ExpressionQuotations/Baselines/Cast.fs | 6 +- .../ExpressionQuotations/Baselines/Char.fs | 2 +- .../ExpressionQuotations/Baselines/Coerce.fs | 8 +- .../Baselines/DefaultValue.fs | 4 +- .../ExpressionQuotations/Baselines/Double.fs | 2 +- .../ExpressionQuotations/Baselines/E_Cast.fs | 2 +- .../Baselines/E_StructQuote.fs | 2 +- .../ExtMethodWithReflectedDefinition.fs | 16 +- .../Baselines/FieldGet.fs | 4 +- .../Baselines/FieldSet.fs | 4 +- .../Baselines/ForIntegerRangeLoop.fs | 4 +- .../Baselines/IfThenElse.fs | 2 +- .../ExpressionQuotations/Baselines/Int16.fs | 2 +- .../ExpressionQuotations/Baselines/Int32.fs | 2 +- .../ExpressionQuotations/Baselines/Int64.fs | 2 +- .../ExpressionQuotations/Baselines/Lambda.fs | 2 +- .../ExpressionQuotations/Baselines/Lambdas.fs | 2 +- .../ExpressionQuotations/Baselines/Let.fs | 4 +- .../ExpressionQuotations/Baselines/LetRec.fs | 4 +- .../MethodWithReflectedDefinition.fs | 2 +- .../Baselines/NewArray.fs | 2 +- .../Baselines/NewDelegate.fs | 2 +- .../Baselines/NewObject.fs | 4 +- .../Baselines/NewRecord.fs | 4 +- .../Baselines/NewStructRecord.fs | 4 +- .../Baselines/NewTuple.fs | 2 +- .../Baselines/NewUnionCase.fs | 4 +- .../ExpressionQuotations/Baselines/OrElse.fs | 2 +- .../ExpressionQuotations/Baselines/PropGet.fs | 2 +- .../ExpressionQuotations/Baselines/PropSet.fs | 2 +- .../PropertyGetterWithReflectedDefinition.fs | 2 +- .../PropertySetterWithReflectedDefinition.fs | 4 +- .../ExpressionQuotations/Baselines/Quote.fs | 2 +- .../Baselines/QuoteUtils.fs | 18 +- .../Baselines/ReferenceToImplicitField.fs | 6 +- .../ExpressionQuotations/Baselines/SByte.fs | 2 +- .../Baselines/Sequential.fs | 6 +- .../ExpressionQuotations/Baselines/Single.fs | 2 +- .../Baselines/SpecificCall.fs | 2 +- .../ExpressionQuotations/Baselines/String.fs | 2 +- .../Baselines/TryFinally.fs | 2 +- .../Baselines/TryGetReflectedDefinition.fs | 8 +- .../ExpressionQuotations/Baselines/TryWith.fs | 8 +- .../Baselines/TryWith01.fs | 4 +- .../Baselines/TupleGet.fs | 2 +- .../Baselines/TypeTest.fs | 2 +- .../ExpressionQuotations/Baselines/UInt16.fs | 2 +- .../ExpressionQuotations/Baselines/UInt32.fs | 2 +- .../ExpressionQuotations/Baselines/UInt64.fs | 2 +- .../Baselines/UnionCaseTest.fs | 6 +- .../ExpressionQuotations/Baselines/Unit.fs | 2 +- .../ExpressionQuotations/Baselines/Value.fs | 4 +- .../ExpressionQuotations/Baselines/Var.fs | 2 +- .../ExpressionQuotations/Baselines/VarSet.fs | 2 +- .../Baselines/WhileLoop.fs | 2 +- .../ExpressionQuotations/Regressions.fs | 2 +- .../ActivePatternDecomposeList01.fs | 36 +- .../Regressions/E_DecomposeArray01.fs | 6 +- .../Regressions/E_GenericQuotation01.fs | 4 +- .../E_InvalidQuotationLiteral01.fs | 4 +- .../E_InvalidQuotationLiteral02.fs | 4 +- .../E_InvalidQuotationLiteral03.fs | 4 +- .../Regressions/E_QuotationHoles01.fs | 4 +- .../Regressions/E_QuotationOperators01.fs | 2 +- .../Regressions/E_QuotationOperators02.fs | 2 +- .../Regressions/E_QuotationOperators03.fs | 2 +- .../Regressions/E_QuotationOperators04.fs | 2 +- .../Regressions/E_QuoteAddressOf01.fs | 6 +- .../Regressions/E_QuoteDynamic01.fs | 2 +- .../Regressions/EnumFromCSQuote01.fs | 4 +- .../Regressions/EnumQuote01.fs | 4 +- .../Regressions/LiteralArrays01.fs | 10 +- .../Regressions/NestedQuoteAddition.fs | 8 +- .../Regressions/NullArgChecks.fs | 14 +- .../Regressions/OperatorInSplice.fs | 12 +- .../Regressions/PropertySetArgOrder.fs | 12 +- .../Regressions/QuotationHoles01.fs | 8 +- .../Regressions/QuotationRegressions01.fs | 6 +- .../Regressions/QuotationRegressions02.fs | 4 +- .../Regressions/QuotationRegressions04.fs | 14 +- .../Regressions/QuotationRegressions05.fs | 2 +- .../Regressions/QuotationRegressions06.fs | 4 +- .../Regressions/QuotationRegressions07.fs | 14 +- .../Regressions/QuotationRegressions09.fs | 6 +- .../Regressions/QuotationRegressions10.fs | 6 +- .../Regressions/QuoteDynamic01.fs | 2 +- .../Regressions/QuoteSetMutable01.fs | 2 +- .../QuoteStructStaticFieldProp01.fs | 2 +- .../Regressions/QuoteWithSplice01.fs | 8 +- .../Regressions/RawQuotation01.fs | 6 +- .../Regressions/ReflectedDefExtMember01.fs | 4 +- .../Regressions/ReflectedDefInterface01.fs | 4 +- .../Regressions/ReflectedDefInterface02.fs | 4 +- .../ReflectedDefinitionConstructor01.fs | 6 +- .../ReflectedDefinitionConstructor02.fs | 2 +- .../ReflectedDefinitionConstructor03.fs | 14 +- .../Regressions/SpecificCall_Instance.fs | 6 +- .../Regressions/SpecificCall_Static.fs | 6 +- .../Regressions/VarIsMutable01a.fs | 2 +- .../Regressions/VarIsMutable01b.fs | 2 +- .../Regressions/VarIsMutable01c.fs | 2 +- .../Regressions/VarIsMutable02.fs | 2 +- .../ObjectExpressions/ObjectExpressions.fs | 75 +- .../OverloadResolutionAdversarialTests.fs | 14 +- .../OverloadResolutionBasicTests.fs | 32 +- .../SyntacticSugar/E_GetSliceNotDef01.fs | 2 +- .../SyntacticSugar/E_GetSliceNotDef02.fs | 4 +- .../Expressions/SyntacticSugar/Slices01.fs | 8 +- .../Expressions/SyntacticSugar/Slices02.fs | 4 +- .../Expressions/SyntacticSugar/Slices03.fs | 8 +- .../Expressions/SyntacticSugar/Slices04.fs | 26 +- .../Expressions/SyntacticSugar/Slices05.fs | 96 +- .../Expressions/SyntacticSugar/Slices06.fs | 10 +- .../Expressions/SyntacticSugar/Slices07.fs | 14 +- .../SyntacticSugar01.fs | 2 +- .../Attributes/Diags/E_AdjustUses01a.fs | 4 +- .../Attributes/Diags/E_AdjustUses01b.fs | 4 +- .../Attributes/Legacy/Test01.fs | 4 +- .../Attributes/Legacy/Test02.fs | 4 +- .../Attributes/Legacy/Test03.fs | 4 +- .../Attributes/Legacy/Test04.fs | 4 +- .../Attributes/Legacy/Test05.fs | 4 +- .../Attributes/Legacy/Test06.fs | 4 +- .../Attributes/Legacy/Test07.fs | 4 +- .../Attributes/Legacy/Test08.fs | 4 +- .../Attributes/Legacy/Test09.fs | 10 +- .../Attributes/Legacy/Test10.fs | 4 +- .../Attributes/Legacy/Test11.fs | 4 +- .../Attributes/Legacy/Test12.fs | 4 +- .../Attributes/Legacy/Test13.fs | 4 +- .../Attributes/Legacy/Test14.fs | 4 +- .../Attributes/Legacy/Test15.fs | 4 +- .../Attributes/Legacy/Test16.fs | 4 +- .../Attributes/Legacy/Test17.fs | 4 +- .../Attributes/Legacy/Test18.fs | 4 +- .../Attributes/Legacy/Test19.fs | 4 +- .../Attributes/Legacy/Test20.fs | 4 +- .../Attributes/Legacy/Test21.fs | 4 +- .../Attributes/Legacy/Test22.fs | 4 +- .../Attributes/Legacy/Test23.fs | 4 +- .../Attributes/Legacy/Test24.fs | 4 +- .../Attributes/Legacy/Test25.fs | 4 +- .../Attributes/Legacy/Test26.fs | 4 +- .../Attributes/Legacy/Test27.fs | 4 +- .../Attributes/Legacy/Test28.fs | 2 +- .../Attributes/New/Test01.fs | 4 +- .../Attributes/New/Test02.fs | 4 +- .../Attributes/New/Test03.fs | 4 +- .../Attributes/New/Test04.fs | 4 +- .../Attributes/New/Test05.fs | 2 +- .../Attributes/New/Test06.fs | 4 +- .../Attributes/New/Test07.fs | 4 +- .../Attributes/New/Test08.fs | 4 +- .../Attributes/New/Test09.fs | 10 +- .../Attributes/New/Test10.fs | 4 +- .../Attributes/New/Test11.fs | 4 +- .../Attributes/New/Test12.fs | 4 +- .../Attributes/New/Test13.fs | 4 +- .../Attributes/New/Test14.fs | 4 +- .../Attributes/New/Test15.fs | 4 +- .../Attributes/New/Test16.fs | 4 +- .../Attributes/New/Test17.fs | 4 +- .../Attributes/New/Test18.fs | 4 +- .../Attributes/New/Test19.fs | 4 +- .../Attributes/New/Test20.fs | 4 +- .../Attributes/New/Test21.fs | 4 +- .../Attributes/New/Test22.fs | 4 +- .../Attributes/New/Test23.fs | 4 +- .../Attributes/New/Test24.fs | 4 +- .../Attributes/New/Test25.fs | 4 +- .../Attributes/New/Test26.fs | 4 +- .../Attributes/New/Test27.fs | 4 +- .../Attributes/New/Test28.fs | 2 +- .../Basic/Comparison01.fs | 4 +- .../Basic/CustomEquality01.fs | 10 +- .../Basic/E_CustomEqualityEquals01.fs | 6 +- .../Basic/E_CustomEqualityGetHashCode01.fs | 6 +- .../Basic/E_ExceptionsNoComparison.fs | 2 +- .../Basic/Equality01.fs | 2 +- .../Basic/Hashing01.fs | 2 +- .../IComparison/DU.fs | 4 +- .../IComparison/Record.fs | 2 +- .../IComparison/Struct.fs | 2 +- .../IComparison/W_ImplIComparable.fs | 6 +- .../ByrefSafetyAnalysis/ByRefParam.fs | 4 +- .../ByRefParam_ExplicitInAttribute.fs | 4 +- .../ByRefParam_ExplicitOutAttribute.fs | 4 +- ...ram_OverloadedTest_ExplicitOutAttribute.fs | 4 +- .../ByrefSafetyAnalysis/ByRefReturn.fs | 4 +- .../ByrefReturn/TestArrayParam.fs | 2 +- .../ByrefReturn/TestClassParamMutableField.fs | 4 +- .../ByrefReturn/TestConditionalReturn.fs | 4 +- .../ByrefReturn/TestDelegateMethod.fs | 4 +- .../ByrefReturn/TestDelegateMethod2.fs | 4 +- .../ByrefReturn/TestImmediateReturn.fs | 4 +- .../ByrefReturn/TestInterfaceMethod.fs | 16 +- .../ByrefReturn/TestInterfaceProperty.fs | 16 +- .../ByrefReturn/TestMatchReturn.fs | 4 +- .../ByrefReturn/TestOneArgument.fs | 2 +- .../ByrefReturn/TestRecordParam.fs | 2 +- .../ByrefReturn/TestRecordParam2.fs | 2 +- .../ByrefReturn/TestStructParam.fs | 2 +- .../ByrefReturn/TestTryFinallyReturn.fs | 4 +- .../ByrefReturn/TestTryWithReturn.fs | 4 +- .../ByrefReturn/TestTwoArguments.fs | 2 +- .../ByrefReturnMember/BaseCallByref.fs | 2 +- .../ByrefReturnMember/Bug820.fs | 2 +- .../ByrefReturnMember/Bug820b.fs | 4 +- .../ByRefExtensionMethods1.fs | 11 +- .../ByRefExtensionMethodsOverloading.fs | 10 +- .../GenericTestNameRecursive.fs | 2 +- .../ByrefReturnMember/MatrixOfTests.fs | 122 +- .../ByrefReturnMember/MutateInRef3.fs | 2 +- .../NonGenericTestNameRecursiveInClass.fs | 8 +- ...nGenericTestNameRecursiveInClassSubsume.fs | 8 +- .../StaticGenericTestNameRecursiveInClass.fs | 2 +- ...taticNonGenericTestNameRecursiveInClass.fs | 2 +- .../ByrefReturnMember/TestArrayParam.fs | 4 +- .../TestAssignToReturnByref.fs | 8 +- .../TestAssignToReturnByref2.fs | 4 +- .../TestClassParamMutableField.fs | 6 +- .../TestConditionalReturn.fs | 6 +- .../ByrefReturnMember/TestDelegateMethod.fs | 2 +- .../ByrefReturnMember/TestDelegateMethod2.fs | 2 +- .../ByrefReturnMember/TestImmediateReturn.fs | 6 +- .../ByrefReturnMember/TestInRefMutation.fs | 4 +- .../ByrefReturnMember/TestInterfaceMethod.fs | 12 +- .../TestInterfaceProperty.fs | 12 +- .../ByrefReturnMember/TestMatchReturn.fs | 6 +- .../TestNameModuleGeneric.fs | 6 +- .../TestNameModuleNonGeneric.fs | 8 +- .../TestNameModuleNonGenericSubsume.fs | 10 +- .../ByrefReturnMember/TestOneArgument.fs | 4 +- .../TestOneArgumentInRefReturned.fs | 4 +- .../TestOneArgumentOutRef.fs | 4 +- .../TestReadOnlyAddressOfStaticField.fs | 2 +- .../ByrefReturnMember/TestRecordParam.fs | 4 +- .../ByrefReturnMember/TestRecordParam2.fs | 4 +- .../ByrefReturnMember/TestStructParam.fs | 4 +- .../ByrefReturnMember/TestStructRecord.fs | 2 +- .../ByrefReturnMember/TestTryFinallyReturn.fs | 6 +- .../ByrefReturnMember/TestTryWithReturn.fs | 6 +- .../ByrefReturnMember/TestTwoArguments.fs | 4 +- .../ByrefSafetyAnalysis.fs | 168 +- .../ByrefSafetyAnalysis/CompareExchange.fs | 2 +- .../E_ByrefAsArrayElement.fs | 4 +- .../E_ByrefAsGenericArgument01.fs | 2 +- .../E_ByrefFieldEscapingLocalScope01.fs | 2 +- .../E_ByrefFieldEscapingLocalScope02.fs | 2 +- .../E_ByrefUsedInInnerLambda01.fs | 8 +- .../E_ByrefUsedInInnerLambda02.fs | 8 +- .../E_ByrefUsedInInnerLambda03.fs | 6 +- .../E_ByrefUsedInQuotation01.fs | 2 +- ...dressOfExpressionReturningReferenceType.fs | 2 +- .../E_FirstClassFuncTakesByref.fs | 2 +- .../ByrefSafetyAnalysis/E_MigratedTest02.fs | 15 +- .../E_SetFieldToByref01.fs | 4 +- .../E_SetFieldToByref02.fs | 4 +- .../E_SetFieldToByref03.fs | 2 +- .../E_SetFieldToByref04.fs | 4 +- .../E_SetFieldToByref05.fs | 2 +- .../E_SpanUsedInInnerLambda01.fs | 6 +- .../E_SpanUsedInInnerLambda02.fs | 6 +- .../E_StaticallyResolvedByRef01.fs | 4 +- .../ByrefSafetyAnalysis/E_TopLevelByref.fs | 2 +- .../ImplicitAddressOf/InRefParam_DateTime.fs | 4 +- ...am_DateTime_ImplicitAddressOfAtCallSite.fs | 4 +- ...m_DateTime_ImplicitAddressOfAtCallSite2.fs | 4 +- ...m_DateTime_ImplicitAddressOfAtCallSite3.fs | 4 +- ...m_DateTime_ImplicitAddressOfAtCallSite4.fs | 4 +- .../ByrefSafetyAnalysis/InRefParam.fs | 6 +- ...ramOverload_ExplicitAddressOfAtCallSite.fs | 6 +- ...ramOverload_ImplicitAddressOfAtCallSite.fs | 4 +- ...amOverload_ImplicitAddressOfAtCallSite2.fs | 6 +- .../InRefParam_ExplicitInAttribute.fs | 4 +- .../InRefParam_ExplicitInAttributeDateTime.fs | 6 +- ...m_Generic_ExplicitAddressOfAttCallSite1.fs | 6 +- ...m_Generic_ExplicitAddressOfAttCallSite2.fs | 6 +- .../ByrefSafetyAnalysis/InRefReturn.fs | 4 +- .../ByrefSafetyAnalysis/MigratedTest02.fs | 10 +- .../ByrefSafetyAnalysis/MigratedTest03.fs | 4 +- .../NoTailcallToByrefsWithModReq.fs | 6 +- .../ByrefSafetyAnalysis/OutRefParam.fs | 4 +- .../OutRefParam_ExplicitOutAttribute.fs | 4 +- .../OutRefParam_Overloaded.fs | 4 +- ...efParam_Overloaded_ExplicitOutAttribute.fs | 4 +- .../ByrefSafetyAnalysis/Prelude.fs | 4 +- .../ReturnFieldSetBySpan.fs | 2 +- .../ByrefSafetyAnalysis/ReturnSpan01.fs | 4 +- .../ByrefSafetyAnalysis/Slot_ByRefReturn.fs | 8 +- .../ByrefSafetyAnalysis/Slot_InRefReturn.fs | 8 +- .../ByrefSafetyAnalysis/Slot_OutRefParam.fs | 8 +- .../ByrefSafetyAnalysis/TryGetValue.fs | 2 +- .../ByrefSafetyAnalysis/UseByrefInLambda01.fs | 6 +- .../ConstructorConstraint01.fs | 4 +- .../ConstraintSolving/DelegateConstraint01.fs | 8 +- .../E_DelegateConstraint01.fs | 6 +- .../ConstraintSolving/E_EnumConstraint01.fs | 10 +- .../E_TypeFuncDeclaredExplicit01.fs | 2 +- .../ConstraintSolving/E_ValueRestriction01.fs | 2 +- .../ConstraintSolving/EnumConstraint01.fs | 2 +- .../ConstraintSolving/ValueRestriction01.fs | 2 +- .../DispatchSlotChecking/InferSlotType01.fs | 2 +- .../E_GenInterfaceWGenMethods01.fs | 2 +- .../E_MoreThanOneDispatchSlotMatch01.fs | 18 +- .../GenInterfaceWGenMethods01.fs | 2 +- .../E_FOFunction01.fs | 2 +- .../InferGenericArgAsTuple01.fs | 2 +- .../InferGenericArgAsTuple02.fs | 10 +- .../E_DynamicTypeTestOverFreeArg01.fs | 6 +- .../E_GeneralizeMemberInGeneric01.fs | 4 +- .../E_NoMoreValueRestriction01.fs | 2 +- .../Generalization/GenGroup01.fs | 2 +- .../Generalization/LessRestrictive01.fs | 12 +- .../Generalization/LessRestrictive02.fs | 96 +- .../Generalization/LessRestrictive03.fs | 2 +- .../NoMoreValueRestriction01.fs | 2 +- .../Generalization/PropertyConstraint01.fs | 6 +- .../Generalization/RecordProperty01.fs | 8 +- .../Generalization/TypeAnnotation01.fs | 4 +- .../E_OverloadedGenericArgs.fs | 4 +- .../MultiExtensionMethods01.fs | 10 +- .../ParamArrayToDelegate01.fs | 2 +- .../UnitVsNoArgs.fs | 2 +- .../UnitVsNoArgs02.fs | 2 +- .../AutoOpen/E_library_with_namespaces01.fs | 4 +- .../NameResolution/AutoOpen/E_module02.fs | 2 +- .../NameResolution/AutoOpen/Module01.fs | 4 +- .../AutoOpen/library_with_namespaces01.fs | 4 +- .../NameResolution/AutoOpen/namespace01.fs | 4 +- .../AutoOpen/redundant_open01.fs | 8 +- .../AutoOpen/type_abbreviation01.fs | 8 +- .../NameResolution/Misc/E-DuplicateTypes01.fs | 2 +- .../Misc/E_ClashingIdentifiersDU01.fs | 2 +- .../Misc/E_ClashingIdentifiersDU02.fs | 2 +- .../Misc/NoPartiallyQualifiedPathWarning01.fs | 2 +- .../NameResolution/Misc/RecordInference01.fs | 2 +- .../NameResolution/Misc/recordlabels.fs | 10 +- .../E_OnDiscriminatedUnion.fs | 2 +- .../RequireQualifiedAccess/E_OnRecord.fs | 2 +- .../OnDiscriminatedUnion.fs | 6 +- .../RequireQualifiedAccess/OnRecord.fs | 2 +- .../RequireQualifiedAccess/OnRecordVsUnion.fs | 2 +- .../OnRecordVsUnion2.fs | 2 +- .../OnRecordVsUnion_NoRQA.fs | 2 +- .../OnRecordVsUnion_NoRQA2.fs | 2 +- .../OnUnionWithCaseOfSameName.fs | 4 +- .../OnUnionWithCaseOfSameName2.fs | 4 +- .../E_DuplicateRecursiveRecords.fs | 2 +- .../E_RecursiveInline.fs | 2 +- .../E_TypeDeclaration01.fs | 10 +- .../E_TypeDeclaration02.fs | 8 +- .../E_VariationsOnRecursiveStruct.fs | 2 +- .../InfiniteRecursiveExplicitConstructor.fs | 4 +- .../RecursiveTypeDeclarations01.fs | 16 +- .../RecursiveTypeDeclarations02.fs | 94 +- .../RecursiveValueDeclarations01.fs | 6 +- .../ComplexExpression01.fs | 2 +- .../TypeInference/AdHoc.fs | 24 +- ...kWarningsWhenVariablesInstantiatedToInt.fs | 2 +- ...rningsWhenVariablesInstantiatedToString.fs | 4 +- .../E_LeftToRightOverloadResolution01.fs | 2 +- .../TypeInference/E_OnOverloadIDAttr01.fs | 2 +- .../TypeInference/E_OneTypeVariable03.fs | 10 +- .../TypeInference/E_OneTypeVariable03rec.fs | 10 +- .../E_TwoDifferentTypeVariables01.fs | 14 +- .../E_TwoDifferentTypeVariables01rec.fs | 12 +- .../E_TwoDifferentTypeVariablesGen00rec.fs | 14 +- .../E_TwoDifferentTypeVariablesGen01rec.fs | 12 +- .../E_TwoEqualTypeVariables02.fs | 10 +- .../E_TwoEqualTypeVariables02rec.fs | 10 +- .../TypeInference/IgnoreUnitParameters.fs | 8 +- .../TypeInference/OneTypeVariable03.fs | 10 +- .../TypeInference/OneTypeVariable03rec.fs | 10 +- .../TypeInference/RegressionTest01.fs | 6 +- .../TypeInference/RegressionTest02.fs | 16 +- .../TwoDifferentTypeVariables01.fs | 10 +- .../TwoDifferentTypeVariables01rec.fs | 10 +- .../TwoDifferentTypeVariablesGen00.fs | 10 +- .../TwoDifferentTypeVariablesGen00rec.fs | 10 +- .../TypeInference/TwoEqualTypeVariables02.fs | 10 +- .../TwoEqualTypeVariables02rec.fs | 10 +- .../TypeInference/W_GenericConstrained01.fs | 2 +- .../TypeInference/W_OneTypeVariable03.fs | 10 +- .../TypeInference/W_OneTypeVariable03rec.fs | 12 +- .../W_TwoDifferentTypeVariables01.fs | 10 +- .../W_TwoDifferentTypeVariables01rec.fs | 10 +- .../W_TwoEqualTypeVariables02.fs | 10 +- .../W_TwoEqualTypeVariables02rec.fs | 10 +- .../E_Clashing_Methods_in_Interface01.fs | 2 +- .../E_Clashing_Methods_in_Interface02.fs | 2 +- .../E_Clashing_Record_Field_and_Member01.fs | 4 +- .../E_Clashing_Values_in_AbstractClass02.fs | 4 +- ...ClassNotImplAllInheritedAbstractSlots01.fs | 4 +- .../E_Override_with_Incorrect_Type01.fs | 4 +- .../LexicalAnalysis/ByteStrings.fs | 6 +- .../LexicalAnalysis/CharByteLiterals.fs | 2 +- .../Conformance/LexicalAnalysis/Comments.fs | 2 +- .../LexicalAnalysis/NumericLiterals.fs | 2 +- .../Conformance/LexicalAnalysis/Strings.fs | 2 +- .../IndentationWithComputationExpression01.fs | 6 +- .../RangeOperator01.fs | 2 +- .../OffsideExceptions/InfixTokenPlusOne.fs | 14 +- .../OffsideExceptions/OffsideExceptions.fs | 4 +- .../OffsideExceptions/RelaxWhitespace2.fs | 82 +- .../AbstractMembers/CallToVirtualMember01.fs | 8 +- .../AbstractMembers/CallToVirtualMember02.fs | 8 +- .../AbstractMembers/CallToVirtualMember03.fs | 10 +- .../DerivedClassSameAssembly.fs | 12 +- .../E_CallToAbstractMember01.fs | 10 +- .../E_CallToAbstractMember02.fs | 8 +- .../E_CallToAbstractMember03.fs | 10 +- .../E_CallToAbstractMember04.fs | 10 +- .../E_CallToUnimplementedMethod01.fs | 4 +- .../E_InlineVirtualMember01.fs | 6 +- .../E_InlineVirtualMember02.fs | 4 +- .../AsDeclarations/SanityCheck01.fs | 4 +- .../AsDeclarations/SanityCheck02.fs | 2 +- .../AutoProperties/AliasedType01.fs | 2 +- .../ClassTypes/AutoProperties/Array01.fs | 2 +- .../ClassTypes/AutoProperties/Attributes01.fs | 2 +- .../ClassTypes/AutoProperties/E_BadType01.fs | 2 +- .../AutoProperties/E_IllegalName01.fs | 2 +- .../AutoProperties/E_InternalProperty01.fs | 2 +- .../AutoProperties/E_PrivateProperty01.fs | 2 +- .../AutoProperties/E_PrivateProperty02.fs | 2 +- .../AutoProperties/ExtensionProperty01.fs | 2 +- .../ClassTypes/AutoProperties/List01.fs | 2 +- .../AutoProperties/PublicProperty01.fs | 2 +- .../AutoProperties/ReferenceType01.fs | 2 +- .../ClassTypes/AutoProperties/Then01.fs | 4 +- .../ClassTypes/AutoProperties/Tuple01.fs | 2 +- .../AutoProperties/UnitsOfMeasure01.fs | 2 +- .../ClassTypes/AutoProperties/ValueType01.fs | 4 +- .../E_AddExplicitWithImplicit.fs | 2 +- .../InheritsDeclarations/BaseValue01.fs | 12 +- .../E_DefaultNoAbstractInBaseClass.fs | 18 +- .../E_InheritFromGenericType01.fs | 2 +- .../E_InheritInterface01.fs | 4 +- .../E_MemberNoAbstractInBaseClass.fs | 18 +- .../MemberDeclarations/CtorAndCCtor01.fs | 2 +- .../MemberDeclarations/CtorAndCCtor02.fs | 2 +- .../E_ClashingInstanceStaticProperties.fs | 2 +- .../MemberDeclarations/E_CtorAndCCtor01.fs | 4 +- .../E_GeneratedPropertyNameClash01.fs | 2 +- .../E_ImplementMemberNoExist.fs | 4 +- .../E_PropertyInvalidGetter01.fs | 2 +- .../E_PropertyInvalidGetter02.fs | 8 +- .../E_PropertyInvalidGetterSetter01.fs | 4 +- .../E_PropertySameNameDiffArity.fs | 8 +- .../E_PropertySetterUnit01.fs | 2 +- .../MemberDeclarations/InlineProperties01.fs | 10 +- .../NoClashMemberIFaceMember.fs | 8 +- .../QuestionOperatorAsMember01.fs | 2 +- .../Misc/AbstractClassAttribute01.fs | 6 +- .../Misc/AbstractClassAttribute02.fs | 2 +- .../AbstractClassMultipleConstructors01.fs | 4 +- .../ClassTypes/Misc/Decondensation.fs | 70 +- .../ClassTypes/Misc/E_AbstractClass01.fs | 2 +- .../ClassTypes/Misc/E_AbstractClass02.fs | 2 +- .../ClassTypes/Misc/E_AbstractClass03.fs | 4 +- .../Misc/E_AbstractClassAttribute01.fs | 4 +- .../ClassTypes/Misc/E_CyclicInheritance.fs | 2 +- .../ClassTypes/Misc/E_ExplicitConstructor.fs | 4 +- .../ClassTypes/Misc/E_NoNestedTypes.fs | 4 +- .../ClassTypes/Misc/E_RestrictedSuperTypes.fs | 2 +- .../ClassTypes/Misc/E_SealedClass01.fs | 10 +- .../ClassTypes/Misc/E_ZeroArity.fs | 2 +- .../ClassTypes/Misc/GenericClass01.fs | 2 +- .../ClassTypes/Misc/ValueRestrictionCtor.fs | 2 +- .../ClassTypes/Misc/W_SealedClass02.fs | 10 +- .../ClassTypes/Misc/W_SealedClass03.fs | 10 +- .../StaticLetDoDeclarations/Attributes01.fs | 6 +- .../E_LexicalScoping01.fs | 2 +- .../StaticLetDoDeclarations/E_RecMutable01.fs | 6 +- .../LexicalScoping01.fs | 2 +- .../StaticLetDoDeclarations/Offside01.fs | 2 +- .../RecNonMutable01.fs | 4 +- .../WithReferenceType.fs | 2 +- .../StaticLetDoDeclarations/WithValueType.fs | 2 +- .../DelegateTypes/ByrefArguments01.fs | 2 +- .../DelegateTypes/E_InvalidSignature01.fs | 2 +- .../DelegateTypes/E_InvalidSignature02.fs | 2 +- .../ValidSignature_MultiArg01.fs | 2 +- .../ValidSignature_ReturningValues01.fs | 2 +- .../EnumTypes/AttributesOn01.fs | 14 +- .../EnumTypes/BinaryOr01.fs | 6 +- .../EnumTypes/CallCSharpEnum.fs | 4 +- .../EnumTypes/ConsumeFromCS.fs | 4 +- .../EnumTypes/E_BoolUnderlyingType.fs | 4 +- .../E_DiscriminantOfDifferentTypes.fs | 4 +- .../EnumTypes/E_InvalidCase01.fs | 2 +- .../EnumTypes/E_NamedTypeInScope.fs | 10 +- .../EnumTypes/E_NeedToQualify01.fs | 8 +- .../EnumTypes/E_NoMethodsOnEnums01.fs | 2 +- .../EnumTypes/E_NoValueFieldOnEnum.fs | 4 +- .../EnumTypes/E_NonInt32Enums01.fs | 6 +- .../EnumTypes/EqualAndBoxing01.fs | 2 +- .../EnumTypes/EqualsTag.fs | 2 +- .../EnumTypes/NamedTypeInScope.fs | 14 +- .../EnumTypes/NonInt32Enums01.fs | 16 +- .../EnumTypes/Simple001.fs | 4 +- .../E_AnonymousTypeInInterface01.fs | 2 +- .../E_ImplementGenIFaceTwice01_5.0.fs | 10 +- .../InterfaceTypes/E_InheritInterface.fs | 4 +- .../E_InterfaceNotFullyImpl01.fs | 2 +- .../E_InterfaceNotFullyImpl02.fs | 4 +- .../E_InterfaceNotFullyImpl03.fs | 8 +- .../InterfaceTypes/E_MultipleInst07.5.0.fs | 6 +- .../E_MultipleInterfaceInheritance.fs | 30 +- .../InterfaceTypes/EmptyInterface01.fs | 6 +- .../ImplementGenIFaceTwice02_5.0.fs | 2 +- .../InterfaceTypes/InheritDotNetInterface.fs | 2 +- .../InheritFromIComparable01.fs | 2 +- .../Inheritance_OverrideInterface.fs | 4 +- .../InterfaceTypes/InheritedInterface.fs | 4 +- .../InterfaceMember_NameCollisions.fs | 14 +- .../InterfaceTypes/MultipleInst01.5.0.fs | 6 +- .../InterfaceTypes/MultipleInst02.fs | 6 +- .../InterfaceTypes/MultipleInst03.fs | 16 +- .../InterfaceTypes/MultipleInst04.5.0.fs | 12 +- .../InterfaceTypes/MultipleInst05.fs | 16 +- .../InterfaceTypes/MultipleInst06.fs | 6 +- .../InterfaceTypes/ObjImplementsInterface.fs | 8 +- ...ObjImplementsInterfaceGenWithConstraint.fs | 2 +- .../InterfaceTypes/interface001.fs | 16 +- .../InterfaceTypes/interface001e.fs | 10 +- .../InterfaceTypes/interface002.fs | 6 +- .../InterfaceTypes/interface002e.fs | 10 +- .../InterfaceTypes/interface003.fs | 2 +- .../StructTypes/DoStaticLetDo.fs | 14 +- .../StructTypes/E_AbstractClassStruct.fs | 8 +- .../StructTypes/E_CyclicInheritance01.fs | 16 +- .../StructTypes/E_ImplicitCTorUse01.fs | 4 +- .../StructTypes/E_ImplicitCTorUse02.fs | 4 +- .../E_InvalidRecursiveGeneric01.fs | 6 +- .../E_InvalidRecursiveGeneric02.fs | 6 +- .../StructTypes/E_NoAbstractMembers.fs | 2 +- .../StructTypes/E_NoDefaultCtor.fs | 2 +- .../StructTypes/E_NoLetBindings.fs | 2 +- .../StructTypes/E_Nullness01.fs | 2 +- .../StructTypes/E_Nullness02.fs | 2 +- .../StructTypes/E_Overload_Equals.fs | 2 +- .../StructTypes/E_Overload_GetHashCode.fs | 2 +- .../StructTypes/E_Regressions02.fs | 2 +- .../StructTypes/E_Regressions02b.fs | 6 +- .../StructTypes/E_StructConstruction03.fs | 2 +- .../StructTypes/E_StructInheritance01.fs | 4 +- .../StructTypes/E_StructInheritance01b.fs | 4 +- .../StructTypes/E_StructWithNoFields01.fs | 8 +- .../StructTypes/EqualAndBoxing01.fs | 2 +- .../StructTypes/ExplicitCtor.fs | 12 +- .../StructTypes/GenericStruct01.fs | 6 +- .../StructTypes/IndexerProperties01.fs | 12 +- .../StructTypes/MutableFields.fs | 10 +- .../StructTypes/NoClashMemberIFaceMember.fs | 10 +- .../StructTypes/Overload_Equals.fs | 2 +- .../StructTypes/Overload_GetHashCode.fs | 4 +- .../StructTypes/Overload_ToString.fs | 2 +- .../StructTypes/Regressions01.fs | 2 +- .../StructTypes/Regressions02.fs | 6 +- .../StructTypes/StructAttribute01.fs | 2 +- .../StructTypes/StructAttribute02.fs | 2 +- .../StructTypes/StructConstruction01.fs | 2 +- .../StructTypes/StructConstruction02.fs | 2 +- .../StructTypes/StructInstantiation01.fs | 2 +- .../StructTypes/StructWithNoFields01.fs | 6 +- .../TypeExtensions/basic/BasicExtensions.fs | 2 +- .../basic/E_CantExtendTypeAbbrev.fs | 2 +- .../basic/E_ConflictingMembers.fs | 6 +- .../basic/E_ExtendVirtualMethods01.fs | 4 +- .../basic/E_ExtensionInNamespace01.fs | 2 +- .../basic/E_ExtensionOperator01.fs | 4 +- .../basic/E_InvalidExtensions01.fs | 4 +- .../basic/E_InvalidExtensions02.fs | 4 +- .../basic/E_InvalidExtensions03.fs | 6 +- .../basic/E_InvalidExtensions04.fs | 4 +- .../basic/E_InvalidForwardRef01.fs | 2 +- .../E_ProtectedMemberInExtensionMember01.fs | 4 +- .../TypeExtensions/basic/ExtendHierarchy01.fs | 8 +- .../TypeExtensions/basic/ExtendHierarchy02.fs | 2 +- .../basic/ExtendViaOverloading01.fs | 18 +- .../basic/ExtendViaOverloading02.fs | 6 +- .../basic/ExtendWithOperator01.fs | 6 +- .../basic/ExtensionInNamespace02.fs | 4 +- .../basic/MultipleExtensions.fs | 16 +- .../basic/NonConflictingIntrinsicMembers.fs | 12 +- .../TypeExtensions/basic/UnqualifiedName.fs | 2 +- .../intrinsic/E_typeext_int002.fs | 12 +- .../TypeExtensions/intrinsic/lib001.fs | 8 +- .../TypeExtensions/intrinsic/lib002.fs | 2 +- .../TypeExtensions/intrinsic/lib003.fs | 8 +- .../TypeExtensions/intrinsic/lib004.fs | 4 +- .../TypeExtensions/intrinsic/lib005.fs | 4 +- .../intrinsic/typeext_int001.fs | 54 +- .../intrinsic/typeext_int003.fs | 14 +- .../intrinsic/typeext_int004.fs | 10 +- .../intrinsic/typeext_int005.fs | 10 +- .../TypeKindInference/infer_class001.fs | 16 +- .../TypeKindInference/infer_class001e.fs | 4 +- .../TypeKindInference/infer_class002.fs | 14 +- .../TypeKindInference/infer_class003.fs | 14 +- .../TypeKindInference/infer_class004.fs | 38 +- .../TypeKindInference/infer_class005.fs | 38 +- .../TypeKindInference/infer_interface001.fs | 14 +- .../TypeKindInference/infer_interface001e.fs | 6 +- .../TypeKindInference/infer_interface002.fs | 12 +- .../TypeKindInference/infer_interface002e.fs | 14 +- .../TypeKindInference/infer_interface003.fs | 14 +- .../TypeKindInference/infer_interface003e.fs | 8 +- .../TypeKindInference/infer_interface004.fs | 22 +- .../TypeKindInference/infer_struct001.fs | 16 +- .../TypeKindInference/infer_struct001e.fs | 10 +- .../TypeKindInference/infer_struct002.fs | 14 +- .../TypeKindInference/infer_struct002e.fs | 4 +- .../TypeKindInference/infer_struct003.fs | 14 +- .../ORPTestRunner.fs | 52 +- .../Conformance/PatternMatching/And/And.fs | 6 +- .../PatternMatching/And/E_IdentBoundTwice.fs | 4 +- .../PatternMatching/And/andPattern01.fs | 2 +- .../PatternMatching/And/andPattern02.fs | 6 +- .../PatternMatching/And/andPattern03.fs | 2 +- .../PatternMatching/And/andPattern04.fs | 2 +- .../PatternMatching/Array/Array.fs | 6 +- .../PatternMatching/Array/TrailingSemi01.fs | 16 +- .../PatternMatching/Array/arrayMatch01.fs | 2 +- .../PatternMatching/Array/arrayMatch02.fs | 2 +- .../PatternMatching/Array/arrayMatch03.fs | 2 +- .../Conformance/PatternMatching/As/As.fs | 6 +- .../PatternMatching/As/asPattern01.fs | 2 +- .../PatternMatching/As/asPattern02.fs | 10 +- .../PatternMatching/ConsList/ConsList.fs | 6 +- .../ConsList/E_consPattern01.fs | 4 +- .../Decimal/incompleteMatchesLiteral01.fs | 2 +- .../PatternMatching/Decimal/literal01.fs | 2 +- .../DynamicTypeTest/ArrayTypeTest01.fs | 2 +- .../DynamicTypeTest/DynamicTypeTest.fs | 3 +- .../DynamicTypeTest/E_DynamTyTestVarType01.fs | 4 +- .../DynamicTypeTest/E_DynamicTest03.fs | 2 +- .../E_DynamicTestPrimType01.fs | 4 +- .../DynamicTypeTest/Regression01.fs | 4 +- .../DynamicTypeTest/Regression02.fs | 2 +- .../DynamicTypeTest/TwoAtOnce01.fs | 10 +- .../DynamicTypeTest/W_RedundantPattern01.fs | 18 +- .../W_TypeTestWillAlwaysHold01.fs | 2 +- .../DynamicTypeTest/dynTestSealedType01.fs | 2 +- .../DynamicTypeTest/dynamicTypeTest01.fs | 6 +- .../DynamicTypeTest/dynamicTypeTest02.fs | 12 +- .../DynamicTypeTest/dynamicTypeTest03.fs | 12 +- .../DynamicTypeTest/dynamicTypeTest04.fs | 2 +- .../DynamicTypeTest/genericType01.fs | 2 +- .../Expression/E_CounterExample01.fs | 4 +- .../PatternMatching/Expression/Expression.fs | 10 +- .../Expression/NoCounterExampleTryWith01.fs | 4 +- .../Expression/W_CounterExampleWithEnum01.fs | 4 +- .../Expression/W_CounterExampleWithEnum02.fs | 10 +- .../Expression/W_whenGuards01.fs | 2 +- .../PatternMatching/Expression/patterns01.fs | 4 +- .../PatternMatching/Expression/patterns02.fs | 2 +- .../Expression/whenGuards01.fs | 10 +- .../Expression/whenGuards02.fs | 4 +- .../Expression/whenGuardss01.fs | 10 +- .../Expression/whenGuardss02.fs | 4 +- .../Named/ActivePatternOutsideMatch01.fs | 2 +- .../Named/ActivePatternOutsideMatch02.fs | 2 +- .../Named/ActivePatternUnconstrained01.fs | 6 +- .../Named/AsHighOrderFunc01.fs | 2 +- .../Named/E_ActivePatternHasNoFields.fs | 4 +- .../Named/E_ActivePatternNotAFunction.fs | 2 +- .../Named/E_ActivePatternUnconstrained01.fs | 6 +- .../Named/E_ActivePatterns01.fs | 2 +- .../Named/E_ActivePatterns02.fs | 2 +- .../PatternMatching/Named/E_Error_LetRec01.fs | 2 +- .../PatternMatching/Named/E_Error_LetRec02.fs | 2 +- .../PatternMatching/Named/E_Error_LetRec03.fs | 4 +- .../PatternMatching/Named/E_Error_LetRec04.fs | 2 +- .../Named/E_Error_NonParam01.fs | 2 +- .../Named/E_Error_NonParam02.fs | 2 +- .../Named/E_Error_NonParam03.fs | 2 +- .../Named/E_Error_NonParam04.fs | 2 +- .../PatternMatching/Named/E_Error_Param01.fs | 2 +- .../PatternMatching/Named/E_Error_Param02.fs | 2 +- .../PatternMatching/Named/E_Error_Param03.fs | 2 +- .../PatternMatching/Named/E_Error_Param04.fs | 2 +- .../Named/E_LargeActivePat01.fs | 2 +- .../Named/E_MulticasePartialNotAllowed01.fs | 12 +- .../Named/E_ParameterRestrictions01.fs | 4 +- .../Named/E_PatternMatchRegressions02.fs | 8 +- .../Named/MultiActivePatterns01.fs | 4 +- .../PatternMatching/Named/Named.fs | 16 +- .../PatternMatching/Named/NamedLiteral01.fs | 10 +- .../PatternMatching/Named/NamedLiteral02.fs | 20 +- .../ParameterizedPartialActivePattern01.fs | 10 +- .../Named/PatternMatchRegressions01.fs | 8 +- .../Named/PatternMatchRegressions02.fs | 8 +- .../Named/RecursiveActivePats.fs | 10 +- .../PatternMatching/Named/activePatterns01.fs | 2 +- .../PatternMatching/Named/activePatterns02.fs | 2 +- .../PatternMatching/Named/activePatterns03.fs | 4 +- .../PatternMatching/Named/activePatterns05.fs | 2 +- .../PatternMatching/Named/activePatterns06.fs | 2 +- .../PatternMatching/Named/activePatterns07.fs | 16 +- .../PatternMatching/Named/activePatterns08.fs | 4 +- .../PatternMatching/Named/activePatterns09.fs | 2 +- .../PatternMatching/Named/activePatterns10.fs | 2 +- .../PatternMatching/Named/discUnion01.fs | 2 +- .../PatternMatching/Named/discUnion02.fs | 8 +- .../Null/E_notNullCompatible01.fs | 2 +- .../Conformance/PatternMatching/Null/Null.fs | 2 +- .../PatternMatching/Null/matchNull01.fs | 4 +- .../Record/E_RecTypesNotMatch01.fs | 2 +- .../Record/E_RecordFieldNotDefined01.fs | 4 +- .../PatternMatching/Record/E_SyntaxError01.fs | 4 +- .../PatternMatching/Record/Record.fs | 7 +- .../Record/recordPatterns01.fs | 12 +- .../Record/recordPatterns02.fs | 6 +- .../Record/structRecordPatterns01.fs | 12 +- .../Record/structRecordPatterns02.fs | 6 +- .../PatternMatching/Simple/CodeGenReg01.fs | 18 +- .../PatternMatching/Simple/E_SyntaxError01.fs | 2 +- .../Simple/E_ValueCapture01.fs | 4 +- .../Simple/E_constPattern01.fs | 4 +- .../Simple/E_namedLiberal01.fs | 14 +- .../Simple/MatchFailureExn01.fs | 6 +- .../PatternMatching/Simple/Simple.fs | 19 +- .../PatternMatching/Simple/ValueCapture01.fs | 4 +- .../PatternMatching/Simple/ValueCapture02.fs | 8 +- .../Simple/W_BindCapitalIdent.fs | 8 +- .../PatternMatching/Simple/W_Incomplete01.fs | 46 +- .../PatternMatching/Simple/W_Incomplete02.fs | 14 +- .../Simple/simplePatterns01.fs | 4 +- .../Simple/simplePatterns02.fs | 4 +- .../Simple/simplePatterns03.fs | 6 +- .../Simple/simplePatterns04.fs | 4 +- .../Simple/simplePatterns05.fs | 12 +- .../Simple/simplePatterns06.fs | 2 +- .../Simple/simplePatterns07.fs | 6 +- .../Simple/simplePatterns08.fs | 4 +- .../Simple/simplePatterns09.fs | 4 +- .../Simple/simplePatterns10.fs | 4 +- .../Simple/simplePatterns11.fs | 4 +- .../Simple/simplePatterns12.fs | 4 +- .../Simple/simplePatterns13.fs | 8 +- .../Simple/simplePatterns14.fs | 6 +- .../Simple/simplePatterns15.fs | 4 +- .../Simple/simplePatterns16.fs | 4 +- .../Simple/simplePatterns17.fs | 6 +- .../Simple/simplePatterns18.fs | 4 +- .../Simple/simplePatterns19.fs | 2 +- .../Simple/simplePatterns20.fs | 2 +- .../SimpleConstant/DiffAssembly.fs | 2 +- .../SimpleConstant/E_NoRangeConst01.fs | 2 +- .../SimpleConstant/E_type_bigint.fs | 2 +- .../SimpleConstant/E_type_bignum40.fs | 2 +- .../SimpleConstant/FullyQualify01.fs | 10 +- .../SimpleConstant/MatchLiteral01.fs | 8 +- .../SimpleConstant/MatchNaN.fs | 6 +- .../SimpleConstant/SimpleConstant.fs | 56 +- .../SimpleConstant/matchConst01.fs | 4 +- .../SimpleConstant/matchConst02.fs | 4 +- .../SimpleConstant/matchConst03.fs | 2 +- .../SimpleConstant/matchConst04.fs | 10 +- .../SimpleConstant/type_bigint.fs | 2 +- .../SimpleConstant/type_bool.fs | 2 +- .../SimpleConstant/type_byte.fs | 2 +- .../SimpleConstant/type_byteArr.fs | 2 +- .../SimpleConstant/type_char.fs | 2 +- .../SimpleConstant/type_double.fs | 2 +- .../SimpleConstant/type_float32.fs | 2 +- .../SimpleConstant/type_int.fs | 2 +- .../SimpleConstant/type_int16.fs | 4 +- .../SimpleConstant/type_int64.fs | 2 +- .../SimpleConstant/type_nativenint.fs | 2 +- .../SimpleConstant/type_sbyte.fs | 2 +- .../SimpleConstant/type_string.fs | 2 +- .../SimpleConstant/type_uint16.fs | 2 +- .../SimpleConstant/type_uint32.fs | 2 +- .../SimpleConstant/type_uint64.fs | 2 +- .../SimpleConstant/type_unativenint.fs | 2 +- .../SimpleConstant/type_unit.fs | 2 +- .../PatternMatching/Tuple/SimpleTuples01.fs | 2 +- .../PatternMatching/Tuple/Tuple.fs | 9 +- .../Tuple/W_IncompleteMatches01.fs | 4 +- .../Tuple/W_RedundantPattern01.fs | 4 +- .../Tuple/W_RedundantPattern02.fs | 6 +- .../PatternMatching/Tuple/tuples01.fs | 6 +- .../TypeConstraint/E_typeconstraint01.fs | 6 +- .../TypeConstraint/TypeConstraint.fs | 1 - .../Union/E_CapturesDiffVal01.fs | 2 +- .../Union/E_NotAllCaptureSameVal01.fs | 2 +- .../PatternMatching/Union/E_UnionPattern01.fs | 2 +- .../PatternMatching/Union/E_UnionPattern02.fs | 2 +- .../PatternMatching/Union/E_UnionPattern03.fs | 4 +- .../PatternMatching/Union/E_UnionPattern04.fs | 2 +- .../PatternMatching/Union/E_UnionPattern05.fs | 2 +- .../PatternMatching/Union/E_UnionPattern06.fs | 2 +- .../PatternMatching/Union/E_UnionPattern07.fs | 2 +- .../PatternMatching/Union/E_UnionPattern08.fs | 2 +- .../PatternMatching/Union/E_UnionPattern09.fs | 2 +- .../PatternMatching/Union/E_UnionPattern10.fs | 2 +- .../PatternMatching/Union/E_UnionPattern11.fs | 2 +- .../PatternMatching/Union/Union.fs | 38 +- .../Union/UpperUnionCasePattern01.fs | 12 +- .../Union/UpperUnionCasePattern02.fs | 8 +- .../PatternMatching/Union/unionPattern01.fs | 12 +- .../PatternMatching/Union/unionPattern02.fs | 6 +- .../PatternMatching/Union/unionPattern03.fs | 6 +- .../PatternMatching/Union/unionPattern04.fs | 2 +- .../Wildcard/wildCardPatterns01.fs | 2 +- .../AssemblyConfiguration_001.fs | 2 +- .../AssemblyVersion_002.fs | 2 +- .../SpecialAttributesAndTypes/CallerInfo.fs | 6 +- .../Conformance/Stress/StressTests.fs | 50 +- .../NegativeCases/Class_NG_TurnToStruct.fs | 2 +- .../NegativeCases/Struct_NG_TurnToClass.fs | 2 +- .../Types/RecordTypes/AnonymousRecords.fs | 70 +- .../Types/RecordTypes/BigRecord01.fs | 2 +- .../Types/RecordTypes/DuckTypingRecords01.fs | 8 +- .../Types/RecordTypes/E_InheritRecord01.fs | 4 +- .../Types/RecordTypes/E_RecordCloning01.fs | 2 +- .../Types/RecordTypes/E_RecordsNotNull01.fs | 2 +- .../Types/RecordTypes/E_RecordsNotNull02.fs | 6 +- .../Types/RecordTypes/E_TypeInference01.fs | 2 +- .../Types/RecordTypes/E_TypeInference01b.fs | 2 +- .../Types/RecordTypes/E_TypeInference02.fs | 2 +- .../Types/RecordTypes/EqualAndBoxing01.fs | 2 +- .../RecordTypes/FieldBindingAfterWith01a.fs | 12 +- .../RecordTypes/FieldBindingAfterWith01b.fs | 12 +- .../Types/RecordTypes/FullyQualify01.fs | 8 +- .../Types/RecordTypes/ImplicitEquals01.fs | 8 +- .../RecordTypes/NoClashMemberIFaceMember.fs | 8 +- .../Types/RecordTypes/Overload_Equals.fs | 2 +- .../Types/RecordTypes/Overload_GetHashCode.fs | 4 +- .../Types/RecordTypes/Overload_ToString.fs | 2 +- .../Types/RecordTypes/RecordCloning01.fs | 2 +- .../Types/RecordTypes/RecordCloning02.fs | 2 +- .../Types/RecordTypes/RecordCloning03.fs | 2 +- .../Types/RecordTypes/RecordTypes.fs | 20 +- .../RecordTypes/StructRecordCloning01.fs | 2 +- .../RecordTypes/StructRecordCloning02.fs | 2 +- .../RecordTypes/StructRecordCloning03.fs | 2 +- .../Conformance/Types/RecordTypes/Syntax01.fs | 6 +- .../Types/RecordTypes/TypeInference01.fs | 2 +- .../Types/RecordTypes/TypeInference02.fs | 4 +- .../Types/StructTypes/E_Inheritance.fs | 6 +- .../Types/StructTypes/Overload_Equals.fs | 2 +- .../Types/StructTypes/Overload_GetHashCode.fs | 4 +- .../Types/StructTypes/Overload_ToString.fs | 2 +- .../E_CannotInlineVirtualMethod2.fs | 2 +- .../E_CannotInlineVirtualMethods1.fs | 6 +- .../testFiles/MiniFSharpPlusExtensionSRTP.fs | 26 +- .../IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs | 16 +- .../testFiles/CheckNewSyntax.fs | 4 +- .../testFiles/CheckSelfConstrainedSRTP.fs | 2 +- .../Types/UnionTypes/E_FieldMemberClash.fs | 2 +- .../Types/UnionTypes/E_FieldNameUsedMulti.fs | 4 +- .../Types/UnionTypes/E_InheritUnion.fs | 2 +- .../Types/UnionTypes/E_LowercaseDT.fs | 2 +- .../Types/UnionTypes/E_Overload_Equals.fs | 2 +- .../UnionTypes/E_Overload_GetHashCode.fs | 4 +- .../E_UnionConstructorBadFieldName.fs | 4 +- .../UnionTypes/E_UnionFieldConflictingName.fs | 6 +- .../Types/UnionTypes/E_UnionFieldNamedTag.fs | 4 +- .../E_UnionFieldNamedTagNoDefault.fs | 6 +- .../Types/UnionTypes/E_UnionMemberNamedTag.fs | 6 +- .../E_UnionMemberNamedTagNoDefault.fs | 6 +- .../UnionTypes/E_UnionMemberNamedTags.fs | 6 +- .../E_UnionMemberNamedTagsNoDefault.fs | 6 +- .../Types/UnionTypes/E_UnionsNotNull01.fs | 2 +- .../Types/UnionTypes/EqualAndBoxing01.fs | 2 +- .../Types/UnionTypes/ImplicitEquals001.fs | 8 +- .../Types/UnionTypes/Overload_Equals.fs | 2 +- .../Types/UnionTypes/Overload_GetHashCode.fs | 4 +- .../Types/UnionTypes/Overload_ToString.fs | 2 +- .../UnionTypes/ReflectionOnUnionTypes01.fs | 6 +- .../Types/UnionTypes/UnionStructTypes.fs | 106 +- .../Types/UnionTypes/UnionTypes.fs | 12 +- .../Types/UnionTypes/UnionsNotNull02.fs | 4 +- .../neg_invalid_constructor.fs | 6 +- .../Debugger/PortablePdbs.fs | 2 +- .../Diagnostics/Records.fs | 6 +- .../InlineWithPrivateValues01.fs | 2 +- .../EmittedIL/AssemblyBoundary/TypeLib01.fs | 14 +- .../EmittedIL/AssemblyBoundary/TypeLib02.fs | 14 +- .../EmittedIL/AssemblyBoundary/lib01.fs | 2 +- .../EmittedIL/AssemblyBoundary/lib02.fs | 4 +- .../EmittedIL/AssemblyBoundary/lib03.fs | 6 +- .../EmittedIL/AssemblyBoundary/lib04.fs | 4 +- .../EmittedIL/AssemblyBoundary/test01.fs | 4 +- .../EmittedIL/AssemblyBoundary/test02.fs | 4 +- .../EmittedIL/AssemblyBoundary/test03.fs | 4 +- .../EmittedIL/AssemblyBoundary/test04.fs | 4 +- .../AsyncExpressionSteppingTest1.fs | 6 +- .../AsyncExpressionSteppingTest2.fs | 2 +- .../AsyncExpressionSteppingTest3.fs | 10 +- .../AsyncExpressionSteppingTest4.fs | 12 +- .../AsyncExpressionSteppingTest5.fs | 6 +- .../AsyncExpressionSteppingTest6.fs | 14 +- .../CCtorDUWithMember/CCtorDUWithMember.fs | 4 +- .../CCtorDUWithMember/CCtorDUWithMember01a.fs | 6 +- .../CCtorDUWithMember/CCtorDUWithMember02a.fs | 2 +- .../CCtorDUWithMember/CCtorDUWithMember03a.fs | 2 +- .../CCtorDUWithMember/CCtorDUWithMember04.fs | 2 +- .../CCtorDUWithMember/CCtorDUWithMember04a.fs | 2 +- .../CodeGenRegressions_Closures.fs | 2 +- .../CodeGenRegressions_Observations.fs | 2 +- .../CompiledNameAttribute.fs | 2 +- .../CompiledNameAttribute01.fs | 2 +- .../CompiledNameAttribute02.fs | 2 +- .../CompiledNameAttribute03.fs | 2 +- .../CompiledNameAttribute04.fs | 14 +- .../ComputationExpr01.fs | 10 +- .../ComputationExpr02.fs | 6 +- .../ComputationExpr03.fs | 20 +- .../ComputationExpr04.fs | 12 +- .../ComputationExpr05.fs | 8 +- .../ComputationExpr06.fs | 10 +- .../ComputationExpr07.fs | 8 +- .../ComputationExprLibrary.fs | 84 +- .../ComputationExpressions.fs | 8 +- .../ComputedCollections.fs | 2 +- ...DoNotBoxStruct_ArrayOfArray_CSInterface.fs | 4 +- ...DoNotBoxStruct_ArrayOfArray_FSInterface.fs | 2 +- ...ruct_ArrayOfArray_FSInterface_NoExtMeth.fs | 2 +- .../DoNotBoxStruct_Array_CSInterface.fs | 2 +- .../DoNotBoxStruct_Array_FSInterface.fs | 2 +- ...otBoxStruct_Array_FSInterface_NoExtMeth.fs | 2 +- .../DoNotBoxStruct_MDArray_CSInterface.fs | 2 +- .../DoNotBoxStruct_MDArray_FSInterface.fs | 2 +- ...BoxStruct_MDArray_FSInterface_NoExtMeth.fs | 2 +- .../DoNotBoxStruct_NoArray_CSInterface.fs | 2 +- .../DoNotBoxStruct_NoArray_FSInterface.fs | 2 +- ...BoxStruct_NoArray_FSInterface_NoExtMeth.fs | 2 +- .../DoNotBoxStruct/DoNotBoxStruct_ToString.fs | 2 +- .../EmittedIL/FixedBindings/FixedBindings.fs | 34 +- .../FixedBindings/PinAddressOfArrayElement.fs | 2 +- .../PinAddressOfExplicitFieldOnThis.fs | 6 +- .../FixedBindings/PinAddressOfRecordField.fs | 2 +- ...eWithGetPinnableReferenceReturningByref.fs | 2 +- .../FixedBindings/PinGenericReadOnlySpan.fs | 2 +- .../PinIntByrefOfLocalVariable.fs | 2 +- .../FixedBindings/PinIntByrefOfParameter.fs | 4 +- .../EmittedIL/FixedBindings/PinSpan.fs | 2 +- ...nSpanWithManualGetPinnableReferenceCall.fs | 2 +- ...eWithGetPinnableReferenceReturningByref.fs | 2 +- ...nsionGetPinnableReferenceReturningByref.fs | 4 +- ...nsionGetPinnableReferenceReturningByref.fs | 2 +- ...eWithGetPinnableReferenceReturningByref.fs | 2 +- ...eWithGetPinnableReferenceReturningInref.fs | 2 +- .../EmittedIL/ForLoop/ForEachOnArray01.fs | 4 +- .../EmittedIL/ForLoop/ForEachOnList01.fs | 8 +- .../EmittedIL/ForLoop/ForLoop01.fs | 2 +- .../EmittedIL/ForLoop/ForLoop02.fs | 4 +- .../EmittedIL/ForLoop/ForLoop03.fs | 4 +- .../ForLoop/NoAllocationOfTuple01.fs | 6 +- .../NonTrivialBranchingBindingInEnd01.fs | 2 +- .../NonTrivialBranchingBindingInEnd02.fs | 2 +- .../NonTrivialBranchingBindingInEnd03.fs | 2 +- .../NonTrivialBranchingBindingInEnd04.fs | 2 +- .../NonTrivialBranchingBindingInEnd05.fs | 2 +- .../EmittedIL/ForLoop/ZeroToArrLength01.fs | 6 +- .../EmittedIL/ForLoop/ZeroToArrLength02.fs | 6 +- .../EmittedIL/GeneratedIterators/GenIter01.fs | 4 +- .../EmittedIL/GeneratedIterators/GenIter02.fs | 4 +- .../EmittedIL/GeneratedIterators/GenIter03.fs | 2 +- .../EmittedIL/GeneratedIterators/GenIter04.fs | 2 +- .../GenericComparison/CrossAssembly.fs | 8 +- .../GenericComparison/GenericComparison.fs | 12 +- .../InequalityComparison01.fs | 2 +- .../InequalityComparison02.fs | 2 +- .../InequalityComparison03.fs | 2 +- .../InequalityComparison04.fs | 2 +- .../InequalityComparison05.fs | 2 +- .../EmittedIL/Inlining/EmptyStringPattern.fs | 2 +- .../EmittedIL/Inlining/Match01.fs | 20 +- .../EmittedIL/Inlining/Match02.fs | 6 +- .../EmittedIL/Inlining/StructUnion01.fs | 44 +- .../ListExpressionStepping.fs | 2 +- .../ListExpressionStepping01.fs | 6 +- .../ListExpressionStepping02.fs | 6 +- .../ListExpressionStepping03.fs | 10 +- .../ListExpressionStepping04.fs | 10 +- .../ListExpressionStepping05.fs | 16 +- .../ListExpressionStepping06.fs | 8 +- .../MethodImplAttribute.fs | 4 +- .../EmittedIL/Misc/AnonRecd.fs | 4 +- .../Misc/ArgumentNamesInClosures01.fs | 14 +- .../EmittedIL/Misc/CodeGenRenamings01.fs | 2 +- .../Misc/CustomAttributeGenericParameter01.fs | 2 +- .../EmittedIL/Misc/Decimal01.fs | 2 +- .../EmittedIL/Misc/EntryPoint01.fs | 6 +- .../EmittedIL/Misc/EqualsOnUnions01.fs | 4 +- .../Misc/GeneralizationOnUnions01.fs | 4 +- .../EmittedIL/Misc/GenericTypeStaticField.fs | 4 +- .../EmittedIL/Misc/IfThenElse01.fs | 4 +- .../EmittedIL/Misc/LetIfThenElse01.fs | 4 +- .../EmittedIL/Misc/Lock01.fs | 4 +- .../EmittedIL/Misc/Marshal.fs | 2 +- .../EmittedIL/Misc/MethodImplNoInline.fs | 2 +- .../EmittedIL/Misc/MethodImplNoInline02.fs | 2 +- .../EmittedIL/Misc/ModuleWithExpression01.fs | 4 +- .../EmittedIL/Misc/NoBoxingOnDispose01.fs | 4 +- .../EmittedIL/Misc/NonEscapingArguments02.fs | 6 +- .../EmittedIL/Misc/Seq_for_all01.fs | 4 +- .../EmittedIL/Misc/Structs01.fs | 2 +- .../EmittedIL/Misc/Structs02.fs | 4 +- .../Misc/Structs02_asNetStandard20.fs | 4 +- .../Misc/StructsAsArrayElements01.fs | 6 +- .../Misc/TryWith_NoFilterBlocks01.fs | 2 +- .../EmittedIL/Nullness/CustomType.fs | 2 +- .../EmittedIL/Nullness/GenericCode.fs | 4 +- .../EmittedIL/Nullness/GenericStructDu.fs | 2 +- .../EmittedIL/Nullness/NullAsTrueValue.fs | 6 +- .../EmittedIL/Nullness/NullnessMetadata.fs | 70 +- .../EmittedIL/Nullness/Records.fs | 4 +- .../EmittedIL/Nullness/ReferenceDU.fs | 2 +- .../EmittedIL/Nullness/StructDU.fs | 6 +- .../EmittedIL/Nullness/SupportsNull.fs | 4 +- .../Linq101Aggregates01.fs | 12 +- .../Linq101ElementOperators01.fs | 4 +- .../Linq101Grouping01.fs | 2 +- .../Linq101Ordering01.fs | 2 +- .../Linq101Partitioning01.fs | 4 +- .../Linq101Select01.fs | 4 +- .../Linq101SetOperators01.fs | 4 +- .../QueryExpressionStepping/Linq101Where01.fs | 6 +- .../QueryExpressionStepping/Utils.fs | 278 +- .../ClassTypeVisibilityNamespaceRoot.fs | 1 - .../nested_generic_closure.fs | 2 +- .../SeqExpressionSteppingTest01.fs | 6 +- .../SeqExpressionSteppingTest02.fs | 6 +- .../SeqExpressionSteppingTest03.fs | 4 +- .../SeqExpressionSteppingTest04.fs | 6 +- .../SeqExpressionSteppingTest05.fs | 6 +- .../SeqExpressionSteppingTest06.fs | 8 +- .../SeqExpressionSteppingTest07.fs | 4 +- .../SeqExpressionTailCalls01.fs | 2 +- .../SeqExpressionTailCalls02.fs | 2 +- .../EmittedIL/SkipLocalsInit.fs | 4 +- .../EmittedIL/StaticInit/LetBinding01.fs | 2 +- .../StaticInit/StaticInit_Class01.fs | 10 +- .../StaticInit/StaticInit_Module01.fs | 12 +- .../StaticInit/StaticInit_Struct01.fs | 8 +- .../SteppingMatch/SteppingMatch01.fs | 8 +- .../SteppingMatch/SteppingMatch02.fs | 8 +- .../SteppingMatch/SteppingMatch03.fs | 8 +- .../SteppingMatch/SteppingMatch04.fs | 8 +- .../SteppingMatch/SteppingMatch05.fs | 8 +- .../SteppingMatch/SteppingMatch06.fs | 6 +- .../SteppingMatch/SteppingMatch07.fs | 6 +- .../SteppingMatch/SteppingMatch08.fs | 4 +- .../SteppingMatch/SteppingMatch09.fs | 26 +- .../StringEncoding/StringEncoding.fs | 6 +- .../EmittedIL/StringFormatAndInterpolation.fs | 2 +- .../StructDefensiveCopy.fs | 12 +- .../EmittedIL/Structure/AttributesOnLet01.fs | 4 +- .../EmittedIL/Structure/AttributesOnLet02.fs | 6 +- .../Structure/AttributesOnProperty.fs | 6 +- .../Structure/AttributesOnPropertyGetter.fs | 8 +- .../AttributesOnPropertyGetterSetter.fs | 8 +- .../Structure/AttributesOnPropertySetter.fs | 8 +- .../EmittedIL/Structure/BaseType.fs | 4 +- .../EmittedIL/Structure/ClassArity01.fs | 6 +- .../EmittedIL/Structure/CodeGenHelper.fs | 62 +- .../EmittedIL/Structure/Delegates01.fs | 4 +- .../EmittedIL/Structure/DiscUnionCodeGen1.fs | 24 +- .../EmittedIL/Structure/DoNotInlineX.fs | 8 +- .../EmittedIL/Structure/Equality01.fs | 4 +- .../EmittedIL/Structure/Events01.fs | 16 +- .../EmittedIL/Structure/Events02.fs | 24 +- .../EmittedIL/Structure/Extensions01.fs | 2 +- .../EmittedIL/Structure/Extensions02.fs | 10 +- .../EmittedIL/Structure/FunctionArity01.fs | 2 +- .../EmittedIL/Structure/ModuleArity01.fs | 6 +- .../EmittedIL/Structure/NativePtr01.fs | 14 +- .../Structure/ObjectExpressions01.fs | 14 +- .../Structure/ReadOnlyStructFromLib.fs | 2 +- .../Structure/UnionTypeWithSignature01.fs | 12 +- .../Structure/UnionTypeWithSignature01.fsi | 2 +- .../Structure/UnionTypeWithSignature02.fs | 18 +- .../Structure/UnionTypeWithSignature02.fsi | 2 +- .../EmittedIL/Structure/UnitsOfMeasure01.fs | 14 +- .../EmittedIL/Structure/UnitsOfMeasure02.fs | 8 +- .../EmittedIL/Structure/UnitsOfMeasure03.fs | 12 +- .../EmittedIL/TestFunctions/TestFunction01.fs | 2 +- .../EmittedIL/TestFunctions/TestFunction02.fs | 8 +- .../EmittedIL/TestFunctions/TestFunction03.fs | 10 +- .../TestFunctions/TestFunction03b.fs | 10 +- .../TestFunctions/TestFunction03c.fs | 10 +- .../EmittedIL/TestFunctions/TestFunction04.fs | 8 +- .../EmittedIL/TestFunctions/TestFunction05.fs | 6 +- .../EmittedIL/TestFunctions/TestFunction06.fs | 6 +- .../EmittedIL/TestFunctions/TestFunction07.fs | 2 +- .../EmittedIL/TestFunctions/TestFunction08.fs | 6 +- .../EmittedIL/TestFunctions/TestFunction09.fs | 4 +- .../TestFunctions/TestFunction09b.fs | 4 +- .../TestFunctions/TestFunction09b1.fs | 4 +- .../TestFunctions/TestFunction09b2.fs | 4 +- .../TestFunctions/TestFunction09b3.fs | 4 +- .../TestFunctions/TestFunction09b4.fs | 2 +- .../EmittedIL/TestFunctions/TestFunction10.fs | 4 +- .../EmittedIL/TestFunctions/TestFunction11.fs | 2 +- .../EmittedIL/TestFunctions/TestFunction12.fs | 2 +- .../EmittedIL/TestFunctions/TestFunction13.fs | 4 +- .../EmittedIL/TestFunctions/TestFunction14.fs | 6 +- .../EmittedIL/TestFunctions/TestFunction15.fs | 4 +- .../EmittedIL/TestFunctions/TestFunction16.fs | 4 +- .../EmittedIL/TestFunctions/TestFunction17.fs | 2 +- .../EmittedIL/TestFunctions/TestFunction18.fs | 2 +- .../EmittedIL/TestFunctions/TestFunction19.fs | 6 +- .../EmittedIL/TestFunctions/TestFunction20.fs | 6 +- .../EmittedIL/TestFunctions/TestFunction21.fs | 2 +- .../EmittedIL/TestFunctions/TestFunction22.fs | 2 +- .../TestFunctions/TestFunction22b.fs | 2 +- .../TestFunctions/TestFunction22c.fs | 2 +- .../TestFunctions/TestFunction22d.fs | 2 +- .../TestFunctions/TestFunction22e.fs | 2 +- .../TestFunctions/TestFunction22f.fs | 2 +- .../TestFunctions/TestFunction22g.fs | 2 +- .../TestFunctions/TestFunction22h.fs | 22 +- .../EmittedIL/TestFunctions/TestFunction23.fs | 8 +- .../EmittedIL/TestFunctions/TestFunction24.fs | 18 +- .../EmittedIL/TryCatch/StackOverflowRepro.fs | 6 +- .../EmittedIL/TryCatch/TryCatch.fs | 2 +- .../EmittedIL/TupleElimination.fs | 6 +- .../EmittedIL/Tuples/OptionalArg01.fs | 14 +- .../EmittedIL/Tuples/Tuple01.fs | 2 +- .../EmittedIL/Tuples/Tuple02.fs | 2 +- .../EmittedIL/Tuples/Tuple03.fs | 2 +- .../EmittedIL/Tuples/Tuple04.fs | 2 +- .../EmittedIL/Tuples/Tuple05.fs | 2 +- .../EmittedIL/Tuples/Tuple06.fs | 2 +- .../EmittedIL/Tuples/Tuple07.fs | 2 +- .../EmittedIL/Tuples/Tuple08.fs | 2 +- .../EmittedIL/Tuples/TupleElimination.fs | 2 +- .../EmittedIL/Tuples/TupleMonster.fs | 2 +- .../EmittedIL/operators/decimal_comparison.fs | 2 +- .../ErrorMessages/ClassesTests.fs | 40 +- .../DiagnosticRegressionTests.fs | 2 +- .../ErrorOnInvalidDeclsInTypeDefinitions.fs | 64 +- .../ExtendedDiagnosticDataTests.fs | 32 +- .../InterfaceImplInAugmentationsTests.fs | 5 +- .../ErrorMessages/ModuleTests.fs | 12 +- .../NameIsBoundMultipleTimesTests.fs | 10 +- .../ErrorMessages/NameResolutionTests.fs | 4 +- .../ErrorMessages/TailCallAttribute.fs | 38 +- .../ErrorMessages/TypeEqualsMissingTests.fs | 2 +- .../UnionCasePatternMatchingErrors.fs | 30 +- .../FSharpChecker/FindReferences.fs | 74 +- .../FSharpChecker/SymbolUse.fs | 2 +- .../Globalization/Arabic.fs | 4 +- .../Globalization/HexCharEncode.fs | 4 +- .../Globalization/Hindi.fs | 24 +- .../Globalization/Mongolian.fs | 8 +- .../Globalization/RightToLeft.fs | 2 +- .../Globalization/Surrogates.fs | 2 +- .../Globalization/Tamil.fs | 2 +- .../Globalization/Tibetan.fs | 10 +- .../Globalization/TurkishI.fs | 2 +- .../Globalization/Uighur.fs | 12 +- .../Globalization/Yi.fs | 8 +- .../Globalization/gb18030.fs | 2 +- .../Globalization/utf16.fs | 2 +- .../Globalization/utf8.fs | 2 +- .../Import/ImportTests.fs | 84 +- .../ErrorTestCases/E_ErrorRanges01.fs | 2 +- .../InteractiveSession/Misc.fs | 38 +- .../Interop/ByrefTests.fs | 12 +- .../Interop/RequiredAndInitOnlyProperties.fs | 6 +- .../Interop/StaticsInInterfaces.fs | 20 +- .../Language/AttributeCheckingTests.fs | 4 +- ...rnTypeDirectedPartialActivePatternTests.fs | 4 +- .../Language/CodeQuotationTests.fs | 4 +- .../Language/ComputationExpressionTests.fs | 86 +- .../Language/CopyAndUpdateTests.fs | 4 +- .../Language/DotLambdaTests.fs | 34 +- .../DynamicAssignmentOperatorTests.fs | 2 +- .../ExperimentalAttributeCheckingTests.fs | 3 +- .../Language/ExtensionMethodTests.fs | 52 +- .../Language/FixedBindings/FixedBindings.fs | 44 +- .../PinAddressOfExplicitFieldOnThis.fs | 4 +- ...itFieldOnThisWithDefaultCtorClassSyntax.fs | 2 +- ...nsionGetPinnableReferenceReturningByref.fs | 2 +- ...eWithGetPinnableReferenceReturningByref.fs | 2 +- ...eWithGetPinnableReferenceReturningInref.fs | 2 +- ...ExtensionGetPinnableReferenceReturnType.fs | 2 +- ...AndInvalidGetPinnableReferenceOverloads.fs | 2 +- .../Language/InterpolatedStringsTests.fs | 2 +- .../Language/NameofTests.fs | 12 +- .../Language/Nullness/EventNullnessTests.fs | 4 +- .../Nullness/NullableCsharpImportTests.fs | 26 +- .../NullableLibraryConstructsTests.fs | 4 +- .../Nullness/NullableReferenceTypesTests.fs | 160 +- .../Nullness/NullableRegressionTests.fs | 40 +- .../Language/Nullness/existing-negative.fs | 4 +- .../Language/Nullness/existing-positive.fs | 14 +- .../inference-problem-size-explosion.fs | 2 +- .../Language/Nullness/library-functions.fs | 22 +- .../Language/Nullness/micro.fs | 6 +- .../Language/Nullness/signatures.fs | 2 +- .../Language/Nullness/signatures.fsi | 2 +- .../using-nullness-syntax-positive.fs | 66 +- .../ObsoleteAttributeCheckingTests.fs | 70 +- .../Language/PrintfFormatTests.fs | 2 +- .../E_SequenceExpressions01.fs | 2 +- .../SequenceExpressionTests.fs | 18 +- .../SequenceExpressions01.fs | 2 +- .../Language/StateMachineTests.fs | 10 +- .../Language/StaticClassTests.fs | 34 +- .../Miscellaneous/FileIndex.fs | 1 - .../Miscellaneous/FsharpSuiteMigrated.fs | 122 +- .../Miscellaneous/MigratedCoreTests.fs | 12 +- .../Miscellaneous/MigratedTypeCheckTests.fs | 12 +- .../Miscellaneous/ReallyLongList01.fs | 2 +- .../Scripting/PreferredUiLangTests.fs | 48 +- .../Scripting/TypeCheckOnlyTests.fs | 8 +- .../Signatures/ArrayTests.fs | 2 +- .../Signatures/ImpliedSignatureHashTests.fs | 6 +- .../Signatures/ModuleOrNamespaceTests.fs | 2 +- .../Signatures/NestedTypeTests.fs | 2 +- .../Signatures/SeqTests.fs | 2 +- .../members_basics.fs | 862 +- .../zero_constraint.fs | 2 +- .../Signatures/TypeTests.fs | 2 +- .../TypeChecks/CrgpLibrary.fs | 6 +- .../Graph/DependencyResolutionTests.fs | 2 +- .../TypeChecks/Graph/GraphProcessingTests.fs | 2 +- .../TypeChecks/Graph/Scenarios.fs | 2 +- .../TypeChecks/Graph/TrieMappingTests.fs | 8 +- .../TypeChecks/Graph/Utils.fs | 2 +- .../TypeChecks/TyparNameTests.fs | 2 +- .../fsc/flaterrors/E_MultiLine01.fs | 2 +- .../fsc/flaterrors/E_MultiLine02.fs | 2 +- .../fsc/flaterrors/E_MultiLine03.fs | 2 +- .../fsc/flaterrors/E_MultiLine04.fs | 2 +- .../fsc/optimize/E_optimizeOMinus.fs | 2 +- .../fsc/optimize/E_optimizeOPlus.fs | 2 +- .../fsc/optimize/Regressions01.fs | 10 +- .../fsc/optimize/optimize01.fs | 2 +- .../AlternateGenericTypeSyntax01.fs | 4 +- .../ObjectConstructors/ChainingCtors.fs | 6 +- .../E_ExtraneousFields01.fs | 2 +- .../E_ImplicitExplicitCTors.fs | 4 +- .../E_MissingArgumentForGetterProp01.fs | 2 +- .../E_NoLetBindingsWOObjCtor.fs | 4 +- .../E_NoObjectConstructorOnInterfaces.fs | 2 +- .../ObjectConstructors/ExplicitCtors01.fs | 6 +- .../GenericTypesInObjCtor.fs | 4 +- ...mplicitCtorsCallingBaseclassPassingSelf.fs | 32 +- .../ObjectConstructors/MutuallyRecursive01.fs | 2 +- .../ObjCtorParamsToBaseclass.fs | 4 +- .../ObjectConstructors/SanityCheck01.fs | 4 +- .../ObjectConstructors/SanityCheck02.fs | 8 +- .../ValOKWithoutImplicitCtor.fs | 8 +- .../WarningforLessGenericthanIndicated.fs | 2 +- .../CallingConventions01.fs | 4 +- .../CallingConventions01_Records.fs | 4 +- .../P-invokeDeclarations/ComVisible01.fs | 2 +- .../P-invokeDeclarations/ComVisible02.fs | 2 +- .../E_DLLImportInTypeDef01.fs | 4 +- .../P-invokeDeclarations/EntryPoint.fs | 8 +- .../P-invokeDeclarations/MarshalStruct01.fs | 10 +- .../MarshalStruct01_Records.fs | 4 +- .../P-invokeDeclarations/SanityCheck01.fs | 2 +- .../AbstractSlot01.fs | 4 +- .../AbstractSlot01.fsi | 4 +- .../E-SignatureAfterSource.fs | 2 +- .../E-SignatureAfterSource.fsi | 2 +- .../E_AnonSignatureFile.fs | 2 +- .../E_AnonSignatureFile.fsi | 2 +- .../E_GenericTypeConstraint01.fs | 10 +- .../E_GenericTypeConstraint01.fsi | 6 +- .../E_GenericTypeConstraint02.fs | 2 +- .../E_GenericTypeConstraint02.fsi | 2 +- .../E_MatchOnProperCtor.fs | 2 +- .../E_MemberNotImplemented01.fs | 4 +- .../E_MemberNotImplemented01.fsi | 2 +- .../Interfaces01.fs | 4 +- .../Interfaces01.fsi | 2 +- .../NullAsTrueUnion01.fs | 16 +- .../NullAsTrueUnion01.fsi | 2 +- .../Properties01.fs | 2 +- .../PublicPrivateInternal01.fs | 2 +- .../PublicPrivateInternal01.fsi | 2 +- .../properties01.fsi | 2 +- .../properties02.fs | 4 +- .../properties02.fsi | 2 +- .../publicprivateinternal02.fs | 2 +- .../publicprivateinternal02.fsi | 4 +- .../publicprivateinternal03.fs | 4 +- .../publicprivateinternal03.fsi | 4 +- .../basic/AnonModule01Main.fs | 4 +- .../basic/E_AnonModule01.fs | 2 +- .../basic/E_HashDirectives01.fs | 2 +- .../basic/E_HashDirectives02.fs | 2 +- .../basic/E_LastFileDllCantBeAnona.fs | 2 +- .../basic/E_LastFileDllCantBeAnonb.fs | 2 +- .../basic/E_ModuleCollision01.fs | 4 +- .../basic/E_NamespaceAndModule01.fs | 2 +- .../basic/E_NamespaceAndModule02.fs | 2 +- .../basic/E_NamespaceAndModule02.fsi | 2 +- .../basic/E_NamespaceCollision01.fs | 6 +- .../basic/E_NamespaceModuleCollision01.fs | 8 +- .../basic/E_NoNamespaceModuleDec01a.fs | 2 +- .../basic/E_NoNamespaceModuleDec01b.fs | 2 +- .../basic/E_NoNamespaceModuleDec02a.fs | 2 +- .../basic/E_NoNamespaceModuleDec02b.fs | 2 +- .../basic/HashDirectives03.fs | 2 +- .../basic/LastFileExeCanBeAnona.fs | 2 +- .../basic/LastFileExeCanBeAnonb.fs | 2 +- .../basic/NoWarningForOneCompiland.fs | 2 +- .../basic/NoWarningWithModNS01a.fs | 2 +- .../basic/NoWarningWithModNS01b.fs | 2 +- .../basic/hashdirectives01.fs | 2 +- .../basic/hashdirectives02.fs | 2 +- .../global/FSharpImportCSharp.fs | 2 +- .../global/MiscNegativeTests.fs | 2 +- .../SignatureFiles/E_MissingSourceFile01.fsi | 4 +- .../SignatureFiles/E_MissingSourceFile02.fsi | 4 +- .../Comments/DontEscapeCommentFromString01.fs | 2 +- .../Comments/E_IncompleteComment01.fs | 2 +- .../Comments/E_IncompleteComment02.fs | 2 +- .../Comments/E_embeddedString005.fs | 2 +- .../Comments/E_ocamlstyle_nested007.fs | 2 +- .../LexicalAnalysis/Comments/E_star02.fs | 2 +- .../Comments/XmlDocComments01.fs | 4 +- .../Comments/embeddedString001.fs | 2 +- .../Comments/embeddedString002.fs | 4 +- .../Comments/embeddedString003.fs | 2 +- .../Comments/embeddedString004.fs | 2 +- .../Comments/escapeCharsInComments001.fs | 2 +- .../Comments/escapeCharsInComments002.fs | 2 +- .../LexicalAnalysis/Comments/ocamlstyle001.fs | 2 +- .../LexicalAnalysis/Comments/ocamlstyle002.fs | 14 +- .../Comments/ocamlstyle_nested001.fs | 2 +- .../Comments/ocamlstyle_nested002.fs | 2 +- .../Comments/ocamlstyle_nested003.fs | 2 +- .../Comments/ocamlstyle_nested004.fs | 2 +- .../Comments/ocamlstyle_nested005.fs | 2 +- .../LexicalAnalysis/Comments/star01.fs | 2 +- .../LexicalAnalysis/Comments/star03.fs | 2 +- .../ConditionalCompilation01.fs | 4 +- .../E_UnmatchedEndif01.fs | 2 +- .../ConditionalCompilation/E_UnmatchedIf01.fs | 2 +- .../ConditionalCompilation/E_UnmatchedIf02.fs | 2 +- .../ConditionalCompilation/FSharp01.fs | 2 +- .../ConditionalCompilation/FSharp02.fs | 2 +- .../ConditionalCompilation/InComment01.fs | 8 +- .../InStringLiteral01.fs | 2 +- .../InStringLiteral02.fs | 6 +- .../InStringLiteral03.fs | 6 +- .../ConditionalCompilation/Nested01.fs | 6 +- .../ConditionalCompilation/Nested02.fs | 6 +- .../ConditionalCompilation/OCaml01.fs | 2 +- .../Directives/multiple_nowarn01.fs | 2 +- .../Directives/multiple_nowarn_many.fs | 2 +- .../Directives/multiple_nowarn_one.fs | 2 +- .../IdentifierReplacements/SourceFile01.fs | 2 +- .../E_InvalidIdentifier01.fs | 2 +- .../E_KeywordIdent01.fs | 2 +- .../E_MissingQualification.fs | 2 +- .../E_NameCollision01.fs | 2 +- .../E_QuotedTypeModuleNames01.fs | 2 +- .../E_ReservedIdentKeywords.fs | 2 +- .../E_ValidIdentifier03.fs | 4 +- .../E_ValidIdentifier04.fs | 2 +- .../StructNotAllowDoKeyword.fs | 2 +- .../ValidIdentifier01.fs | 2 +- .../ValidIdentifier02.fs | 2 +- .../W_IdentContainsAtSign.fs | 2 +- .../W_ReservedWord01.fs | 2 +- .../LexicalAnalysis/LineDirectives/Line01.fs | 2 +- .../LexicalAnalysis/LineDirectives/Line02.fs | 10 +- .../NumericLiterals/BigIntConversion02.fs | 2 +- .../NumericLiterals/BigIntConversion02b.fs | 2 +- .../NumericLiterals/BigNums01.fs | 6 +- .../NumericLiterals/E_BigIntConversion01.fs | 2 +- .../NumericLiterals/E_BigIntConversion01b.fs | 2 +- .../NumericLiterals/E_BigNumNotImpl01.fs | 6 +- .../NumericLiterals/E_BigNums01.fs | 2 +- .../NumericLiterals/E_BigNums40.fs | 2 +- .../NumericLiterals/E_DecimalWO0Prefix.fs | 2 +- .../NumericLiterals/E_InvalidIEEE64.fs | 2 +- .../NumericLiterals/E_MaxLiterals01.fs | 2 +- .../NumericLiterals/E_MaxLiterals02.fs | 2 +- .../NumericLiterals/E_MaxLiterals03.fs | 2 +- .../NumericLiterals/E_MaxLiterals04.fs | 2 +- .../E_enumNegativeLiterals001.fs | 4 +- .../E_enumNegativeLiterals002.fs | 4 +- .../E_enumNegativeLiterals003.fs | 4 +- .../E_enumNegativeLiterals004.fs | 4 +- .../E_enumNegativeLiterals005.fs | 4 +- .../E_enumNegativeLiterals006.fs | 4 +- .../E_enumNegativeLiterals007.fs | 4 +- .../E_enumNegativeLiterals008.fs | 4 +- .../E_enumNegativeLiterals009.fs | 4 +- .../NumericLiterals/MaxLiterals01.fs | 2 +- .../NumericLiterals/NumericLiterals01.fs | 2 +- .../NumericLiterals/casingBin.fs | 2 +- .../NumericLiterals/casingHex.fs | 2 +- .../NumericLiterals/casingIEEE-lf-LF01.fs | 2 +- .../NumericLiterals/casingIEEE-lf-LF02.fs | 2 +- .../NumericLiterals/casingIEEE-lf-LF03a.fs | 2 +- .../NumericLiterals/casingIEEE-lf-LF03b.fs | 2 +- .../NumericLiterals/casingOct.fs | 2 +- .../enumNegativeLiterals001.fs | 4 +- .../Shift/Generics/RightShift001.fs | 2 +- .../Shift/Generics/RightShift002.fs | 2 +- .../StringsAndCharacters/Backslash01.fs | 2 +- .../StringsAndCharacters/Backslash02.fs | 4 +- .../StringsAndCharacters/ByteChars01.fs | 2 +- .../StringsAndCharacters/ByteString01.fs | 2 +- .../StringsAndCharacters/ByteString02.fs | 2 +- .../StringsAndCharacters/ByteString03.fs | 2 +- .../StringsAndCharacters/CharLiterals01.fs | 2 +- .../StringsAndCharacters/CharLiterals02.fs | 2 +- .../StringsAndCharacters/CharLiterals03.fs | 2 +- .../E_BogusLongUnicodeEscape.fs | 2 +- .../E_ByteCharUnicodeChar01.fs | 4 +- .../StringsAndCharacters/E_ByteChars02.fs | 2 +- .../E_ByteStrUnicodeChar01.fs | 4 +- .../E_MalformedShortUnicode01.fs | 2 +- .../StringsAndCharacters/EscapeSequences01.fs | 2 +- .../StringsAndCharacters/EscapeSequences02.fs | 2 +- .../StringsAndCharacters/TripleQuote.fs | 2 +- .../TripleQuoteString01.fs | 2 +- .../StringsAndCharacters/UnicodeString01.fs | 2 +- .../StringsAndCharacters/UnicodeString02.fs | 2 +- .../StringsAndCharacters/UnicodeString03.fs | 6 +- .../StringsAndCharacters/VerbatimString01.fs | 2 +- .../GreaterThanClosedCurly01.fs | 2 +- .../GreaterThanClosedCurly02.fs | 2 +- .../GreaterThanClosedCurly03.fs | 2 +- .../GreaterThanClosedCurly04.fs | 2 +- .../GreaterThanClosedCurly05.fs | 4 +- .../GreaterThanClosedParenthesis01.fs | 2 +- .../GreaterThanClosedSquare01.fs | 2 +- .../GreaterThanClosedSquare02.fs | 2 +- .../SymbolicOperators/E_CantUseDollarSign.fs | 2 +- .../E_GreaterThanColon002.fs | 2 +- .../E_GreaterThanDotParen01.fs | 2 +- .../E_LessThanDotOpenParen001.fs | 4 +- .../SymbolicOperators/E_QMarkGeneric.fs | 4 +- .../SymbolicOperators/GreaterThanColon001.fs | 2 +- .../GreaterThanDotParen01.fs | 2 +- .../LessThanDotOpenParen001.fs | 6 +- .../SymbolicOperators/QMarkArguments.fs | 8 +- .../SymbolicOperators/QMarkAssignSimple.fs | 8 +- .../QMarkExpressionAsArgument.fs | 8 +- .../QMarkExpressionAsArgument2.fs | 10 +- .../SymbolicOperators/QMarkNested.fs | 6 +- .../SymbolicOperators/QMarkPrecedenceArray.fs | 8 +- .../QMarkPrecedenceCurrying.fs | 8 +- .../QMarkPrecedenceInArrays.fs | 6 +- .../QMarkPrecedenceMethodCall.fs | 8 +- .../QMarkPrecedenceMethodCallSpace.fs | 8 +- .../SymbolicOperators/QMarkPrecedenceSpace.fs | 8 +- .../SymbolicOperators/QMarkSimple.fs | 8 +- .../Whitespace/WhiteSpace01.fs | 16 +- .../Basic/ByExample/BasicCheck01.fs | 8 +- .../Basic/OffsideExceptions/Offside01a.fs | 4 +- .../Basic/OffsideExceptions/Offside01b.fs | 4 +- .../Basic/OffsideExceptions/Offside01c.fs | 4 +- .../HashLight/CastOperators01.fs | 6 +- .../HashLight/E_SpacesAfterLetBinding.fs | 4 +- .../HashLight/E_TABsNotAllowedIndentOff.fs | 2 +- .../HashLight/E_UnclosedLetBlock01.fs | 2 +- .../HashLight/First_Non_Comment_Text01.fs | 2 +- .../HashLight/MissingEndToken01.fs | 2 +- .../HashLight/OffsideAccessibility01.fs | 6 +- .../HashLight/default_in_fsi01.fs | 8 +- .../HashLight/default_in_fsi02.fs | 10 +- .../HighPrecedenceApplication/BasicCheck01.fs | 2 +- .../HighPrecedenceApplication/BasicCheck02.fs | 22 +- .../ComplexTypeApp01.fs | 2 +- .../Printing/CustomExceptions01.fs | 2 +- .../Conformance/Printing/DisposeOnSprintfA.fs | 4 +- .../tests/Conformance/Printing/Quotation01.fs | 2 +- .../Printing/ToStringOnCollections.fs | 2 +- .../UnitsOfMeasureIdentifiersRoundTrip02.fs | 2 +- .../Conformance/Printing/VariantTypes01.fs | 2 +- .../Printing/WidthForAFormatter.fs | 4 +- .../E_StructConstructor01.fs | 4 +- .../E_StructWithNameConflict01.fs | 4 +- .../E_StructWithNameConflict01.fsi | 4 +- .../E_StructWithNameConflict02.fs | 4 +- .../E_StructWithNameConflict02.fsi | 4 +- .../ImplementsComparable.fs | 6 +- .../ImplementsComparable.fsi | 4 +- .../InternalAccessibility01.fs | 4 +- .../InternalAccessibility01.fsi | 2 +- .../InternalAccessibility02.fs | 2 +- .../InternalAccessibility03.fs | 6 +- .../InternalAccessibility03.fsi | 2 +- .../MissingMethodInImplementation01.fs | 2 +- .../MissingMethodInImplementation01.fsi | 2 +- .../CheckingSyntacticTypes/ByRef04.fs | 2 +- .../ComparisonConstraint01.fs | 4 +- .../CheckingSyntacticTypes/ConstraintCall1.fs | 6 +- .../CheckingSyntacticTypes/ConstraintCall2.fs | 4 +- .../DefaultConstructorConstraint01.fs | 4 +- .../DefaultConstructorConstraint02.fs | 4 +- .../DefaultConstructorConstraint03.fs | 4 +- .../DefaultConstructorConstraint04.fs | 4 +- .../DefaultConstructorConstraint05.fs | 4 +- .../CheckingSyntacticTypes/E_ByRef01.fs | 2 +- .../CheckingSyntacticTypes/E_ByRef03.fs | 1 - .../E_CannotInlineVirtualMethods1.fs | 6 +- .../E_ComparisonConstraint01.fs | 2 +- .../E_ConstraintCall1.fs | 2 +- .../E_ConstraintCall2.fs | 2 +- .../E_DelegateConstraint01.fs | 2 +- .../E_EnumConstraint01.fs | 6 +- .../E_EnumConstraint02.fs | 2 +- .../E_EqualityConstraint01.fs | 2 +- .../E_MemberConstraint01.fs | 2 +- .../E_MemberConstraint04.fs | 8 +- .../E_NullnessConstraint01.fs | 2 +- .../E_RefConstraint01.fs | 2 +- .../CheckingSyntacticTypes/E_Regression02.fs | 74 +- .../CheckingSyntacticTypes/E_Regressions01.fs | 2 +- .../E_StructConstraint01.fs | 2 +- .../E_SubtypeConstraint01.fs | 2 +- .../E_UnmanagedConstraint01.fs | 2 +- .../ExplicitMemberConstraints1.fs | 2 +- .../ExplicitMemberConstraints2.fs | 2 +- .../NativePtrArrayElementUsage.fs | 12 +- .../NullnessConstraint01.fs | 2 +- .../CheckingSyntacticTypes/Regressions01.fs | 2 +- .../StructConstraint01.fs | 4 +- .../StructConstraint02.fs | 2 +- .../UnmanagedConstraint01.fs | 2 +- .../W_LessGenericThanAnnotated01.fs | 8 +- .../AllowNullLiteral01.fs | 2 +- .../BaseTypes_Abstract.fs | 2 +- .../BaseTypes_Array.fs | 2 +- .../BaseTypes_Class.fs | 6 +- .../BaseTypes_Delegate.fs | 4 +- .../BaseTypes_DerivedClass.fs | 4 +- .../BaseTypes_DiscriminatedUnion.fs | 2 +- .../BaseTypes_Exception.fs | 2 +- .../BaseTypes_Interface.fs | 4 +- .../BaseTypes_Record.fs | 2 +- .../BaseTypes_Struct.fs | 2 +- .../BaseTypes_Tuple1.fs | 2 +- .../BaseTypes_Variable.fs | 2 +- .../E_AllowNullLiteral01.fs | 2 +- .../E_AllowNullLiteral02.fs | 8 +- .../FSharpType_IsRecord.fs | 8 +- .../GenericTypeDef.fs | 2 +- .../BasicTypeParam01.fs | 2 +- .../E_GenericTypeConstraint.fs | 4 +- .../E_LazyInType02.fs | 2 +- .../HashConstraint01.fs | 4 +- .../HashConstraint02.fs | 2 +- .../MultipleConstraints01.fs | 6 +- .../UnitSpecialization.fs | 2 +- .../ValueTypesWithConstraints01.fs | 4 +- .../E_AreYouMissingAnArgumentToAFunction01.fs | 2 +- ...E_AreYouMissingAnArgumentToAFunction01b.fs | 2 +- .../General/E_AsBindingOnInheritDecl01.fs | 4 +- .../General/E_BaseInObjectExpression01.fs | 4 +- .../tests/Diagnostics/General/E_Big_int01.fs | 2 +- .../E_ConsiderAddingSealedAttribute01.fs | 2 +- .../E_ConsiderAddingSealedAttribute01.fsi | 2 +- .../General/E_ExpressionHasType_FullPath01.fs | 10 +- .../E_FormattingStringBadPrecision01.fs | 2 +- .../E_FormattingStringBadSpecifier01.fs | 4 +- .../E_FormattingStringFlagSetTwice01.fs | 4 +- .../General/E_FormattingStringInvalid01.fs | 4 +- .../General/E_FormattingStringPrecision01.fs | 4 +- .../General/E_FoundInPowerPack_Matrix01.fs | 2 +- .../General/E_IncompleteConstruct01.fs | 2 +- .../General/E_IncompleteConstruct01b.fs | 2 +- .../General/E_IndexedPropertySetter01.fs | 2 +- .../General/E_InvalidObjectExpression01.fs | 4 +- .../E_LiteralEnumerationMustHaveType01.fs | 4 +- .../E_MemberConstraintsWithSpecialStatus01.fs | 4 +- .../General/E_MemberObjectctorTakeGiven.fs | 6 +- .../Diagnostics/General/E_Multiline01.fs | 12 +- .../Diagnostics/General/E_Multiline03.fs | 2 +- .../General/E_NoPoundRDirectiveInFSFile01.fs | 2 +- .../General/E_ObjectConstructorAndTry01.fs | 6 +- .../General/E_ObjectConstructorAndTry02.fs | 6 +- .../General/E_PropertyIsNotReadable01.fs | 2 +- ..._Quotation_UnresolvedGenericConstruct01.fs | 8 +- .../General/E_SpanExtendsToNextToken01.fs | 2 +- .../E_StructMustHaveAtLeastOneField.fs | 2 +- ...TryFinallyIncompleteStructuredConstruct.fs | 2 +- .../General/E_UnexpectedKeywordAs01.fs | 8 +- .../General/E_UnexpectedKeyworkWith01.fs | 2 +- .../General/E_UnexpectedSymbol01.fs | 8 +- .../General/E_matrix_LetBinding01.fs | 2 +- .../Diagnostics/General/E_matrix_class01.fs | 2 +- .../General/E_matrix_interface01.fs | 2 +- .../Diagnostics/General/E_matrix_struct01.fs | 2 +- .../Diagnostics/General/Generic_Subtype01.fs | 2 +- .../General/MutatingImmutable01.fs | 2 +- .../General/MutatingImmutable02.fs | 2 +- .../General/TypecheckSignature01.fs | 6 +- .../General/W_CreateIDisposable.fs | 8 +- .../General/W_FailwithRedundantArgs.fs | 2 +- .../General/W_FailwithfRedundantArgs.fs | 2 +- ..._GenericTypeProvideATypeInstantiation01.fs | 6 +- .../General/W_HashOfSealedType01.fs | 4 +- .../W_InstantiationOfGenericTypeMissing01.fs | 4 +- .../W_InstantiationOfGenericTypeMissing02.fs | 2 +- .../General/W_InvalidArgRedundantArgs.fs | 2 +- .../General/W_InvalidOpRedundantArgs.fs | 2 +- .../General/W_Keyword_tailcall01.fs | 4 +- .../General/W_LowercaseLiteralIgnored.fs | 2 +- .../General/W_LowercaseLiteralNotIgnored.fs | 2 +- .../Diagnostics/General/W_Multiline02.fs | 2 +- .../General/W_NoValueHasBeenCopiedWarning.fs | 6 +- .../General/W_NullArgRedundantArgs.fs | 2 +- ...OverrideImplementationInAugmentation01a.fs | 2 +- ...OverrideImplementationInAugmentation02b.fs | 4 +- ...OverrideImplementationInAugmentation03a.fs | 2 +- ...OverrideImplementationInAugmentation03b.fs | 2 +- .../General/W_RaiseRedundantArgs.fs | 2 +- .../General/W_redefineOperator01.fs | 2 +- .../General/W_redefineOperator02.fs | 2 +- .../General/W_redefineOperator03.fs | 2 +- .../General/W_redefineOperator04.fs | 2 +- .../General/W_redefineOperator05.fs | 2 +- .../General/W_redefineOperator06.fs | 2 +- .../General/W_redefineOperator08.fs | 2 +- .../General/W_redefineOperator10.fs | 2 +- .../NONTERM/attrUnionCaseDecl01.fs | 10 +- .../NONTERM/attrUnionCaseDecl01b.fs | 10 +- .../tests/Diagnostics/NONTERM/braceExpr01.fs | 2 +- .../tests/Diagnostics/NONTERM/braceExpr01b.fs | 2 +- .../Diagnostics/NONTERM/fileModuleImpl01.fs | 4 +- .../Diagnostics/NONTERM/fileModuleImpl01b.fs | 4 +- .../Diagnostics/NONTERM/fileModuleImpl03.fs | 2 +- .../Diagnostics/NONTERM/fileModuleImpl03b.fs | 2 +- .../Diagnostics/NONTERM/fileModuleImpl04.fs | 2 +- ...nteractiveExprOrDefinitionsTerminator01.fs | 2 +- ...teractiveExprOrDefinitionsTerminator01b.fs | 2 +- ...nteractiveExprOrDefinitionsTerminator02.fs | 2 +- ...teractiveExprOrDefinitionsTerminator02b.fs | 2 +- ...nteractiveExprOrDefinitionsTerminator05.fs | 2 +- ...teractiveExprOrDefinitionsTerminator05b.fs | 2 +- ...nteractiveExprOrDefinitionsTerminator06.fs | 2 +- ...teractiveExprOrDefinitionsTerminator06b.fs | 2 +- .../NONTERM/memberDefinitionWithoutType01.fs | 2 +- .../NONTERM/memberDefinitionWithoutType01b.fs | 2 +- .../NONTERM/monadicExprNonEmptyInitial01.fs | 6 +- .../NONTERM/monadicExprNonEmptyInitial01b.fs | 6 +- .../NONTERM/monadicPatternClauses01.fs | 12 +- .../NONTERM/monadicPatternClauses01b.fs | 12 +- .../tests/Diagnostics/NONTERM/quoteExpr01.fs | 2 +- .../tests/Diagnostics/NONTERM/quoteExpr01b.fs | 2 +- .../Diagnostics/NONTERM/tuplewithlazy01.fs | 2 +- .../Diagnostics/NONTERM/tuplewithlazy01b.fs | 2 +- .../tests/Diagnostics/NONTERM/typ01.fs | 2 +- .../tests/Diagnostics/NONTERM/typ01b.fs | 2 +- .../Diagnostics/NONTERM/typeConstraint01.fs | 4 +- .../Diagnostics/NONTERM/typeConstraint01b.fs | 4 +- .../NONTERM/typedSeqExprBlock01.fs | 2 +- .../NONTERM/typedSeqExprBlock01b.fs | 2 +- .../NONTERM/typedSeqExprBlock02.fs | 2 +- .../NONTERM/typedSeqExprBlock02b.fs | 2 +- .../Diagnostics/ParsingAtEOF/for_in01.fs | 4 +- .../ParsingAtEOF/for_in_range01.fs | 2 +- .../tests/Diagnostics/ParsingAtEOF/if01.fs | 2 +- .../tests/Diagnostics/ParsingAtEOF/match01.fs | 2 +- .../tests/Diagnostics/ParsingAtEOF/try01.fs | 2 +- .../ParsingAtEOF/type_id_equal_curly01.fs | 2 +- .../Diagnostics/ParsingAtEOF/while_cond01.fs | 4 +- .../Diagnostics/async/LetBangNonAsync.fs | 2 +- .../Diagnostics/async/MissingBangForLoop01.fs | 6 +- .../Diagnostics/async/MissingBangForLoop02.fs | 4 +- .../tests/Diagnostics/async/MissingIgnore.fs | 2 +- .../async/MissingReturnBangForLoop01.fs | 2 +- .../async/MissingReturnBangForLoop02.fs | 2 +- .../async/MissingReturnBangForLoop03.fs | 4 +- .../async/MissingReturnBangForLoop04.fs | 4 +- .../Diagnostics/async/ReturnBangNonAsync01.fs | 2 +- .../Diagnostics/async/ReturnBangNonAsync02.fs | 4 +- .../async/ReturnBangNonAsync_For.fs | 4 +- .../async/ReturnBangNonAsync_IfThenElse.fs | 4 +- .../async/ReturnBangNonAsync_TryFinally.fs | 4 +- .../async/ReturnBangNonAsync_TryWith.fs | 6 +- .../async/ReturnBangNonAsync_While.fs | 6 +- .../async/UseBindingWrongForm01.fs | 10 +- .../async/UsingReturnInAWhileLoop.fs | 4 +- .../async/UsingReturnInIfThenElse.fs | 4 +- .../InteractiveSession/Misc/Array2D01.fs | 6 +- .../Misc/BailAfterFirstError01.fs | 2 +- .../Misc/CommandLineArgs01.fs | 2 +- .../Misc/CommandLineArgs01b.fs | 6 +- .../Misc/CommandLineArgs02.fs | 2 +- .../Misc/DefinesCompiled.fs | 6 +- .../Misc/DefinesInteractive.fs | 6 +- .../InteractiveSession/Misc/DoWithNotUnit.fs | 2 +- .../Misc/E_ErrorRanges01.fs | 2 +- .../Misc/NativeIntSuffix01.fs | 2 +- .../Misc/PipingWithDirectives.fs | 6 +- .../InteractiveSession/Misc/Regressions02.fs | 10 +- .../Misc/UNativeIntSuffix01.fs | 2 +- .../stackalloc/negativesize01.fs | 4 +- .../tests/Misc/ConstraintSolverRecursion01.fs | 16 +- .../resources/tests/Misc/E_CompiledName.fs | 16 +- .../tests/Misc/E_productioncoverage01.fs | 8 +- .../tests/Misc/E_productioncoverage02.fs | 6 +- .../tests/Misc/E_productioncoverage03.fs | 14 +- .../tests/Misc/E_productioncoverage04.fs | 6 +- .../tests/Misc/FileWithSameNameDiffExt.fs | 2 +- .../resources/tests/Misc/Parsing01.fs | 2 +- .../resources/tests/Misc/Parsing02.fs | 2 +- .../UseStatementCallDisposeOnNullValue01.fs | 2 +- .../resources/tests/Misc/UserCodeSnippet01.fs | 2 +- .../tests/Misc/productioncoverage01.fs | 60 +- .../CompletionTests.fs | 2 +- .../DependencyManagerInteractiveTests.fs | 2 +- .../DependencyManagerLineParserTests.fs | 14 +- .../AssemblyContentProviderTests.fs | 22 +- .../BuildGraphTests.fs | 62 +- .../CSharpProjectAnalysis.fs | 2 +- .../FSharp.Compiler.Service.Tests/Checker.fs | 2 +- .../CompletionTests.fs | 4 +- .../ConsoleOnlyOptionsTests.fs | 2 +- .../EditorTests.fs | 34 +- .../FSharp.Compiler.Service.Tests/FsiTests.fs | 2 +- .../InteractiveCheckerTests.fs | 6 +- .../ManglingNameOfProvidedTypes.fs | 50 +- .../ModuleReaderCancellationTests.fs | 2 +- .../MultiProjectAnalysisTests.fs | 20 +- .../OverloadCacheTests.fs | 12 +- .../ParserTests.fs | 4 +- .../ProductVersion.fs | 20 +- .../ProjectAnalysisTests.fs | 8 +- .../QuickParseTests.fs | 22 +- .../RangeTests.fs | 4 +- .../ServiceUntypedParseTests.fs | 28 +- .../SourceTextTests.fs | 4 +- .../StructureTests.fs | 14 +- .../SuggestionBuffer.fs | 16 +- .../FSharp.Compiler.Service.Tests/Symbols.fs | 30 +- .../TokenizerTests.fs | 54 +- .../Tooltip/TooltipTests.Types.fs | 2 +- .../TooltipTests.fs | 36 +- .../VisualStudioVersusConsoleContextTests.fs | 14 +- .../WarnScopeTests.fs | 8 +- .../FSharp.Core/ComparersRegression.fs | 162 +- .../FSharp.Core/DiscriminatedUnionType.fs | 60 +- .../Array2Module.fs | 442 +- .../Array3Module.fs | 322 +- .../Array4Module.fs | 354 +- .../ArrayModule.fs | 916 +- .../ArrayModule2.fs | 920 +- .../ArrayProperties.fs | 4 +- .../CollectionModulesConsistency.fs | 76 +- .../ComparisonIdentityModule.fs | 24 +- .../HashIdentityModule.fs | 20 +- .../ListModule.fs | 514 +- .../ListModule2.fs | 712 +- .../ListProperties.fs | 122 +- .../Microsoft.FSharp.Collections/ListType.fs | 106 +- .../Microsoft.FSharp.Collections/MapModule.fs | 460 +- .../Microsoft.FSharp.Collections/MapType.fs | 220 +- .../ObsoleteListFunctions.fs | 6 +- .../ObsoleteSeqFunctions.fs | 4 +- .../Microsoft.FSharp.Collections/SeqModule.fs | 618 +- .../SeqModule2.fs | 876 +- .../SeqProperties.fs | 6 +- .../Microsoft.FSharp.Collections/SetModule.fs | 249 +- .../Microsoft.FSharp.Collections/SetType.fs | 194 +- .../StringModule.fs | 46 +- .../Microsoft.FSharp.Collections/Utils.fs | 6 +- .../Microsoft.FSharp.Control/AsyncModule.fs | 114 +- .../AsyncModuleFunctions.fs | 10 +- .../Microsoft.FSharp.Control/AsyncType.fs | 24 +- .../Microsoft.FSharp.Control/Cancellation.fs | 88 +- ...tinuationsThreadingDetailsStandaloneExe.fs | 32 +- .../Microsoft.FSharp.Control/EventModule.fs | 153 +- .../Microsoft.FSharp.Control/EventTypes.fs | 22 +- .../Microsoft.FSharp.Control/LazyType.fs | 72 +- .../MailboxProcessorType.fs | 62 +- .../NestedTaskFailures.fs | 4 +- .../ObservableModule.fs | 160 +- .../TaskModuleFunctions.fs | 22 +- .../Microsoft.FSharp.Control/Tasks.fs | 184 +- .../Microsoft.FSharp.Control/TasksDynamic.fs | 146 +- .../Microsoft.FSharp.Core/BigIntType.fs | 174 +- .../IntConversionsGenerated.fs | 382 +- .../Microsoft.FSharp.Core/OptionModule.fs | 22 +- .../Microsoft.FSharp.Core/PrintfTests.fs | 52 +- .../Microsoft.FSharp.Core/ResultTests.fs | 38 +- .../NullableOperators.fs | 2 +- .../Microsoft.FSharp.Linq/QueryTests.fs | 234 +- .../FSharpQuotations.fs | 40 +- .../FSharpReflection.fs | 812 +- .../FSharp.Core/OperatorsModule1.fs | 200 +- .../FSharp.Core/OperatorsModule2.fs | 351 +- .../FSharp.Core/OperatorsModuleChecked.fs | 74 +- .../FSharp.Core/OperatorsModuleDynamic.fs | 278 +- .../FSharp.Core/PrimTypes.fs | 270 +- .../FSharp.Core/RecordTypes.fs | 48 +- .../FSharp.Core/XmlDocumentationValidation.fs | 18 +- tests/FSharp.Core.UnitTests/LibraryTestFx.fs | 2 +- .../TestFrameworkHelpers.fs | 18 +- tests/FSharp.Test.Utilities/Assert.fs | 10 +- tests/FSharp.Test.Utilities/Compiler.fs | 14 +- tests/FSharp.Test.Utilities/CompilerAssert.fs | 30 +- .../DirectoryAttribute.fs | 6 +- .../FileInlineDataAttribute.fs | 4 +- tests/FSharp.Test.Utilities/ILChecker.fs | 2 +- .../FSharp.Test.Utilities/ILVerifierModule.fs | 4 +- .../ProjectGeneration.fs | 2 +- tests/FSharp.Test.Utilities/TestConsole.fs | 6 +- tests/FSharp.Test.Utilities/TestFramework.fs | 6 +- tests/FSharp.Test.Utilities/Utilities.fs | 18 +- .../VSInstallDiscovery.fs | 24 +- tests/FSharp.Test.Utilities/XunitSetup.fs | 4 +- .../CompiledCodeBenchmarks/MicroPerf/Async.fs | 2 +- .../MicroPerf/Collections.fs | 86 +- .../MicroPerf/Conditions.fs | 2 +- .../MicroPerf/Equality/BasicTypes.fs | 2 +- .../MicroPerf/Equality/ExactEquals.fs | 6 +- .../MicroPerf/Equality/Misc.fs | 26 +- .../MicroPerf/Equality/OptionsAndCo.fs | 16 +- .../MicroPerf/Equality/ValueTypes.fs | 6 +- .../BenchmarkComparison/Helpers.fs | 4 +- .../HistoricalBenchmark.Runner/Runner.fs | 96 +- .../BenchmarkComparison/SingleFileCompiler.fs | 2 +- .../CompilerServiceBenchmarks.fs | 22 +- .../FileCascadeBenchmarks.fs | 42 +- .../CompilerServiceBenchmarks/SourceText.fs | 6 +- .../ce/CE1xnest15.fs | 22 +- .../ce/CEwCO500xnest1.fs | 2 +- .../FCSBenchmarks/FCSSourceFiles/Program.fs | 8 +- .../decentlySizedStandAloneFile.fs | 120 +- .../CodeGen/EmittedIL/BooleanLogic.fs | 2 +- .../CodeGen/EmittedIL/DeterministicTests.fs | 54 +- .../EmittedIL/ReferenceAssemblyTests.fs | 12 +- .../CodeGen/EmittedIL/StaticLinkTests.fs | 4 +- .../CodeGen/EmittedIL/TaskGeneratedCode.fs | 20 +- .../BasicGrammarElements/BasicConstants.fs | 40 +- .../BasicGrammarElements/DecimalConstants.fs | 18 +- .../BasicGrammarElements/IntegerConstants.fs | 14 +- .../DataExpressions/ComputationExpressions.fs | 4 +- .../Compiler/Language/AnonRecordTests.fs | 2 +- .../Language/ComparisonOptimizationTest.fs | 42 +- .../Language/CustomCollectionTests.fs | 4 +- .../Compiler/Language/FixedIndexSliceTests.fs | 4 +- .../Compiler/Language/HatDesugaringTests.fs | 4 +- .../Language/OpenTypeDeclarationTests.fs | 2 +- .../Language/StringConcatOptimizationTests.fs | 6 +- .../Compiler/Language/StringInterpolation.fs | 8 +- .../Language/StructActivePatternTests.fs | 6 +- .../Compiler/Language/TypeAttributeTests.fs | 8 +- .../Language/TypeDirectedConversionTests.fs | 22 +- .../fsharp/Compiler/Language/WitnessTests.fs | 2 +- .../Core/Collections/IEnumerableTests.fs | 12 +- .../Libraries/Core/Collections/ListTests.fs | 6 +- .../Libraries/Core/Collections/MapTests.fs | 2 +- .../LanguagePrimitives/CastToUnitsTests.fs | 2 +- .../Core/NativeInterop/StackallocTests.fs | 26 +- .../Libraries/Core/Operators/AbsTests.fs | 8 +- .../Libraries/Core/Operators/HashTests.fs | 2 +- .../Libraries/Core/Operators/PowTests.fs | 4 +- .../Libraries/Core/Operators/RoundTests.fs | 12 +- .../Libraries/Core/Operators/SignTests.fs | 2 +- .../Libraries/Core/Operators/StringTests.fs | 10 +- .../PreComputedTupleConstructorTests.fs | 2 +- .../Core/Unchecked/DefaultOfTests.fs | 12 +- .../ForInDoMutableRegressionTest.fs | 2 +- .../Regressions/IndexerRegressionTests.fs | 2 +- .../Compiler/Service/MultiProjectTests.fs | 26 +- .../Service/SignatureGenerationTests.fs | 12 +- tests/fsharp/HandleExpects.fs | 6 +- tests/fsharp/TypeProviderTests.fs | 12 +- tests/fsharp/core/anon/lib.fs | 90 +- tests/fsharp/core/attributes/testlib.fs | 34 +- tests/fsharp/core/attributes/testlib.fsi | 36 +- tests/fsharp/core/events/test.fs | 246 +- tests/fsharp/core/forwarders/c.fs | 2 +- tests/fsharp/core/forwarders/test.fs | 2 +- tests/fsharp/core/fsfromcs/lib.fs | 30 +- tests/fsharp/core/fsfromfsviacs/lib.fs | 22 +- .../fsi-reference/ImplementationAssembly.fs | 2 +- .../core/fsi-reference/ReferenceAssembly.fs | 2 +- tests/fsharp/core/fsi-shadowcopy/Library1.fs | 2 +- .../conditionals/LargeConditionals-200.fs | 404 +- .../LargeConditionals-maxtested.fs | 832 +- tests/fsharp/core/large/lets/LargeLets-500.fs | 1002 +- .../core/large/lets/LargeLets-maxtested.fs | 1574 +- .../fsharp/core/large/lists/LargeList-500.fs | 1002 +- .../core/large/matches/LargeMatches-200.fs | 602 +- .../large/matches/LargeMatches-maxtested.fs | 914 +- .../large/mixed/LargeSequentialLet-500.fs | 1004 +- .../mixed/LargeSequentialLet-maxtested.fs | 1004 +- .../large/sequential/LargeSequential-500.fs | 1002 +- .../sequential/LargeSequential-maxtested.fs | 13414 ++++++++-------- tests/fsharp/core/letrec-mutrec/test.fs | 112 +- tests/fsharp/core/letrec-mutrec2/test.fs | 164 +- tests/fsharp/core/load-script/FlagCheck.fs | 4 +- tests/fsharp/core/load-script/ProjectFile.fs | 4 +- tests/fsharp/core/members/absil.fs | 20 +- .../core/members/basics-hw-mutrec/test.fs | 16 +- tests/fsharp/core/members/basics/test.fs | 878 +- tests/fsharp/core/members/basics/test.fsi | 36 +- tests/fsharp/core/members/console/console2.fs | 34 +- .../core/members/factors-mutrec/test.fs | 68 +- tests/fsharp/core/members/ops-mutrec/test.fs | 138 +- tests/fsharp/core/namespaces/test.fs | 58 +- tests/fsharp/core/namespaces/test.fsi | 24 +- tests/fsharp/core/namespaces/test2.fs | 10 +- tests/fsharp/core/namespaces/test2.fsi | 4 +- tests/fsharp/core/reflect/test.fs | 2 +- tests/fsharp/core/reflect/test2.fs | 78 +- .../refnormalization/AscendentAssembly.fs | 2 +- tests/fsharp/core/refnormalization/test.fs | 2 +- tests/fsharp/core/topinit/lib69514.fs | 8 +- tests/fsharp/core/topinit/lib69514.fsi | 6 +- .../core/topinit/lib_deterministic_init16.fs | 2 +- tests/fsharp/core/topinit/static-main.fs | 2 +- tests/fsharp/core/topinit/test0.fs | 56 +- tests/fsharp/core/topinit/test1.fs | 14 +- tests/fsharp/core/topinit/test2.fs | 20 +- tests/fsharp/core/topinit/test3.fs | 16 +- tests/fsharp/core/topinit/test4.fs | 18 +- tests/fsharp/core/topinit/test5.fs | 18 +- tests/fsharp/core/topinit/test6.fs | 22 +- .../core/topinit/test_deterministic_init.fs | 2 +- .../kanji-unicode-utf7-codepage-65000.fs | 1 - ...kanji-unicode-utf8-nosig-codepage-65001.fs | 2 +- ...nji-unicode-utf8-withsig-codepage-65001.fs | 2 +- tests/fsharp/core/unitsOfMeasure/test.fs | 88 +- tests/fsharp/core/verify/xmlverify.fs | 6 +- tests/fsharp/optimize/analyses/effects.fs | 72 +- tests/fsharp/optimize/analyses/sizes.fs | 10 +- tests/fsharp/optimize/analyses/tailcalls.fs | 100 +- tests/fsharp/optimize/inline/lib.fs | 10 +- tests/fsharp/optimize/inline/lib2.fs | 6 +- tests/fsharp/optimize/inline/lib3.fs | 2 +- tests/fsharp/optimize/inline/test.fs | 4 +- tests/fsharp/regression/12383/test.fs | 2256 +-- tests/fsharp/regression/4715/main.fs | 4 +- tests/fsharp/regression/5531/test.fs | 6 +- .../regression/literal-value-bug-1/test.fs | 2 +- .../regression/struct-measure-bug-1/test.fs | 4 +- tests/fsharp/single-test.fs | 2 +- tests/fsharp/tests.fs | 116 +- .../typeProviders/helloWorld/TypeMagic.fs | 300 +- .../typeProviders/helloWorld/provided.fs | 84 +- .../typeProviders/helloWorld/providedJ.fs | 4 +- .../typeProviders/helloWorld/providedK.fs | 2 +- .../typeProviders/helloWorldCSharp/magic.fs | 288 +- .../fsharp/typeProviders/negTests/TypeEvil.fs | 352 +- .../splitAssemblyTools/provider.fs | 4 +- .../splitAssemblyTypeproviders/provider.fs | 4 +- .../wedgeAssembly/test2a-restricted.fsi | 28 +- .../typeProviders/wedgeAssembly/test2a.fs | 20 +- .../typeProviders/wedgeAssembly/test2a.fsi | 28 +- .../wedgeAssembly/test2b-restricted.fsi | 28 +- .../typeProviders/wedgeAssembly/test2b.fs | 20 +- .../typeProviders/wedgeAssembly/test2b.fsi | 28 +- .../constructors/neg_invalid_constructor.fs | 6 +- tests/fsharp/typecheck/sigs/neg01a.fs | 6 +- tests/fsharp/typecheck/sigs/neg01a.fsi | 2 +- tests/fsharp/typecheck/sigs/neg02.fs | 6 +- tests/fsharp/typecheck/sigs/neg04.fs | 64 +- tests/fsharp/typecheck/sigs/neg05.fs | 20 +- tests/fsharp/typecheck/sigs/neg06.fs | 136 +- tests/fsharp/typecheck/sigs/neg06_a.fs | 6 +- tests/fsharp/typecheck/sigs/neg06_b.fs | 4 +- tests/fsharp/typecheck/sigs/neg07.fs | 32 +- tests/fsharp/typecheck/sigs/neg08.fs | 16 +- tests/fsharp/typecheck/sigs/neg09.fs | 8 +- tests/fsharp/typecheck/sigs/neg10.fs | 68 +- tests/fsharp/typecheck/sigs/neg10.fsi | 2 +- tests/fsharp/typecheck/sigs/neg100.fs | 2 +- tests/fsharp/typecheck/sigs/neg100.fsi | 2 +- tests/fsharp/typecheck/sigs/neg101.fs | 8 +- tests/fsharp/typecheck/sigs/neg102.fs | 2 +- tests/fsharp/typecheck/sigs/neg104.fs | 2 +- tests/fsharp/typecheck/sigs/neg106.fs | 102 +- tests/fsharp/typecheck/sigs/neg11.fs | 2 +- tests/fsharp/typecheck/sigs/neg111.fs | 2 +- tests/fsharp/typecheck/sigs/neg112.fs | 6 +- tests/fsharp/typecheck/sigs/neg113.fs | 2 +- tests/fsharp/typecheck/sigs/neg115.fs | 3 +- tests/fsharp/typecheck/sigs/neg118.fs | 2 +- tests/fsharp/typecheck/sigs/neg119a.fs | 4 +- tests/fsharp/typecheck/sigs/neg119b.fs | 4 +- tests/fsharp/typecheck/sigs/neg12.fs | 8 +- tests/fsharp/typecheck/sigs/neg120.fs | 4 +- tests/fsharp/typecheck/sigs/neg121.fs | 4 +- tests/fsharp/typecheck/sigs/neg122.fs | 4 +- tests/fsharp/typecheck/sigs/neg124.fs | 3 +- tests/fsharp/typecheck/sigs/neg125.fs | 6 +- tests/fsharp/typecheck/sigs/neg126.fs | 10 +- tests/fsharp/typecheck/sigs/neg127.fs | 10 +- tests/fsharp/typecheck/sigs/neg128.fs | 4 +- tests/fsharp/typecheck/sigs/neg129.fs | 6 +- tests/fsharp/typecheck/sigs/neg13.fs | 16 +- tests/fsharp/typecheck/sigs/neg130.fs | 12 +- tests/fsharp/typecheck/sigs/neg131.fs | 4 +- tests/fsharp/typecheck/sigs/neg132.fs | 4 +- tests/fsharp/typecheck/sigs/neg133.fs | 8 +- tests/fsharp/typecheck/sigs/neg14a.fs | 4 +- tests/fsharp/typecheck/sigs/neg15.fs | 56 +- tests/fsharp/typecheck/sigs/neg16.fs | 32 +- tests/fsharp/typecheck/sigs/neg17.fs | 72 +- tests/fsharp/typecheck/sigs/neg17.fsi | 24 +- tests/fsharp/typecheck/sigs/neg17b.fs | 5 +- tests/fsharp/typecheck/sigs/neg18.fs | 163 +- tests/fsharp/typecheck/sigs/neg19.fs | 8 +- tests/fsharp/typecheck/sigs/neg20.fs | 126 +- tests/fsharp/typecheck/sigs/neg23.fs | 86 +- tests/fsharp/typecheck/sigs/neg24.fs | 228 +- tests/fsharp/typecheck/sigs/neg25.fs | 46 +- tests/fsharp/typecheck/sigs/neg26.fs | 24 +- tests/fsharp/typecheck/sigs/neg29.fs | 2 +- tests/fsharp/typecheck/sigs/neg30.fs | 8 +- tests/fsharp/typecheck/sigs/neg31.fs | 33 +- tests/fsharp/typecheck/sigs/neg31.fsi | 32 +- tests/fsharp/typecheck/sigs/neg32.fs | 32 +- tests/fsharp/typecheck/sigs/neg35.fs | 2 +- tests/fsharp/typecheck/sigs/neg36.fs | 14 +- tests/fsharp/typecheck/sigs/neg37.fs | 36 +- tests/fsharp/typecheck/sigs/neg37_a.fs | 2 +- tests/fsharp/typecheck/sigs/neg39.fs | 2 +- tests/fsharp/typecheck/sigs/neg40.fs | 2 +- tests/fsharp/typecheck/sigs/neg41.fs | 2 +- tests/fsharp/typecheck/sigs/neg42.fs | 4 +- tests/fsharp/typecheck/sigs/neg42.fsi | 2 +- tests/fsharp/typecheck/sigs/neg43.fs | 4 +- tests/fsharp/typecheck/sigs/neg44.fs | 4 +- tests/fsharp/typecheck/sigs/neg45.fs | 53 +- tests/fsharp/typecheck/sigs/neg46.fs | 14 +- tests/fsharp/typecheck/sigs/neg47.fs | 14 +- tests/fsharp/typecheck/sigs/neg48.fs | 72 +- tests/fsharp/typecheck/sigs/neg49.fs | 2 +- tests/fsharp/typecheck/sigs/neg50.fs | 8 +- tests/fsharp/typecheck/sigs/neg52.fs | 2 +- tests/fsharp/typecheck/sigs/neg53.fs | 4 +- tests/fsharp/typecheck/sigs/neg54.fs | 4 +- tests/fsharp/typecheck/sigs/neg55.fs | 14 +- tests/fsharp/typecheck/sigs/neg56.fs | 12 +- tests/fsharp/typecheck/sigs/neg56_a.fs | 14 +- tests/fsharp/typecheck/sigs/neg56_b.fs | 18 +- tests/fsharp/typecheck/sigs/neg57.fs | 2 +- tests/fsharp/typecheck/sigs/neg58.fs | 4 +- tests/fsharp/typecheck/sigs/neg58.fsi | 4 +- tests/fsharp/typecheck/sigs/neg59.fs | 122 +- tests/fsharp/typecheck/sigs/neg60.fs | 70 +- tests/fsharp/typecheck/sigs/neg61.fs | 120 +- tests/fsharp/typecheck/sigs/neg62.fs | 36 +- tests/fsharp/typecheck/sigs/neg63.fs | 12 +- tests/fsharp/typecheck/sigs/neg88.fs | 4 +- tests/fsharp/typecheck/sigs/neg90.fs | 2 +- tests/fsharp/typecheck/sigs/neg91.fs | 52 +- tests/fsharp/typecheck/sigs/neg92.fs | 6 +- tests/fsharp/typecheck/sigs/neg93.fs | 6 +- tests/fsharp/typecheck/sigs/neg94-pre.fs | 4 +- tests/fsharp/typecheck/sigs/neg94.fs | 8 +- tests/fsharp/typecheck/sigs/neg95.fs | 14 +- tests/fsharp/typecheck/sigs/neg96.fs | 4 +- tests/fsharp/typecheck/sigs/neg97.fs | 8 +- tests/fsharp/typecheck/sigs/neg99.fs | 10 +- tests/fsharp/typecheck/sigs/neg_anon_1.fs | 2 +- tests/fsharp/typecheck/sigs/neg_byref_0.fs | 2 +- tests/fsharp/typecheck/sigs/neg_byref_4.fs | 2 +- tests/fsharp/typecheck/sigs/pos03.fs | 2 +- tests/fsharp/typecheck/sigs/pos03a.fs | 2 +- tests/fsharp/typecheck/sigs/pos05.fs | 6 +- tests/fsharp/typecheck/sigs/pos06.fs | 4 +- tests/fsharp/typecheck/sigs/pos07.fs | 6 +- tests/fsharp/typecheck/sigs/pos08.fs | 188 +- tests/fsharp/typecheck/sigs/pos09.fs | 2 +- tests/fsharp/typecheck/sigs/pos1281.fs | 2 +- tests/fsharp/typecheck/sigs/pos15.fs | 6 +- tests/fsharp/typecheck/sigs/pos16.fs | 8 +- tests/fsharp/typecheck/sigs/pos17.fs | 80 +- tests/fsharp/typecheck/sigs/pos18.fs | 10 +- tests/fsharp/typecheck/sigs/pos19.fs | 60 +- tests/fsharp/typecheck/sigs/pos20.fs | 4 +- tests/fsharp/typecheck/sigs/pos21.fs | 2 +- tests/fsharp/typecheck/sigs/pos23.fs | 4 +- tests/fsharp/typecheck/sigs/pos24.fs | 2 +- tests/fsharp/typecheck/sigs/pos27.fs | 6 +- tests/fsharp/typecheck/sigs/pos28.fs | 7 +- tests/fsharp/typecheck/sigs/pos29.fsi | 2 +- tests/fsharp/typecheck/sigs/pos30.fs | 33 +- tests/fsharp/typecheck/sigs/pos31.fs | 10 +- tests/fsharp/typecheck/sigs/pos32.fs | 4 +- tests/fsharp/typecheck/sigs/pos33.fsi | 2 +- tests/fsharp/typecheck/sigs/pos34.fs | 4 +- tests/fsharp/typecheck/sigs/pos35.fs | 40 +- tests/fsharp/typecheck/sigs/pos36-srtp-lib.fs | 4 +- tests/fsharp/typecheck/sigs/pos37.fs | 74 +- tests/fsharp/typecheck/sigs/pos38.fs | 2 +- tests/fsharp/typecheck/sigs/pos39.fs | 12 +- tests/fsharp/typecheck/sigs/pos40.fs | 30 +- .../CompilerCompatApp/Program.fs | 14 +- .../CompilerCompatLib/Library.fs | 8 +- tests/scripts/array-perf/array-perf.fs | 90 +- ...ConditionalDirectiveAroundInlineKeyword.fs | 2 +- .../Expression/AnonRecd - Quotation 02.fs | 2 +- .../Expression/InheritRecord - Field 1.fs | 2 +- .../data/SyntaxTree/Expression/Return 07.fs | 2 +- .../SynExprAnonRecdWithStructKeyword.fs | 2 +- ...tOrUseDoesNotContainTheRangeOfInKeyword.fs | 2 +- .../SyntaxTree/Expression/Try - Finally 02.fs | 2 +- .../Expression/Try with - Missing expr 02.fs | 2 +- .../Expression/Try with - Missing expr 03.fs | 2 +- .../Expression/Try with - Missing expr 04.fs | 2 +- .../Expression/Try with - Missing expr 05.fs | 2 +- .../data/SyntaxTree/Expression/Try with 01.fs | 2 +- .../Expression/Unfinished escaped ident 01.fs | 26 +- .../data/SyntaxTree/Expression/Yield 06.fs | 2 +- .../ComplexArgumentsLambdaHasArrowRange.fs | 8 +- .../SyntaxTree/MatchClause/Missing expr 01.fs | 2 +- .../SyntaxTree/MatchClause/Missing pat 01.fs | 2 +- .../SyntaxTree/MatchClause/Missing pat 02.fs | 2 +- .../SyntaxTree/MatchClause/Missing pat 03.fs | 2 +- .../data/SyntaxTree/Measure/Constant - 07.fs | 2 +- .../data/SyntaxTree/Measure/Constant - 08.fs | 2 +- .../data/SyntaxTree/Measure/Constant - 09.fs | 2 +- .../data/SyntaxTree/Measure/Constant - 10.fs | 2 +- .../Member/GetSetMemberWithInlineKeyword.fs | 2 +- .../SynTypeDefnWithStaticMemberWithGetset.fs | 2 +- ...FileShouldEndAtTheLastSynModuleSigDecl.fsi | 2 +- .../RegressionAnnotatedInlinePatternMatch.fs | 2 +- .../Nullness/RegressionChoiceType.fs | 4 +- .../SyntaxTree/Nullness/RegressionListType.fs | 4 +- .../Nullness/RegressionOptionType.fs | 2 +- .../Nullness/RegressionResultType.fs | 4 +- .../OperatorNameInValConstraint.fsi | 4 +- .../service/data/SyntaxTree/Pattern/And 01.fs | 2 +- .../service/data/SyntaxTree/Pattern/And 02.fs | 2 +- .../service/data/SyntaxTree/Pattern/And 03.fs | 2 +- .../service/data/SyntaxTree/Pattern/And 04.fs | 2 +- .../SyntaxTree/Pattern/Tuple - Recover 01.fs | 2 +- .../Pattern/Typed - Missing type 06.fs | 2 +- ...thUnionContainsTheRangeOfTheEqualsSign.fsi | 2 +- ...nTypeConstraintWhereTyparSupportsMember.fs | 2 +- .../SyntaxTree/SynType/Typed LetBang 07.fs | 4 +- .../SyntaxTree/SynType/Typed LetBang 08.fs | 2 +- .../SyntaxTree/SynType/Typed LetBang 09.fs | 2 +- .../SyntaxTree/SynType/Typed LetBang 11.fs | 2 +- .../SyntaxTree/SynType/Typed LetBang 12.fs | 2 +- .../SyntaxTree/SynType/Typed LetBang 13.fs | 2 +- .../SynType/Typed LetBang AndBang 15.fs | 2 +- .../SynType/Typed LetBang AndBang 16.fs | 2 +- .../SynType/Typed LetBang AndBang 17.fs | 2 +- .../Type/Exception Inside Type 01.fs | 2 +- .../SyntaxTree/Type/Inline IL With Type 01.fs | 2 +- .../Type/Module After Do Binding 01.fs | 2 +- .../Type/Module After Inherit 01.fs | 4 +- .../Type/Module After Members 01.fs | 4 +- .../Type/Module After Static Members 01.fs | 4 +- ...d Exception Interleaved With Members 01.fs | 2 +- .../Module And Type After Do Binding 01.fs | 10 +- .../Type/Module And Type Inside Type 01.fs | 4 +- .../Type/Module At Module Level 01.fs | 4 +- .../Type/Module At Type Column 01.fs | 2 +- .../Type/Module Between Constructors 01.fs | 6 +- .../Type/Module Inside Nested Type 01.fs | 2 +- .../Type/Module Inside Struct 01.fs | 2 +- ...Module Inside Type With Augmentation 01.fs | 2 +- .../Type/Module Less Indented 01.fs | 4 +- .../Type/Module Same Indentation 01.fs | 10 +- .../Module With Semicolon Delimiter 01.fs | 4 +- .../Type/Nested Module Hierarchy 01.fs | 2 +- .../SyntaxTree/Type/Open Inside Type 01.fs | 2 +- ...ithUnionContainsTheRangeOfTheEqualsSign.fs | 2 +- .../Type/SynTypeFunHasRangeOfArrow.fs | 2 +- tests/service/data/SyntaxTree/Type/Type 10.fs | 2 +- .../SyntaxTree/Type/Type Inside Type 01.fs | 4 +- .../SyntaxTree/UnionCase/Missing name 06.fs | 2 +- .../SyntaxTree/UnionCase/Missing name 07.fs | 2 +- .../SyntaxTree/UnionCase/Missing name 08.fs | 2 +- .../service/data/TestProject/AssemblyInfo.fs | 14 +- tests/service/data/TestProject/TestProject.fs | 4 +- .../service/data/TestProject2/AssemblyInfo.fs | 14 +- .../service/data/TestProject2/TestProject2.fs | 2 +- tests/service/data/TestTP/ProvidedTypes.fs | 5502 +++---- tests/service/data/TestTP/ProvidedTypes.fsi | 27 +- tests/service/data/TestTP/TestTP.fs | 20 +- .../LibraryProject/Template/Library1.fs | 2 +- .../DummyProviderForLanguageServiceTesting.fs | 152 +- .../ProvidedTypes.fs | 4518 +++--- .../ProvidedTypes.fsi | 20 +- .../Salsa/FSharpLanguageServiceTestable.fs | 108 +- vsintegration/tests/Salsa/SalsaUtils.fs | 180 +- vsintegration/tests/Salsa/SalsaUtils.fsi | 32 +- vsintegration/tests/Salsa/VsMocks.fs | 440 +- vsintegration/tests/Salsa/salsa.fs | 706 +- .../Tests.LanguageService.Completion.fs | 372 +- .../Tests.LanguageService.ErrorList.fs | 56 +- .../Tests.LanguageService.ErrorRecovery.fs | 10 +- .../Tests.LanguageService.General.fs | 50 +- .../Tests.LanguageService.GotoDefinition.fs | 70 +- .../Tests.LanguageService.NavigationBar.fs | 10 +- .../Tests.LanguageService.ParameterInfo.fs | 90 +- .../Tests.LanguageService.QuickInfo.fs | 172 +- .../Tests.LanguageService.Script.fs | 188 +- .../Tests.LanguageService.TimeStamp.fs | 94 +- .../Tests.ProjectSystem.Configs.fs | 44 +- .../Tests.ProjectSystem.Miscellaneous.fs | 168 +- .../Tests.ProjectSystem.MultiTargeting.fs | 16 +- .../Tests.ProjectSystem.Project.fs | 114 +- .../Tests.ProjectSystem.ProjectItems.fs | 18 +- .../Tests.ProjectSystem.References.fs | 70 +- .../Tests.ProjectSystem.RoundTrip.fs | 10 +- .../Tests.ProjectSystem.UpToDate.fs | 26 +- .../UnitTests/TestLib.LanguageService.fs | 184 +- .../tests/UnitTests/TestLib.ProjectSystem.fs | 264 +- .../tests/UnitTests/TestLib.Salsa.fs | 36 +- .../tests/UnitTests/TestLib.Utils.fs | 80 +- vsintegration/tests/UnitTests/Tests.Build.fs | 60 +- .../UnitTests/Tests.InternalCollections.fs | 76 +- .../tests/UnitTests/Tests.RoslynHelpers.fs | 12 +- .../tests/UnitTests/Tests.TaskReporter.fs | 218 +- vsintegration/tests/UnitTests/Tests.Watson.fs | 96 +- .../tests/UnitTests/Tests.XmlDocComments.fs | 24 +- .../tests/UnitTests/UnusedOpensTests.fs | 46 +- .../UnitTests/Workspace/WorkspaceTests.fs | 92 +- 2932 files changed, 42598 insertions(+), 42628 deletions(-) diff --git a/buildtools/AssemblyCheck/AssemblyCheck.fs b/buildtools/AssemblyCheck/AssemblyCheck.fs index 61ef6dcdfcf..4a4fe1e636e 100644 --- a/buildtools/AssemblyCheck/AssemblyCheck.fs +++ b/buildtools/AssemblyCheck/AssemblyCheck.fs @@ -139,7 +139,7 @@ module AssemblyCheck = printfn "All shipping assemblies had an embedded PDB." // return code is the number of failures - failedVersionCheck.Length + failedCommitHash.Length + failedVerifyEmbeddedPdb.Length + failedVersionCheck.Length + failedCommitHash.Length + failedVerifyEmbeddedPdb.Length [] diff --git a/buildtools/fslex/Arg.fs b/buildtools/fslex/Arg.fs index d6f8ed790e3..f6f2aa03252 100644 --- a/buildtools/fslex/Arg.fs +++ b/buildtools/fslex/Arg.fs @@ -1,8 +1,8 @@ -// (c) Microsoft Corporation 2005-2009. +// (c) Microsoft Corporation 2005-2009. namespace FSharp.Text -type ArgType = +type ArgType = | ClearArg of bool ref | FloatArg of (float -> unit) | IntArg of (int -> unit) @@ -19,22 +19,22 @@ type ArgType = static member Unit r = UnitArg r -type ArgInfo (name,action,help) = +type ArgInfo (name,action,help) = member x.Name = name member x.ArgType = action member x.HelpText = help - + exception Bad of string exception HelpText of string [] -type ArgParser() = - static let getUsage specs u = - let sbuf = System.Text.StringBuilder 100 - let pstring (s:string) = sbuf.Append s |> ignore - let pendline s = pstring s; pstring "\n" +type ArgParser() = + static let getUsage specs u = + let sbuf = System.Text.StringBuilder 100 + let pstring (s:string) = sbuf.Append s |> ignore + let pendline s = pstring s; pstring "\n" pendline u; - List.iter (fun (arg:ArgInfo) -> + List.iter (fun (arg:ArgInfo) -> match arg.Name, arg.ArgType, arg.HelpText with | s, (UnitArg _ | SetArg _ | ClearArg _), helpText -> pstring "\t"; pstring s; pstring ": "; pendline helpText | s, StringArg _, helpText -> pstring "\t"; pstring s; pstring " : "; pendline helpText @@ -50,79 +50,79 @@ type ArgParser() = static member ParsePartial(cursor,argv,arguments:seq,?otherArgs,?usageText) = let other = defaultArg otherArgs (fun _ -> ()) let usageText = defaultArg usageText "" - let nargs = Array.length argv + let nargs = Array.length argv incr cursor; let argSpecs = arguments |> Seq.toList let specs = argSpecs |> List.map (fun (arg:ArgInfo) -> arg.Name, arg.ArgType) while !cursor < nargs do - let arg = argv.[!cursor] - let rec findMatchingArg args = + let arg = argv.[!cursor] + let rec findMatchingArg args = match args with - | (s, action) :: _ when s = arg -> - let getSecondArg () = - if !cursor + 1 >= nargs then + | (s, action) :: _ when s = arg -> + let getSecondArg () = + if !cursor + 1 >= nargs then raise(Bad("option "+s+" needs an argument.\n"+getUsage argSpecs usageText)); - argv.[!cursor+1] - - match action with - | UnitArg f -> - f (); + argv.[!cursor+1] + + match action with + | UnitArg f -> + f (); incr cursor | SetArg f -> - f := true; + f := true; incr cursor - | ClearArg f -> - f := false; + | ClearArg f -> + f := false; incr cursor - | StringArg f-> - let arg2 = getSecondArg() - f arg2; + | StringArg f-> + let arg2 = getSecondArg() + f arg2; cursor := !cursor + 2 - | IntArg f -> - let arg2 = getSecondArg () - let arg2 = try int32 arg2 with _ -> raise(Bad(getUsage argSpecs usageText)) in + | IntArg f -> + let arg2 = getSecondArg () + let arg2 = try int32 arg2 with _ -> raise(Bad(getUsage argSpecs usageText)) in f arg2; cursor := !cursor + 2; - | FloatArg f -> - let arg2 = getSecondArg() - let arg2 = try float arg2 with _ -> raise(Bad(getUsage argSpecs usageText)) in - f arg2; + | FloatArg f -> + let arg2 = getSecondArg() + let arg2 = try float arg2 with _ -> raise(Bad(getUsage argSpecs usageText)) in + f arg2; cursor := !cursor + 2; - | RestArg f -> + | RestArg f -> incr cursor; while !cursor < nargs do f argv.[!cursor]; incr cursor; - | _ :: more -> findMatchingArg more - | [] -> + | _ :: more -> findMatchingArg more + | [] -> if arg = "-help" || arg = "--help" || arg = "/help" || arg = "/help" || arg = "/?" then raise (HelpText (getUsage argSpecs usageText)) // Note: for '/abc/def' does not count as an argument // Note: '/abc' does elif arg.Length>0 && (arg.[0] = '-' || (arg.[0] = '/' && not (arg.Length > 1 && arg.[1..].Contains "/"))) then raise (Bad ("unrecognized argument: "+ arg + "\n" + getUsage argSpecs usageText)) - else + else other arg; incr cursor - findMatchingArg specs + findMatchingArg specs - static member Usage (arguments, ?usage) = + static member Usage (arguments, ?usage) = let usage = defaultArg usage "" System.Console.Error.WriteLine (getUsage (Seq.toList arguments) usage) #if FX_NO_COMMAND_LINE_ARGS #else - static member Parse (arguments, ?otherArgs,?usageText) = + static member Parse (arguments, ?otherArgs,?usageText) = let current = ref 0 - let argv = System.Environment.GetCommandLineArgs() + let argv = System.Environment.GetCommandLineArgs() try ArgParser.ParsePartial (current, argv, arguments, ?otherArgs=otherArgs, ?usageText=usageText) - with - | Bad h - | HelpText h -> - System.Console.Error.WriteLine h; - System.Console.Error.Flush(); - System.Environment.Exit(1); - | _ -> + with + | Bad h + | HelpText h -> + System.Console.Error.WriteLine h; + System.Console.Error.Flush(); + System.Environment.Exit(1); + | _ -> reraise() #endif diff --git a/buildtools/fslex/Arg.fsi b/buildtools/fslex/Arg.fsi index b5203999928..1be35637a68 100644 --- a/buildtools/fslex/Arg.fsi +++ b/buildtools/fslex/Arg.fsi @@ -1,4 +1,4 @@ -// (c) Microsoft Corporation 2005-2009. +// (c) Microsoft Corporation 2005-2009. /// A simple command-line argument processor. namespace FSharp.Text @@ -6,7 +6,7 @@ namespace FSharp.Text /// The spec value describes the action of the argument, /// and whether it expects a following parameter. [] -type ArgType = +type ArgType = static member Clear : bool ref -> ArgType static member Float : (float -> unit) -> ArgType static member Int : (int -> unit) -> ArgType @@ -15,7 +15,7 @@ type ArgType = static member String : (string -> unit) -> ArgType static member Unit : (unit -> unit) -> ArgType -type ArgInfo = +type ArgInfo = new : name:string * action:ArgType * help:string -> ArgInfo /// Return the name of the argument member Name : string @@ -25,7 +25,7 @@ type ArgInfo = member HelpText : string [] -type ArgParser = +type ArgParser = #if FX_NO_COMMAND_LINE_ARGS #else diff --git a/buildtools/fslex/Lexing.fs b/buildtools/fslex/Lexing.fs index afeae0f0dca..91c67dfe266 100644 --- a/buildtools/fslex/Lexing.fs +++ b/buildtools/fslex/Lexing.fs @@ -7,7 +7,7 @@ open System.Collections.Generic // REVIEW: This type showed up on a parsing-intensive performance measurement. Consider whether it can be a struct-record later when we have this feature. -jomo [] -type Position = +type Position = { pos_fname : string pos_lnum : int pos_orig_lnum : int @@ -30,82 +30,82 @@ type Position = member pos.Column = pos.pos_cnum - pos.pos_bol - member pos.NextLine = + member pos.NextLine = let pos = pos - { pos with + { pos with pos_orig_lnum = pos.OriginalLine + 1 - pos_lnum = pos.Line+1 + pos_lnum = pos.Line+1 pos_bol = pos.AbsoluteOffset } - member pos.EndOfToken(n) = + member pos.EndOfToken(n) = let pos = pos {pos with pos_cnum=pos.pos_cnum + n } member pos.AsNewLinePos() = pos.NextLine - member pos.ShiftColumnBy(by) = + member pos.ShiftColumnBy(by) = let pos = pos {pos with pos_cnum = pos.pos_cnum + by} - static member Empty = - { pos_fname="" - pos_lnum= 0 + static member Empty = + { pos_fname="" + pos_lnum= 0 pos_orig_lnum = 0 - pos_bol= 0 + pos_bol= 0 pos_cnum=0 } - static member FirstLine(filename) = - { pos_fname=filename + static member FirstLine(filename) = + { pos_fname=filename pos_orig_lnum = 1 - pos_lnum= 1 - pos_bol= 0 + pos_lnum= 1 + pos_bol= 0 pos_cnum=0 } -type LexBufferFiller<'char> = +type LexBufferFiller<'char> = { fillSync : (LexBuffer<'char> -> unit) option - fillAsync : (LexBuffer<'char> -> Async) option } - + fillAsync : (LexBuffer<'char> -> Async) option } + and [] - LexBuffer<'char>(filler: LexBufferFiller<'char>) as this = - let context = Dictionary(1) in + LexBuffer<'char>(filler: LexBufferFiller<'char>) as this = + let context = Dictionary(1) in let extendBufferSync = (fun () -> match filler.fillSync with Some refill -> refill this | None -> invalidOp "attempt to read synchronously from an asynchronous lex buffer") let extendBufferAsync = (fun () -> match filler.fillAsync with Some refill -> refill this | None -> invalidOp "attempt to read asynchronously from a synchronous lex buffer") let mutable buffer=[||] - /// number of valid characters beyond bufferScanStart + /// number of valid characters beyond bufferScanStart let mutable bufferMaxScanLength=0 - /// count into the buffer when scanning + /// count into the buffer when scanning let mutable bufferScanStart=0 - /// number of characters scanned so far + /// number of characters scanned so far let mutable bufferScanLength=0 - /// length of the scan at the last accepting state + /// length of the scan at the last accepting state let mutable lexemeLength=0 - /// action related to the last accepting state + /// action related to the last accepting state let mutable bufferAcceptAction=0 let mutable eof = false - let mutable startPos = Position.Empty + let mutable startPos = Position.Empty let mutable endPos = Position.Empty - /// Throw away all the input besides the lexeme - let discardInput () = + /// Throw away all the input besides the lexeme + let discardInput () = Array.blit buffer bufferScanStart buffer 0 bufferScanLength bufferScanStart <- 0 bufferMaxScanLength <- bufferScanLength - + member lexbuf.EndOfScan () : int = // Printf.eprintf "endOfScan, lexBuffer.lexemeLength = %d\n" lexBuffer.lexemeLength - if bufferAcceptAction < 0 then + if bufferAcceptAction < 0 then failwith "unrecognized input" // Printf.printf "endOfScan %d state %d on unconsumed input '%c' (%d)\n" a s (Char.chr inp) inp - // Printf.eprintf "accept, lexeme = %s\n" (lexeme lexBuffer) + // Printf.eprintf "accept, lexeme = %s\n" (lexeme lexBuffer) lexbuf.StartPos <- endPos lexbuf.EndPos <- endPos.EndOfToken(lexbuf.LexemeLength) bufferAcceptAction @@ -113,15 +113,15 @@ and [] member _.StartPos with get() = startPos and set b = startPos <- b - - member _.EndPos + + member _.EndPos with get() = endPos and set b = endPos <- b member _.Lexeme = Array.sub buffer bufferScanStart lexemeLength member _.LexemeChar n = buffer.[n+bufferScanStart] - + member _.BufferLocalStore = (context :> IDictionary<_, _>) member _.LexemeLength @@ -137,25 +137,25 @@ and [] and set v = bufferMaxScanLength <- v member internal _.BufferScanLength - with get() = bufferScanLength + with get() = bufferScanLength and set v = bufferScanLength <- v member internal _.BufferScanStart - with get() : int = bufferScanStart + with get() : int = bufferScanStart and set v = bufferScanStart <- v - member internal _.BufferAcceptAction - with get() = bufferAcceptAction + member internal _.BufferAcceptAction + with get() = bufferAcceptAction and set v = bufferAcceptAction <- v member internal _.RefillBuffer = extendBufferSync member internal _.AsyncRefillBuffer = extendBufferAsync - static member LexemeString(lexbuf:LexBuffer) = + static member LexemeString(lexbuf:LexBuffer) = System.String(lexbuf.Buffer, lexbuf.BufferScanStart, lexbuf.LexemeLength) - member _.IsPastEndOfStream + member _.IsPastEndOfStream with get() = eof and set b = eof <- b @@ -163,30 +163,30 @@ and [] member _.BufferScanPos = bufferScanStart + bufferScanLength - member lexbuf.EnsureBufferSize n = - if lexbuf.BufferScanPos + n >= buffer.Length then - let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) + member lexbuf.EnsureBufferSize n = + if lexbuf.BufferScanPos + n >= buffer.Length then + let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) Array.blit buffer bufferScanStart repl bufferScanStart bufferScanLength buffer <- repl - static member FromReadFunctions (syncRead : ('char[] * int * int -> int) option, asyncRead : ('char[] * int * int -> Async) option) : LexBuffer<'char> = + static member FromReadFunctions (syncRead : ('char[] * int * int -> int) option, asyncRead : ('char[] * int * int -> Async) option) : LexBuffer<'char> = let extension= Array.zeroCreate 4096 - let fillers = - { fillSync = - match syncRead with + let fillers = + { fillSync = + match syncRead with | None -> None - | Some read -> - Some (fun lexBuffer -> + | Some read -> + Some (fun lexBuffer -> let n = read(extension, 0, extension.Length) lexBuffer.EnsureBufferSize n Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n - lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n) - fillAsync = - match asyncRead with + lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n) + fillAsync = + match asyncRead with | None -> None - | Some read -> - Some (fun lexBuffer -> - async { + | Some read -> + Some (fun lexBuffer -> + async { let! n = read(extension, 0, extension.Length) lexBuffer.EnsureBufferSize n Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n @@ -194,31 +194,31 @@ and [] LexBuffer<_>(fillers) // A full type signature is required on this method because it is used at more specific types within its own scope - static member FromFunction (f : 'char[] * int * int -> int) : LexBuffer<'char> = + static member FromFunction (f : 'char[] * int * int -> int) : LexBuffer<'char> = LexBuffer<_>.FromReadFunctions(Some(f), None) - static member FromAsyncFunction (f : 'char[] * int * int -> Async) : LexBuffer<'char> = + static member FromAsyncFunction (f : 'char[] * int * int -> Async) : LexBuffer<'char> = LexBuffer<_>.FromReadFunctions(None, Some(f)) - - static member FromCharFunction f : LexBuffer = - LexBuffer.FromFunction(fun (buff, start, len) -> + + static member FromCharFunction f : LexBuffer = + LexBuffer.FromFunction(fun (buff, start, len) -> let buff2 = Array.zeroCreate len - let n = f buff2 len + let n = f buff2 len Array.blit buff2 0 buff start len n) - static member FromByteFunction f : LexBuffer = - LexBuffer.FromFunction(fun (buff, start, len) -> + static member FromByteFunction f : LexBuffer = + LexBuffer.FromFunction(fun (buff, start, len) -> let buff2 = Array.zeroCreate len - let n = f buff2 len + let n = f buff2 len Array.blit buff2 0 buff start len n) // A full type signature is required on this method because it is used at more specific types within its own scope - static member FromArray (s: 'char[]) : LexBuffer<'char> = - let lexBuffer = - LexBuffer<_> - { fillSync = Some (fun _ -> ()) + static member FromArray (s: 'char[]) : LexBuffer<'char> = + let lexBuffer = + LexBuffer<_> + { fillSync = Some (fun _ -> ()) fillAsync = Some (fun _ -> async { return () }) } lexBuffer.Buffer <- s lexBuffer.BufferMaxScanLength <- s.Length @@ -233,38 +233,38 @@ and [] static member FromString (s:string) = LexBuffer.FromArray (s.ToCharArray()) - static member FromTextReader (tr:System.IO.TextReader) : LexBuffer = + static member FromTextReader (tr:System.IO.TextReader) : LexBuffer = LexBuffer.FromReadFunctions(Some tr.Read, Some (tr.ReadAsync >> Async.AwaitTask)) - static member FromBinaryReader (br:System.IO.BinaryReader) : LexBuffer = + static member FromBinaryReader (br:System.IO.BinaryReader) : LexBuffer = LexBuffer.FromFunction(br.Read) - static member FromStream (stream:System.IO.Stream) : LexBuffer = - LexBuffer.FromReadFunctions(Some(stream.Read), Some(fun (buf, offset, len) -> stream.AsyncRead(buf, offset=offset, count=len))) + static member FromStream (stream:System.IO.Stream) : LexBuffer = + LexBuffer.FromReadFunctions(Some(stream.Read), Some(fun (buf, offset, len) -> stream.AsyncRead(buf, offset=offset, count=len))) -module GenericImplFragments = - let startInterpret(lexBuffer:LexBuffer<_>)= +module GenericImplFragments = + let startInterpret(lexBuffer:LexBuffer<_>)= lexBuffer.BufferScanStart <- lexBuffer.BufferScanStart + lexBuffer.LexemeLength lexBuffer.BufferMaxScanLength <- lexBuffer.BufferMaxScanLength - lexBuffer.LexemeLength lexBuffer.BufferScanLength <- 0 lexBuffer.LexemeLength <- 0 lexBuffer.BufferAcceptAction <- -1 - let afterRefill (trans: uint16[] array, sentinel, lexBuffer:LexBuffer<_>, scanUntilSentinel, endOfScan, state, eofPos) = - // end of file occurs if we couldn't extend the buffer - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then - let snew = int trans.[state].[eofPos] // == EOF - if snew = sentinel then + let afterRefill (trans: uint16[] array, sentinel, lexBuffer:LexBuffer<_>, scanUntilSentinel, endOfScan, state, eofPos) = + // end of file occurs if we couldn't extend the buffer + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + let snew = int trans.[state].[eofPos] // == EOF + if snew = sentinel then endOfScan() - else + else if lexBuffer.IsPastEndOfStream then failwith "End of file on lexing stream" lexBuffer.IsPastEndOfStream <- true // Printf.printf "state %d --> %d on eof\n" state snew scanUntilSentinel(lexBuffer, snew) - else + else scanUntilSentinel(lexBuffer, state) - let onAccept (lexBuffer:LexBuffer<_>, a) = + let onAccept (lexBuffer:LexBuffer<_>, a) = lexBuffer.LexemeLength <- lexBuffer.BufferScanLength lexBuffer.BufferAcceptAction <- a @@ -273,61 +273,61 @@ open GenericImplFragments [] type AsciiTables(trans: uint16[] array, accept: uint16[]) = let rec scanUntilSentinel(lexBuffer, state) = - let sentinel = 255 * 256 + 255 - // Return an endOfScan after consuming the input - let a = int accept.[state] - if a <> sentinel then + let sentinel = 255 * 256 + 255 + // Return an endOfScan after consuming the input + let a = int accept.[state] + if a <> sentinel then onAccept (lexBuffer, a) - - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then lexBuffer.DiscardInput() lexBuffer.RefillBuffer () - // end of file occurs if we couldn't extend the buffer + // end of file occurs if we couldn't extend the buffer afterRefill (trans, sentinel, lexBuffer, scanUntilSentinel, lexBuffer.EndOfScan, state, 256 (* == EOF *) ) else - // read a character - end the scan if there are no further transitions + // read a character - end the scan if there are no further transitions let inp = int(lexBuffer.Buffer.[lexBuffer.BufferScanPos]) - let snew = int trans.[state].[inp] - if snew = sentinel then + let snew = int trans.[state].[inp] + if snew = sentinel then lexBuffer.EndOfScan() - else + else lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1 // Printf.printf "state %d --> %d on '%c' (%d)\n" state snew (Char.chr inp) inp scanUntilSentinel(lexBuffer, snew) - - /// Interpret tables for an ascii lexer generated by fslex. - member tables.Interpret(initialState, lexBuffer : LexBuffer) = + + /// Interpret tables for an ascii lexer generated by fslex. + member tables.Interpret(initialState, lexBuffer : LexBuffer) = startInterpret(lexBuffer) scanUntilSentinel(lexBuffer, initialState) - /// Interpret tables for an ascii lexer generated by fslex. - member tables.AsyncInterpret(initialState, lexBuffer : LexBuffer) = - - let rec scanUntilSentinel(lexBuffer, state) : Async = - async { - let sentinel = 255 * 256 + 255 - // Return an endOfScan after consuming the input - let a = int accept.[state] - if a <> sentinel then + /// Interpret tables for an ascii lexer generated by fslex. + member tables.AsyncInterpret(initialState, lexBuffer : LexBuffer) = + + let rec scanUntilSentinel(lexBuffer, state) : Async = + async { + let sentinel = 255 * 256 + 255 + // Return an endOfScan after consuming the input + let a = int accept.[state] + if a <> sentinel then onAccept (lexBuffer, a) - - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then lexBuffer.DiscardInput() do! lexBuffer.AsyncRefillBuffer () - // end of file occurs if we couldn't extend the buffer + // end of file occurs if we couldn't extend the buffer return! afterRefill (trans, sentinel, lexBuffer, scanUntilSentinel, endOfScan, state, 256 (* == EOF *) ) else - // read a character - end the scan if there are no further transitions + // read a character - end the scan if there are no further transitions let inp = int(lexBuffer.Buffer.[lexBuffer.BufferScanPos]) - let snew = int trans.[state].[inp] - if snew = sentinel then + let snew = int trans.[state].[inp] + if snew = sentinel then return! endOfScan() - else + else lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1 return! scanUntilSentinel(lexBuffer, snew) } - and endOfScan() = + and endOfScan() = async { return lexBuffer.EndOfScan() } startInterpret(lexBuffer) @@ -338,29 +338,29 @@ type AsciiTables(trans: uint16[] array, accept: uint16[]) = static member Create(trans, accept) = AsciiTables(trans, accept) [] -type UnicodeTables(trans: uint16[] array, accept: uint16[]) = - let sentinel = 255 * 256 + 255 - let numUnicodeCategories = 30 - let numLowUnicodeChars = 128 +type UnicodeTables(trans: uint16[] array, accept: uint16[]) = + let sentinel = 255 * 256 + 255 + let numUnicodeCategories = 30 + let numLowUnicodeChars = 128 let numSpecificUnicodeChars = (trans.[0].Length - 1 - numLowUnicodeChars - numUnicodeCategories)/2 - let lookupUnicodeCharacters (state, inp: char) = + let lookupUnicodeCharacters (state, inp: char) = let inpAsInt = int inp // Is it a fast ASCII character? - if inpAsInt < numLowUnicodeChars then + if inpAsInt < numLowUnicodeChars then int trans.[state].[inpAsInt] - else + else // Search for a specific unicode character let baseForSpecificUnicodeChars = numLowUnicodeChars - let rec loop i = - if i >= numSpecificUnicodeChars then - // OK, if we failed then read the 'others' entry in the alphabet, + let rec loop i = + if i >= numSpecificUnicodeChars then + // OK, if we failed then read the 'others' entry in the alphabet, // which covers all Unicode characters not covered in other // ways let baseForUnicodeCategories = numLowUnicodeChars+numSpecificUnicodeChars*2 let unicodeCategory = System.Globalization.CharUnicodeInfo.GetUnicodeCategory(inp) //System.Console.WriteLine("inp = {0}, unicodeCategory = {1}", [| box inp; box unicodeCategory |]) int trans.[state].[baseForUnicodeCategories + int32 unicodeCategory] - else + else // This is the specific unicode character let c = char (int trans.[state].[baseForSpecificUnicodeChars+i*2]) //System.Console.WriteLine("c = {0}, inp = {1}, i = {2}", [| box c; box inp; box i |]) @@ -368,74 +368,74 @@ type UnicodeTables(trans: uint16[] array, accept: uint16[]) = if c = inp then int trans.[state].[baseForSpecificUnicodeChars+i*2+1] else loop(i+1) - + loop 0 - let eofPos = numLowUnicodeChars + 2*numSpecificUnicodeChars + numUnicodeCategories - + let eofPos = numLowUnicodeChars + 2*numSpecificUnicodeChars + numUnicodeCategories + let rec scanUntilSentinel(lexBuffer, state) = - // Return an endOfScan after consuming the input - let a = int accept.[state] - if a <> sentinel then + // Return an endOfScan after consuming the input + let a = int accept.[state] + if a <> sentinel then onAccept(lexBuffer, a) - - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then lexBuffer.DiscardInput() lexBuffer.RefillBuffer () - // end of file occurs if we couldn't extend the buffer + // end of file occurs if we couldn't extend the buffer afterRefill (trans, sentinel, lexBuffer, scanUntilSentinel, lexBuffer.EndOfScan, state, eofPos) else - // read a character - end the scan if there are no further transitions + // read a character - end the scan if there are no further transitions let inp = lexBuffer.Buffer.[lexBuffer.BufferScanPos] - + // Find the new state let snew = lookupUnicodeCharacters (state, inp) - if snew = sentinel then + if snew = sentinel then lexBuffer.EndOfScan() - else + else lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1 // Printf.printf "state %d --> %d on '%c' (%d)\n" s snew (char inp) inp scanUntilSentinel(lexBuffer, snew) - - // Each row for the Unicode table has format + + // Each row for the Unicode table has format // 128 entries for ASCII characters - // A variable number of 2*UInt16 entries for SpecificUnicodeChars + // A variable number of 2*UInt16 entries for SpecificUnicodeChars // 30 entries, one for each UnicodeCategory // 1 entry for EOF - member tables.Interpret(initialState, lexBuffer : LexBuffer) = + member tables.Interpret(initialState, lexBuffer : LexBuffer) = startInterpret(lexBuffer) scanUntilSentinel(lexBuffer, initialState) - member tables.AsyncInterpret(initialState, lexBuffer : LexBuffer) = + member tables.AsyncInterpret(initialState, lexBuffer : LexBuffer) = let rec scanUntilSentinel(lexBuffer, state) = async { - // Return an endOfScan after consuming the input - let a = int accept.[state] - if a <> sentinel then + // Return an endOfScan after consuming the input + let a = int accept.[state] + if a <> sentinel then onAccept(lexBuffer, a) - - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then lexBuffer.DiscardInput() lexBuffer.RefillBuffer () - // end of file occurs if we couldn't extend the buffer + // end of file occurs if we couldn't extend the buffer return! afterRefill (trans, sentinel, lexBuffer, scanUntilSentinel, endOfScan, state, eofPos) else - // read a character - end the scan if there are no further transitions + // read a character - end the scan if there are no further transitions let inp = lexBuffer.Buffer.[lexBuffer.BufferScanPos] - + // Find the new state let snew = lookupUnicodeCharacters (state, inp) - if snew = sentinel then + if snew = sentinel then return! endOfScan() - else + else lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1 return! scanUntilSentinel(lexBuffer, snew) } - and endOfScan() = - async { return lexBuffer.EndOfScan() } + and endOfScan() = + async { return lexBuffer.EndOfScan() } startInterpret(lexBuffer) scanUntilSentinel(lexBuffer, initialState) diff --git a/buildtools/fslex/Lexing.fsi b/buildtools/fslex/Lexing.fsi index d88af6712aa..81a3fd2803e 100644 --- a/buildtools/fslex/Lexing.fsi +++ b/buildtools/fslex/Lexing.fsi @@ -12,10 +12,10 @@ open System.Collections.Generic /// Position information stored for lexing tokens [] type Position = - { + { /// The file name for the position pos_fname: string - + /// The line number for the position pos_lnum: int diff --git a/buildtools/fslex/Parsing.fs b/buildtools/fslex/Parsing.fs index bfb4c1705af..a4a645e3cfb 100644 --- a/buildtools/fslex/Parsing.fs +++ b/buildtools/fslex/Parsing.fs @@ -1,24 +1,24 @@ -// (c) Microsoft Corporation 2005-2009. +// (c) Microsoft Corporation 2005-2009. namespace FSharp.Text.Parsing open FSharp.Text.Lexing open System.Collections.Generic -type IParseState = +type IParseState = abstract InputRange: int -> Position * Position - abstract InputEndPosition: int -> Position + abstract InputEndPosition: int -> Position - abstract InputStartPosition: int -> Position + abstract InputStartPosition: int -> Position abstract ResultRange: Position * Position - abstract GetInput: int -> obj + abstract GetInput: int -> obj abstract ParserLocalStore : IDictionary - abstract RaiseError<'b> : unit -> 'b + abstract RaiseError<'b> : unit -> 'b //------------------------------------------------------------------------- // This context is passed to the error reporter when a syntax error occurs @@ -27,11 +27,11 @@ type IParseState = type ParseErrorContext<'tok> (//lexbuf: LexBuffer<_>, stateStack:int list, - parseState: IParseState, - reduceTokens: int list, - currentToken: 'tok option, - reducibleProductions: int list list, - shiftableTokens: int list, + parseState: IParseState, + reduceTokens: int list, + currentToken: 'tok option, + reducibleProductions: int list list, + shiftableTokens: int list, message : string) = member _.StateStack = stateStack @@ -50,21 +50,21 @@ type ParseErrorContext<'tok> //------------------------------------------------------------------------- -// This is the data structure emitted as code by FSYACC. +// This is the data structure emitted as code by FSYACC. -type Tables<'tok> = +type Tables<'tok> = { reductions: (IParseState -> obj)[] endOfInputTag: int tagOfToken: 'tok -> int - dataOfToken: 'tok -> obj - actionTableElements: uint16[] + dataOfToken: 'tok -> obj + actionTableElements: uint16[] actionTableRowOffsets: uint16[] reductionSymbolCounts: uint16[] immediateActions: uint16[] gotos: uint16[] sparseGotoTableRowOffsets: uint16[] - stateToProdIdxsTableElements: uint16[] - stateToProdIdxsTableRowOffsets: uint16[] + stateToProdIdxsTableElements: uint16[] + stateToProdIdxsTableRowOffsets: uint16[] productionToNonTerminalTable: uint16[] /// For fsyacc.exe, this entry is filled in by context from the generated parser file. If no 'parse_error' function /// is defined by the user then ParseHelpers.parse_error is used by default (ParseHelpers is opened @@ -79,26 +79,26 @@ type Tables<'tok> = // This type is in System.dll so for the moment we can't use it in FSharp.Core.dll //type Stack<'a> = System.Collections.Generic.Stack<'a> -type internal Stack<'a>(n) = +type internal Stack<'a>(n) = let mutable contents = Array.zeroCreate<'a>(n) let mutable count = 0 - member buf.Ensure newSize = + member buf.Ensure newSize = let oldSize = Array.length contents - if newSize > oldSize then + if newSize > oldSize then let old = contents contents <- Array.zeroCreate (max newSize (oldSize * 2)) Array.blit old 0 contents 0 count - + member buf.Count = count member buf.Pop() = count <- count - 1 member buf.Peep() = contents.[count - 1] member buf.Top(n) = [ for x in contents.[max 0 (count-n)..count - 1] -> x ] |> List.rev member buf.Push(x) = - buf.Ensure(count + 1) - contents.[count] <- x + buf.Ensure(count + 1) + contents.[count] <- x count <- count + 1 - + member buf.IsEmpty = (count = 0) #if __DEBUG member buf.PrintStack() = @@ -117,9 +117,9 @@ module Flags = let mutable debug = false #endif -module Implementation = - - // Definitions shared with fsyacc +module Implementation = + + // Definitions shared with fsyacc let anyMarker = 0xffff let shiftFlag = 0x0000 let reduceFlag = 0x4000 @@ -127,23 +127,23 @@ module Implementation = let acceptFlag = 0xc000 let actionMask = 0xc000 - let actionValue action = action &&& (~~~ actionMask) + let actionValue action = action &&& (~~~ actionMask) let actionKind action = action &&& actionMask - + //------------------------------------------------------------------------- - // Read the tables written by FSYACC. + // Read the tables written by FSYACC. type AssocTable(elemTab:uint16[], offsetTab:uint16[]) = let cache = Dictionary<_,_>(2000) - member t.readAssoc (minElemNum,maxElemNum,defaultValueOfAssoc,keyToFind) = - // do a binary chop on the table + member t.readAssoc (minElemNum,maxElemNum,defaultValueOfAssoc,keyToFind) = + // do a binary chop on the table let elemNumber : int = (minElemNum+maxElemNum)/2 - if elemNumber = maxElemNum + if elemNumber = maxElemNum then defaultValueOfAssoc - else + else let x = int elemTab.[elemNumber*2] - if keyToFind = x then + if keyToFind = x then int elemTab.[elemNumber*2+1] elif keyToFind < x then t.readAssoc (minElemNum,elemNumber,defaultValueOfAssoc,keyToFind) @@ -151,59 +151,59 @@ module Implementation = t.readAssoc (elemNumber+1,maxElemNum,defaultValueOfAssoc,keyToFind) member t.Read(rowNumber,keyToFind) = - + // First check the sparse lookaside table // Performance note: without this lookaside table the binary chop in readAssoc - // takes up around 10% of of parsing time + // takes up around 10% of of parsing time // for parsing intensive samples such as the bootstrapped F# compiler. // // Note: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal. // Some other better sparse lookup table may be better. - let mutable res = 0 + let mutable res = 0 let cacheKey = (rowNumber <<< 16) ||| keyToFind - let ok = cache.TryGetValue(cacheKey, &res) - if ok then res + let ok = cache.TryGetValue(cacheKey, &res) + if ok then res else let headOfTable = int offsetTab.[rowNumber] - let firstElemNumber = headOfTable + 1 + let firstElemNumber = headOfTable + 1 let numberOfElementsInAssoc = int elemTab.[headOfTable*2] - let defaultValueOfAssoc = int elemTab.[headOfTable*2+1] + let defaultValueOfAssoc = int elemTab.[headOfTable*2+1] let res = t.readAssoc (firstElemNumber,(firstElemNumber+numberOfElementsInAssoc),defaultValueOfAssoc,keyToFind) cache.[cacheKey] <- res res // Read all entries in the association table // Used during error recovery to find all valid entries in the table - member _.ReadAll(n) = + member _.ReadAll(n) = let headOfTable = int offsetTab.[n] - let firstElemNumber = headOfTable + 1 - let numberOfElementsInAssoc = int32 elemTab.[headOfTable*2] - let defaultValueOfAssoc = int elemTab.[headOfTable*2+1] - [ for i in firstElemNumber .. (firstElemNumber+numberOfElementsInAssoc-1) -> + let firstElemNumber = headOfTable + 1 + let numberOfElementsInAssoc = int32 elemTab.[headOfTable*2] + let defaultValueOfAssoc = int elemTab.[headOfTable*2+1] + [ for i in firstElemNumber .. (firstElemNumber+numberOfElementsInAssoc-1) -> (int elemTab.[i*2], int elemTab.[i*2+1]) ], defaultValueOfAssoc type IdxToIdxListTable(elemTab:uint16[], offsetTab:uint16[]) = // Read all entries in a row of the table - member _.ReadAll(n) = + member _.ReadAll(n) = let headOfTable = int offsetTab.[n] - let firstElemNumber = headOfTable + 1 - let numberOfElements = int32 elemTab.[headOfTable] + let firstElemNumber = headOfTable + 1 + let numberOfElements = int32 elemTab.[headOfTable] [ for i in firstElemNumber .. (firstElemNumber+numberOfElements-1) -> int elemTab.[i] ] //------------------------------------------------------------------------- - // interpret the tables emitted by FSYACC. + // interpret the tables emitted by FSYACC. [] [] - type ValueInfo = + type ValueInfo = val value: obj val startPos: Position val endPos: Position new(value,startPos,endPos) = { value=value; startPos=startPos; endPos=endPos } - let interpret (tables: Tables<'tok>) lexer (lexbuf : LexBuffer<_>) initialState = + let interpret (tables: Tables<'tok>) lexer (lexbuf : LexBuffer<_>) initialState = let localStore = Dictionary() in localStore.["LexBuffer"] <- lexbuf #if __DEBUG @@ -215,7 +215,7 @@ module Implementation = let valueStack = Stack(100) - let mutable haveLookahead = false + let mutable haveLookahead = false let mutable lookaheadToken = Unchecked.defaultof<'tok> @@ -227,12 +227,12 @@ module Implementation = // After an error occurs, we suppress errors until we've shifted three tokens in a row. let mutable errorSuppressionCountDown = 0 - + // When we hit the end-of-file we don't fail straight away but rather keep permitting shift // and reduce against the last token in the token stream 20 times or until we've accepted // or exhausted the stack. This allows error recovery rules of the form // input : realInput EOF | realInput error EOF | error EOF - // where consuming one EOF to trigger an error doesn't result in overall parse failure + // where consuming one EOF to trigger an error doesn't result in overall parse failure // catastrophe and the loss of intermediate results. // @@ -241,26 +241,26 @@ module Implementation = let mutable eofCountDown = 20 // Number of EOFs to supply at the end for error recovery // The 100 here means a maximum of 100 elements for each rule - let ruleStartPoss = (Array.zeroCreate 100 : Position[]) - let ruleEndPoss = (Array.zeroCreate 100 : Position[]) - let ruleValues = (Array.zeroCreate 100 : obj[]) - let lhsPos = (Array.zeroCreate 2 : Position[]) + let ruleStartPoss = (Array.zeroCreate 100 : Position[]) + let ruleEndPoss = (Array.zeroCreate 100 : Position[]) + let ruleValues = (Array.zeroCreate 100 : obj[]) + let lhsPos = (Array.zeroCreate 2 : Position[]) let reductions = tables.reductions let actionTable = AssocTable(tables.actionTableElements, tables.actionTableRowOffsets) let gotoTable = AssocTable(tables.gotos, tables.sparseGotoTableRowOffsets) let stateToProdIdxsTable = IdxToIdxListTable(tables.stateToProdIdxsTableElements, tables.stateToProdIdxsTableRowOffsets) - let parseState = - { new IParseState with - member _.InputRange(n) = ruleStartPoss.[n-1], ruleEndPoss.[n-1] + let parseState = + { new IParseState with + member _.InputRange(n) = ruleStartPoss.[n-1], ruleEndPoss.[n-1] member _.InputStartPosition(n) = ruleStartPoss.[n-1] - member _.InputEndPosition(n) = ruleEndPoss.[n-1] - member _.GetInput(n) = ruleValues.[n-1] - member _.ResultRange = (lhsPos.[0], lhsPos.[1]) - member _.ParserLocalStore = (localStore :> IDictionary<_,_>) + member _.InputEndPosition(n) = ruleEndPoss.[n-1] + member _.GetInput(n) = ruleValues.[n-1] + member _.ResultRange = (lhsPos.[0], lhsPos.[1]) + member _.ParserLocalStore = (localStore :> IDictionary<_,_>) member _.RaiseError() = raise RecoverableParseError (* NOTE: this binding tests the fairly complex logic associated with an object expression implementing a generic abstract method *) - } + } #if __DEBUG let report haveLookahead lookaheadToken = @@ -276,38 +276,38 @@ module Implementation = #if __DEBUG if Flags.debug then System.Console.WriteLine("popStackUntilErrorShifted") #endif - if stateStack.IsEmpty then + if stateStack.IsEmpty then #if __DEBUG if Flags.debug then System.Console.WriteLine("state stack empty during error recovery - generating parse error") #endif failwith "parse error" - + let currState = stateStack.Peep() #if __DEBUG if Flags.debug then System.Console.WriteLine("In state {0} during error recovery", currState) #endif - + let action = actionTable.Read(currState, tables.tagOfErrorTerminal) - - if actionKind action = shiftFlag && - (match tokenOpt with + + if actionKind action = shiftFlag && + (match tokenOpt with | None -> true - | Some(token) -> - let nextState = actionValue action + | Some(token) -> + let nextState = actionValue action actionKind (actionTable.Read(nextState, tables.tagOfToken(token))) = shiftFlag) then #if __DEBUG if Flags.debug then System.Console.WriteLine("shifting error, continuing with error recovery") #endif - let nextState = actionValue action + let nextState = actionValue action // The "error" non terminal needs position information, though it tends to be unreliable. // Use the StartPos/EndPos from the lex buffer valueStack.Push(ValueInfo(box (), lexbuf.StartPos, lexbuf.EndPos)) stateStack.Push(nextState) else - if valueStack.IsEmpty then + if valueStack.IsEmpty then failwith "parse error" #if __DEBUG if Flags.debug then @@ -317,87 +317,87 @@ module Implementation = stateStack.Pop() popStackUntilErrorShifted(tokenOpt) - while not finished do - if stateStack.IsEmpty then + while not finished do + if stateStack.IsEmpty then finished <- true else let state = stateStack.Peep() #if __DEBUG if Flags.debug then (Console.Write("{0} value(state), state ",valueStack.Count); stateStack.PrintStack()) #endif - let action = + let action = let immediateAction = int tables.immediateActions.[state] if not (immediateAction = anyMarker) then - // Action has been pre-determined, no need to lookahead - // Expecting it to be a Reduce action on a non-fakeStartNonTerminal ? + // Action has been pre-determined, no need to lookahead + // Expecting it to be a Reduce action on a non-fakeStartNonTerminal ? immediateAction else - // Lookahead required to determine action - if not haveLookahead then - if lexbuf.IsPastEndOfStream then + // Lookahead required to determine action + if not haveLookahead then + if lexbuf.IsPastEndOfStream then // When the input runs out, keep supplying the last token for eofCountDown times if eofCountDown>0 then haveLookahead <- true eofCountDown <- eofCountDown - 1 inEofCountDown <- true - else + else haveLookahead <- false - else + else lookaheadToken <- lexer lexbuf lookaheadStartPos <- lexbuf.StartPos lookaheadEndPos <- lexbuf.EndPos haveLookahead <- true - let tag = - if haveLookahead then tables.tagOfToken lookaheadToken - else tables.endOfInputTag - - // Printf.printf "state %d\n" state + let tag = + if haveLookahead then tables.tagOfToken lookaheadToken + else tables.endOfInputTag + + // Printf.printf "state %d\n" state actionTable.Read(state,tag) - - let kind = actionKind action + + let kind = actionKind action if kind = shiftFlag then ( - if errorSuppressionCountDown > 0 then + if errorSuppressionCountDown > 0 then errorSuppressionCountDown <- errorSuppressionCountDown - 1 #if __DEBUG if Flags.debug then Console.WriteLine("shifting, reduced errorRecoverylevel to {0}\n", errorSuppressionCountDown) #endif - let nextState = actionValue action + let nextState = actionValue action if not haveLookahead then failwith "shift on end of input!" let data = tables.dataOfToken lookaheadToken valueStack.Push(ValueInfo(data, lookaheadStartPos, lookaheadEndPos)) - stateStack.Push(nextState) + stateStack.Push(nextState) #if __DEBUG if Flags.debug then Console.WriteLine("shift/consume input {0}, shift to state {1}", report haveLookahead lookaheadToken, nextState) #endif haveLookahead <- false ) elif kind = reduceFlag then - let prod = actionValue action - let reduction = reductions.[prod] + let prod = actionValue action + let reduction = reductions.[prod] let n = int tables.reductionSymbolCounts.[prod] - // pop the symbols, populate the values and populate the locations + // pop the symbols, populate the values and populate the locations #if __DEBUG if Flags.debug then Console.Write("reduce popping {0} values/states, lookahead {1}", n, report haveLookahead lookaheadToken) #endif - - lhsPos.[0] <- Position.Empty - lhsPos.[1] <- Position.Empty - for i = 0 to n - 1 do + + lhsPos.[0] <- Position.Empty + lhsPos.[1] <- Position.Empty + for i = 0 to n - 1 do if valueStack.IsEmpty then failwith "empty symbol stack" let topVal = valueStack.Peep() valueStack.Pop() stateStack.Pop() - ruleValues.[(n-i)-1] <- topVal.value - ruleStartPoss.[(n-i)-1] <- topVal.startPos - ruleEndPoss.[(n-i)-1] <- topVal.endPos + ruleValues.[(n-i)-1] <- topVal.value + ruleStartPoss.[(n-i)-1] <- topVal.startPos + ruleEndPoss.[(n-i)-1] <- topVal.endPos if lhsPos.[1] = Position.Empty then lhsPos.[1] <- topVal.endPos if not (topVal.startPos = Position.Empty) then lhsPos.[0] <- topVal.startPos - done - - try - // Printf.printf "reduce %d\n" prod - let redResult = reduction parseState + done + + try + // Printf.printf "reduce %d\n" prod + let redResult = reduction parseState valueStack.Push(ValueInfo(redResult, lhsPos.[0], lhsPos.[1])) let currState = stateStack.Peep() let newGotoState = gotoTable.Read(int tables.productionToNonTerminalTable.[prod], currState) @@ -405,40 +405,40 @@ module Implementation = #if __DEBUG if Flags.debug then Console.WriteLine(" goto state {0}", newGotoState) #endif - with - | Accept res -> - finished <- true - valueStack.Push(ValueInfo(res, lhsPos.[0], lhsPos.[1])) + with + | Accept res -> + finished <- true + valueStack.Push(ValueInfo(res, lhsPos.[0], lhsPos.[1])) | RecoverableParseError -> #if __DEBUG if Flags.debug then Console.WriteLine("RecoverableParseErrorException...\n") #endif popStackUntilErrorShifted(None) - // User code raised a Parse_error. Don't report errors again until three tokens have been shifted + // User code raised a Parse_error. Don't report errors again until three tokens have been shifted errorSuppressionCountDown <- 3 elif kind = errorFlag then ( #if __DEBUG if Flags.debug then Console.Write("ErrorFlag... ") #endif - // Silently discard inputs and don't report errors - // until three tokens in a row have been shifted + // Silently discard inputs and don't report errors + // until three tokens in a row have been shifted #if __DEBUG if Flags.debug then printfn "error on token '%A' " (if haveLookahead then Some(lookaheadToken) else None) #endif - if errorSuppressionCountDown > 0 then + if errorSuppressionCountDown > 0 then // If we're in the end-of-file count down then we're very keen to 'Accept'. // We can only do this by repeatedly popping the stack until we can shift both an 'error' token - // and an EOF token. - if inEofCountDown && eofCountDown < 10 then + // and an EOF token. + if inEofCountDown && eofCountDown < 10 then #if __DEBUG if Flags.debug then printfn "poppin stack, looking to shift both 'error' and that token, during end-of-file error recovery" #endif popStackUntilErrorShifted(if haveLookahead then Some(lookaheadToken) else None) // If we don't haveLookahead then the end-of-file count down is over and we have no further options. - if not haveLookahead then + if not haveLookahead then failwith "parse error: unexpected end of file" - + #if __DEBUG if Flags.debug then printfn "discarding token '%A' during error suppression" (if haveLookahead then Some(lookaheadToken) else None) #endif @@ -449,32 +449,32 @@ module Implementation = else ( let currentToken = if haveLookahead then Some(lookaheadToken) else None - let actions,defaultAction = actionTable.ReadAll(state) + let actions,defaultAction = actionTable.ReadAll(state) let explicit = Set.ofList [ for tag,_action in actions -> tag ] - - let shiftableTokens = + + let shiftableTokens = [ for tag,action in actions do - if (actionKind action) = shiftFlag then + if (actionKind action) = shiftFlag then yield tag if actionKind defaultAction = shiftFlag then - for tag in 0 .. tables.numTerminals-1 do - if not (explicit.Contains(tag)) then + for tag in 0 .. tables.numTerminals-1 do + if not (explicit.Contains(tag)) then yield tag ] in let stateStack = stateStack.Top(12) in - let reducibleProductions = - [ for state in stateStack do + let reducibleProductions = + [ for state in stateStack do yield stateToProdIdxsTable.ReadAll(state) ] - let reduceTokens = + let reduceTokens = [ for tag,action in actions do if actionKind(action) = reduceFlag then yield tag if actionKind(defaultAction) = reduceFlag then - for tag in 0 .. tables.numTerminals-1 do - if not (explicit.Contains(tag)) then + for tag in 0 .. tables.numTerminals-1 do + if not (explicit.Contains(tag)) then yield tag ] in - //let activeRules = stateStack |> List.iter (fun state -> + //let activeRules = stateStack |> List.iter (fun state -> let errorContext = new ParseErrorContext<'tok>(stateStack,parseState, reduceTokens,currentToken,reducibleProductions, shiftableTokens, "syntax error") tables.parseError(errorContext) popStackUntilErrorShifted(None) @@ -483,20 +483,20 @@ module Implementation = if Flags.debug then System.Console.WriteLine("generated syntax error and shifted error token, haveLookahead = {0}\n", haveLookahead) #endif ) - ) elif kind = acceptFlag then + ) elif kind = acceptFlag then finished <- true #if __DEBUG else if Flags.debug then System.Console.WriteLine("ALARM!!! drop through case in parser") #endif - done + done // OK, we're done - read off the overall generated value valueStack.Peep().value type Tables<'tok> with - member tables.Interpret (lexer,lexbuf,startState) = + member tables.Interpret (lexer,lexbuf,startState) = Implementation.interpret tables lexer lexbuf startState - -module ParseHelpers = + +module ParseHelpers = let parse_error (_s:string) = () let parse_error_rich = (None : (ParseErrorContext<_> -> unit) option) diff --git a/buildtools/fslex/Parsing.fsi b/buildtools/fslex/Parsing.fsi index 68ab4dbfcdf..1f5cf0ff97d 100644 --- a/buildtools/fslex/Parsing.fsi +++ b/buildtools/fslex/Parsing.fsi @@ -8,43 +8,43 @@ open FSharp.Text.Lexing open System.Collections.Generic /// The information accessible via the parseState value within parser actions. -type IParseState = +type IParseState = /// Get the start and end position for the terminal or non-terminal at a given index matched by the production abstract InputRange: index:int -> Position * Position /// Get the end position for the terminal or non-terminal at a given index matched by the production - abstract InputEndPosition: int -> Position + abstract InputEndPosition: int -> Position /// Get the start position for the terminal or non-terminal at a given index matched by the production - abstract InputStartPosition: int -> Position + abstract InputStartPosition: int -> Position /// Get the full range of positions matched by the production abstract ResultRange: Position * Position /// Get the value produced by the terminal or non-terminal at the given position - abstract GetInput : int -> obj + abstract GetInput : int -> obj /// Get the store of local values associated with this parser // Dynamically typed, non-lexically scoped local store abstract ParserLocalStore : IDictionary /// Raise an error in this parse context - abstract RaiseError<'b> : unit -> 'b + abstract RaiseError<'b> : unit -> 'b [] /// The context provided when a parse error occurs type ParseErrorContext<'tok> = - /// The stack of state indexes active at the parse error + /// The stack of state indexes active at the parse error member StateStack : int list - /// The state active at the parse error + /// The state active at the parse error member ParseState : IParseState - /// The tokens that would cause a reduction at the parse error + /// The tokens that would cause a reduction at the parse error member ReduceTokens: int list - /// The stack of productions that would be reduced at the parse error + /// The stack of productions that would be reduced at the parse error member ReducibleProductions : int list list /// The token that caused the parse error @@ -58,60 +58,60 @@ type ParseErrorContext<'tok> = /// Tables generated by fsyacc /// The type of the tables contained in a file produced by the fsyacc.exe parser generator. -type Tables<'tok> = - { +type Tables<'tok> = + { /// The reduction table reductions: (IParseState -> obj) array ; - + /// The token number indicating the end of input endOfInputTag: int; - + /// A function to compute the tag of a token tagOfToken: 'tok -> int; - + /// A function to compute the data carried by a token - dataOfToken: 'tok -> obj; - + dataOfToken: 'tok -> obj; + /// The sparse action table elements actionTableElements: uint16[]; - + /// The sparse action table row offsets actionTableRowOffsets: uint16[]; - + /// The number of symbols for each reduction reductionSymbolCounts: uint16[]; - + /// The immediate action table - immediateActions: uint16[]; - + immediateActions: uint16[]; + /// The sparse goto table gotos: uint16[]; - + /// The sparse goto table row offsets sparseGotoTableRowOffsets: uint16[]; - + /// The sparse table for the productions active for each state - stateToProdIdxsTableElements: uint16[]; - + stateToProdIdxsTableElements: uint16[]; + /// The sparse table offsets for the productions active for each state - stateToProdIdxsTableRowOffsets: uint16[]; - + stateToProdIdxsTableRowOffsets: uint16[]; + /// This table is logically part of the Goto table productionToNonTerminalTable: uint16[]; - + /// This function is used to hold the user specified "parse_error" or "parse_error_rich" functions parseError: ParseErrorContext<'tok> -> unit; - - /// The total number of terminals + + /// The total number of terminals numTerminals: int; - + /// The tag of the error terminal - tagOfErrorTerminal: int + tagOfErrorTerminal: int } /// Interpret the parser table taking input from the given lexer, using the given lex buffer, and the given start state. /// Returns an object indicating the final synthesized value for the parse. - member Interpret : lexer:(LexBuffer<'char> -> 'tok) * lexbuf:LexBuffer<'char> * startState:int -> obj + member Interpret : lexer:(LexBuffer<'char> -> 'tok) * lexbuf:LexBuffer<'char> * startState:int -> obj /// Indicates an accept action has occurred exception Accept of obj @@ -124,10 +124,10 @@ module internal Flags = #endif /// Helpers used by generated parsers. -module ParseHelpers = +module ParseHelpers = /// The default implementation of the parse_error_rich function val parse_error_rich: (ParseErrorContext<'tok> -> unit) option - + /// The default implementation of the parse_error function val parse_error: string -> unit diff --git a/buildtools/fslex/fslex.fs b/buildtools/fslex/fslex.fs index ffd9449caf0..8770700f72a 100644 --- a/buildtools/fslex/fslex.fs +++ b/buildtools/fslex/fslex.fs @@ -26,7 +26,7 @@ let usage = [ ArgInfo ("-o", ArgType.String (fun s -> out <- Some s), "Name the output file.") ArgInfo ("--module", ArgType.String (fun s -> modname <- Some s), "Define the F# module name to host the generated parser."); ArgInfo ("--internal", ArgType.Unit (fun () -> internal_module <- true), "Generate an internal module"); - ArgInfo("--open", ArgType.String (fun s -> opens <- opens @ [s]), "Add the given module to the list of those to open in both the generated signature and implementation."); + ArgInfo("--open", ArgType.String (fun s -> opens <- opens @ [s]), "Add the given module to the list of those to open in both the generated signature and implementation."); ArgInfo ("--codepage", ArgType.Int (fun i -> inputCodePage <- Some i), "Assume input lexer specification file is encoded with the given codepage.") ArgInfo ("--light", ArgType.Unit (fun () -> light <- Some true), "(ignored)") ArgInfo ("--light-off", ArgType.Unit (fun () -> light <- Some false), "Add #light \"off\" to the top of the generated file") @@ -38,15 +38,15 @@ let usage = let _ = ArgParser.Parse(usage, (fun x -> match input with Some _ -> failwith "more than one input given" | None -> input <- Some x), "fslex ") let compileSpec (spec: Spec) (ctx: ParseContext) = - let perRuleData, dfaNodes = Compile ctx spec + let perRuleData, dfaNodes = Compile ctx spec let dfaNodes = dfaNodes |> List.sortBy (fun n -> n.Id) perRuleData, dfaNodes let main() = try let filename = (match input with Some x -> x | None -> failwith "no input given") - let parseContext = - { unicode = unicode + let parseContext = + { unicode = unicode caseInsensitive = caseInsensitive } let spec = match readSpecFromFile filename inputCodePage with diff --git a/buildtools/fslex/fslexast.fs b/buildtools/fslex/fslexast.fs index 6c9e790101c..ed8e34ea01e 100644 --- a/buildtools/fslex/fslexast.fs +++ b/buildtools/fslex/fslexast.fs @@ -261,7 +261,7 @@ let LexerStateToNfa ctx (macros: Map) (clauses: Clause list) = // Note we've delayed the expansion of these until we've worked out all the 'special' Unicode characters // mentioned in the entire lexer spec, i.e. we wait until GetAlphabet returns a reliable and stable answer. | Inp (UnicodeCategory uc) -> - let re = Alt(fun ctx -> + let re = Alt(fun ctx -> [ yield Inp(Alphabet(EncodeUnicodeCategory uc)) // Also include any specific characters in this category for c in GetSingleCharAlphabet ctx do @@ -277,7 +277,7 @@ let LexerStateToNfa ctx (macros: Map) (clauses: Clause list) = | Inp (NotCharSet chars) -> let chars = chars ctx - let re = Alt(fun ctx -> + let re = Alt(fun ctx -> [ // Include any characters from those in the alphabet besides those that are not immediately excluded for c in GetSingleCharAlphabet ctx do let ec = EncodeChar c ctx @@ -327,12 +327,12 @@ type NfaNodeIdSet(nodes: NfaNodeIdSetBuilder) = member x.Representation = s member x.Elements = s member x.Fold f z = Array.fold f z s - interface System.IComparable with + interface System.IComparable with member x.CompareTo(y:obj) = Array.compareWith compare x.Representation (y :?> NfaNodeIdSet).Representation - override x.Equals(y:obj) = - match y with + override x.Equals(y:obj) = + match y with | :? NfaNodeIdSet as y -> let xr = x.Representation let yr = y.Representation diff --git a/buildtools/fslex/fslexdriver.fs b/buildtools/fslex/fslexdriver.fs index 5bfb798ec58..a5f9880c530 100644 --- a/buildtools/fslex/fslexdriver.fs +++ b/buildtools/fslex/fslexdriver.fs @@ -1,4 +1,4 @@ -module FsLexYacc.FsLex.Driver +module FsLexYacc.FsLex.Driver open FsLexYacc.FsLex.AST open System @@ -51,16 +51,16 @@ type Writer(outputFileName, outputFileInterface) = os.Write "us;" member x.LineCount = lineCount - - member x.WriteInterface format = + + member x.WriteInterface format = fprintf osi format - - member x.WriteLineInterface format = - Printf.kfprintf (fun _ -> + + member x.WriteLineInterface format = + Printf.kfprintf (fun _ -> interfaceLineCount <- interfaceLineCount + 1 osi.WriteLine () ) osi format - + member x.InterfaceLineCount = interfaceLineCount interface IDisposable with @@ -97,7 +97,7 @@ let writeModuleExpression genModuleName isInternal (writer: Writer) = let writeOpens opens (writer: Writer) = writer.WriteLine "" writer.WriteLineInterface "" - + for s in opens do writer.WriteLine "open %s" s writer.WriteLineInterface "open %s" s @@ -109,7 +109,7 @@ let writeOpens opens (writer: Writer) = let writeTopCode code (writer: Writer) = writer.WriteCode code let writeUnicodeTranslationArray dfaNodes domain (writer: Writer) = - let parseContext = + let parseContext = { unicode = match domain with | Unicode -> true | ASCII -> false caseInsensitive = false } writer.WriteLine "let trans : uint16[] array = " @@ -213,7 +213,7 @@ let writeRules (rules: Rule list) (perRuleData: PerRuleData) outputFileName (wri |> String.concat " " writer.WriteLine "and %s %s lexbuf =" ident arguments - + let signature = if List.isEmpty args then sprintf "val %s: lexbuf: LexBuffer -> token" ident @@ -228,7 +228,7 @@ let writeRules (rules: Rule list) (perRuleData: PerRuleData) outputFileName (wri |> sprintf "val %s: %s -> lexbuf: LexBuffer -> token" ident writer.WriteLineInterface "%s" signature - + writer.WriteLine " match _fslex_tables.Interpret(%d,lexbuf) with" startNode.Id actions |> Seq.iteri (fun i (code:string, pos) -> writer.WriteLine " | %d -> ( " i diff --git a/buildtools/fslex/fslexlex.fs b/buildtools/fslex/fslexlex.fs index 987b6904d04..3d6754b26f7 100644 --- a/buildtools/fslex/fslexlex.fs +++ b/buildtools/fslex/fslexlex.fs @@ -1,16 +1,16 @@ # 1 "fslexlex.fsl" - + (* (c) Microsoft Corporation 2005-2008. *) - + module FsLexYacc.FsLex.Lexer - + open FsLexYacc.FsLex.AST open FsLexYacc.FsLex.Parser open FSharp.Text open FSharp.Text.Lexing open System.Text -let escape c = +let escape c = match c with | '\\' -> '\\' | '\'' -> '\'' @@ -26,15 +26,15 @@ let newline (lexbuf:LexBuffer<_>) = lexbuf.EndPos <- lexbuf.EndPos.NextLine let unexpected_char lexbuf = failwith ("Unexpected character '"+(lexeme lexbuf)+"'") -let digit d = - if d >= '0' && d <= '9' then int32 d - int32 '0' - else failwith "digit" +let digit d = + if d >= '0' && d <= '9' then int32 d - int32 '0' + else failwith "digit" -let hexdigit d = - if d >= '0' && d <= '9' then digit d +let hexdigit d = + if d >= '0' && d <= '9' then digit d else if d >= 'a' && d <= 'f' then int32 d - int32 'a' + 10 else if d >= 'A' && d <= 'F' then int32 d - int32 'A' + 10 - else failwithf "bad hexdigit: %c" d + else failwithf "bad hexdigit: %c" d let trigraph c1 c2 c3 = char (digit c1 * 100 + digit c2 * 10 + digit c3) @@ -48,18 +48,18 @@ let unicodegraph_short (s:string) = let unicodegraph_long (s:string) = if s.Length <> 8 then failwith "unicodegraph_long"; - let high = hexdigit s.[0] * 4096 + hexdigit s.[1] * 256 + hexdigit s.[2] * 16 + hexdigit s.[3] in - let low = hexdigit s.[4] * 4096 + hexdigit s.[5] * 256 + hexdigit s.[6] * 16 + hexdigit s.[7] in - if high = 0 then None, char low - else + let high = hexdigit s.[0] * 4096 + hexdigit s.[1] * 256 + hexdigit s.[2] * 16 + hexdigit s.[3] in + let low = hexdigit s.[4] * 4096 + hexdigit s.[5] * 256 + hexdigit s.[6] * 16 + hexdigit s.[7] in + if high = 0 then None, char low + else (* A surrogate pair - see http://www.unicode.org/unicode/uni2book/ch03.pdf, section 3.7 *) Some (char(0xD800 + ((high * 0x10000 + low - 0x10000) / 0x400))), char(0xDF30 + ((high * 0x10000 + low - 0x10000) % 0x400)) # 60 "fslexlex.fs" -let trans : uint16[] array = - [| +let trans : uint16[] array = + [| (* State 0 *) [| 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 4us; 8us; 8us; 5us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 2us; 8us; 8us; 8us; 8us; 1us; 3us; 9us; 6us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 8us; 7us; |]; (* State 1 *) @@ -340,391 +340,391 @@ let trans : uint16[] array = [| 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 93us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 65535us; 65535us; 65535us; 65535us; 93us; 65535us; 93us; 93us; 93us; 93us; 139us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; |]; (* State 139 *) [| 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 93us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 65535us; 65535us; 65535us; 65535us; 93us; 65535us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 93us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; |]; - |] + |] let actions : uint16[] = [|65535us; 7us; 1us; 7us; 3us; 7us; 7us; 5us; 6us; 7us; 6us; 4us; 3us; 2us; 65535us; 65535us; 0us; 65535us; 5us; 1us; 2us; 5us; 3us; 4us; 5us; 3us; 2us; 0us; 65535us; 0us; 1us; 8us; 3us; 4us; 8us; 5us; 8us; 7us; 8us; 6us; 6us; 5us; 4us; 2us; 65535us; 7us; 3us; 4us; 7us; 5us; 6us; 7us; 5us; 4us; 0us; 65535us; 1us; 65535us; 65535us; 2us; 65535us; 15us; 15us; 15us; 15us; 15us; 32us; 11us; 12us; 13us; 14us; 32us; 15us; 16us; 17us; 18us; 19us; 20us; 21us; 22us; 23us; 24us; 25us; 26us; 27us; 28us; 29us; 32us; 32us; 33us; 31us; 31us; 30us; 15us; 14us; 13us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 10us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 9us; 65535us; 65535us; 65535us; 65535us; 8us; 65535us; 65535us; 7us; 65535us; 65535us; 6us; 5us; 15us; 4us; 15us; 3us; 15us; 2us; 15us; 15us; 15us; 1us; 15us; 15us; 0us; |] let _fslex_tables = FSharp.Text.Lexing.UnicodeTables.Create(trans,actions) -let rec _fslex_dummy () = _fslex_dummy() +let rec _fslex_dummy () = _fslex_dummy() // Rule token and token lexbuf = match _fslex_tables.Interpret(60,lexbuf) with - | 0 -> ( + | 0 -> ( # 76 "fslexlex.fsl" - RULE + RULE # 353 "fslexlex.fs" ) - | 1 -> ( + | 1 -> ( # 77 "fslexlex.fsl" - PARSE + PARSE # 358 "fslexlex.fs" ) - | 2 -> ( + | 2 -> ( # 78 "fslexlex.fsl" - EOF + EOF # 363 "fslexlex.fs" ) - | 3 -> ( + | 3 -> ( # 79 "fslexlex.fsl" - LET + LET # 368 "fslexlex.fs" ) - | 4 -> ( + | 4 -> ( # 80 "fslexlex.fsl" - AND + AND # 373 "fslexlex.fs" ) - | 5 -> ( + | 5 -> ( # 82 "fslexlex.fsl" - let s = lexeme lexbuf in - CHAR (if s.[1] = '\\' then escape s.[2] else s.[1]) + let s = lexeme lexbuf in + CHAR (if s.[1] = '\\' then escape s.[2] else s.[1]) # 379 "fslexlex.fs" ) - | 6 -> ( + | 6 -> ( # 86 "fslexlex.fsl" - let s = lexeme lexbuf in - CHAR (trigraph s.[2] s.[3] s.[4]) + let s = lexeme lexbuf in + CHAR (trigraph s.[2] s.[3] s.[4]) # 385 "fslexlex.fs" ) - | 7 -> ( + | 7 -> ( # 90 "fslexlex.fsl" - let s = lexeme lexbuf in - CHAR (hexgraph s.[3] s.[4]) + let s = lexeme lexbuf in + CHAR (hexgraph s.[3] s.[4]) # 391 "fslexlex.fs" ) - | 8 -> ( + | 8 -> ( # 94 "fslexlex.fsl" - let s = lexeme lexbuf in - CHAR (unicodegraph_short s.[3..6]) + let s = lexeme lexbuf in + CHAR (unicodegraph_short s.[3..6]) # 397 "fslexlex.fs" ) - | 9 -> ( + | 9 -> ( # 98 "fslexlex.fsl" - let s = lexeme lexbuf in - match (unicodegraph_long s.[3..10]) with + let s = lexeme lexbuf in + match (unicodegraph_long s.[3..10]) with | None, c -> CHAR(c) - | Some _ , _ -> failwith "Unicode characters needing surrogate pairs are not yet supported by this tool" + | Some _ , _ -> failwith "Unicode characters needing surrogate pairs are not yet supported by this tool" # 405 "fslexlex.fs" ) - | 10 -> ( + | 10 -> ( # 104 "fslexlex.fsl" - let s = (lexeme lexbuf).[2..3] in - UNICODE_CATEGORY (s) + let s = (lexeme lexbuf).[2..3] in + UNICODE_CATEGORY (s) # 411 "fslexlex.fs" ) - | 11 -> ( + | 11 -> ( # 107 "fslexlex.fsl" - let p = lexbuf.StartPos in + let p = lexbuf.StartPos in let buff = (new StringBuilder 100) in // adjust the first line to get even indentation for all lines w.r.t. the left hand margin buff.Append (String.replicate (lexbuf.StartPos.Column+1) " ") |> ignore; - code p buff lexbuf + code p buff lexbuf # 420 "fslexlex.fs" ) - | 12 -> ( + | 12 -> ( # 113 "fslexlex.fsl" - string lexbuf.StartPos (new StringBuilder 100) lexbuf + string lexbuf.StartPos (new StringBuilder 100) lexbuf # 425 "fslexlex.fs" ) - | 13 -> ( + | 13 -> ( # 115 "fslexlex.fsl" - token lexbuf + token lexbuf # 430 "fslexlex.fs" ) - | 14 -> ( + | 14 -> ( # 116 "fslexlex.fsl" - newline lexbuf; token lexbuf + newline lexbuf; token lexbuf # 435 "fslexlex.fs" ) - | 15 -> ( + | 15 -> ( # 117 "fslexlex.fsl" - IDENT (lexeme lexbuf) + IDENT (lexeme lexbuf) # 440 "fslexlex.fs" ) - | 16 -> ( + | 16 -> ( # 118 "fslexlex.fsl" - BAR + BAR # 445 "fslexlex.fs" ) - | 17 -> ( + | 17 -> ( # 119 "fslexlex.fsl" - DOT + DOT # 450 "fslexlex.fs" ) - | 18 -> ( + | 18 -> ( # 120 "fslexlex.fsl" - PLUS + PLUS # 455 "fslexlex.fs" ) - | 19 -> ( + | 19 -> ( # 121 "fslexlex.fsl" - STAR + STAR # 460 "fslexlex.fs" ) - | 20 -> ( + | 20 -> ( # 122 "fslexlex.fsl" - QMARK + QMARK # 465 "fslexlex.fs" ) - | 21 -> ( + | 21 -> ( # 123 "fslexlex.fsl" - EQUALS + EQUALS # 470 "fslexlex.fs" ) - | 22 -> ( + | 22 -> ( # 124 "fslexlex.fsl" - LBRACK + LBRACK # 475 "fslexlex.fs" ) - | 23 -> ( + | 23 -> ( # 125 "fslexlex.fsl" - RBRACK + RBRACK # 480 "fslexlex.fs" ) - | 24 -> ( + | 24 -> ( # 126 "fslexlex.fsl" - LPAREN + LPAREN # 485 "fslexlex.fs" ) - | 25 -> ( + | 25 -> ( # 127 "fslexlex.fsl" - RPAREN + RPAREN # 490 "fslexlex.fs" ) - | 26 -> ( + | 26 -> ( # 128 "fslexlex.fsl" - COLON + COLON # 495 "fslexlex.fs" ) - | 27 -> ( + | 27 -> ( # 129 "fslexlex.fsl" - UNDERSCORE + UNDERSCORE # 500 "fslexlex.fs" ) - | 28 -> ( + | 28 -> ( # 130 "fslexlex.fsl" - HAT + HAT # 505 "fslexlex.fs" ) - | 29 -> ( + | 29 -> ( # 131 "fslexlex.fsl" - DASH + DASH # 510 "fslexlex.fs" ) - | 30 -> ( + | 30 -> ( # 132 "fslexlex.fsl" - ignore(comment lexbuf.StartPos lexbuf); token lexbuf + ignore(comment lexbuf.StartPos lexbuf); token lexbuf # 515 "fslexlex.fs" ) - | 31 -> ( + | 31 -> ( # 133 "fslexlex.fsl" - token lexbuf + token lexbuf # 520 "fslexlex.fs" ) - | 32 -> ( + | 32 -> ( # 134 "fslexlex.fsl" - unexpected_char lexbuf + unexpected_char lexbuf # 525 "fslexlex.fs" ) - | 33 -> ( + | 33 -> ( # 135 "fslexlex.fsl" - EOF + EOF # 530 "fslexlex.fs" ) | _ -> failwith "token" // Rule string and string p buff lexbuf = match _fslex_tables.Interpret(44,lexbuf) with - | 0 -> ( + | 0 -> ( # 137 "fslexlex.fsl" - newline lexbuf; string p buff lexbuf + newline lexbuf; string p buff lexbuf # 539 "fslexlex.fs" ) - | 1 -> ( + | 1 -> ( # 139 "fslexlex.fsl" let _ = buff.Append (escape (lexeme lexbuf).[1]) in - string p buff lexbuf + string p buff lexbuf # 545 "fslexlex.fs" ) - | 2 -> ( + | 2 -> ( # 142 "fslexlex.fsl" - let s = lexeme lexbuf in + let s = lexeme lexbuf in let _ = buff.Append (trigraph s.[1] s.[2] s.[3]) in - string p buff lexbuf + string p buff lexbuf # 552 "fslexlex.fs" ) - | 3 -> ( + | 3 -> ( # 145 "fslexlex.fsl" - STRING (buff.ToString()) + STRING (buff.ToString()) # 557 "fslexlex.fs" ) - | 4 -> ( + | 4 -> ( # 146 "fslexlex.fsl" - newline lexbuf; + newline lexbuf; let _ = buff.Append System.Environment.NewLine in - string p buff lexbuf + string p buff lexbuf # 564 "fslexlex.fs" ) - | 5 -> ( + | 5 -> ( # 150 "fslexlex.fsl" - let _ = buff.Append (lexeme lexbuf) in - string p buff lexbuf + let _ = buff.Append (lexeme lexbuf) in + string p buff lexbuf # 570 "fslexlex.fs" ) - | 6 -> ( + | 6 -> ( # 152 "fslexlex.fsl" - failwith (Printf.sprintf "end of file in string started at (%d,%d)" p.pos_lnum (p.pos_cnum - p.pos_bol)) + failwith (Printf.sprintf "end of file in string started at (%d,%d)" p.pos_lnum (p.pos_cnum - p.pos_bol)) # 575 "fslexlex.fs" ) - | 7 -> ( + | 7 -> ( # 153 "fslexlex.fsl" let _ = buff.Append (lexeme lexbuf).[0] in - string p buff lexbuf + string p buff lexbuf # 581 "fslexlex.fs" ) | _ -> failwith "string" // Rule code and code p buff lexbuf = match _fslex_tables.Interpret(28,lexbuf) with - | 0 -> ( + | 0 -> ( # 156 "fslexlex.fsl" - CODE (buff.ToString(), p) + CODE (buff.ToString(), p) # 590 "fslexlex.fs" ) - | 1 -> ( + | 1 -> ( # 157 "fslexlex.fsl" - let _ = buff.Append (lexeme lexbuf) in - ignore(code p buff lexbuf); + let _ = buff.Append (lexeme lexbuf) in + ignore(code p buff lexbuf); let _ = buff.Append "}" in - code p buff lexbuf + code p buff lexbuf # 598 "fslexlex.fs" ) - | 2 -> ( + | 2 -> ( # 162 "fslexlex.fsl" - let _ = buff.Append (lexeme lexbuf) in - code p buff lexbuf + let _ = buff.Append (lexeme lexbuf) in + code p buff lexbuf # 604 "fslexlex.fs" ) - | 3 -> ( + | 3 -> ( # 164 "fslexlex.fsl" - let _ = buff.Append (lexeme lexbuf) in - ignore(codestring buff lexbuf); - code p buff lexbuf + let _ = buff.Append (lexeme lexbuf) in + ignore(codestring buff lexbuf); + code p buff lexbuf # 611 "fslexlex.fs" ) - | 4 -> ( + | 4 -> ( # 167 "fslexlex.fsl" - newline lexbuf; + newline lexbuf; let _ = buff.Append System.Environment.NewLine in - code p buff lexbuf + code p buff lexbuf # 618 "fslexlex.fs" ) - | 5 -> ( + | 5 -> ( # 171 "fslexlex.fsl" - let _ = buff.Append (lexeme lexbuf) in - code p buff lexbuf + let _ = buff.Append (lexeme lexbuf) in + code p buff lexbuf # 624 "fslexlex.fs" ) - | 6 -> ( + | 6 -> ( # 174 "fslexlex.fsl" let _ = buff.Append (lexeme lexbuf) in - code p buff lexbuf + code p buff lexbuf # 630 "fslexlex.fs" ) - | 7 -> ( + | 7 -> ( # 176 "fslexlex.fsl" - EOF + EOF # 635 "fslexlex.fs" ) - | 8 -> ( + | 8 -> ( # 177 "fslexlex.fsl" let _ = buff.Append (lexeme lexbuf).[0] in - code p buff lexbuf + code p buff lexbuf # 641 "fslexlex.fs" ) | _ -> failwith "code" // Rule codestring and codestring buff lexbuf = match _fslex_tables.Interpret(17,lexbuf) with - | 0 -> ( + | 0 -> ( # 182 "fslexlex.fsl" - let _ = buff.Append (lexeme lexbuf) in - codestring buff lexbuf + let _ = buff.Append (lexeme lexbuf) in + codestring buff lexbuf # 651 "fslexlex.fs" ) - | 1 -> ( + | 1 -> ( # 184 "fslexlex.fsl" - let _ = buff.Append (lexeme lexbuf) in - buff.ToString() + let _ = buff.Append (lexeme lexbuf) in + buff.ToString() # 657 "fslexlex.fs" ) - | 2 -> ( + | 2 -> ( # 186 "fslexlex.fsl" - newline lexbuf; + newline lexbuf; let _ = buff.Append System.Environment.NewLine in - codestring buff lexbuf + codestring buff lexbuf # 664 "fslexlex.fs" ) - | 3 -> ( + | 3 -> ( # 190 "fslexlex.fsl" - let _ = buff.Append (lexeme lexbuf) in - codestring buff lexbuf + let _ = buff.Append (lexeme lexbuf) in + codestring buff lexbuf # 670 "fslexlex.fs" ) - | 4 -> ( + | 4 -> ( # 192 "fslexlex.fsl" - failwith "unterminated string in code" + failwith "unterminated string in code" # 675 "fslexlex.fs" ) - | 5 -> ( + | 5 -> ( # 193 "fslexlex.fsl" let _ = buff.Append (lexeme lexbuf).[0] in - codestring buff lexbuf + codestring buff lexbuf # 681 "fslexlex.fs" ) | _ -> failwith "codestring" // Rule comment and comment p lexbuf = match _fslex_tables.Interpret(0,lexbuf) with - | 0 -> ( + | 0 -> ( # 197 "fslexlex.fsl" - comment p lexbuf + comment p lexbuf # 690 "fslexlex.fs" ) - | 1 -> ( + | 1 -> ( # 198 "fslexlex.fsl" - ignore(try string lexbuf.StartPos (new StringBuilder 100) lexbuf - with Failure s -> failwith (s + "\n" + Printf.sprintf "error while processing string nested in comment started at (%d,%d)" p.pos_lnum (p.pos_cnum - p.pos_bol))); - comment p lexbuf + ignore(try string lexbuf.StartPos (new StringBuilder 100) lexbuf + with Failure s -> failwith (s + "\n" + Printf.sprintf "error while processing string nested in comment started at (%d,%d)" p.pos_lnum (p.pos_cnum - p.pos_bol))); + comment p lexbuf # 697 "fslexlex.fs" ) - | 2 -> ( + | 2 -> ( # 201 "fslexlex.fsl" - ignore(try comment p lexbuf with Failure s -> failwith (s + "\n" + Printf.sprintf "error while processing nested comment started at (%d,%d)" p.pos_lnum (p.pos_cnum - p.pos_bol))); - comment p lexbuf + ignore(try comment p lexbuf with Failure s -> failwith (s + "\n" + Printf.sprintf "error while processing nested comment started at (%d,%d)" p.pos_lnum (p.pos_cnum - p.pos_bol))); + comment p lexbuf # 703 "fslexlex.fs" ) - | 3 -> ( + | 3 -> ( # 203 "fslexlex.fsl" - newline lexbuf; comment p lexbuf + newline lexbuf; comment p lexbuf # 708 "fslexlex.fs" ) - | 4 -> ( + | 4 -> ( # 204 "fslexlex.fsl" - () + () # 713 "fslexlex.fs" ) - | 5 -> ( + | 5 -> ( # 205 "fslexlex.fsl" - failwith (Printf.sprintf "end of file in comment started at (%d,%d)" p.pos_lnum (p.pos_cnum - p.pos_bol)) + failwith (Printf.sprintf "end of file in comment started at (%d,%d)" p.pos_lnum (p.pos_cnum - p.pos_bol)) # 718 "fslexlex.fs" ) - | 6 -> ( + | 6 -> ( # 206 "fslexlex.fsl" - comment p lexbuf + comment p lexbuf # 723 "fslexlex.fs" ) - | 7 -> ( + | 7 -> ( # 207 "fslexlex.fsl" - comment p lexbuf + comment p lexbuf # 728 "fslexlex.fs" ) | _ -> failwith "comment" diff --git a/buildtools/fslex/fslexpars.fs b/buildtools/fslex/fslexpars.fs index ce0d157ae22..ffe6db13a6e 100644 --- a/buildtools/fslex/fslexpars.fs +++ b/buildtools/fslex/fslexpars.fs @@ -13,7 +13,7 @@ open FsLexYacc.FsLex.AST # 14 "fslexpars.fs" // This type is the type of tokens accepted by the parser -type token = +type token = | EOF | BAR | DOT @@ -39,7 +39,7 @@ type token = | STRING of (string) | IDENT of (string) // This type is used to give symbolic names to token indexes, useful for error messages -type tokenId = +type tokenId = | TOKEN_EOF | TOKEN_BAR | TOKEN_DOT @@ -67,7 +67,7 @@ type tokenId = | TOKEN_end_of_input | TOKEN_error // This type is used to give symbolic names to token indexes, useful for error messages -type nonTerminalId = +type nonTerminalId = | NONTERM__startspec | NONTERM_spec | NONTERM_codeopt @@ -83,162 +83,162 @@ type nonTerminalId = | NONTERM_charset // This function maps tokens to integer indexes -let tagOfToken (t:token) = +let tagOfToken (t:token) = match t with - | EOF -> 0 - | BAR -> 1 - | DOT -> 2 - | PLUS -> 3 - | STAR -> 4 - | QMARK -> 5 - | EQUALS -> 6 - | UNDERSCORE -> 7 - | LBRACK -> 8 - | RBRACK -> 9 - | HAT -> 10 - | DASH -> 11 - | RULE -> 12 - | PARSE -> 13 - | LET -> 14 - | AND -> 15 - | LPAREN -> 16 - | RPAREN -> 17 - | COLON -> 18 - | UNICODE_CATEGORY _ -> 19 - | CHAR _ -> 20 - | CODE _ -> 21 - | STRING _ -> 22 - | IDENT _ -> 23 + | EOF -> 0 + | BAR -> 1 + | DOT -> 2 + | PLUS -> 3 + | STAR -> 4 + | QMARK -> 5 + | EQUALS -> 6 + | UNDERSCORE -> 7 + | LBRACK -> 8 + | RBRACK -> 9 + | HAT -> 10 + | DASH -> 11 + | RULE -> 12 + | PARSE -> 13 + | LET -> 14 + | AND -> 15 + | LPAREN -> 16 + | RPAREN -> 17 + | COLON -> 18 + | UNICODE_CATEGORY _ -> 19 + | CHAR _ -> 20 + | CODE _ -> 21 + | STRING _ -> 22 + | IDENT _ -> 23 // This function maps integer indexes to symbolic token ids -let tokenTagToTokenId (tokenIdx:int) = +let tokenTagToTokenId (tokenIdx:int) = match tokenIdx with - | 0 -> TOKEN_EOF - | 1 -> TOKEN_BAR - | 2 -> TOKEN_DOT - | 3 -> TOKEN_PLUS - | 4 -> TOKEN_STAR - | 5 -> TOKEN_QMARK - | 6 -> TOKEN_EQUALS - | 7 -> TOKEN_UNDERSCORE - | 8 -> TOKEN_LBRACK - | 9 -> TOKEN_RBRACK - | 10 -> TOKEN_HAT - | 11 -> TOKEN_DASH - | 12 -> TOKEN_RULE - | 13 -> TOKEN_PARSE - | 14 -> TOKEN_LET - | 15 -> TOKEN_AND - | 16 -> TOKEN_LPAREN - | 17 -> TOKEN_RPAREN - | 18 -> TOKEN_COLON - | 19 -> TOKEN_UNICODE_CATEGORY - | 20 -> TOKEN_CHAR - | 21 -> TOKEN_CODE - | 22 -> TOKEN_STRING - | 23 -> TOKEN_IDENT + | 0 -> TOKEN_EOF + | 1 -> TOKEN_BAR + | 2 -> TOKEN_DOT + | 3 -> TOKEN_PLUS + | 4 -> TOKEN_STAR + | 5 -> TOKEN_QMARK + | 6 -> TOKEN_EQUALS + | 7 -> TOKEN_UNDERSCORE + | 8 -> TOKEN_LBRACK + | 9 -> TOKEN_RBRACK + | 10 -> TOKEN_HAT + | 11 -> TOKEN_DASH + | 12 -> TOKEN_RULE + | 13 -> TOKEN_PARSE + | 14 -> TOKEN_LET + | 15 -> TOKEN_AND + | 16 -> TOKEN_LPAREN + | 17 -> TOKEN_RPAREN + | 18 -> TOKEN_COLON + | 19 -> TOKEN_UNICODE_CATEGORY + | 20 -> TOKEN_CHAR + | 21 -> TOKEN_CODE + | 22 -> TOKEN_STRING + | 23 -> TOKEN_IDENT | 26 -> TOKEN_end_of_input | 24 -> TOKEN_error | _ -> failwith "tokenTagToTokenId: bad token" /// This function maps production indexes returned in syntax errors to strings representing the non terminal that would be produced by that production -let prodIdxToNonTerminal (prodIdx:int) = +let prodIdxToNonTerminal (prodIdx:int) = match prodIdx with - | 0 -> NONTERM__startspec - | 1 -> NONTERM_spec - | 2 -> NONTERM_codeopt - | 3 -> NONTERM_codeopt - | 4 -> NONTERM_Macros - | 5 -> NONTERM_Macros - | 6 -> NONTERM_macro - | 7 -> NONTERM_Rules - | 8 -> NONTERM_Rules - | 9 -> NONTERM_rule - | 10 -> NONTERM_args - | 11 -> NONTERM_args - | 12 -> NONTERM_args - | 13 -> NONTERM_optbar - | 14 -> NONTERM_optbar - | 15 -> NONTERM_clauses - | 16 -> NONTERM_clauses - | 17 -> NONTERM_clause - | 18 -> NONTERM_regexp - | 19 -> NONTERM_regexp - | 20 -> NONTERM_regexp - | 21 -> NONTERM_regexp - | 22 -> NONTERM_regexp - | 23 -> NONTERM_regexp - | 24 -> NONTERM_regexp - | 25 -> NONTERM_regexp - | 26 -> NONTERM_regexp - | 27 -> NONTERM_regexp - | 28 -> NONTERM_regexp - | 29 -> NONTERM_regexp - | 30 -> NONTERM_regexp - | 31 -> NONTERM_regexp - | 32 -> NONTERM_charset - | 33 -> NONTERM_charset - | 34 -> NONTERM_charset + | 0 -> NONTERM__startspec + | 1 -> NONTERM_spec + | 2 -> NONTERM_codeopt + | 3 -> NONTERM_codeopt + | 4 -> NONTERM_Macros + | 5 -> NONTERM_Macros + | 6 -> NONTERM_macro + | 7 -> NONTERM_Rules + | 8 -> NONTERM_Rules + | 9 -> NONTERM_rule + | 10 -> NONTERM_args + | 11 -> NONTERM_args + | 12 -> NONTERM_args + | 13 -> NONTERM_optbar + | 14 -> NONTERM_optbar + | 15 -> NONTERM_clauses + | 16 -> NONTERM_clauses + | 17 -> NONTERM_clause + | 18 -> NONTERM_regexp + | 19 -> NONTERM_regexp + | 20 -> NONTERM_regexp + | 21 -> NONTERM_regexp + | 22 -> NONTERM_regexp + | 23 -> NONTERM_regexp + | 24 -> NONTERM_regexp + | 25 -> NONTERM_regexp + | 26 -> NONTERM_regexp + | 27 -> NONTERM_regexp + | 28 -> NONTERM_regexp + | 29 -> NONTERM_regexp + | 30 -> NONTERM_regexp + | 31 -> NONTERM_regexp + | 32 -> NONTERM_charset + | 33 -> NONTERM_charset + | 34 -> NONTERM_charset | _ -> failwith "prodIdxToNonTerminal: bad production index" -let _fsyacc_endOfInputTag = 26 +let _fsyacc_endOfInputTag = 26 let _fsyacc_tagOfErrorTerminal = 24 // This function gets the name of a token as a string -let token_to_string (t:token) = - match t with - | EOF -> "EOF" - | BAR -> "BAR" - | DOT -> "DOT" - | PLUS -> "PLUS" - | STAR -> "STAR" - | QMARK -> "QMARK" - | EQUALS -> "EQUALS" - | UNDERSCORE -> "UNDERSCORE" - | LBRACK -> "LBRACK" - | RBRACK -> "RBRACK" - | HAT -> "HAT" - | DASH -> "DASH" - | RULE -> "RULE" - | PARSE -> "PARSE" - | LET -> "LET" - | AND -> "AND" - | LPAREN -> "LPAREN" - | RPAREN -> "RPAREN" - | COLON -> "COLON" - | UNICODE_CATEGORY _ -> "UNICODE_CATEGORY" - | CHAR _ -> "CHAR" - | CODE _ -> "CODE" - | STRING _ -> "STRING" - | IDENT _ -> "IDENT" +let token_to_string (t:token) = + match t with + | EOF -> "EOF" + | BAR -> "BAR" + | DOT -> "DOT" + | PLUS -> "PLUS" + | STAR -> "STAR" + | QMARK -> "QMARK" + | EQUALS -> "EQUALS" + | UNDERSCORE -> "UNDERSCORE" + | LBRACK -> "LBRACK" + | RBRACK -> "RBRACK" + | HAT -> "HAT" + | DASH -> "DASH" + | RULE -> "RULE" + | PARSE -> "PARSE" + | LET -> "LET" + | AND -> "AND" + | LPAREN -> "LPAREN" + | RPAREN -> "RPAREN" + | COLON -> "COLON" + | UNICODE_CATEGORY _ -> "UNICODE_CATEGORY" + | CHAR _ -> "CHAR" + | CODE _ -> "CODE" + | STRING _ -> "STRING" + | IDENT _ -> "IDENT" // This function gets the data carried by a token as an object -let _fsyacc_dataOfToken (t:token) = - match t with - | EOF -> (null : System.Object) - | BAR -> (null : System.Object) - | DOT -> (null : System.Object) - | PLUS -> (null : System.Object) - | STAR -> (null : System.Object) - | QMARK -> (null : System.Object) - | EQUALS -> (null : System.Object) - | UNDERSCORE -> (null : System.Object) - | LBRACK -> (null : System.Object) - | RBRACK -> (null : System.Object) - | HAT -> (null : System.Object) - | DASH -> (null : System.Object) - | RULE -> (null : System.Object) - | PARSE -> (null : System.Object) - | LET -> (null : System.Object) - | AND -> (null : System.Object) - | LPAREN -> (null : System.Object) - | RPAREN -> (null : System.Object) - | COLON -> (null : System.Object) - | UNICODE_CATEGORY _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x - | CHAR _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x - | CODE _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x - | STRING _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x - | IDENT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x +let _fsyacc_dataOfToken (t:token) = + match t with + | EOF -> (null : System.Object) + | BAR -> (null : System.Object) + | DOT -> (null : System.Object) + | PLUS -> (null : System.Object) + | STAR -> (null : System.Object) + | QMARK -> (null : System.Object) + | EQUALS -> (null : System.Object) + | UNDERSCORE -> (null : System.Object) + | LBRACK -> (null : System.Object) + | RBRACK -> (null : System.Object) + | HAT -> (null : System.Object) + | DASH -> (null : System.Object) + | RULE -> (null : System.Object) + | PARSE -> (null : System.Object) + | LET -> (null : System.Object) + | AND -> (null : System.Object) + | LPAREN -> (null : System.Object) + | RPAREN -> (null : System.Object) + | COLON -> (null : System.Object) + | UNICODE_CATEGORY _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x + | CHAR _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x + | CODE _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x + | STRING _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x + | IDENT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x let _fsyacc_gotos = [| 0us; 65535us; 1us; 65535us; 0us; 1us; 2us; 65535us; 0us; 2us; 5us; 6us; 2us; 65535us; 2us; 3us; 8us; 9us; 2us; 65535us; 2us; 8us; 8us; 8us; 2us; 65535us; 4us; 5us; 15us; 16us; 2us; 65535us; 4us; 14us; 15us; 14us; 3us; 65535us; 17us; 18us; 27us; 28us; 29us; 30us; 1us; 65535us; 20us; 21us; 2us; 65535us; 21us; 22us; 33us; 34us; 2us; 65535us; 21us; 32us; 33us; 32us; 10us; 65535us; 12us; 13us; 13us; 43us; 21us; 35us; 33us; 35us; 35us; 43us; 43us; 43us; 44us; 43us; 45us; 43us; 49us; 44us; 50us; 45us; 5us; 65535us; 52us; 53us; 53us; 61us; 55us; 56us; 56us; 61us; 61us; 61us; |] let _fsyacc_sparseGotoTableRowOffsets = [|0us; 1us; 3us; 6us; 9us; 12us; 15us; 18us; 22us; 24us; 27us; 30us; 41us; |] let _fsyacc_stateToProdIdxsTableElements = [| 1us; 0us; 1us; 0us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 2us; 1us; 5us; 1us; 5us; 1us; 6us; 1us; 6us; 1us; 6us; 6us; 6us; 24us; 25us; 26us; 27us; 28us; 2us; 7us; 8us; 1us; 7us; 1us; 7us; 1us; 9us; 1us; 9us; 1us; 9us; 1us; 9us; 1us; 9us; 1us; 9us; 1us; 11us; 1us; 11us; 1us; 11us; 1us; 11us; 1us; 11us; 1us; 11us; 1us; 12us; 1us; 12us; 1us; 14us; 2us; 15us; 16us; 1us; 15us; 1us; 15us; 6us; 17us; 24us; 25us; 26us; 27us; 28us; 1us; 17us; 1us; 18us; 1us; 19us; 1us; 20us; 1us; 21us; 1us; 22us; 1us; 23us; 6us; 24us; 24us; 25us; 26us; 27us; 28us; 6us; 24us; 25us; 26us; 27us; 28us; 28us; 6us; 24us; 25us; 26us; 27us; 28us; 29us; 1us; 25us; 1us; 26us; 1us; 27us; 1us; 28us; 1us; 29us; 1us; 29us; 2us; 30us; 31us; 2us; 30us; 34us; 1us; 30us; 1us; 31us; 2us; 31us; 34us; 1us; 31us; 2us; 32us; 33us; 1us; 33us; 1us; 33us; 2us; 34us; 34us; |] @@ -249,7 +249,7 @@ let _fsyacc_actionTableRowOffsets = [|0us; 2us; 3us; 5us; 7us; 9us; 11us; 12us; let _fsyacc_reductionSymbolCounts = [|1us; 5us; 1us; 0us; 0us; 2us; 4us; 3us; 1us; 6us; 0us; 6us; 2us; 0us; 1us; 3us; 1us; 2us; 1us; 1us; 1us; 1us; 1us; 1us; 2us; 2us; 2us; 2us; 3us; 3us; 3us; 4us; 1us; 3us; 2us; |] let _fsyacc_productionToNonTerminalTable = [|0us; 1us; 2us; 2us; 3us; 3us; 4us; 5us; 5us; 6us; 7us; 7us; 7us; 8us; 8us; 9us; 9us; 10us; 11us; 11us; 11us; 11us; 11us; 11us; 11us; 11us; 11us; 11us; 11us; 11us; 11us; 11us; 12us; 12us; 12us; |] let _fsyacc_immediateActions = [|65535us; 49152us; 65535us; 65535us; 65535us; 65535us; 16385us; 16386us; 65535us; 16389us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16391us; 65535us; 65535us; 65535us; 65535us; 65535us; 16393us; 65535us; 65535us; 65535us; 65535us; 65535us; 16395us; 65535us; 16396us; 16398us; 65535us; 65535us; 16399us; 65535us; 16401us; 16402us; 16403us; 16404us; 16405us; 16406us; 16407us; 65535us; 65535us; 65535us; 16409us; 16410us; 16411us; 65535us; 65535us; 16413us; 65535us; 65535us; 16414us; 65535us; 65535us; 16415us; 65535us; 65535us; 16417us; 65535us; |] -let _fsyacc_reductions () = [| +let _fsyacc_reductions () = [| # 253 "fslexpars.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> AST.Spec in @@ -269,7 +269,7 @@ let _fsyacc_reductions () = [| ( ( # 25 "fslexpars.fsy" - + { TopCode=_1;Macros=_2;Rules=_4;BottomCode=_5 } ) # 25 "fslexpars.fsy" @@ -281,7 +281,7 @@ let _fsyacc_reductions () = [| ( ( # 30 "fslexpars.fsy" - _1 + _1 ) # 30 "fslexpars.fsy" : 'gentype_codeopt)); @@ -291,7 +291,7 @@ let _fsyacc_reductions () = [| ( ( # 31 "fslexpars.fsy" - "", (parseState.ResultRange |> fst) + "", (parseState.ResultRange |> fst) ) # 31 "fslexpars.fsy" : 'gentype_codeopt)); @@ -301,7 +301,7 @@ let _fsyacc_reductions () = [| ( ( # 34 "fslexpars.fsy" - [] + [] ) # 34 "fslexpars.fsy" : 'gentype_Macros)); @@ -313,7 +313,7 @@ let _fsyacc_reductions () = [| ( ( # 35 "fslexpars.fsy" - + _1 :: _2 ) # 35 "fslexpars.fsy" @@ -326,7 +326,7 @@ let _fsyacc_reductions () = [| ( ( # 40 "fslexpars.fsy" - + (_2, _4) ) # 40 "fslexpars.fsy" @@ -339,7 +339,7 @@ let _fsyacc_reductions () = [| ( ( # 45 "fslexpars.fsy" - + _1 :: _3 ) # 45 "fslexpars.fsy" @@ -351,7 +351,7 @@ let _fsyacc_reductions () = [| ( ( # 48 "fslexpars.fsy" - [_1] + [_1] ) # 48 "fslexpars.fsy" : 'gentype_Rules)); @@ -365,7 +365,7 @@ let _fsyacc_reductions () = [| ( ( # 51 "fslexpars.fsy" - + (_1,_2,_6) ) # 51 "fslexpars.fsy" @@ -376,7 +376,7 @@ let _fsyacc_reductions () = [| ( ( # 56 "fslexpars.fsy" - [] + [] ) # 56 "fslexpars.fsy" : 'gentype_args)); @@ -389,7 +389,7 @@ let _fsyacc_reductions () = [| ( ( # 57 "fslexpars.fsy" - RuleArgument.Typed(_2, _4) :: _6 + RuleArgument.Typed(_2, _4) :: _6 ) # 57 "fslexpars.fsy" : 'gentype_args)); @@ -401,7 +401,7 @@ let _fsyacc_reductions () = [| ( ( # 58 "fslexpars.fsy" - RuleArgument.Ident(_1) :: _2 + RuleArgument.Ident(_1) :: _2 ) # 58 "fslexpars.fsy" : 'gentype_args)); @@ -411,7 +411,7 @@ let _fsyacc_reductions () = [| ( ( # 61 "fslexpars.fsy" - + ) # 61 "fslexpars.fsy" : 'gentype_optbar)); @@ -421,7 +421,7 @@ let _fsyacc_reductions () = [| ( ( # 62 "fslexpars.fsy" - + ) # 62 "fslexpars.fsy" : 'gentype_optbar)); @@ -433,7 +433,7 @@ let _fsyacc_reductions () = [| ( ( # 65 "fslexpars.fsy" - _1 :: _3 + _1 :: _3 ) # 65 "fslexpars.fsy" : 'gentype_clauses)); @@ -444,7 +444,7 @@ let _fsyacc_reductions () = [| ( ( # 66 "fslexpars.fsy" - [_1] + [_1] ) # 66 "fslexpars.fsy" : 'gentype_clauses)); @@ -456,7 +456,7 @@ let _fsyacc_reductions () = [| ( ( # 69 "fslexpars.fsy" - _1, _2 + _1, _2 ) # 69 "fslexpars.fsy" : 'gentype_clause)); @@ -498,7 +498,7 @@ let _fsyacc_reductions () = [| ( ( # 75 "fslexpars.fsy" - Inp Any + Inp Any ) # 75 "fslexpars.fsy" : 'gentype_regexp)); @@ -520,7 +520,7 @@ let _fsyacc_reductions () = [| ( ( # 77 "fslexpars.fsy" - Macro(_1) + Macro(_1) ) # 77 "fslexpars.fsy" : 'gentype_regexp)); @@ -532,7 +532,7 @@ let _fsyacc_reductions () = [| ( ( # 78 "fslexpars.fsy" - Seq[_1;_2] + Seq[_1;_2] ) # 78 "fslexpars.fsy" : 'gentype_regexp)); @@ -543,7 +543,7 @@ let _fsyacc_reductions () = [| ( ( # 79 "fslexpars.fsy" - Seq[_1;Star _1] + Seq[_1;Star _1] ) # 79 "fslexpars.fsy" : 'gentype_regexp)); @@ -554,7 +554,7 @@ let _fsyacc_reductions () = [| ( ( # 80 "fslexpars.fsy" - Star _1 + Star _1 ) # 80 "fslexpars.fsy" : 'gentype_regexp)); @@ -588,7 +588,7 @@ let _fsyacc_reductions () = [| ( ( # 83 "fslexpars.fsy" - _2 + _2 ) # 83 "fslexpars.fsy" : 'gentype_regexp)); @@ -651,11 +651,11 @@ let _fsyacc_reductions () = [| : 'gentype_charset)); |] # 653 "fslexpars.fs" -let tables : FSharp.Text.Parsing.Tables<_> = +let tables : FSharp.Text.Parsing.Tables<_> = { reductions= _fsyacc_reductions (); endOfInputTag = _fsyacc_endOfInputTag; tagOfToken = tagOfToken; - dataOfToken = _fsyacc_dataOfToken; + dataOfToken = _fsyacc_dataOfToken; actionTableElements = _fsyacc_actionTableElements; actionTableRowOffsets = _fsyacc_actionTableRowOffsets; stateToProdIdxsTableElements = _fsyacc_stateToProdIdxsTableElements; @@ -665,8 +665,8 @@ let tables : FSharp.Text.Parsing.Tables<_> = gotos = _fsyacc_gotos; sparseGotoTableRowOffsets = _fsyacc_sparseGotoTableRowOffsets; tagOfErrorTerminal = _fsyacc_tagOfErrorTerminal; - parseError = (fun (ctxt:FSharp.Text.Parsing.ParseErrorContext<_>) -> - match parse_error_rich with + parseError = (fun (ctxt:FSharp.Text.Parsing.ParseErrorContext<_>) -> + match parse_error_rich with | Some f -> f ctxt | None -> parse_error ctxt.Message); numTerminals = 27; diff --git a/buildtools/fsyacc/Arg.fs b/buildtools/fsyacc/Arg.fs index d6f8ed790e3..f6f2aa03252 100644 --- a/buildtools/fsyacc/Arg.fs +++ b/buildtools/fsyacc/Arg.fs @@ -1,8 +1,8 @@ -// (c) Microsoft Corporation 2005-2009. +// (c) Microsoft Corporation 2005-2009. namespace FSharp.Text -type ArgType = +type ArgType = | ClearArg of bool ref | FloatArg of (float -> unit) | IntArg of (int -> unit) @@ -19,22 +19,22 @@ type ArgType = static member Unit r = UnitArg r -type ArgInfo (name,action,help) = +type ArgInfo (name,action,help) = member x.Name = name member x.ArgType = action member x.HelpText = help - + exception Bad of string exception HelpText of string [] -type ArgParser() = - static let getUsage specs u = - let sbuf = System.Text.StringBuilder 100 - let pstring (s:string) = sbuf.Append s |> ignore - let pendline s = pstring s; pstring "\n" +type ArgParser() = + static let getUsage specs u = + let sbuf = System.Text.StringBuilder 100 + let pstring (s:string) = sbuf.Append s |> ignore + let pendline s = pstring s; pstring "\n" pendline u; - List.iter (fun (arg:ArgInfo) -> + List.iter (fun (arg:ArgInfo) -> match arg.Name, arg.ArgType, arg.HelpText with | s, (UnitArg _ | SetArg _ | ClearArg _), helpText -> pstring "\t"; pstring s; pstring ": "; pendline helpText | s, StringArg _, helpText -> pstring "\t"; pstring s; pstring " : "; pendline helpText @@ -50,79 +50,79 @@ type ArgParser() = static member ParsePartial(cursor,argv,arguments:seq,?otherArgs,?usageText) = let other = defaultArg otherArgs (fun _ -> ()) let usageText = defaultArg usageText "" - let nargs = Array.length argv + let nargs = Array.length argv incr cursor; let argSpecs = arguments |> Seq.toList let specs = argSpecs |> List.map (fun (arg:ArgInfo) -> arg.Name, arg.ArgType) while !cursor < nargs do - let arg = argv.[!cursor] - let rec findMatchingArg args = + let arg = argv.[!cursor] + let rec findMatchingArg args = match args with - | (s, action) :: _ when s = arg -> - let getSecondArg () = - if !cursor + 1 >= nargs then + | (s, action) :: _ when s = arg -> + let getSecondArg () = + if !cursor + 1 >= nargs then raise(Bad("option "+s+" needs an argument.\n"+getUsage argSpecs usageText)); - argv.[!cursor+1] - - match action with - | UnitArg f -> - f (); + argv.[!cursor+1] + + match action with + | UnitArg f -> + f (); incr cursor | SetArg f -> - f := true; + f := true; incr cursor - | ClearArg f -> - f := false; + | ClearArg f -> + f := false; incr cursor - | StringArg f-> - let arg2 = getSecondArg() - f arg2; + | StringArg f-> + let arg2 = getSecondArg() + f arg2; cursor := !cursor + 2 - | IntArg f -> - let arg2 = getSecondArg () - let arg2 = try int32 arg2 with _ -> raise(Bad(getUsage argSpecs usageText)) in + | IntArg f -> + let arg2 = getSecondArg () + let arg2 = try int32 arg2 with _ -> raise(Bad(getUsage argSpecs usageText)) in f arg2; cursor := !cursor + 2; - | FloatArg f -> - let arg2 = getSecondArg() - let arg2 = try float arg2 with _ -> raise(Bad(getUsage argSpecs usageText)) in - f arg2; + | FloatArg f -> + let arg2 = getSecondArg() + let arg2 = try float arg2 with _ -> raise(Bad(getUsage argSpecs usageText)) in + f arg2; cursor := !cursor + 2; - | RestArg f -> + | RestArg f -> incr cursor; while !cursor < nargs do f argv.[!cursor]; incr cursor; - | _ :: more -> findMatchingArg more - | [] -> + | _ :: more -> findMatchingArg more + | [] -> if arg = "-help" || arg = "--help" || arg = "/help" || arg = "/help" || arg = "/?" then raise (HelpText (getUsage argSpecs usageText)) // Note: for '/abc/def' does not count as an argument // Note: '/abc' does elif arg.Length>0 && (arg.[0] = '-' || (arg.[0] = '/' && not (arg.Length > 1 && arg.[1..].Contains "/"))) then raise (Bad ("unrecognized argument: "+ arg + "\n" + getUsage argSpecs usageText)) - else + else other arg; incr cursor - findMatchingArg specs + findMatchingArg specs - static member Usage (arguments, ?usage) = + static member Usage (arguments, ?usage) = let usage = defaultArg usage "" System.Console.Error.WriteLine (getUsage (Seq.toList arguments) usage) #if FX_NO_COMMAND_LINE_ARGS #else - static member Parse (arguments, ?otherArgs,?usageText) = + static member Parse (arguments, ?otherArgs,?usageText) = let current = ref 0 - let argv = System.Environment.GetCommandLineArgs() + let argv = System.Environment.GetCommandLineArgs() try ArgParser.ParsePartial (current, argv, arguments, ?otherArgs=otherArgs, ?usageText=usageText) - with - | Bad h - | HelpText h -> - System.Console.Error.WriteLine h; - System.Console.Error.Flush(); - System.Environment.Exit(1); - | _ -> + with + | Bad h + | HelpText h -> + System.Console.Error.WriteLine h; + System.Console.Error.Flush(); + System.Environment.Exit(1); + | _ -> reraise() #endif diff --git a/buildtools/fsyacc/Arg.fsi b/buildtools/fsyacc/Arg.fsi index b5203999928..1be35637a68 100644 --- a/buildtools/fsyacc/Arg.fsi +++ b/buildtools/fsyacc/Arg.fsi @@ -1,4 +1,4 @@ -// (c) Microsoft Corporation 2005-2009. +// (c) Microsoft Corporation 2005-2009. /// A simple command-line argument processor. namespace FSharp.Text @@ -6,7 +6,7 @@ namespace FSharp.Text /// The spec value describes the action of the argument, /// and whether it expects a following parameter. [] -type ArgType = +type ArgType = static member Clear : bool ref -> ArgType static member Float : (float -> unit) -> ArgType static member Int : (int -> unit) -> ArgType @@ -15,7 +15,7 @@ type ArgType = static member String : (string -> unit) -> ArgType static member Unit : (unit -> unit) -> ArgType -type ArgInfo = +type ArgInfo = new : name:string * action:ArgType * help:string -> ArgInfo /// Return the name of the argument member Name : string @@ -25,7 +25,7 @@ type ArgInfo = member HelpText : string [] -type ArgParser = +type ArgParser = #if FX_NO_COMMAND_LINE_ARGS #else diff --git a/buildtools/fsyacc/Lexing.fs b/buildtools/fsyacc/Lexing.fs index afeae0f0dca..91c67dfe266 100644 --- a/buildtools/fsyacc/Lexing.fs +++ b/buildtools/fsyacc/Lexing.fs @@ -7,7 +7,7 @@ open System.Collections.Generic // REVIEW: This type showed up on a parsing-intensive performance measurement. Consider whether it can be a struct-record later when we have this feature. -jomo [] -type Position = +type Position = { pos_fname : string pos_lnum : int pos_orig_lnum : int @@ -30,82 +30,82 @@ type Position = member pos.Column = pos.pos_cnum - pos.pos_bol - member pos.NextLine = + member pos.NextLine = let pos = pos - { pos with + { pos with pos_orig_lnum = pos.OriginalLine + 1 - pos_lnum = pos.Line+1 + pos_lnum = pos.Line+1 pos_bol = pos.AbsoluteOffset } - member pos.EndOfToken(n) = + member pos.EndOfToken(n) = let pos = pos {pos with pos_cnum=pos.pos_cnum + n } member pos.AsNewLinePos() = pos.NextLine - member pos.ShiftColumnBy(by) = + member pos.ShiftColumnBy(by) = let pos = pos {pos with pos_cnum = pos.pos_cnum + by} - static member Empty = - { pos_fname="" - pos_lnum= 0 + static member Empty = + { pos_fname="" + pos_lnum= 0 pos_orig_lnum = 0 - pos_bol= 0 + pos_bol= 0 pos_cnum=0 } - static member FirstLine(filename) = - { pos_fname=filename + static member FirstLine(filename) = + { pos_fname=filename pos_orig_lnum = 1 - pos_lnum= 1 - pos_bol= 0 + pos_lnum= 1 + pos_bol= 0 pos_cnum=0 } -type LexBufferFiller<'char> = +type LexBufferFiller<'char> = { fillSync : (LexBuffer<'char> -> unit) option - fillAsync : (LexBuffer<'char> -> Async) option } - + fillAsync : (LexBuffer<'char> -> Async) option } + and [] - LexBuffer<'char>(filler: LexBufferFiller<'char>) as this = - let context = Dictionary(1) in + LexBuffer<'char>(filler: LexBufferFiller<'char>) as this = + let context = Dictionary(1) in let extendBufferSync = (fun () -> match filler.fillSync with Some refill -> refill this | None -> invalidOp "attempt to read synchronously from an asynchronous lex buffer") let extendBufferAsync = (fun () -> match filler.fillAsync with Some refill -> refill this | None -> invalidOp "attempt to read asynchronously from a synchronous lex buffer") let mutable buffer=[||] - /// number of valid characters beyond bufferScanStart + /// number of valid characters beyond bufferScanStart let mutable bufferMaxScanLength=0 - /// count into the buffer when scanning + /// count into the buffer when scanning let mutable bufferScanStart=0 - /// number of characters scanned so far + /// number of characters scanned so far let mutable bufferScanLength=0 - /// length of the scan at the last accepting state + /// length of the scan at the last accepting state let mutable lexemeLength=0 - /// action related to the last accepting state + /// action related to the last accepting state let mutable bufferAcceptAction=0 let mutable eof = false - let mutable startPos = Position.Empty + let mutable startPos = Position.Empty let mutable endPos = Position.Empty - /// Throw away all the input besides the lexeme - let discardInput () = + /// Throw away all the input besides the lexeme + let discardInput () = Array.blit buffer bufferScanStart buffer 0 bufferScanLength bufferScanStart <- 0 bufferMaxScanLength <- bufferScanLength - + member lexbuf.EndOfScan () : int = // Printf.eprintf "endOfScan, lexBuffer.lexemeLength = %d\n" lexBuffer.lexemeLength - if bufferAcceptAction < 0 then + if bufferAcceptAction < 0 then failwith "unrecognized input" // Printf.printf "endOfScan %d state %d on unconsumed input '%c' (%d)\n" a s (Char.chr inp) inp - // Printf.eprintf "accept, lexeme = %s\n" (lexeme lexBuffer) + // Printf.eprintf "accept, lexeme = %s\n" (lexeme lexBuffer) lexbuf.StartPos <- endPos lexbuf.EndPos <- endPos.EndOfToken(lexbuf.LexemeLength) bufferAcceptAction @@ -113,15 +113,15 @@ and [] member _.StartPos with get() = startPos and set b = startPos <- b - - member _.EndPos + + member _.EndPos with get() = endPos and set b = endPos <- b member _.Lexeme = Array.sub buffer bufferScanStart lexemeLength member _.LexemeChar n = buffer.[n+bufferScanStart] - + member _.BufferLocalStore = (context :> IDictionary<_, _>) member _.LexemeLength @@ -137,25 +137,25 @@ and [] and set v = bufferMaxScanLength <- v member internal _.BufferScanLength - with get() = bufferScanLength + with get() = bufferScanLength and set v = bufferScanLength <- v member internal _.BufferScanStart - with get() : int = bufferScanStart + with get() : int = bufferScanStart and set v = bufferScanStart <- v - member internal _.BufferAcceptAction - with get() = bufferAcceptAction + member internal _.BufferAcceptAction + with get() = bufferAcceptAction and set v = bufferAcceptAction <- v member internal _.RefillBuffer = extendBufferSync member internal _.AsyncRefillBuffer = extendBufferAsync - static member LexemeString(lexbuf:LexBuffer) = + static member LexemeString(lexbuf:LexBuffer) = System.String(lexbuf.Buffer, lexbuf.BufferScanStart, lexbuf.LexemeLength) - member _.IsPastEndOfStream + member _.IsPastEndOfStream with get() = eof and set b = eof <- b @@ -163,30 +163,30 @@ and [] member _.BufferScanPos = bufferScanStart + bufferScanLength - member lexbuf.EnsureBufferSize n = - if lexbuf.BufferScanPos + n >= buffer.Length then - let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) + member lexbuf.EnsureBufferSize n = + if lexbuf.BufferScanPos + n >= buffer.Length then + let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) Array.blit buffer bufferScanStart repl bufferScanStart bufferScanLength buffer <- repl - static member FromReadFunctions (syncRead : ('char[] * int * int -> int) option, asyncRead : ('char[] * int * int -> Async) option) : LexBuffer<'char> = + static member FromReadFunctions (syncRead : ('char[] * int * int -> int) option, asyncRead : ('char[] * int * int -> Async) option) : LexBuffer<'char> = let extension= Array.zeroCreate 4096 - let fillers = - { fillSync = - match syncRead with + let fillers = + { fillSync = + match syncRead with | None -> None - | Some read -> - Some (fun lexBuffer -> + | Some read -> + Some (fun lexBuffer -> let n = read(extension, 0, extension.Length) lexBuffer.EnsureBufferSize n Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n - lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n) - fillAsync = - match asyncRead with + lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n) + fillAsync = + match asyncRead with | None -> None - | Some read -> - Some (fun lexBuffer -> - async { + | Some read -> + Some (fun lexBuffer -> + async { let! n = read(extension, 0, extension.Length) lexBuffer.EnsureBufferSize n Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n @@ -194,31 +194,31 @@ and [] LexBuffer<_>(fillers) // A full type signature is required on this method because it is used at more specific types within its own scope - static member FromFunction (f : 'char[] * int * int -> int) : LexBuffer<'char> = + static member FromFunction (f : 'char[] * int * int -> int) : LexBuffer<'char> = LexBuffer<_>.FromReadFunctions(Some(f), None) - static member FromAsyncFunction (f : 'char[] * int * int -> Async) : LexBuffer<'char> = + static member FromAsyncFunction (f : 'char[] * int * int -> Async) : LexBuffer<'char> = LexBuffer<_>.FromReadFunctions(None, Some(f)) - - static member FromCharFunction f : LexBuffer = - LexBuffer.FromFunction(fun (buff, start, len) -> + + static member FromCharFunction f : LexBuffer = + LexBuffer.FromFunction(fun (buff, start, len) -> let buff2 = Array.zeroCreate len - let n = f buff2 len + let n = f buff2 len Array.blit buff2 0 buff start len n) - static member FromByteFunction f : LexBuffer = - LexBuffer.FromFunction(fun (buff, start, len) -> + static member FromByteFunction f : LexBuffer = + LexBuffer.FromFunction(fun (buff, start, len) -> let buff2 = Array.zeroCreate len - let n = f buff2 len + let n = f buff2 len Array.blit buff2 0 buff start len n) // A full type signature is required on this method because it is used at more specific types within its own scope - static member FromArray (s: 'char[]) : LexBuffer<'char> = - let lexBuffer = - LexBuffer<_> - { fillSync = Some (fun _ -> ()) + static member FromArray (s: 'char[]) : LexBuffer<'char> = + let lexBuffer = + LexBuffer<_> + { fillSync = Some (fun _ -> ()) fillAsync = Some (fun _ -> async { return () }) } lexBuffer.Buffer <- s lexBuffer.BufferMaxScanLength <- s.Length @@ -233,38 +233,38 @@ and [] static member FromString (s:string) = LexBuffer.FromArray (s.ToCharArray()) - static member FromTextReader (tr:System.IO.TextReader) : LexBuffer = + static member FromTextReader (tr:System.IO.TextReader) : LexBuffer = LexBuffer.FromReadFunctions(Some tr.Read, Some (tr.ReadAsync >> Async.AwaitTask)) - static member FromBinaryReader (br:System.IO.BinaryReader) : LexBuffer = + static member FromBinaryReader (br:System.IO.BinaryReader) : LexBuffer = LexBuffer.FromFunction(br.Read) - static member FromStream (stream:System.IO.Stream) : LexBuffer = - LexBuffer.FromReadFunctions(Some(stream.Read), Some(fun (buf, offset, len) -> stream.AsyncRead(buf, offset=offset, count=len))) + static member FromStream (stream:System.IO.Stream) : LexBuffer = + LexBuffer.FromReadFunctions(Some(stream.Read), Some(fun (buf, offset, len) -> stream.AsyncRead(buf, offset=offset, count=len))) -module GenericImplFragments = - let startInterpret(lexBuffer:LexBuffer<_>)= +module GenericImplFragments = + let startInterpret(lexBuffer:LexBuffer<_>)= lexBuffer.BufferScanStart <- lexBuffer.BufferScanStart + lexBuffer.LexemeLength lexBuffer.BufferMaxScanLength <- lexBuffer.BufferMaxScanLength - lexBuffer.LexemeLength lexBuffer.BufferScanLength <- 0 lexBuffer.LexemeLength <- 0 lexBuffer.BufferAcceptAction <- -1 - let afterRefill (trans: uint16[] array, sentinel, lexBuffer:LexBuffer<_>, scanUntilSentinel, endOfScan, state, eofPos) = - // end of file occurs if we couldn't extend the buffer - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then - let snew = int trans.[state].[eofPos] // == EOF - if snew = sentinel then + let afterRefill (trans: uint16[] array, sentinel, lexBuffer:LexBuffer<_>, scanUntilSentinel, endOfScan, state, eofPos) = + // end of file occurs if we couldn't extend the buffer + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + let snew = int trans.[state].[eofPos] // == EOF + if snew = sentinel then endOfScan() - else + else if lexBuffer.IsPastEndOfStream then failwith "End of file on lexing stream" lexBuffer.IsPastEndOfStream <- true // Printf.printf "state %d --> %d on eof\n" state snew scanUntilSentinel(lexBuffer, snew) - else + else scanUntilSentinel(lexBuffer, state) - let onAccept (lexBuffer:LexBuffer<_>, a) = + let onAccept (lexBuffer:LexBuffer<_>, a) = lexBuffer.LexemeLength <- lexBuffer.BufferScanLength lexBuffer.BufferAcceptAction <- a @@ -273,61 +273,61 @@ open GenericImplFragments [] type AsciiTables(trans: uint16[] array, accept: uint16[]) = let rec scanUntilSentinel(lexBuffer, state) = - let sentinel = 255 * 256 + 255 - // Return an endOfScan after consuming the input - let a = int accept.[state] - if a <> sentinel then + let sentinel = 255 * 256 + 255 + // Return an endOfScan after consuming the input + let a = int accept.[state] + if a <> sentinel then onAccept (lexBuffer, a) - - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then lexBuffer.DiscardInput() lexBuffer.RefillBuffer () - // end of file occurs if we couldn't extend the buffer + // end of file occurs if we couldn't extend the buffer afterRefill (trans, sentinel, lexBuffer, scanUntilSentinel, lexBuffer.EndOfScan, state, 256 (* == EOF *) ) else - // read a character - end the scan if there are no further transitions + // read a character - end the scan if there are no further transitions let inp = int(lexBuffer.Buffer.[lexBuffer.BufferScanPos]) - let snew = int trans.[state].[inp] - if snew = sentinel then + let snew = int trans.[state].[inp] + if snew = sentinel then lexBuffer.EndOfScan() - else + else lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1 // Printf.printf "state %d --> %d on '%c' (%d)\n" state snew (Char.chr inp) inp scanUntilSentinel(lexBuffer, snew) - - /// Interpret tables for an ascii lexer generated by fslex. - member tables.Interpret(initialState, lexBuffer : LexBuffer) = + + /// Interpret tables for an ascii lexer generated by fslex. + member tables.Interpret(initialState, lexBuffer : LexBuffer) = startInterpret(lexBuffer) scanUntilSentinel(lexBuffer, initialState) - /// Interpret tables for an ascii lexer generated by fslex. - member tables.AsyncInterpret(initialState, lexBuffer : LexBuffer) = - - let rec scanUntilSentinel(lexBuffer, state) : Async = - async { - let sentinel = 255 * 256 + 255 - // Return an endOfScan after consuming the input - let a = int accept.[state] - if a <> sentinel then + /// Interpret tables for an ascii lexer generated by fslex. + member tables.AsyncInterpret(initialState, lexBuffer : LexBuffer) = + + let rec scanUntilSentinel(lexBuffer, state) : Async = + async { + let sentinel = 255 * 256 + 255 + // Return an endOfScan after consuming the input + let a = int accept.[state] + if a <> sentinel then onAccept (lexBuffer, a) - - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then lexBuffer.DiscardInput() do! lexBuffer.AsyncRefillBuffer () - // end of file occurs if we couldn't extend the buffer + // end of file occurs if we couldn't extend the buffer return! afterRefill (trans, sentinel, lexBuffer, scanUntilSentinel, endOfScan, state, 256 (* == EOF *) ) else - // read a character - end the scan if there are no further transitions + // read a character - end the scan if there are no further transitions let inp = int(lexBuffer.Buffer.[lexBuffer.BufferScanPos]) - let snew = int trans.[state].[inp] - if snew = sentinel then + let snew = int trans.[state].[inp] + if snew = sentinel then return! endOfScan() - else + else lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1 return! scanUntilSentinel(lexBuffer, snew) } - and endOfScan() = + and endOfScan() = async { return lexBuffer.EndOfScan() } startInterpret(lexBuffer) @@ -338,29 +338,29 @@ type AsciiTables(trans: uint16[] array, accept: uint16[]) = static member Create(trans, accept) = AsciiTables(trans, accept) [] -type UnicodeTables(trans: uint16[] array, accept: uint16[]) = - let sentinel = 255 * 256 + 255 - let numUnicodeCategories = 30 - let numLowUnicodeChars = 128 +type UnicodeTables(trans: uint16[] array, accept: uint16[]) = + let sentinel = 255 * 256 + 255 + let numUnicodeCategories = 30 + let numLowUnicodeChars = 128 let numSpecificUnicodeChars = (trans.[0].Length - 1 - numLowUnicodeChars - numUnicodeCategories)/2 - let lookupUnicodeCharacters (state, inp: char) = + let lookupUnicodeCharacters (state, inp: char) = let inpAsInt = int inp // Is it a fast ASCII character? - if inpAsInt < numLowUnicodeChars then + if inpAsInt < numLowUnicodeChars then int trans.[state].[inpAsInt] - else + else // Search for a specific unicode character let baseForSpecificUnicodeChars = numLowUnicodeChars - let rec loop i = - if i >= numSpecificUnicodeChars then - // OK, if we failed then read the 'others' entry in the alphabet, + let rec loop i = + if i >= numSpecificUnicodeChars then + // OK, if we failed then read the 'others' entry in the alphabet, // which covers all Unicode characters not covered in other // ways let baseForUnicodeCategories = numLowUnicodeChars+numSpecificUnicodeChars*2 let unicodeCategory = System.Globalization.CharUnicodeInfo.GetUnicodeCategory(inp) //System.Console.WriteLine("inp = {0}, unicodeCategory = {1}", [| box inp; box unicodeCategory |]) int trans.[state].[baseForUnicodeCategories + int32 unicodeCategory] - else + else // This is the specific unicode character let c = char (int trans.[state].[baseForSpecificUnicodeChars+i*2]) //System.Console.WriteLine("c = {0}, inp = {1}, i = {2}", [| box c; box inp; box i |]) @@ -368,74 +368,74 @@ type UnicodeTables(trans: uint16[] array, accept: uint16[]) = if c = inp then int trans.[state].[baseForSpecificUnicodeChars+i*2+1] else loop(i+1) - + loop 0 - let eofPos = numLowUnicodeChars + 2*numSpecificUnicodeChars + numUnicodeCategories - + let eofPos = numLowUnicodeChars + 2*numSpecificUnicodeChars + numUnicodeCategories + let rec scanUntilSentinel(lexBuffer, state) = - // Return an endOfScan after consuming the input - let a = int accept.[state] - if a <> sentinel then + // Return an endOfScan after consuming the input + let a = int accept.[state] + if a <> sentinel then onAccept(lexBuffer, a) - - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then lexBuffer.DiscardInput() lexBuffer.RefillBuffer () - // end of file occurs if we couldn't extend the buffer + // end of file occurs if we couldn't extend the buffer afterRefill (trans, sentinel, lexBuffer, scanUntilSentinel, lexBuffer.EndOfScan, state, eofPos) else - // read a character - end the scan if there are no further transitions + // read a character - end the scan if there are no further transitions let inp = lexBuffer.Buffer.[lexBuffer.BufferScanPos] - + // Find the new state let snew = lookupUnicodeCharacters (state, inp) - if snew = sentinel then + if snew = sentinel then lexBuffer.EndOfScan() - else + else lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1 // Printf.printf "state %d --> %d on '%c' (%d)\n" s snew (char inp) inp scanUntilSentinel(lexBuffer, snew) - - // Each row for the Unicode table has format + + // Each row for the Unicode table has format // 128 entries for ASCII characters - // A variable number of 2*UInt16 entries for SpecificUnicodeChars + // A variable number of 2*UInt16 entries for SpecificUnicodeChars // 30 entries, one for each UnicodeCategory // 1 entry for EOF - member tables.Interpret(initialState, lexBuffer : LexBuffer) = + member tables.Interpret(initialState, lexBuffer : LexBuffer) = startInterpret(lexBuffer) scanUntilSentinel(lexBuffer, initialState) - member tables.AsyncInterpret(initialState, lexBuffer : LexBuffer) = + member tables.AsyncInterpret(initialState, lexBuffer : LexBuffer) = let rec scanUntilSentinel(lexBuffer, state) = async { - // Return an endOfScan after consuming the input - let a = int accept.[state] - if a <> sentinel then + // Return an endOfScan after consuming the input + let a = int accept.[state] + if a <> sentinel then onAccept(lexBuffer, a) - - if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then + + if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then lexBuffer.DiscardInput() lexBuffer.RefillBuffer () - // end of file occurs if we couldn't extend the buffer + // end of file occurs if we couldn't extend the buffer return! afterRefill (trans, sentinel, lexBuffer, scanUntilSentinel, endOfScan, state, eofPos) else - // read a character - end the scan if there are no further transitions + // read a character - end the scan if there are no further transitions let inp = lexBuffer.Buffer.[lexBuffer.BufferScanPos] - + // Find the new state let snew = lookupUnicodeCharacters (state, inp) - if snew = sentinel then + if snew = sentinel then return! endOfScan() - else + else lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1 return! scanUntilSentinel(lexBuffer, snew) } - and endOfScan() = - async { return lexBuffer.EndOfScan() } + and endOfScan() = + async { return lexBuffer.EndOfScan() } startInterpret(lexBuffer) scanUntilSentinel(lexBuffer, initialState) diff --git a/buildtools/fsyacc/Lexing.fsi b/buildtools/fsyacc/Lexing.fsi index d88af6712aa..81a3fd2803e 100644 --- a/buildtools/fsyacc/Lexing.fsi +++ b/buildtools/fsyacc/Lexing.fsi @@ -12,10 +12,10 @@ open System.Collections.Generic /// Position information stored for lexing tokens [] type Position = - { + { /// The file name for the position pos_fname: string - + /// The line number for the position pos_lnum: int diff --git a/buildtools/fsyacc/Parsing.fs b/buildtools/fsyacc/Parsing.fs index bfb4c1705af..a4a645e3cfb 100644 --- a/buildtools/fsyacc/Parsing.fs +++ b/buildtools/fsyacc/Parsing.fs @@ -1,24 +1,24 @@ -// (c) Microsoft Corporation 2005-2009. +// (c) Microsoft Corporation 2005-2009. namespace FSharp.Text.Parsing open FSharp.Text.Lexing open System.Collections.Generic -type IParseState = +type IParseState = abstract InputRange: int -> Position * Position - abstract InputEndPosition: int -> Position + abstract InputEndPosition: int -> Position - abstract InputStartPosition: int -> Position + abstract InputStartPosition: int -> Position abstract ResultRange: Position * Position - abstract GetInput: int -> obj + abstract GetInput: int -> obj abstract ParserLocalStore : IDictionary - abstract RaiseError<'b> : unit -> 'b + abstract RaiseError<'b> : unit -> 'b //------------------------------------------------------------------------- // This context is passed to the error reporter when a syntax error occurs @@ -27,11 +27,11 @@ type IParseState = type ParseErrorContext<'tok> (//lexbuf: LexBuffer<_>, stateStack:int list, - parseState: IParseState, - reduceTokens: int list, - currentToken: 'tok option, - reducibleProductions: int list list, - shiftableTokens: int list, + parseState: IParseState, + reduceTokens: int list, + currentToken: 'tok option, + reducibleProductions: int list list, + shiftableTokens: int list, message : string) = member _.StateStack = stateStack @@ -50,21 +50,21 @@ type ParseErrorContext<'tok> //------------------------------------------------------------------------- -// This is the data structure emitted as code by FSYACC. +// This is the data structure emitted as code by FSYACC. -type Tables<'tok> = +type Tables<'tok> = { reductions: (IParseState -> obj)[] endOfInputTag: int tagOfToken: 'tok -> int - dataOfToken: 'tok -> obj - actionTableElements: uint16[] + dataOfToken: 'tok -> obj + actionTableElements: uint16[] actionTableRowOffsets: uint16[] reductionSymbolCounts: uint16[] immediateActions: uint16[] gotos: uint16[] sparseGotoTableRowOffsets: uint16[] - stateToProdIdxsTableElements: uint16[] - stateToProdIdxsTableRowOffsets: uint16[] + stateToProdIdxsTableElements: uint16[] + stateToProdIdxsTableRowOffsets: uint16[] productionToNonTerminalTable: uint16[] /// For fsyacc.exe, this entry is filled in by context from the generated parser file. If no 'parse_error' function /// is defined by the user then ParseHelpers.parse_error is used by default (ParseHelpers is opened @@ -79,26 +79,26 @@ type Tables<'tok> = // This type is in System.dll so for the moment we can't use it in FSharp.Core.dll //type Stack<'a> = System.Collections.Generic.Stack<'a> -type internal Stack<'a>(n) = +type internal Stack<'a>(n) = let mutable contents = Array.zeroCreate<'a>(n) let mutable count = 0 - member buf.Ensure newSize = + member buf.Ensure newSize = let oldSize = Array.length contents - if newSize > oldSize then + if newSize > oldSize then let old = contents contents <- Array.zeroCreate (max newSize (oldSize * 2)) Array.blit old 0 contents 0 count - + member buf.Count = count member buf.Pop() = count <- count - 1 member buf.Peep() = contents.[count - 1] member buf.Top(n) = [ for x in contents.[max 0 (count-n)..count - 1] -> x ] |> List.rev member buf.Push(x) = - buf.Ensure(count + 1) - contents.[count] <- x + buf.Ensure(count + 1) + contents.[count] <- x count <- count + 1 - + member buf.IsEmpty = (count = 0) #if __DEBUG member buf.PrintStack() = @@ -117,9 +117,9 @@ module Flags = let mutable debug = false #endif -module Implementation = - - // Definitions shared with fsyacc +module Implementation = + + // Definitions shared with fsyacc let anyMarker = 0xffff let shiftFlag = 0x0000 let reduceFlag = 0x4000 @@ -127,23 +127,23 @@ module Implementation = let acceptFlag = 0xc000 let actionMask = 0xc000 - let actionValue action = action &&& (~~~ actionMask) + let actionValue action = action &&& (~~~ actionMask) let actionKind action = action &&& actionMask - + //------------------------------------------------------------------------- - // Read the tables written by FSYACC. + // Read the tables written by FSYACC. type AssocTable(elemTab:uint16[], offsetTab:uint16[]) = let cache = Dictionary<_,_>(2000) - member t.readAssoc (minElemNum,maxElemNum,defaultValueOfAssoc,keyToFind) = - // do a binary chop on the table + member t.readAssoc (minElemNum,maxElemNum,defaultValueOfAssoc,keyToFind) = + // do a binary chop on the table let elemNumber : int = (minElemNum+maxElemNum)/2 - if elemNumber = maxElemNum + if elemNumber = maxElemNum then defaultValueOfAssoc - else + else let x = int elemTab.[elemNumber*2] - if keyToFind = x then + if keyToFind = x then int elemTab.[elemNumber*2+1] elif keyToFind < x then t.readAssoc (minElemNum,elemNumber,defaultValueOfAssoc,keyToFind) @@ -151,59 +151,59 @@ module Implementation = t.readAssoc (elemNumber+1,maxElemNum,defaultValueOfAssoc,keyToFind) member t.Read(rowNumber,keyToFind) = - + // First check the sparse lookaside table // Performance note: without this lookaside table the binary chop in readAssoc - // takes up around 10% of of parsing time + // takes up around 10% of of parsing time // for parsing intensive samples such as the bootstrapped F# compiler. // // Note: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal. // Some other better sparse lookup table may be better. - let mutable res = 0 + let mutable res = 0 let cacheKey = (rowNumber <<< 16) ||| keyToFind - let ok = cache.TryGetValue(cacheKey, &res) - if ok then res + let ok = cache.TryGetValue(cacheKey, &res) + if ok then res else let headOfTable = int offsetTab.[rowNumber] - let firstElemNumber = headOfTable + 1 + let firstElemNumber = headOfTable + 1 let numberOfElementsInAssoc = int elemTab.[headOfTable*2] - let defaultValueOfAssoc = int elemTab.[headOfTable*2+1] + let defaultValueOfAssoc = int elemTab.[headOfTable*2+1] let res = t.readAssoc (firstElemNumber,(firstElemNumber+numberOfElementsInAssoc),defaultValueOfAssoc,keyToFind) cache.[cacheKey] <- res res // Read all entries in the association table // Used during error recovery to find all valid entries in the table - member _.ReadAll(n) = + member _.ReadAll(n) = let headOfTable = int offsetTab.[n] - let firstElemNumber = headOfTable + 1 - let numberOfElementsInAssoc = int32 elemTab.[headOfTable*2] - let defaultValueOfAssoc = int elemTab.[headOfTable*2+1] - [ for i in firstElemNumber .. (firstElemNumber+numberOfElementsInAssoc-1) -> + let firstElemNumber = headOfTable + 1 + let numberOfElementsInAssoc = int32 elemTab.[headOfTable*2] + let defaultValueOfAssoc = int elemTab.[headOfTable*2+1] + [ for i in firstElemNumber .. (firstElemNumber+numberOfElementsInAssoc-1) -> (int elemTab.[i*2], int elemTab.[i*2+1]) ], defaultValueOfAssoc type IdxToIdxListTable(elemTab:uint16[], offsetTab:uint16[]) = // Read all entries in a row of the table - member _.ReadAll(n) = + member _.ReadAll(n) = let headOfTable = int offsetTab.[n] - let firstElemNumber = headOfTable + 1 - let numberOfElements = int32 elemTab.[headOfTable] + let firstElemNumber = headOfTable + 1 + let numberOfElements = int32 elemTab.[headOfTable] [ for i in firstElemNumber .. (firstElemNumber+numberOfElements-1) -> int elemTab.[i] ] //------------------------------------------------------------------------- - // interpret the tables emitted by FSYACC. + // interpret the tables emitted by FSYACC. [] [] - type ValueInfo = + type ValueInfo = val value: obj val startPos: Position val endPos: Position new(value,startPos,endPos) = { value=value; startPos=startPos; endPos=endPos } - let interpret (tables: Tables<'tok>) lexer (lexbuf : LexBuffer<_>) initialState = + let interpret (tables: Tables<'tok>) lexer (lexbuf : LexBuffer<_>) initialState = let localStore = Dictionary() in localStore.["LexBuffer"] <- lexbuf #if __DEBUG @@ -215,7 +215,7 @@ module Implementation = let valueStack = Stack(100) - let mutable haveLookahead = false + let mutable haveLookahead = false let mutable lookaheadToken = Unchecked.defaultof<'tok> @@ -227,12 +227,12 @@ module Implementation = // After an error occurs, we suppress errors until we've shifted three tokens in a row. let mutable errorSuppressionCountDown = 0 - + // When we hit the end-of-file we don't fail straight away but rather keep permitting shift // and reduce against the last token in the token stream 20 times or until we've accepted // or exhausted the stack. This allows error recovery rules of the form // input : realInput EOF | realInput error EOF | error EOF - // where consuming one EOF to trigger an error doesn't result in overall parse failure + // where consuming one EOF to trigger an error doesn't result in overall parse failure // catastrophe and the loss of intermediate results. // @@ -241,26 +241,26 @@ module Implementation = let mutable eofCountDown = 20 // Number of EOFs to supply at the end for error recovery // The 100 here means a maximum of 100 elements for each rule - let ruleStartPoss = (Array.zeroCreate 100 : Position[]) - let ruleEndPoss = (Array.zeroCreate 100 : Position[]) - let ruleValues = (Array.zeroCreate 100 : obj[]) - let lhsPos = (Array.zeroCreate 2 : Position[]) + let ruleStartPoss = (Array.zeroCreate 100 : Position[]) + let ruleEndPoss = (Array.zeroCreate 100 : Position[]) + let ruleValues = (Array.zeroCreate 100 : obj[]) + let lhsPos = (Array.zeroCreate 2 : Position[]) let reductions = tables.reductions let actionTable = AssocTable(tables.actionTableElements, tables.actionTableRowOffsets) let gotoTable = AssocTable(tables.gotos, tables.sparseGotoTableRowOffsets) let stateToProdIdxsTable = IdxToIdxListTable(tables.stateToProdIdxsTableElements, tables.stateToProdIdxsTableRowOffsets) - let parseState = - { new IParseState with - member _.InputRange(n) = ruleStartPoss.[n-1], ruleEndPoss.[n-1] + let parseState = + { new IParseState with + member _.InputRange(n) = ruleStartPoss.[n-1], ruleEndPoss.[n-1] member _.InputStartPosition(n) = ruleStartPoss.[n-1] - member _.InputEndPosition(n) = ruleEndPoss.[n-1] - member _.GetInput(n) = ruleValues.[n-1] - member _.ResultRange = (lhsPos.[0], lhsPos.[1]) - member _.ParserLocalStore = (localStore :> IDictionary<_,_>) + member _.InputEndPosition(n) = ruleEndPoss.[n-1] + member _.GetInput(n) = ruleValues.[n-1] + member _.ResultRange = (lhsPos.[0], lhsPos.[1]) + member _.ParserLocalStore = (localStore :> IDictionary<_,_>) member _.RaiseError() = raise RecoverableParseError (* NOTE: this binding tests the fairly complex logic associated with an object expression implementing a generic abstract method *) - } + } #if __DEBUG let report haveLookahead lookaheadToken = @@ -276,38 +276,38 @@ module Implementation = #if __DEBUG if Flags.debug then System.Console.WriteLine("popStackUntilErrorShifted") #endif - if stateStack.IsEmpty then + if stateStack.IsEmpty then #if __DEBUG if Flags.debug then System.Console.WriteLine("state stack empty during error recovery - generating parse error") #endif failwith "parse error" - + let currState = stateStack.Peep() #if __DEBUG if Flags.debug then System.Console.WriteLine("In state {0} during error recovery", currState) #endif - + let action = actionTable.Read(currState, tables.tagOfErrorTerminal) - - if actionKind action = shiftFlag && - (match tokenOpt with + + if actionKind action = shiftFlag && + (match tokenOpt with | None -> true - | Some(token) -> - let nextState = actionValue action + | Some(token) -> + let nextState = actionValue action actionKind (actionTable.Read(nextState, tables.tagOfToken(token))) = shiftFlag) then #if __DEBUG if Flags.debug then System.Console.WriteLine("shifting error, continuing with error recovery") #endif - let nextState = actionValue action + let nextState = actionValue action // The "error" non terminal needs position information, though it tends to be unreliable. // Use the StartPos/EndPos from the lex buffer valueStack.Push(ValueInfo(box (), lexbuf.StartPos, lexbuf.EndPos)) stateStack.Push(nextState) else - if valueStack.IsEmpty then + if valueStack.IsEmpty then failwith "parse error" #if __DEBUG if Flags.debug then @@ -317,87 +317,87 @@ module Implementation = stateStack.Pop() popStackUntilErrorShifted(tokenOpt) - while not finished do - if stateStack.IsEmpty then + while not finished do + if stateStack.IsEmpty then finished <- true else let state = stateStack.Peep() #if __DEBUG if Flags.debug then (Console.Write("{0} value(state), state ",valueStack.Count); stateStack.PrintStack()) #endif - let action = + let action = let immediateAction = int tables.immediateActions.[state] if not (immediateAction = anyMarker) then - // Action has been pre-determined, no need to lookahead - // Expecting it to be a Reduce action on a non-fakeStartNonTerminal ? + // Action has been pre-determined, no need to lookahead + // Expecting it to be a Reduce action on a non-fakeStartNonTerminal ? immediateAction else - // Lookahead required to determine action - if not haveLookahead then - if lexbuf.IsPastEndOfStream then + // Lookahead required to determine action + if not haveLookahead then + if lexbuf.IsPastEndOfStream then // When the input runs out, keep supplying the last token for eofCountDown times if eofCountDown>0 then haveLookahead <- true eofCountDown <- eofCountDown - 1 inEofCountDown <- true - else + else haveLookahead <- false - else + else lookaheadToken <- lexer lexbuf lookaheadStartPos <- lexbuf.StartPos lookaheadEndPos <- lexbuf.EndPos haveLookahead <- true - let tag = - if haveLookahead then tables.tagOfToken lookaheadToken - else tables.endOfInputTag - - // Printf.printf "state %d\n" state + let tag = + if haveLookahead then tables.tagOfToken lookaheadToken + else tables.endOfInputTag + + // Printf.printf "state %d\n" state actionTable.Read(state,tag) - - let kind = actionKind action + + let kind = actionKind action if kind = shiftFlag then ( - if errorSuppressionCountDown > 0 then + if errorSuppressionCountDown > 0 then errorSuppressionCountDown <- errorSuppressionCountDown - 1 #if __DEBUG if Flags.debug then Console.WriteLine("shifting, reduced errorRecoverylevel to {0}\n", errorSuppressionCountDown) #endif - let nextState = actionValue action + let nextState = actionValue action if not haveLookahead then failwith "shift on end of input!" let data = tables.dataOfToken lookaheadToken valueStack.Push(ValueInfo(data, lookaheadStartPos, lookaheadEndPos)) - stateStack.Push(nextState) + stateStack.Push(nextState) #if __DEBUG if Flags.debug then Console.WriteLine("shift/consume input {0}, shift to state {1}", report haveLookahead lookaheadToken, nextState) #endif haveLookahead <- false ) elif kind = reduceFlag then - let prod = actionValue action - let reduction = reductions.[prod] + let prod = actionValue action + let reduction = reductions.[prod] let n = int tables.reductionSymbolCounts.[prod] - // pop the symbols, populate the values and populate the locations + // pop the symbols, populate the values and populate the locations #if __DEBUG if Flags.debug then Console.Write("reduce popping {0} values/states, lookahead {1}", n, report haveLookahead lookaheadToken) #endif - - lhsPos.[0] <- Position.Empty - lhsPos.[1] <- Position.Empty - for i = 0 to n - 1 do + + lhsPos.[0] <- Position.Empty + lhsPos.[1] <- Position.Empty + for i = 0 to n - 1 do if valueStack.IsEmpty then failwith "empty symbol stack" let topVal = valueStack.Peep() valueStack.Pop() stateStack.Pop() - ruleValues.[(n-i)-1] <- topVal.value - ruleStartPoss.[(n-i)-1] <- topVal.startPos - ruleEndPoss.[(n-i)-1] <- topVal.endPos + ruleValues.[(n-i)-1] <- topVal.value + ruleStartPoss.[(n-i)-1] <- topVal.startPos + ruleEndPoss.[(n-i)-1] <- topVal.endPos if lhsPos.[1] = Position.Empty then lhsPos.[1] <- topVal.endPos if not (topVal.startPos = Position.Empty) then lhsPos.[0] <- topVal.startPos - done - - try - // Printf.printf "reduce %d\n" prod - let redResult = reduction parseState + done + + try + // Printf.printf "reduce %d\n" prod + let redResult = reduction parseState valueStack.Push(ValueInfo(redResult, lhsPos.[0], lhsPos.[1])) let currState = stateStack.Peep() let newGotoState = gotoTable.Read(int tables.productionToNonTerminalTable.[prod], currState) @@ -405,40 +405,40 @@ module Implementation = #if __DEBUG if Flags.debug then Console.WriteLine(" goto state {0}", newGotoState) #endif - with - | Accept res -> - finished <- true - valueStack.Push(ValueInfo(res, lhsPos.[0], lhsPos.[1])) + with + | Accept res -> + finished <- true + valueStack.Push(ValueInfo(res, lhsPos.[0], lhsPos.[1])) | RecoverableParseError -> #if __DEBUG if Flags.debug then Console.WriteLine("RecoverableParseErrorException...\n") #endif popStackUntilErrorShifted(None) - // User code raised a Parse_error. Don't report errors again until three tokens have been shifted + // User code raised a Parse_error. Don't report errors again until three tokens have been shifted errorSuppressionCountDown <- 3 elif kind = errorFlag then ( #if __DEBUG if Flags.debug then Console.Write("ErrorFlag... ") #endif - // Silently discard inputs and don't report errors - // until three tokens in a row have been shifted + // Silently discard inputs and don't report errors + // until three tokens in a row have been shifted #if __DEBUG if Flags.debug then printfn "error on token '%A' " (if haveLookahead then Some(lookaheadToken) else None) #endif - if errorSuppressionCountDown > 0 then + if errorSuppressionCountDown > 0 then // If we're in the end-of-file count down then we're very keen to 'Accept'. // We can only do this by repeatedly popping the stack until we can shift both an 'error' token - // and an EOF token. - if inEofCountDown && eofCountDown < 10 then + // and an EOF token. + if inEofCountDown && eofCountDown < 10 then #if __DEBUG if Flags.debug then printfn "poppin stack, looking to shift both 'error' and that token, during end-of-file error recovery" #endif popStackUntilErrorShifted(if haveLookahead then Some(lookaheadToken) else None) // If we don't haveLookahead then the end-of-file count down is over and we have no further options. - if not haveLookahead then + if not haveLookahead then failwith "parse error: unexpected end of file" - + #if __DEBUG if Flags.debug then printfn "discarding token '%A' during error suppression" (if haveLookahead then Some(lookaheadToken) else None) #endif @@ -449,32 +449,32 @@ module Implementation = else ( let currentToken = if haveLookahead then Some(lookaheadToken) else None - let actions,defaultAction = actionTable.ReadAll(state) + let actions,defaultAction = actionTable.ReadAll(state) let explicit = Set.ofList [ for tag,_action in actions -> tag ] - - let shiftableTokens = + + let shiftableTokens = [ for tag,action in actions do - if (actionKind action) = shiftFlag then + if (actionKind action) = shiftFlag then yield tag if actionKind defaultAction = shiftFlag then - for tag in 0 .. tables.numTerminals-1 do - if not (explicit.Contains(tag)) then + for tag in 0 .. tables.numTerminals-1 do + if not (explicit.Contains(tag)) then yield tag ] in let stateStack = stateStack.Top(12) in - let reducibleProductions = - [ for state in stateStack do + let reducibleProductions = + [ for state in stateStack do yield stateToProdIdxsTable.ReadAll(state) ] - let reduceTokens = + let reduceTokens = [ for tag,action in actions do if actionKind(action) = reduceFlag then yield tag if actionKind(defaultAction) = reduceFlag then - for tag in 0 .. tables.numTerminals-1 do - if not (explicit.Contains(tag)) then + for tag in 0 .. tables.numTerminals-1 do + if not (explicit.Contains(tag)) then yield tag ] in - //let activeRules = stateStack |> List.iter (fun state -> + //let activeRules = stateStack |> List.iter (fun state -> let errorContext = new ParseErrorContext<'tok>(stateStack,parseState, reduceTokens,currentToken,reducibleProductions, shiftableTokens, "syntax error") tables.parseError(errorContext) popStackUntilErrorShifted(None) @@ -483,20 +483,20 @@ module Implementation = if Flags.debug then System.Console.WriteLine("generated syntax error and shifted error token, haveLookahead = {0}\n", haveLookahead) #endif ) - ) elif kind = acceptFlag then + ) elif kind = acceptFlag then finished <- true #if __DEBUG else if Flags.debug then System.Console.WriteLine("ALARM!!! drop through case in parser") #endif - done + done // OK, we're done - read off the overall generated value valueStack.Peep().value type Tables<'tok> with - member tables.Interpret (lexer,lexbuf,startState) = + member tables.Interpret (lexer,lexbuf,startState) = Implementation.interpret tables lexer lexbuf startState - -module ParseHelpers = + +module ParseHelpers = let parse_error (_s:string) = () let parse_error_rich = (None : (ParseErrorContext<_> -> unit) option) diff --git a/buildtools/fsyacc/Parsing.fsi b/buildtools/fsyacc/Parsing.fsi index 68ab4dbfcdf..1f5cf0ff97d 100644 --- a/buildtools/fsyacc/Parsing.fsi +++ b/buildtools/fsyacc/Parsing.fsi @@ -8,43 +8,43 @@ open FSharp.Text.Lexing open System.Collections.Generic /// The information accessible via the parseState value within parser actions. -type IParseState = +type IParseState = /// Get the start and end position for the terminal or non-terminal at a given index matched by the production abstract InputRange: index:int -> Position * Position /// Get the end position for the terminal or non-terminal at a given index matched by the production - abstract InputEndPosition: int -> Position + abstract InputEndPosition: int -> Position /// Get the start position for the terminal or non-terminal at a given index matched by the production - abstract InputStartPosition: int -> Position + abstract InputStartPosition: int -> Position /// Get the full range of positions matched by the production abstract ResultRange: Position * Position /// Get the value produced by the terminal or non-terminal at the given position - abstract GetInput : int -> obj + abstract GetInput : int -> obj /// Get the store of local values associated with this parser // Dynamically typed, non-lexically scoped local store abstract ParserLocalStore : IDictionary /// Raise an error in this parse context - abstract RaiseError<'b> : unit -> 'b + abstract RaiseError<'b> : unit -> 'b [] /// The context provided when a parse error occurs type ParseErrorContext<'tok> = - /// The stack of state indexes active at the parse error + /// The stack of state indexes active at the parse error member StateStack : int list - /// The state active at the parse error + /// The state active at the parse error member ParseState : IParseState - /// The tokens that would cause a reduction at the parse error + /// The tokens that would cause a reduction at the parse error member ReduceTokens: int list - /// The stack of productions that would be reduced at the parse error + /// The stack of productions that would be reduced at the parse error member ReducibleProductions : int list list /// The token that caused the parse error @@ -58,60 +58,60 @@ type ParseErrorContext<'tok> = /// Tables generated by fsyacc /// The type of the tables contained in a file produced by the fsyacc.exe parser generator. -type Tables<'tok> = - { +type Tables<'tok> = + { /// The reduction table reductions: (IParseState -> obj) array ; - + /// The token number indicating the end of input endOfInputTag: int; - + /// A function to compute the tag of a token tagOfToken: 'tok -> int; - + /// A function to compute the data carried by a token - dataOfToken: 'tok -> obj; - + dataOfToken: 'tok -> obj; + /// The sparse action table elements actionTableElements: uint16[]; - + /// The sparse action table row offsets actionTableRowOffsets: uint16[]; - + /// The number of symbols for each reduction reductionSymbolCounts: uint16[]; - + /// The immediate action table - immediateActions: uint16[]; - + immediateActions: uint16[]; + /// The sparse goto table gotos: uint16[]; - + /// The sparse goto table row offsets sparseGotoTableRowOffsets: uint16[]; - + /// The sparse table for the productions active for each state - stateToProdIdxsTableElements: uint16[]; - + stateToProdIdxsTableElements: uint16[]; + /// The sparse table offsets for the productions active for each state - stateToProdIdxsTableRowOffsets: uint16[]; - + stateToProdIdxsTableRowOffsets: uint16[]; + /// This table is logically part of the Goto table productionToNonTerminalTable: uint16[]; - + /// This function is used to hold the user specified "parse_error" or "parse_error_rich" functions parseError: ParseErrorContext<'tok> -> unit; - - /// The total number of terminals + + /// The total number of terminals numTerminals: int; - + /// The tag of the error terminal - tagOfErrorTerminal: int + tagOfErrorTerminal: int } /// Interpret the parser table taking input from the given lexer, using the given lex buffer, and the given start state. /// Returns an object indicating the final synthesized value for the parse. - member Interpret : lexer:(LexBuffer<'char> -> 'tok) * lexbuf:LexBuffer<'char> * startState:int -> obj + member Interpret : lexer:(LexBuffer<'char> -> 'tok) * lexbuf:LexBuffer<'char> * startState:int -> obj /// Indicates an accept action has occurred exception Accept of obj @@ -124,10 +124,10 @@ module internal Flags = #endif /// Helpers used by generated parsers. -module ParseHelpers = +module ParseHelpers = /// The default implementation of the parse_error_rich function val parse_error_rich: (ParseErrorContext<'tok> -> unit) option - + /// The default implementation of the parse_error function val parse_error: string -> unit diff --git a/buildtools/fsyacc/fsyacc.fs b/buildtools/fsyacc/fsyacc.fs index b2b2f4df047..5ee07fe0bf9 100644 --- a/buildtools/fsyacc/fsyacc.fs +++ b/buildtools/fsyacc/fsyacc.fs @@ -26,14 +26,14 @@ let mutable bufferTypeArgument = "'cty" let usage = [ ArgInfo("-o", ArgType.String (fun s -> out <- Some s), "Name the output file."); - ArgInfo("-v", ArgType.Unit (fun () -> log <- true), "Produce a listing file."); - ArgInfo("--module", ArgType.String (fun s -> modname <- Some s), "Define the F# module name to host the generated parser."); + ArgInfo("-v", ArgType.Unit (fun () -> log <- true), "Produce a listing file."); + ArgInfo("--module", ArgType.String (fun s -> modname <- Some s), "Define the F# module name to host the generated parser."); ArgInfo("--internal", ArgType.Unit (fun () -> internal_module <- true), "Generate an internal module"); - ArgInfo("--open", ArgType.String (fun s -> opens <- opens @ [s]), "Add the given module to the list of those to open in both the generated signature and implementation."); + ArgInfo("--open", ArgType.String (fun s -> opens <- opens @ [s]), "Add the given module to the list of those to open in both the generated signature and implementation."); ArgInfo("--light", ArgType.Unit (fun () -> light <- Some true), "(ignored)"); ArgInfo("--light-off", ArgType.Unit (fun () -> light <- Some false), "Add #light \"off\" to the top of the generated file"); - ArgInfo("--ml-compatibility", ArgType.Unit (fun _ -> compat <- true), "Support the use of the global state from the 'Parsing' module in FSharp.PowerPack.dll."); - ArgInfo("--tokens", ArgType.Unit (fun _ -> tokenize <- true), "Simply tokenize the specification file itself."); + ArgInfo("--ml-compatibility", ArgType.Unit (fun _ -> compat <- true), "Support the use of the global state from the 'Parsing' module in FSharp.PowerPack.dll."); + ArgInfo("--tokens", ArgType.Unit (fun _ -> tokenize <- true), "Simply tokenize the specification file itself."); ArgInfo("--lexlib", ArgType.String (fun s -> lexlib <- s), "Specify the namespace for the implementation of the lexer (default: FSharp.Text.Lexing)"); ArgInfo("--parslib", ArgType.String (fun s -> parslib <- s), "Specify the namespace for the implementation of the parser table interpreter (default: FSharp.Text.Parsing)"); ArgInfo("--codepage", ArgType.Int (fun i -> inputCodePage <- Some i), "Assume input lexer specification file is encoded with the given codepage.") @@ -41,33 +41,33 @@ let usage = let _ = ArgParser.Parse(usage,(fun x -> match input with Some _ -> failwith "more than one input given" | None -> input <- Some x),"fsyacc ") -let main() = - let filename = (match input with Some x -> x | None -> failwith "no input given") in +let main() = + let filename = (match input with Some x -> x | None -> failwith "no input given") in if tokenize then printTokens filename inputCodePage - - let spec = + + let spec = match readSpecFromFile filename inputCodePage with | Ok spec -> spec - | Result.Error (e, line, col) -> + | Result.Error (e, line, col) -> eprintf "%s(%d,%d): error: %s" filename line col e.Message exit 1 - + use logger = match logFileName(filename, out, log) with | Some outputLogName -> new FileLogger(outputLogName) :> Logger | None -> new NullLogger() :> Logger let compiledSpec = compileSpec spec logger printfn " building tables" - printfn " %d states" compiledSpec.states.Length; - printfn " %d nonterminals" compiledSpec.gotoTable.[0].Length; - printfn " %d terminals" compiledSpec.actionTable.[0].Length; - printfn " %d productions" compiledSpec.prods.Length; - printfn " #rows in action table: %d" compiledSpec.actionTable.Length; + printfn " %d states" compiledSpec.states.Length; + printfn " %d nonterminals" compiledSpec.gotoTable.[0].Length; + printfn " %d terminals" compiledSpec.actionTable.[0].Length; + printfn " %d productions" compiledSpec.prods.Length; + printfn " #rows in action table: %d" compiledSpec.actionTable.Length; (* - printfn "#unique rows in action table: %d" (List.length (Array.foldBack (fun row acc -> insert (Array.to_list row) acc) actionTable [])); - printfn "maximum #different actions per state: %d" (Array.foldBack (fun row acc ->max (List.length (List.foldBack insert (Array.to_list row) [])) acc) actionTable 0); - printfn "average #different actions per state: %d" ((Array.foldBack (fun row acc -> (List.length (List.foldBack insert (Array.to_list row) [])) + acc) actionTable 0) / (Array.length states)); + printfn "#unique rows in action table: %d" (List.length (Array.foldBack (fun row acc -> insert (Array.to_list row) acc) actionTable [])); + printfn "maximum #different actions per state: %d" (Array.foldBack (fun row acc ->max (List.length (List.foldBack insert (Array.to_list row) [])) acc) actionTable 0); + printfn "average #different actions per state: %d" ((Array.foldBack (fun row acc -> (List.length (List.foldBack insert (Array.to_list row) [])) + acc) actionTable 0) / (Array.length states)); *) - + let generatorState: GeneratorState = { GeneratorState.Default with input = filename @@ -83,9 +83,9 @@ let main() = bufferTypeArgument = bufferTypeArgument } writeSpecToFile generatorState spec compiledSpec -let result = +let result = try main() - with e -> + with e -> eprintf "FSYACC: error FSY000: %s\n%s" (match e with Failure s -> s | e -> e.Message) e.StackTrace; exit 1 diff --git a/buildtools/fsyacc/fsyaccast.fs b/buildtools/fsyacc/fsyaccast.fs index 8681786a0d8..db9e704a514 100644 --- a/buildtools/fsyacc/fsyaccast.fs +++ b/buildtools/fsyacc/fsyaccast.fs @@ -17,14 +17,14 @@ type Code = string * Position type Associativity = LeftAssoc | RightAssoc | NonAssoc type Rule = Rule of Identifier list * Identifier option * Code option -type ParserSpec= +type ParserSpec= { Header : Code; Tokens : (Identifier * string option) list; Types : (Identifier * string) list; Associativities: (Identifier * Associativity) list list; // suggest to do: (Associativity * Identifier list) list StartSymbols : Identifier list; Rules : (Identifier * Rule list) list } - + type Terminal = string type NonTerminal = string @@ -45,8 +45,8 @@ let OutputSyms os syms = let OutputTerminalSet os (tset:string seq) = fprintf os "%s" (String.Join(";", tset |> Seq.toArray)) -let OutputAssoc os p = - match p with +let OutputAssoc os p = + match p with | LeftAssoc -> fprintf os "left" | RightAssoc -> fprintf os "right" | NonAssoc -> fprintf os "nonassoc" @@ -55,71 +55,71 @@ let OutputAssoc os p = //--------------------------------------------------------------------- // PreProcess Raw Parser Spec AST -type PrecedenceInfo = - | ExplicitPrec of Associativity * int +type PrecedenceInfo = + | ExplicitPrec of Associativity * int | NoPrecedence - + type Production = Production of NonTerminal * PrecedenceInfo * Symbols * Code option -type ProcessedParserSpec = +type ProcessedParserSpec = { Terminals: (Terminal * PrecedenceInfo) list; NonTerminals: NonTerminal list; Productions: Production list; StartSymbols: NonTerminal list } -let ProcessParserSpecAst (spec: ParserSpec) = - let explicitPrecInfo = - spec.Associativities +let ProcessParserSpecAst (spec: ParserSpec) = + let explicitPrecInfo = + spec.Associativities |> List.mapi (fun n precSpecs -> precSpecs |> List.map (fun (precSym, assoc) -> precSym,ExplicitPrec (assoc, 9999 - n))) |> List.concat - + for key,_ in explicitPrecInfo |> Seq.countBy fst |> Seq.filter (fun (_,n) -> n > 1) do failwithf "%s is given two associativities" key - - let explicitPrecInfo = + + let explicitPrecInfo = explicitPrecInfo |> Map.ofList let implicitSymPrecInfo = NoPrecedence let terminals = List.map fst spec.Tokens @ ["error"] let terminalSet = Set.ofList terminals let IsTerminal z = terminalSet.Contains(z) - let prec_of_terminal sym implicitPrecInfo = + let prec_of_terminal sym implicitPrecInfo = if explicitPrecInfo.ContainsKey(sym) then explicitPrecInfo.[sym] else match implicitPrecInfo with Some x -> x | None -> implicitSymPrecInfo - + let mkSym s = if IsTerminal s then Terminal s else NonTerminal s - let prods = - spec.Rules |> List.mapi (fun _ (nonterm,rules) -> - rules |> List.mapi (fun _ (Rule(syms,precsym,code)) -> - let precInfo = + let prods = + spec.Rules |> List.mapi (fun _ (nonterm,rules) -> + rules |> List.mapi (fun _ (Rule(syms,precsym,code)) -> + let precInfo = let precsym = List.foldBack (fun x acc -> match acc with Some _ -> acc | None -> match x with z when IsTerminal z -> Some z | _ -> acc) syms precsym let implicitPrecInfo = NoPrecedence - match precsym with - | None -> implicitPrecInfo + match precsym with + | None -> implicitPrecInfo | Some sym -> prec_of_terminal sym None Production(nonterm, precInfo, List.map mkSym syms, code))) |> List.concat let nonTerminals = List.map fst spec.Rules let nonTerminalSet = Set.ofList nonTerminals - let checkNonTerminal nt = - if nt <> "error" && not (nonTerminalSet.Contains(nt)) then + let checkNonTerminal nt = + if nt <> "error" && not (nonTerminalSet.Contains(nt)) then failwith (sprintf "NonTerminal '%s' has no productions" nt) for Production(_,_,syms,_) in prods do - for sym in syms do - match sym with - | NonTerminal nt -> - checkNonTerminal nt - | Terminal t -> + for sym in syms do + match sym with + | NonTerminal nt -> + checkNonTerminal nt + | Terminal t -> if not (IsTerminal t) then failwith (sprintf "token %s is not declared" t) - + if spec.StartSymbols= [] then (failwith "at least one %start declaration is required"); - for nt,_ in spec.Types do + for nt,_ in spec.Types do checkNonTerminal nt; - let terminals = terminals |> List.map (fun t -> (t,prec_of_terminal t None)) + let terminals = terminals |> List.map (fun t -> (t,prec_of_terminal t None)) { Terminals=terminals; NonTerminals=nonTerminals; @@ -133,22 +133,22 @@ let ProcessParserSpecAst (spec: ParserSpec) = type ProductionIndex = int type ProductionDotIndex = int -/// Represent (ProductionIndex,ProductionDotIndex) as one integer -type Item0 = uint32 +/// Represent (ProductionIndex,ProductionDotIndex) as one integer +type Item0 = uint32 let mkItem0 (prodIdx,dotIdx) : Item0 = (uint32 prodIdx <<< 16) ||| uint32 dotIdx let prodIdx_of_item0 (item0:Item0) = int32 (item0 >>> 16) let dotIdx_of_item0 (item0:Item0) = int32 (item0 &&& 0xFFFFu) /// Part of the output of CompilerLalrParserSpec -type Action = +type Action = | Shift of int | Reduce of ProductionIndex | Accept | Error - -let outputPrecInfo os p = - match p with + +let outputPrecInfo os p = + match p with | ExplicitPrec (assoc,n) -> fprintf os "explicit %a %d" OutputAssoc assoc n | NoPrecedence -> fprintf os "noprec" @@ -164,7 +164,7 @@ type TerminalIndex = int type NonTerminalIndex = int /// Representation of Symbols. -/// Ideally would be declared as +/// Ideally would be declared as /// type SymbolIndex = PTerminal of TerminalIndex | PNonTerminal of NonTerminalIndex /// but for performance reasons we embed as a simple integer (saves ~10%) /// @@ -199,22 +199,22 @@ let GotoItemIdx (i1:KernelIdx,i2:SymbolIndex) = (uint64 (uint32 i1) <<< 32) ||| let (|GotoItemIdx|) (i64:uint64) = int32 ((i64 >>> 32) &&& 0xFFFFFFFFUL), int32 (i64 &&& 0xFFFFFFFFUL) /// Create a work list and loop until it is exhausted, calling a worker function for -/// each element. Pass a function to queue additional work on the work list +/// each element. Pass a function to queue additional work on the work list /// to the worker function let ProcessWorkList start f = let work = ref (start : 'a list) let queueWork = (fun x -> work := x :: !work) - let rec loop() = - match !work with + let rec loop() = + match !work with | [] -> () - | x::t -> - work := t; + | x::t -> + work := t; f queueWork x; loop() loop() /// A standard utility to compute a least fixed point of a set under a generative computation -let LeastFixedPoint f set = +let LeastFixedPoint f set = let acc = ref set ProcessWorkList (Set.toList set) (fun queueWork item -> f(item) |> List.iter (fun i2 -> if not (Set.contains i2 !acc) then (acc := Set.add i2 !acc; queueWork i2)) ) @@ -222,20 +222,20 @@ let LeastFixedPoint f set = /// A general standard memoization utility. Be sure to apply to only one (function) argument to build the /// residue function! -let Memoize f = +let Memoize f = let t = Dictionary(1000) - fun x -> - let ok,v = t.TryGetValue(x) - if ok then v else let res = f x in t.[x] <- res; res + fun x -> + let ok,v = t.TryGetValue(x) + if ok then v else let res = f x in t.[x] <- res; res /// A standard utility to create a dictionary from a list of pairs -let CreateDictionary xs = +let CreateDictionary xs = let dict = Dictionary() for x,y in xs do dict.Add(x,y) dict /// Allocate indexes for each non-terminal -type NonTerminalTable(nonTerminals:NonTerminal list) = +type NonTerminalTable(nonTerminals:NonTerminal list) = let nonterminalsWithIdxs = List.mapi (fun (i:NonTerminalIndex) n -> (i,n)) nonTerminals let nonterminalIdxs = List.map fst nonterminalsWithIdxs let a = Array.ofList nonTerminals @@ -245,7 +245,7 @@ type NonTerminalTable(nonTerminals:NonTerminal list) = member table.Indexes = nonterminalIdxs /// Allocate indexes for each terminal -type TerminalTable(terminals:(Terminal * PrecedenceInfo) list) = +type TerminalTable(terminals:(Terminal * PrecedenceInfo) list) = let terminalsWithIdxs = List.mapi (fun i (t,_) -> (i,t)) terminals let terminalIdxs = List.map fst terminalsWithIdxs let a = Array.ofList (List.map fst terminals) @@ -260,18 +260,18 @@ type TerminalTable(terminals:(Terminal * PrecedenceInfo) list) = /// Allocate indexes for each production type ProductionTable(ntTab:NonTerminalTable, termTab:TerminalTable, nonTerminals:string list, prods: Production list) = let prodsWithIdxs = List.mapi (fun i n -> (i,n)) prods - let a = + let a = prodsWithIdxs - |> List.map(fun (_,Production(_,_,syms,_)) -> - syms - |> Array.ofList - |> Array.map (function - | Terminal t -> PTerminal (termTab.ToIndex t) + |> List.map(fun (_,Production(_,_,syms,_)) -> + syms + |> Array.ofList + |> Array.map (function + | Terminal t -> PTerminal (termTab.ToIndex t) | NonTerminal nt -> PNonTerminal (ntTab.ToIndex nt )) ) |> Array.ofList let b = Array.ofList (List.map (fun (_,Production(nt,_,_,_)) -> ntTab.ToIndex nt) prodsWithIdxs) let c = Array.ofList (List.map (fun (_,Production(_,prec,_,_)) -> prec) prodsWithIdxs) - let productions = + let productions = nonTerminals |> List.map(fun nt -> (ntTab.ToIndex nt, List.choose (fun (i,Production(nt2,_,_,_)) -> if nt2=nt then Some i else None) prodsWithIdxs)) |> CreateDictionary @@ -279,27 +279,27 @@ type ProductionTable(ntTab:NonTerminalTable, termTab:TerminalTable, nonTerminals member prodTab.Symbols(i) = a.[i] member prodTab.NonTerminal(i) = b.[i] member prodTab.Precedence(i) = c.[i] - member prodTab.Symbol i n = + member prodTab.Symbol i n = let syms = prodTab.Symbols i if n >= syms.Length then None else Some syms.[n] member prodTab.Productions = productions /// A mutable table mapping kernels to sets of lookahead tokens -type LookaheadTable() = +type LookaheadTable() = let t = Dictionary>() - member table.Add(x,y) = - let prev = if t.ContainsKey(x) then t.[x] else Set.empty + member table.Add(x,y) = + let prev = if t.ContainsKey(x) then t.[x] else Set.empty t.[x] <- prev.Add(y) member table.Contains(x,y) = t.ContainsKey(x) && t.[x].Contains(y) - member table.GetLookaheads(idx:KernelItemIndex) = - let ok,v = t.TryGetValue(idx) + member table.GetLookaheads(idx:KernelItemIndex) = + let ok,v = t.TryGetValue(idx) if ok then v else Set.empty member table.Count = t |> Seq.fold(fun acc (KeyValue(_,v)) -> v.Count+acc) 0 /// A mutable table giving an index to each LR(0) kernel. Kernels are referred to only by index. type KernelTable(kernels) = - // Give an index to each LR(0) kernel, and from now on refer to them only by index - // Also develop "kernelItemIdx" to refer to individual items within a kernel + // Give an index to each LR(0) kernel, and from now on refer to them only by index + // Also develop "kernelItemIdx" to refer to individual items within a kernel let kernelsAndIdxs = List.mapi (fun i x -> (i,x)) kernels let kernelIdxs = List.map fst kernelsAndIdxs let toIdxMap = Map.ofList [ for i,x in kernelsAndIdxs -> x,i ] @@ -309,9 +309,9 @@ type KernelTable(kernels) = member t.Kernel(i) = ofIdxMap.[i] /// Hold the results of computing the LALR(1) closure of an LR(0) kernel -type Closure1Table() = +type Closure1Table() = let t = Dictionary>() - member table.Add(a,b) = + member table.Add(a,b) = if not (t.ContainsKey(a)) then t.[a] <- HashSet<_>(HashIdentity.Structural) t.[a].Add(b) member table.Count = t.Count @@ -320,9 +320,9 @@ type Closure1Table() = /// A mutable table giving a lookahead set Set for each kernel. The terminals represent the /// "spontaneous" items for the kernel. TODO: document this more w.r.t. the Dragon book. -type SpontaneousTable() = +type SpontaneousTable() = let t = Dictionary>() - member table.Add(a,b) = + member table.Add(a,b) = if not (t.ContainsKey(a)) then t.[a] <- HashSet<_>(HashIdentity.Structural) t.[a].Add(b) member table.Count = t.Count @@ -330,14 +330,14 @@ type SpontaneousTable() = /// A mutable table giving a Set for each kernel. The kernels represent the /// "propagate" items for the kernel. TODO: document this more w.r.t. the Dragon book. -type PropagateTable() = +type PropagateTable() = let t = Dictionary>() - member table.Add(a,b) = + member table.Add(a,b) = if not (t.ContainsKey(a)) then t.[a] <- HashSet(HashIdentity.Structural) t.[a].Add(b) - member table.Item - with get a = - let ok,v = t.TryGetValue(a) + member table.Item + with get a = + let ok,v = t.TryGetValue(a) if ok then v :> seq<_> else Seq.empty member table.Count = t.Count @@ -345,7 +345,7 @@ type PropagateTable() = type Prod = NonTerminal * int * Symbols * option type ActionTable = (PrecedenceInfo * Action) array array -type CompiledSpec = +type CompiledSpec = { prods: Prod [] states: int list [] startStates: int list @@ -363,8 +363,8 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = let reportTime() = printfn " time: %A" stopWatch.Elapsed; stopWatch.Reset(); stopWatch.Start() stopWatch.Start() - // Augment the grammar - let fakeStartNonTerminals = spec.StartSymbols |> List.map(fun nt -> String.Concat("_start", nt)) + // Augment the grammar + let fakeStartNonTerminals = spec.StartSymbols |> List.map(fun nt -> String.Concat("_start", nt)) let nonTerminals = fakeStartNonTerminals@spec.NonTerminals let endOfInputTerminal = "$$" let dummyLookahead = "#" @@ -373,7 +373,7 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = let prods = List.map2 (fun a b -> Production(a, dummyPrec,[NonTerminal b],None)) fakeStartNonTerminals spec.StartSymbols @ spec.Productions let startNonTerminalIdx_to_prodIdx (i:int) = i - // Build indexed tables + // Build indexed tables let ntTab = NonTerminalTable(nonTerminals) let termTab = TerminalTable(terminals) let prodTab = ProductionTable(ntTab,termTab,nonTerminals,prods) @@ -385,90 +385,90 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = // Compute the FIRST function printf "computing first function..."; stdout.Flush(); - let computedFirstTable = - let seed = + let computedFirstTable = + let seed = Map.ofList [ for term in termTab.Indexes do yield (PTerminal(term),Set.singleton (Some term)) - for nonTerm in ntTab.Indexes do - yield - (PNonTerminal nonTerm, - List.foldBack - (fun prodIdx acc -> match prodTab.Symbol prodIdx 0 with None -> Set.add None acc | Some _ -> acc) - prodTab.Productions.[nonTerm] + for nonTerm in ntTab.Indexes do + yield + (PNonTerminal nonTerm, + List.foldBack + (fun prodIdx acc -> match prodTab.Symbol prodIdx 0 with None -> Set.add None acc | Some _ -> acc) + prodTab.Productions.[nonTerm] Set.empty) ] - - let add changed ss (x,y) = + + let add changed ss (x,y) = let s = Map.find x ss - if Set.contains y s then ss + if Set.contains y s then ss else (changed := true; Map.add x (Set.add y s) ss) - let oneRound (ss:Map<_,_>) = + let oneRound (ss:Map<_,_>) = let changed = ref false - let frontier = + let frontier = let res = ref [] - for nonTermX in ntTab.Indexes do + for nonTermX in ntTab.Indexes do for prodIdx in prodTab.Productions.[nonTermX] do let rhs = Array.toList (prodTab.Symbols prodIdx) let rec place l = match l with - | yi::t -> - res := - List.choose - (function None -> None | Some a -> Some (PNonTerminal nonTermX,Some a)) - (Set.toList ss.[yi]) + | yi::t -> + res := + List.choose + (function None -> None | Some a -> Some (PNonTerminal nonTermX,Some a)) + (Set.toList ss.[yi]) @ !res; if ss.[yi].Contains(None) then place t; - | [] -> + | [] -> res := (PNonTerminal nonTermX,None) :: !res place rhs !res let ss' = List.fold (add changed) ss frontier !changed, ss' - let rec loop ss = + let rec loop ss = let changed, ss' = oneRound ss if changed then loop ss' else ss' - loop seed - - + loop seed + + /// Compute the first set of the given sequence of non-terminals. If any of the non-terminals - /// have an empty token in the first set then we have to iterate through those. + /// have an empty token in the first set then we have to iterate through those. let ComputeFirstSetOfTokenList = - Memoize (fun (str,term) -> + Memoize (fun (str,term) -> let acc = System.Collections.Generic.List<_>() - let rec add l = - match l with + let rec add l = + match l with | [] -> acc.Add(term) - | sym::moreSyms -> + | sym::moreSyms -> let firstSetOfSym = computedFirstTable.[sym] - firstSetOfSym |> Set.iter (function None -> () | Some v -> acc.Add(v)) - if firstSetOfSym.Contains(None) then add moreSyms + firstSetOfSym |> Set.iter (function None -> () | Some v -> acc.Add(v)) + if firstSetOfSym.Contains(None) then add moreSyms add str; Set.ofSeq acc) - - // (int,int) representation of LR(0) items - let prodIdx_to_item0 idx = mkItem0(idx,0) + + // (int,int) representation of LR(0) items + let prodIdx_to_item0 idx = mkItem0(idx,0) let prec_of_item0 item0 = prodTab.Precedence (prodIdx_of_item0 item0) let ntIdx_of_item0 item0 = prodTab.NonTerminal (prodIdx_of_item0 item0) - let lsyms_of_item0 item0 = + let lsyms_of_item0 item0 = let prodIdx = prodIdx_of_item0 item0 let dotIdx = dotIdx_of_item0 item0 let syms = prodTab.Symbols prodIdx if dotIdx <= 0 then [||] else syms.[..dotIdx-1] - let rsyms_of_item0 item0 = + let rsyms_of_item0 item0 = let prodIdx = prodIdx_of_item0 item0 let dotIdx = dotIdx_of_item0 item0 let syms = prodTab.Symbols prodIdx syms.[dotIdx..] - let rsym_of_item0 item0 = + let rsym_of_item0 item0 = let prodIdx = prodIdx_of_item0 item0 let dotIdx = dotIdx_of_item0 item0 prodTab.Symbol prodIdx dotIdx - let advance_of_item0 item0 = + let advance_of_item0 item0 = let prodIdx = prodIdx_of_item0 item0 let dotIdx = dotIdx_of_item0 item0 mkItem0(prodIdx,dotIdx+1) @@ -484,53 +484,53 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = let OutputSyms os syms = fprintf os "%s" (String.Join(" ",Array.map StringOfSym syms)) - // Print items and other stuff + // Print items and other stuff let OutputItem0 os item0 = - fprintf os " %s -> %a . %a" (ntTab.OfIndex (ntIdx_of_item0 item0)) (* outputPrecInfo precInfo *) OutputSyms (lsyms_of_item0 item0) OutputSyms (rsyms_of_item0 item0) - - let OutputItem0Set os s = + fprintf os " %s -> %a . %a" (ntTab.OfIndex (ntIdx_of_item0 item0)) (* outputPrecInfo precInfo *) OutputSyms (lsyms_of_item0 item0) OutputSyms (rsyms_of_item0 item0) + + let OutputItem0Set os s = Set.iter (fun item -> fprintfn os "%a" OutputItem0 item) s - let OutputFirstSet os m = + let OutputFirstSet os m = Set.iter (function None -> fprintf os "" | Some x -> fprintfn os " term %s" x) m - let OutputFirstMap os m = + let OutputFirstMap os m = Map.iter (fun x y -> fprintf os "first '%a' = " OutputSym x; fprintfn os "%a" OutputFirstSet y) m - let OutputAction os m = - match m with - | Shift n -> fprintf os " shift %d" n + let OutputAction os m = + match m with + | Shift n -> fprintf os " shift %d" n | Reduce prodIdx -> fprintf os " reduce %s --> %a" (ntTab.OfIndex (prodTab.NonTerminal prodIdx)) OutputSyms (prodTab.Symbols prodIdx) | Error -> fprintf os " error" - | Accept -> fprintf os " accept" - - let OutputActions os m = + | Accept -> fprintf os " accept" + + let OutputActions os m = Array.iteri (fun i (prec,action) -> let term = termTab.OfIndex i in fprintfn os " action '%s' (%a): %a" term outputPrecInfo prec OutputAction action) m - let OutputActionTable os m = + let OutputActionTable os m = Array.iteri (fun i n -> fprintfn os "state %d:" i; fprintfn os "%a" OutputActions n) m - let OutputImmediateActions os m = - match m with + let OutputImmediateActions os m = + match m with | None -> fprintf os "" | Some a -> OutputAction os a - - let OutputGotos os m = + + let OutputGotos os m = Array.iteri (fun ntIdx s -> let nonterm = ntTab.OfIndex ntIdx in match s with Some st -> fprintfn os " goto %s: %d" nonterm st | None -> ()) m - - let OutputCombined os m = - Array.iteri (fun i (a,b,c,d) -> + + let OutputCombined os m = + Array.iteri (fun i (a,b,c,d) -> fprintf os "state %d:" i fprintf os " items:" - fprintf os "%a" OutputItem0Set a + fprintf os "%a" OutputItem0Set a fprintf os " actions:" - fprintf os "%a" OutputActions b + fprintf os "%a" OutputActions b fprintf os " immediate action: " - fprintf os "%a" OutputImmediateActions c + fprintf os "%a" OutputImmediateActions c fprintf os " gotos:" fprintf os "%a" OutputGotos d) m - - let OutputLalrTables os (_,states, startStates,actionTable,immediateActionTable,gotoTable,_,_) = + + let OutputLalrTables os (_,states, startStates,actionTable,immediateActionTable,gotoTable,_,_) = let combined = Array.ofList (List.map2 (fun x (y,(z,w)) -> x,y,z,w) (Array.toList states) (List.zip (Array.toList actionTable) (List.zip (Array.toList immediateActionTable) (Array.toList gotoTable)))) fprintfn os "------------------------"; fprintfn os "states = "; @@ -539,12 +539,12 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = fprintfn os "------------------------" - // Closure of LR(0) nonTerminals, items etc - let ComputeClosure0NonTerminal = - Memoize (fun nt -> + // Closure of LR(0) nonTerminals, items etc + let ComputeClosure0NonTerminal = + Memoize (fun nt -> let seed = (List.foldBack (prodIdx_to_item0 >> Set.add) prodTab.Productions.[nt] Set.empty) - LeastFixedPoint - (fun item0 -> + LeastFixedPoint + (fun item0 -> match rsym_of_item0 item0 with | None -> [] | Some(PNonTerminal ntB) -> List.map prodIdx_to_item0 prodTab.Productions.[ntB] @@ -552,52 +552,52 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = seed) // Close a symbol under epsilon moves - let ComputeClosure0Symbol rsym acc = + let ComputeClosure0Symbol rsym acc = match rsym with | Some (PNonTerminal nt) -> Set.union (ComputeClosure0NonTerminal nt) acc | _ -> acc // Close a set under epsilon moves - let ComputeClosure0 iset = - Set.fold (fun acc x -> ComputeClosure0Symbol (rsym_of_item0 x) acc) iset iset + let ComputeClosure0 iset = + Set.fold (fun acc x -> ComputeClosure0Symbol (rsym_of_item0 x) acc) iset iset // Right symbols after closing under epsilon moves let RelevantSymbolsOfKernel kernel = let kernelClosure0 = ComputeClosure0 kernel - Set.fold (fun acc x -> Option.fold (fun acc x -> Set.add x acc) acc (rsym_of_item0 x)) Set.empty kernelClosure0 + Set.fold (fun acc x -> Option.fold (fun acc x -> Set.add x acc) acc (rsym_of_item0 x)) Set.empty kernelClosure0 - // Goto set of a kernel of LR(0) nonTerminals, items etc + // Goto set of a kernel of LR(0) nonTerminals, items etc // Input is kernel, output is kernel - let ComputeGotosOfKernel iset sym = + let ComputeGotosOfKernel iset sym = let isetClosure = ComputeClosure0 iset let acc = System.Collections.Generic.List<_>(10) - isetClosure |> Set.iter (fun item0 -> - match rsym_of_item0 item0 with - | Some sym2 when sym = sym2 -> acc.Add(advance_of_item0 item0) - | _ -> ()) + isetClosure |> Set.iter (fun item0 -> + match rsym_of_item0 item0 with + | Some sym2 when sym = sym2 -> acc.Add(advance_of_item0 item0) + | _ -> ()) Set.ofSeq acc - - // Build the full set of LR(0) kernels + + // Build the full set of LR(0) kernels reportTime(); printf "building kernels..."; stdout.Flush(); let startItems = List.mapi (fun i _ -> prodIdx_to_item0 (startNonTerminalIdx_to_prodIdx i)) fakeStartNonTerminals let startKernels = List.map Set.singleton startItems - let kernels = + let kernels = /// We use a set-of-sets here. F# sets support structural comparison but at the time of writing - /// did not structural hashing. + /// did not structural hashing. let acc = ref Set.empty - ProcessWorkList startKernels (fun addToWorkList kernel -> + ProcessWorkList startKernels (fun addToWorkList kernel -> if not ((!acc).Contains(kernel)) then acc := (!acc).Add(kernel); - for csym in RelevantSymbolsOfKernel kernel do - let gotoKernel = ComputeGotosOfKernel kernel csym + for csym in RelevantSymbolsOfKernel kernel do + let gotoKernel = ComputeGotosOfKernel kernel csym assert (gotoKernel.Count > 0) addToWorkList gotoKernel ) - + !acc |> Seq.toList |> List.map (Set.filter IsKernelItem) - + reportTime(); printf "building kernel table..."; stdout.Flush(); - // Give an index to each LR(0) kernel, and from now on refer to them only by index + // Give an index to each LR(0) kernel, and from now on refer to them only by index let kernelTab = KernelTable(kernels) let startKernelIdxs = List.map kernelTab.Index startKernels let startKernelItemIdxs = List.map2 (fun a b -> KernelItemIdx(a,b)) startKernelIdxs startItems @@ -605,93 +605,93 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = let outputKernelItemIdx os (kernelIdx,item0) = fprintf os "kernel %d, item %a" kernelIdx OutputItem0 item0 - /// A cached version of the "goto" computation on LR(0) kernels - let gotoKernel = - Memoize (fun (GotoItemIdx(kernelIdx,sym)) -> + /// A cached version of the "goto" computation on LR(0) kernels + let gotoKernel = + Memoize (fun (GotoItemIdx(kernelIdx,sym)) -> let gset = ComputeGotosOfKernel (kernelTab.Kernel kernelIdx) sym if gset.IsEmpty then None else Some (kernelTab.Index gset)) /// Iterate (iset,sym) pairs such that (gotoKernel kernelIdx sym) is not empty let IterateGotosOfKernel kernelIdx f = - for sym in RelevantSymbolsOfKernel (kernelTab.Kernel kernelIdx) do - match gotoKernel (GotoItemIdx(kernelIdx,sym)) with + for sym in RelevantSymbolsOfKernel (kernelTab.Kernel kernelIdx) do + match gotoKernel (GotoItemIdx(kernelIdx,sym)) with | None -> () | Some k -> f sym k - - // This is used to compute the closure of an LALR(1) kernel + + // This is used to compute the closure of an LALR(1) kernel // // For each item [A --> X.BY, a] in I // For each production B -> g in G' // For each terminal b in FIRST(Ya) // such that [B --> .g, b] is not in I do // add [B --> .g, b] to I - - let ComputeClosure1 iset = + + let ComputeClosure1 iset = let acc = Closure1Table() ProcessWorkList iset (fun addToWorkList (item0,pretokens:Set) -> - pretokens |> Set.iter (fun pretoken -> + pretokens |> Set.iter (fun pretoken -> if not (acc.Contains(item0,pretoken)) then acc.Add(item0,pretoken) |> ignore - let rsyms = rsyms_of_item0 item0 - if rsyms.Length > 0 then - match rsyms.[0] with - | PNonTerminal ntB -> + let rsyms = rsyms_of_item0 item0 + if rsyms.Length > 0 then + match rsyms.[0] with + | PNonTerminal ntB -> let firstSet = ComputeFirstSetOfTokenList (Array.toList rsyms.[1..],pretoken) for prodIdx in prodTab.Productions.[ntB] do addToWorkList (prodIdx_to_item0 prodIdx,firstSet) | PTerminal _ -> ())) acc - // Compute the "spontaneous" and "propagate" maps for each LR(0) kernelItem + // Compute the "spontaneous" and "propagate" maps for each LR(0) kernelItem // // Input: The kernel K of a set of LR(0) items I and a grammar symbol X // - // Output: The lookaheads generated spontaneously by items in I for kernel items + // Output: The lookaheads generated spontaneously by items in I for kernel items // in goto(I,X) and the items I from which lookaheads are propagated to kernel // items in goto(I,X) // // Method // 1. Construct LR(0) kernel items (done - above) - // 2. - // TODO: this is very, very slow. + // 2. + // TODO: this is very, very slow. // // PLAN TO OPTIMIZE THIS; // - Clarify and comment what's going on here // - verify if we really have to do these enormous closure computations // - assess if it's possible to use the symbol we're looking for to help trim the jset - + reportTime(); printf "computing lookahead relations..."; stdout.Flush(); - + let spontaneous, propagate = - let closure1OfItem0WithDummy = + let closure1OfItem0WithDummy = Memoize (fun item0 -> ComputeClosure1 [(item0,Set.ofList [dummyLookaheadIdx])]) let spontaneous = SpontaneousTable() let propagate = PropagateTable() - let count = ref 0 + let count = ref 0 for kernelIdx in kernelTab.Indexes do printf "."; stdout.Flush(); //printf "kernelIdx = %d\n" kernelIdx; stdout.Flush(); let kernel = kernelTab.Kernel(kernelIdx) - for item0 in kernel do + for item0 in kernel do let item0Idx = KernelItemIdx(kernelIdx,item0) let jset = closure1OfItem0WithDummy item0 //printf "#jset = %d\n" jset.Count; stdout.Flush(); for KeyValue(closureItem0, lookaheadTokens) in jset.IEnumerable do incr count - match rsym_of_item0 closureItem0 with + match rsym_of_item0 closureItem0 with | None -> () | Some rsym -> - match gotoKernel (GotoItemIdx(kernelIdx,rsym)) with + match gotoKernel (GotoItemIdx(kernelIdx,rsym)) with | None -> () | Some gotoKernelIdx -> let gotoItem = advance_of_item0 closureItem0 let gotoItemIdx = KernelItemIdx(gotoKernelIdx,gotoItem) for lookaheadToken in lookaheadTokens do - if lookaheadToken = dummyLookaheadIdx + if lookaheadToken = dummyLookaheadIdx then propagate.Add(item0Idx, gotoItemIdx) |> ignore else spontaneous.Add(gotoItemIdx, lookaheadToken) |> ignore @@ -699,14 +699,14 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = //printfn "#kernelIdxs = %d, count = %d" kernelTab.Indexes.Length !count spontaneous, propagate - + //printfn "#spontaneous = %d, #propagate = %d" spontaneous.Count propagate.Count; stdout.Flush(); - + //exit 0; - // Repeatedly use the "spontaneous" and "propagate" maps to build the full set - // of lookaheads for each LR(0) kernelItem. + // Repeatedly use the "spontaneous" and "propagate" maps to build the full set + // of lookaheads for each LR(0) kernelItem. reportTime(); printf "building lookahead table..."; stdout.Flush(); - let lookaheadTable = + let lookaheadTable = // Seed the table with the startKernelItems and the spontaneous info let initialWork = @@ -718,12 +718,12 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = let acc = LookaheadTable() // Compute the closure - ProcessWorkList + ProcessWorkList initialWork (fun queueWork (kernelItemIdx,lookahead) -> acc.Add(kernelItemIdx,lookahead) for gotoKernelIdx in propagate.[kernelItemIdx] do - if not (acc.Contains(gotoKernelIdx,lookahead)) then + if not (acc.Contains(gotoKernelIdx,lookahead)) then queueWork(gotoKernelIdx,lookahead)) acc @@ -732,24 +732,24 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = reportTime(); printf "building action table..."; stdout.Flush(); let shiftReduceConflicts = ref 0 let reduceReduceConflicts = ref 0 - let actionTable, immediateActionTable = + let actionTable, immediateActionTable = - // Now build the action tables. First a utility to merge the given action - // into the table, taking into account precedences etc. and reporting errors. - let addResolvingPrecedence (arr: _[]) kernelIdx termIdx (precNew, actionNew) = - // printf "DEBUG: state %d: adding action for %s, precNew = %a, actionNew = %a\n" kernelIdx (termTab.OfIndex termIdx) outputPrec precNew OutputAction actionNew; - // We add in order of precedence - however the precedences may be the same, and we give warnings when precedence resolution is based on implicit file orderings + // Now build the action tables. First a utility to merge the given action + // into the table, taking into account precedences etc. and reporting errors. + let addResolvingPrecedence (arr: _[]) kernelIdx termIdx (precNew, actionNew) = + // printf "DEBUG: state %d: adding action for %s, precNew = %a, actionNew = %a\n" kernelIdx (termTab.OfIndex termIdx) outputPrec precNew OutputAction actionNew; + // We add in order of precedence - however the precedences may be the same, and we give warnings when precedence resolution is based on implicit file orderings let _, actionSoFar as itemSoFar = arr.[termIdx] - // printf "DEBUG: state %d: adding action for %s, precNew = %a, precSoFar = %a, actionSoFar = %a\n" kernelIdx (termTab.OfIndex termIdx) outputPrec precNew outputPrec precSoFar OutputAction actionSoFar; - // if compare_prec precSoFar precNew = -1 then failwith "addResolvingPrecedence"; + // printf "DEBUG: state %d: adding action for %s, precNew = %a, precSoFar = %a, actionSoFar = %a\n" kernelIdx (termTab.OfIndex termIdx) outputPrec precNew outputPrec precSoFar OutputAction actionSoFar; + // if compare_prec precSoFar precNew = -1 then failwith "addResolvingPrecedence"; - let itemNew = (precNew, actionNew) - let winner = + let itemNew = (precNew, actionNew) + let winner = let reportConflict x1 x2 reason = let reportAction (p, a) = - let an, astr = + let an, astr = match a with | Shift x -> "shift", sprintf "shift(%d)" x | Reduce x -> @@ -759,37 +759,37 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = |> String.concat " " |> sprintf "reduce(%s:%s)" (ntTab.OfIndex nt) | _ -> "", "" - let pstr = - match p with - | ExplicitPrec (assoc,n) -> - let astr = - match assoc with + let pstr = + match p with + | ExplicitPrec (assoc,n) -> + let astr = + match assoc with | LeftAssoc -> "left" | RightAssoc -> "right" | NonAssoc -> "nonassoc" sprintf "[explicit %s %d]" astr n - | NoPrecedence -> + | NoPrecedence -> "noprec" an, "{" + pstr + " " + astr + "}" let a1n, astr1 = reportAction x1 let a2n, astr2 = reportAction x2 printfn " %s/%s error at state %d on terminal %s between %s and %s - assuming the former because %s" a1n a2n kernelIdx (termTab.OfIndex termIdx) astr1 astr2 reason - match itemSoFar,itemNew with - | (_,Shift _),(_, Shift _) -> - if actionSoFar <> actionNew then + match itemSoFar,itemNew with + | (_,Shift _),(_, Shift _) -> + if actionSoFar <> actionNew then reportConflict itemSoFar itemNew "internal error" itemSoFar - | (precShift,Shift _ as shiftItem, + | (precShift,Shift _ as shiftItem, (precReduce,Reduce _ as reduceItem)) - | (precReduce,Reduce _ as reduceItem, - (precShift,Shift _ as shiftItem)) -> - match precReduce, precShift with - | ExplicitPrec (_,p1), ExplicitPrec(assocNew,p2) -> + | (precReduce,Reduce _ as reduceItem, + (precShift,Shift _ as shiftItem)) -> + match precReduce, precShift with + | ExplicitPrec (_,p1), ExplicitPrec(assocNew,p2) -> if p1 < p2 then shiftItem elif p1 > p2 then reduceItem else - match assocNew with + match assocNew with | LeftAssoc -> reduceItem | RightAssoc -> shiftItem | NonAssoc -> @@ -800,24 +800,24 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = reportConflict shiftItem reduceItem "we prefer shift when unable to compare precedences" incr shiftReduceConflicts; shiftItem - | (_,Reduce prodIdx1),(_, Reduce prodIdx2) -> + | (_,Reduce prodIdx1),(_, Reduce prodIdx2) -> "we prefer the rule earlier in the file" |> if prodIdx1 < prodIdx2 then reportConflict itemSoFar itemNew else reportConflict itemNew itemSoFar incr reduceReduceConflicts; if prodIdx1 < prodIdx2 then itemSoFar else itemNew - | _ -> itemNew + | _ -> itemNew arr.[termIdx] <- winner - - // This build the action table for one state. - let ComputeActions kernelIdx = + + // This build the action table for one state. + let ComputeActions kernelIdx = let kernel = kernelTab.Kernel kernelIdx let arr = Array.create terminals.Length (NoPrecedence,Error) //printf "building lookahead table LR(1) items for kernelIdx %d\n" kernelIdx; stdout.Flush(); // Compute the LR(1) items based on lookaheads - let items = + let items = [ for item0 in kernel do let kernelItemIdx = KernelItemIdx(kernelIdx,item0) let lookaheads = lookaheadTable.GetLookaheads(kernelItemIdx) @@ -827,37 +827,37 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = for KeyValue(item0,lookaheads) in items.IEnumerable do let _ = ntIdx_of_item0 item0 - match rsym_of_item0 item0 with - | Some (PTerminal termIdx) -> + match rsym_of_item0 item0 with + | Some (PTerminal termIdx) -> let action = - match gotoKernel (GotoItemIdx(kernelIdx,PTerminal termIdx)) with + match gotoKernel (GotoItemIdx(kernelIdx,PTerminal termIdx)) with | None -> failwith "action on terminal should have found a non-empty goto state" | Some gkernelItemIdx -> Shift gkernelItemIdx let prec = termTab.PrecInfoOfIndex termIdx - addResolvingPrecedence arr kernelIdx termIdx (prec, action) + addResolvingPrecedence arr kernelIdx termIdx (prec, action) | None -> for lookahead in lookaheads do if not (IsStartItem(item0)) then let prodIdx = prodIdx_of_item0 item0 let prec = prec_of_item0 item0 let action = (prec, Reduce prodIdx) - addResolvingPrecedence arr kernelIdx lookahead action + addResolvingPrecedence arr kernelIdx lookahead action elif lookahead = endOfInputTerminalIdx then let prec = prec_of_item0 item0 let action = (prec,Accept) - addResolvingPrecedence arr kernelIdx lookahead action + addResolvingPrecedence arr kernelIdx lookahead action else () | _ -> () - // If there is a single item A -> B C . and no Shift or Accept actions (i.e. only Error or Reduce, so the choice of terminal - // cannot affect what we do) then we emit an immediate reduce action for the rule corresponding to that item - // Also do the same for Accept rules. + // If there is a single item A -> B C . and no Shift or Accept actions (i.e. only Error or Reduce, so the choice of terminal + // cannot affect what we do) then we emit an immediate reduce action for the rule corresponding to that item + // Also do the same for Accept rules. let closure = (ComputeClosure0 kernel) let immediateAction = match Set.toList closure with | [item0] -> - match (rsym_of_item0 item0) with + match (rsym_of_item0 item0) with | None when (let reduceOrErrorAction = function Error | Reduce _ -> true | Shift _ | Accept -> false termTab.Indexes |> List.forall(fun terminalIdx -> reduceOrErrorAction (snd(arr.[terminalIdx])))) -> Some (Reduce (prodIdx_of_item0 item0)) @@ -869,13 +869,13 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = | _ -> None | _ -> None - // A -> B C . rules give rise to reductions in favour of errors + // A -> B C . rules give rise to reductions in favour of errors for item0 in ComputeClosure0 kernel do let prec = prec_of_item0 item0 - match rsym_of_item0 item0 with + match rsym_of_item0 item0 with | None -> - for terminalIdx in termTab.Indexes do - if snd(arr.[terminalIdx]) = Error then + for terminalIdx in termTab.Indexes do + if snd(arr.[terminalIdx]) = Error then let prodIdx = prodIdx_of_item0 item0 let action = (prec, (if IsStartItem(item0) then Accept else Reduce prodIdx)) addResolvingPrecedence arr kernelIdx terminalIdx action @@ -887,10 +887,10 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = Array.ofList (List.map fst actionInfo), Array.ofList (List.map snd actionInfo) - // The goto table is much simpler - it is based on LR(0) kernels alone. + // The goto table is much simpler - it is based on LR(0) kernels alone. reportTime(); printf " building goto table..."; stdout.Flush(); - let gotoTable = + let gotoTable = let gotos kernelIdx = Array.ofList (List.map (fun nt -> gotoKernel (GotoItemIdx(kernelIdx,PNonTerminal nt))) ntTab.Indexes) Array.ofList (List.map gotos kernelTab.Indexes) @@ -900,10 +900,10 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = if !shiftReduceConflicts > 0 || !reduceReduceConflicts > 0 then printfn " consider setting precedences explicitly using %%left %%right and %%nonassoc on terminals and/or setting explicit precedence on rules using %%prec" /// The final results - let states = kernels |> Array.ofList + let states = kernels |> Array.ofList let prods = Array.ofList (List.map (fun (Production(nt,_,syms,code)) -> (nt, ntTab.ToIndex nt, syms,code)) prods) - logf (fun logStream -> + logf (fun logStream -> printfn "writing tables to log"; stdout.Flush(); OutputLalrTables logStream (prods, states, startKernelIdxs, actionTable, immediateActionTable, gotoTable, (termTab.ToIndex endOfInputTerminal), errorTerminalIdx)); @@ -917,13 +917,13 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = endOfInputTerminalIdx = termTab.ToIndex endOfInputTerminal errorTerminalIdx = errorTerminalIdx nonTerminals = nonTerminals } - -(* Some examples for testing *) + +(* Some examples for testing *) (* -let example1 = - let e = "E" +let example1 = + let e = "E" let t = "Terminal" let plus = "+" let mul = "*" @@ -931,12 +931,12 @@ let example1 = let lparen = "(" let rparen = ")" let id = "id" - + let terminals = [plus; mul; lparen; rparen; id] let nonTerminals = [e; t; f] - + let p2 = e, (NonAssoc, ExplicitPrec 1), [NonTerminal e; Terminal plus; NonTerminal t], None - let p3 = e, (NonAssoc, ExplicitPrec 2), [NonTerminal t], None in + let p3 = e, (NonAssoc, ExplicitPrec 2), [NonTerminal t], None in let p4 = t, (NonAssoc, ExplicitPrec 3), [NonTerminal t; Terminal mul; NonTerminal f], None let p5 = t, (NonAssoc, ExplicitPrec 4), [NonTerminal f], None let p6 = f, (NonAssoc, ExplicitPrec 5), [Terminal lparen; NonTerminal e; Terminal rparen], None @@ -945,13 +945,13 @@ let example1 = let prods = [p2;p3;p4;p5;p6;p7] Spec(terminals,nonTerminals,prods, [e]) -let example2 = - let prods = [ "S", (NonAssoc, ExplicitPrec 1), [NonTerminal "C";NonTerminal "C"], None; +let example2 = + let prods = [ "S", (NonAssoc, ExplicitPrec 1), [NonTerminal "C";NonTerminal "C"], None; "C", (NonAssoc, ExplicitPrec 2), [Terminal "c";NonTerminal "C"], None ; "C", (NonAssoc, ExplicitPrec 3), [Terminal "d"] , None ]in Spec(["c";"d"],["S";"C"],prods, ["S"]) -let example3 = +let example3 = let terminals = ["+"; "*"; "("; ")"; "id"] let nonTerminals = ["E"; "Terminal"; "E'"; "F"; "Terminal'"] let prods = [ "E", (NonAssoc, ExplicitPrec 1), [ NonTerminal "Terminal"; NonTerminal "E'" ], None; @@ -964,7 +964,7 @@ let example3 = "F", (NonAssoc, ExplicitPrec 8), [ Terminal "id"], None ] Spec(terminals,nonTerminals,prods, ["E"]) -let example4 = +let example4 = let terminals = ["+"; "*"; "("; ")"; "id"] let nonTerminals = ["E"] let prods = [ "E", (NonAssoc, ExplicitPrec 1), [ NonTerminal "E"; Terminal "+"; NonTerminal "E" ], None; @@ -973,7 +973,7 @@ let example4 = "E", (NonAssoc, ExplicitPrec 8), [ Terminal "id"], None ] Spec(terminals,nonTerminals,prods, ["E"]) -let example5 = +let example5 = let terminals = ["+"; "*"; "("; ")"; "id"] let nonTerminals = ["E"] let prods = [ "E", (NonAssoc, ExplicitPrec 1), [ NonTerminal "E"; Terminal "+"; NonTerminal "E" ], None; @@ -982,7 +982,7 @@ let example5 = "E", (NonAssoc, ExplicitPrec 8), [ Terminal "id"], None ] Spec(terminals,nonTerminals,prods, ["E"]) -let example6 = +let example6 = let terminals = ["+"; "*"; "("; ")"; "id"; "-"] let nonTerminals = ["E"] let prods = [ "E", (RightAssoc, ExplicitPrec 1), [ NonTerminal "E"; Terminal "-"; NonTerminal "E" ], None; @@ -993,11 +993,11 @@ let example6 = Spec(terminals,nonTerminals,prods, ["E"]) -let example7 = - let prods = [ "S", (NonAssoc, ExplicitPrec 1), [NonTerminal "L";Terminal "="; NonTerminal "R"], None; +let example7 = + let prods = [ "S", (NonAssoc, ExplicitPrec 1), [NonTerminal "L";Terminal "="; NonTerminal "R"], None; "S", (NonAssoc, ExplicitPrec 2), [NonTerminal "R"], None ; "L", (NonAssoc, ExplicitPrec 3), [Terminal "*"; NonTerminal "R"], None; - "L", (NonAssoc, ExplicitPrec 3), [Terminal "id"], None; + "L", (NonAssoc, ExplicitPrec 3), [Terminal "id"], None; "R", (NonAssoc, ExplicitPrec 3), [NonTerminal "L"], None; ] Spec(["*";"=";"id"],["S";"L";"R"],prods, ["S"]) @@ -1007,8 +1007,8 @@ let test ex = CompilerLalrParserSpec stdout ex (* let _ = test example2*) (* let _ = exit 1*) -(* let _ = test example3 -let _ = test example1 +(* let _ = test example3 +let _ = test example1 let _ = test example4 let _ = test example5 let _ = test example6 *) diff --git a/buildtools/fsyacc/fsyaccdriver.fs b/buildtools/fsyacc/fsyaccdriver.fs index c9ca12e4710..0a2fb92ca8d 100644 --- a/buildtools/fsyacc/fsyaccdriver.fs +++ b/buildtools/fsyacc/fsyaccdriver.fs @@ -8,13 +8,13 @@ open FsLexYacc.FsYacc.AST open Printf open System.Collections.Generic -let has_extension (s:string) = - (s.Length >= 1 && s.[s.Length - 1] = '.') +let has_extension (s:string) = + (s.Length >= 1 && s.[s.Length - 1] = '.') || Path.HasExtension(s) let chop_extension (s:string) = if not (has_extension s) then invalidArg "s" "the file name does not have an extension" - Path.Combine (Path.GetDirectoryName s,Path.GetFileNameWithoutExtension(s)) + Path.Combine (Path.GetDirectoryName s,Path.GetFileNameWithoutExtension(s)) let checkSuffix (x:string) (y:string) = x.EndsWith(y) @@ -29,23 +29,23 @@ let readSpecFromFile fileName codePage = (e, lexbuf.StartPos.Line, lexbuf.StartPos.Column) |> Result.Error -let printTokens filename codePage = - let stream,reader,lexbuf = UnicodeFileAsLexbuf(filename, codePage) +let printTokens filename codePage = + let stream,reader,lexbuf = UnicodeFileAsLexbuf(filename, codePage) use stream = stream use reader = reader - try - while true do + try + while true do printf "tokenize - getting one token"; - let t = Lexer.token lexbuf in + let t = Lexer.token lexbuf in (*F# printf "tokenize - got %s" (Parser.token_to_string t); F#*) if t = Parser.EOF then exit 0 - with e -> + with e -> eprintf "%s(%d,%d): error: %s" filename lexbuf.StartPos.Line lexbuf.StartPos.Column e.Message; exit 1 -let logFileName (input: string, out: string option, log: bool) = - if log then Some (match out with Some x -> chop_extension x + ".fsyacc.output" | _ -> chop_extension input + ".fsyacc.output") +let logFileName (input: string, out: string option, log: bool) = + if log then Some (match out with Some x -> chop_extension x + ".fsyacc.output" | _ -> chop_extension input + ".fsyacc.output") else None let deriveOutputFileNames (filename, out: string option) = @@ -53,7 +53,7 @@ let deriveOutputFileNames (filename, out: string option) = let outputi = match out with Some x -> chop_extension x + (if checkSuffix x ".ml" then ".mli" else ".fsi") | _ -> chop_extension filename + (if checkSuffix filename ".mly" then ".mli" else ".fsi") in output, outputi -type Logger = +type Logger = inherit IDisposable abstract member LogStream: (TextWriter -> 'a) -> 'a @@ -67,41 +67,41 @@ type FileLogger (outputFileLog) = member x.LogStream f = f osl member x.Log format = fprintfn osl format - + member x.LogString msg = fprintfn osl "%s" msg interface IDisposable with - member _.Dispose() = + member _.Dispose() = osl.Dispose() type NullLogger () = interface Logger with - member x.LogStream f = + member x.LogStream f = f TextWriter.Null - member x.Log f = + member x.Log f = fprintfn TextWriter.Null f member x.LogString _ = () interface IDisposable with member _.Dispose () = () -type Writer(outputFileName, outputFileInterface) = +type Writer(outputFileName, outputFileInterface) = let os = File.CreateText outputFileName :> TextWriter let mutable outputLineCount = 0 let osi = File.CreateText outputFileInterface :> TextWriter let mutable interfaceLineCount = 0 - member x.Write format = + member x.Write format = fprintf os format - + member x.WriteLine format = - kfprintf (fun _ -> + kfprintf (fun _ -> outputLineCount <- outputLineCount + 1 os.WriteLine () ) os format member x.WriteUInt16 (i: int) = fprintf os "%dus;" i - - member x.WriteCode (code, pos) = + + member x.WriteCode (code, pos) = x.WriteLine "# %d \"%s\"" pos.pos_lnum pos.pos_fname x.WriteLine "%s" code let codeLines = code.Replace("\r","").Split([| '\n' |]).Length @@ -110,18 +110,18 @@ type Writer(outputFileName, outputFileInterface) = member x.OutputLineCount = outputLineCount - member x.WriteInterface format = + member x.WriteInterface format = fprintf osi format - - member x.WriteLineInterface format = - kfprintf (fun _ -> + + member x.WriteLineInterface format = + kfprintf (fun _ -> interfaceLineCount <- interfaceLineCount + 1 osi.WriteLine () ) osi format member x.InterfaceLineCount = interfaceLineCount - - + + interface IDisposable with member x.Dispose () = @@ -142,9 +142,9 @@ let actionCoding = | Accept -> acceptFlag | Shift n -> shiftFlag ||| n | Reduce n -> reduceFlag ||| n - | Error -> errorFlag + | Error -> errorFlag -type GeneratorState = +type GeneratorState = { input: string output: string option logger: Logger @@ -159,8 +159,8 @@ type GeneratorState = map_action_to_int: Action -> int anyMarker: int bufferTypeArgument: string } - with - static member Default = + with + static member Default = { input = "" output = None logger = new NullLogger() @@ -176,7 +176,7 @@ type GeneratorState = anyMarker = anyMarker bufferTypeArgument = "'cty" } -let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compiledSpec: CompiledSpec) = +let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compiledSpec: CompiledSpec) = let output, outputi = deriveOutputFileNames (generatorState.input, generatorState.output) generatorState.logger.Log " Output file describing compiled parser placed in %s and %s" output outputi use writer = new Writer(output, outputi) @@ -187,9 +187,9 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine "#light \"off\""; writer.WriteLineInterface "#light \"off\""; - match generatorState.modname with + match generatorState.modname with | None -> () - | Some s -> + | Some s -> match generatorState.internal_module with | true -> writer.WriteLine "module internal %s" s; @@ -197,7 +197,7 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile | false -> writer.WriteLine "module %s" s; writer.WriteLineInterface "module %s" s; - + writer.WriteLine "#nowarn \"64\";; // turn off warnings that type variables used in production annotations are instantiated to concrete type"; for s in generatorState.opens do @@ -206,22 +206,22 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine "open %s" generatorState.lexlib; writer.WriteLine "open %s.ParseHelpers" generatorState.parslib; - if generatorState.compat then + if generatorState.compat then writer.WriteLine "open Microsoft.FSharp.Compatibility.OCaml.Parsing"; writer.WriteCode spec.Header - + // Print the datatype for the tokens writer.WriteLine "// This type is the type of tokens accepted by the parser"; - + writer.WriteLine "type token = "; writer.WriteLineInterface "type token = "; - for id,typ in spec.Tokens do + for id,typ in spec.Tokens do match typ with - | None -> + | None -> writer.WriteLine " | %s" id writer.WriteLineInterface " | %s" id - | Some ty -> + | Some ty -> writer.WriteLine " | %s of (%s)" id ty writer.WriteLineInterface " | %s of (%s)" id ty @@ -229,7 +229,7 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine "// This type is used to give symbolic names to token indexes, useful for error messages"; writer.WriteLine "type tokenId = "; writer.WriteLineInterface "type tokenId = "; - for id,_ in spec.Tokens do + for id,_ in spec.Tokens do writer.WriteLine " | TOKEN_%s" id; writer.WriteLineInterface " | TOKEN_%s" id; writer.WriteLine " | TOKEN_end_of_input"; @@ -240,7 +240,7 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine "// This type is used to give symbolic names to token indexes, useful for error messages"; writer.WriteLine "type nonTerminalId = "; writer.WriteLineInterface "type nonTerminalId = "; - for nt in compiledSpec.nonTerminals do + for nt in compiledSpec.nonTerminals do writer.WriteLine " | NONTERM_%s" nt; writer.WriteLineInterface " | NONTERM_%s" nt; @@ -249,7 +249,7 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine "// This function maps tokens to integer indexes"; writer.WriteLine "let tagOfToken (t:token) = "; writer.WriteLine " match t with"; - spec.Tokens |> List.iteri (fun i (id,typ) -> + spec.Tokens |> List.iteri (fun i (id,typ) -> writer.WriteLine " | %s %s -> %d " id (match typ with Some _ -> "_" | None -> "") i); writer.WriteLineInterface "/// This function maps tokens to integer indexes"; writer.WriteLineInterface "val tagOfToken: token -> int"; @@ -297,64 +297,64 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine " match t with "; for id,typ in spec.Tokens do - writer.WriteLine " | %s %s -> %s " + writer.WriteLine " | %s %s -> %s " id (match typ with Some _ -> "_fsyacc_x" | None -> "") (match typ with Some _ -> "Microsoft.FSharp.Core.Operators.box _fsyacc_x" | None -> "(null : System.Object)") for key,_ in spec.Types |> Seq.countBy fst |> Seq.filter (fun (_,n) -> n > 1) do failwithf "%s is given multiple %%type declarations" key; - + for key,_ in spec.Tokens |> Seq.countBy fst |> Seq.filter (fun (_,n) -> n > 1) do failwithf "%s is given %%token declarations" key - - let types = Map.ofList spec.Types - let tokens = Map.ofList spec.Tokens - - let nStates = compiledSpec.states.Length - begin + + let types = Map.ofList spec.Types + let tokens = Map.ofList spec.Tokens + + let nStates = compiledSpec.states.Length + begin writer.Write "let _fsyacc_gotos = [| " ; - let numGotoNonTerminals = compiledSpec.gotoTable.[0].Length - let gotoIndexes = Array.create numGotoNonTerminals 0 - let mutable gotoTableCurrIndex = 0 - for j = 0 to numGotoNonTerminals-1 do + let numGotoNonTerminals = compiledSpec.gotoTable.[0].Length + let gotoIndexes = Array.create numGotoNonTerminals 0 + let mutable gotoTableCurrIndex = 0 + for j = 0 to numGotoNonTerminals-1 do gotoIndexes.[j] <- gotoTableCurrIndex (* Count the number of entries in the association table. *) let mutable count = 0 - for i = 0 to nStates - 1 do - let goto = compiledSpec.gotoTable.[i].[j] - match goto with + for i = 0 to nStates - 1 do + let goto = compiledSpec.gotoTable.[i].[j] + match goto with | None -> () | Some _ -> count <- count + 1 - + (* Write the head of the table (i.e. the number of entries and the default value) *) gotoTableCurrIndex <- gotoTableCurrIndex + 1 writer.WriteUInt16 count writer.WriteUInt16 generatorState.anyMarker - + (* Write the pairs of entries in incremental order by key *) (* This lets us implement the lookup by a binary chop. *) - for i = 0 to nStates - 1 do - let goto = compiledSpec.gotoTable.[i].[j] - match goto with + for i = 0 to nStates - 1 do + let goto = compiledSpec.gotoTable.[i].[j] + match goto with | None -> () - | Some n -> + | Some n -> gotoTableCurrIndex <- gotoTableCurrIndex + 1 writer.WriteUInt16 i writer.WriteUInt16 n writer.WriteLine "|]" ; (* Output offsets into gotos table where the gotos for a particular nonterminal begin *) writer.Write "let _fsyacc_sparseGotoTableRowOffsets = [|" ; - for j = 0 to numGotoNonTerminals-1 do + for j = 0 to numGotoNonTerminals-1 do writer.WriteUInt16 gotoIndexes.[j] writer.WriteLine "|]" end; - begin + begin writer.Write "let _fsyacc_stateToProdIdxsTableElements = [| " ; - let indexes = Array.create compiledSpec.states.Length 0 - let mutable currIndex = 0 + let indexes = Array.create compiledSpec.states.Length 0 + let mutable currIndex = 0 for j = 0 to compiledSpec.states.Length - 1 do let state = compiledSpec.states.[j] indexes.[j] <- currIndex; @@ -362,7 +362,7 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile (* Write the head of the table (i.e. the number of entries) *) writer.WriteUInt16 state.Length; currIndex <- currIndex + state.Length + 1 - + (* Write the pairs of entries in incremental order by key *) (* This lets us implement the lookup by a binary chop. *) for prodIdx in state do @@ -370,58 +370,58 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine "|]" ; (* Output offsets into gotos table where the gotos for a particular nonterminal begin *) writer.Write "let _fsyacc_stateToProdIdxsTableRowOffsets = [|" ; - for idx in indexes do + for idx in indexes do writer.WriteUInt16 idx; writer.WriteLine "|]" ; end; - begin - let numActionRows = (Array.length compiledSpec.actionTable) - let _ = Array.length compiledSpec.actionTable.[0] + begin + let numActionRows = (Array.length compiledSpec.actionTable) + let _ = Array.length compiledSpec.actionTable.[0] writer.WriteLine "let _fsyacc_action_rows = %d" numActionRows; writer.Write "let _fsyacc_actionTableElements = [|" ; - let actionIndexes = Array.create numActionRows 0 - - let mutable actionTableCurrIndex = 0 - for i = 0 to nStates-1 do + let actionIndexes = Array.create numActionRows 0 + + let mutable actionTableCurrIndex = 0 + for i = 0 to nStates-1 do actionIndexes.[i] <- actionTableCurrIndex; - let actions = compiledSpec.actionTable.[i] - let terminalsByAction = Dictionary<_,int list>(10) - let countPerAction = Dictionary<_,_>(10) - for terminal = 0 to actions.Length - 1 do - let action = snd actions.[terminal] - if terminalsByAction.ContainsKey action then + let actions = compiledSpec.actionTable.[i] + let terminalsByAction = Dictionary<_,int list>(10) + let countPerAction = Dictionary<_,_>(10) + for terminal = 0 to actions.Length - 1 do + let action = snd actions.[terminal] + if terminalsByAction.ContainsKey action then terminalsByAction.[action] <- terminal :: terminalsByAction.[action] ; else terminalsByAction.[action] <- [terminal]; - if countPerAction.ContainsKey action then + if countPerAction.ContainsKey action then countPerAction.[action] <- countPerAction.[action]+1 - else + else countPerAction.[action] <- 1 - let mostCommonAction = - let mostCommon = ref Error - let max = ref 0 - for KeyValue(x,y) in countPerAction do + let mostCommonAction = + let mostCommon = ref Error + let max = ref 0 + for KeyValue(x,y) in countPerAction do if y > !max then (mostCommon := x; max := y) - !mostCommon + !mostCommon (* Count the number of entries in the association table. *) - let count = ref 0 - for KeyValue(action,terminals) in terminalsByAction do - for terminal in terminals do - if action <> mostCommonAction then + let count = ref 0 + for KeyValue(action,terminals) in terminalsByAction do + for terminal in terminals do + if action <> mostCommonAction then incr count; - + (* Write the head of the table (i.e. the number of entries and the default value) *) actionTableCurrIndex <- actionTableCurrIndex + 1; writer.WriteUInt16 !count; writer.WriteUInt16 (generatorState.map_action_to_int mostCommonAction); - + (* Write the pairs of entries in incremental order by key *) (* This lets us implement the lookup by a binary chop. *) - for terminal = 0 to Array.length actions-1 do - let action = snd actions.[terminal] in + for terminal = 0 to Array.length actions-1 do + let action = snd actions.[terminal] in if action <> mostCommonAction then ( actionTableCurrIndex <- actionTableCurrIndex + 1; writer.WriteUInt16 terminal; @@ -430,74 +430,74 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine "|]" ; (* Output offsets into actions table where the actions for a particular nonterminal begin *) writer.Write "let _fsyacc_actionTableRowOffsets = [|" ; - for j = 0 to numActionRows-1 do + for j = 0 to numActionRows-1 do writer.WriteUInt16 actionIndexes.[j]; writer.WriteLine "|]" ; end; - begin + begin writer.Write "let _fsyacc_reductionSymbolCounts = [|" ; - for nt,ntIdx,syms,code in compiledSpec.prods do + for nt,ntIdx,syms,code in compiledSpec.prods do writer.WriteUInt16 (List.length syms); writer.WriteLine "|]" ; end; - begin + begin writer.Write "let _fsyacc_productionToNonTerminalTable = [|" ; - for nt,ntIdx,syms,code in compiledSpec.prods do + for nt,ntIdx,syms,code in compiledSpec.prods do writer.WriteUInt16 ntIdx; writer.WriteLine "|]" ; end; - begin + begin writer.Write "let _fsyacc_immediateActions = [|" ; - for prodIdx in compiledSpec.immediateActionTable do + for prodIdx in compiledSpec.immediateActionTable do match prodIdx with | None -> writer.WriteUInt16 generatorState.anyMarker (* NONE REP *) | Some act -> writer.WriteUInt16 (generatorState.map_action_to_int act) writer.WriteLine "|]" ; end; - + let getType nt = if types.ContainsKey nt then types.[nt] else generatorState.generate_nonterminal_name nt - begin + begin writer.WriteLine "let _fsyacc_reductions = lazy [|" - for nt,ntIdx,syms,code in compiledSpec.prods do + for nt,ntIdx,syms,code in compiledSpec.prods do writer.WriteLine "# %d \"%s\"" writer.OutputLineCount output; writer.WriteLine " (fun (parseState : %s.IParseState) ->" generatorState.parslib - if generatorState.compat then + if generatorState.compat then writer.WriteLine " Parsing.set_parse_state parseState;" - syms |> List.iteri (fun i sym -> - let tyopt = + syms |> List.iteri (fun i sym -> + let tyopt = match sym with - | Terminal t -> - if tokens.ContainsKey t then + | Terminal t -> + if tokens.ContainsKey t then tokens.[t] else None - | NonTerminal nt -> Some (getType nt) - match tyopt with + | NonTerminal nt -> Some (getType nt) + match tyopt with | Some ty -> writer.WriteLine " let _%d = parseState.GetInput(%d) :?> %s in" (i+1) (i+1) ty | None -> ()) - writer.WriteLine " Microsoft.FSharp.Core.Operators.box" + writer.WriteLine " Microsoft.FSharp.Core.Operators.box" writer.WriteLine " ("; writer.WriteLine " ("; - match code with + match code with | Some (_,pos) -> writer.WriteLine "# %d \"%s\"" pos.pos_lnum pos.pos_fname | None -> () - match code with - | Some (code,_) -> - let dollar = ref false in - let c = code |> String.collect (fun c -> + match code with + | Some (code,_) -> + let dollar = ref false in + let c = code |> String.collect (fun c -> if not !dollar && c = '$' then (dollar := true; "") elif !dollar && c >= '0' && c <= '9' then (dollar := false; "_"+String(c,1)) elif !dollar then (dollar := false; "$"+String(c,1)) else String(c,1)) let lines = c.Split([| '\r'; '\n' |], StringSplitOptions.RemoveEmptyEntries); - for line in lines do + for line in lines do writer.WriteLine " %s" line; if !dollar then writer.Write "$" - | None -> + | None -> writer.WriteLine " raise (%s.Accept(Microsoft.FSharp.Core.Operators.box _1))" generatorState.parslib writer.WriteLine " )"; // Place the line count back for the type constraint - match code with + match code with | Some (_,pos) -> writer.WriteLine "# %d \"%s\"" pos.pos_lnum pos.pos_fname | None -> () writer.WriteLine " : %s));" (if types.ContainsKey nt then types.[nt] else generatorState.generate_nonterminal_name nt); @@ -523,25 +523,25 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLine " match parse_error_rich with " writer.WriteLine " | Some f -> f ctxt" writer.WriteLine " | None -> parse_error ctxt.Message);" - + writer.WriteLine " numTerminals = %d;" (Array.length compiledSpec.actionTable.[0]); writer.WriteLine " productionToNonTerminalTable = _fsyacc_productionToNonTerminalTable }" - writer.WriteLine "let engine lexer lexbuf startState = tables.Interpret(lexer, lexbuf, startState)" + writer.WriteLine "let engine lexer lexbuf startState = tables.Interpret(lexer, lexbuf, startState)" for id,startState in List.zip spec.StartSymbols compiledSpec.startStates do - if not (types.ContainsKey id) then + if not (types.ContainsKey id) then failwith ("a %type declaration is required for start token "+id); - let ty = types.[id] in + let ty = types.[id] in writer.WriteLine "let %s lexer lexbuf : %s =" id ty; writer.WriteLine " engine lexer lexbuf %d :?> _" startState for id in spec.StartSymbols do - if not (types.ContainsKey id) then + if not (types.ContainsKey id) then failwith ("a %type declaration is required for start token "+id); - let ty = types.[id] in + let ty = types.[id] in writer.WriteLineInterface "val %s : (%s.LexBuffer<%s> -> token) -> %s.LexBuffer<%s> -> (%s) " id generatorState.lexlib generatorState.bufferTypeArgument generatorState.lexlib generatorState.bufferTypeArgument ty; -let compileSpec (spec: ParserSpec) (logger: Logger) = - let spec1 = ProcessParserSpecAst spec - CompilerLalrParserSpec logger.LogStream spec1 +let compileSpec (spec: ParserSpec) (logger: Logger) = + let spec1 = ProcessParserSpecAst spec + CompilerLalrParserSpec logger.LogStream spec1 diff --git a/buildtools/fsyacc/fsyacclex.fs b/buildtools/fsyacc/fsyacclex.fs index 5b99ce61cdd..58d01813aaf 100644 --- a/buildtools/fsyacc/fsyacclex.fs +++ b/buildtools/fsyacc/fsyacclex.fs @@ -1,9 +1,9 @@ # 1 "fsyacclex.fsl" - + (* (c) Microsoft Corporation 2005-2008. *) module FsLexYacc.FsYacc.Lexer - + open FsLexYacc.FsYacc.AST open FsLexYacc.FsYacc.Parser open System.Text @@ -24,8 +24,8 @@ let clearBuf () = str_buf <- new System.Text.StringBuilder() # 26 "fsyacclex.fs" -let trans : uint16[] array = - [| +let trans : uint16[] array = + [| (* State 0 *) [| 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 2us; 6us; 6us; 3us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 7us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 4us; 6us; 6us; 6us; 6us; 1us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 6us; 5us; |]; (* State 1 *) @@ -288,343 +288,343 @@ let trans : uint16[] array = [| 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; |]; (* State 130 *) [| 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 130us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 130us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 129us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; |]; - |] + |] let actions : uint16[] = [|65535us; 5us; 1us; 5us; 5us; 3us; 4us; 5us; 4us; 2us; 1us; 0us; 65535us; 5us; 1us; 2us; 5us; 3us; 4us; 5us; 3us; 2us; 0us; 65535us; 0us; 1us; 2us; 8us; 8us; 4us; 5us; 8us; 7us; 8us; 6us; 6us; 5us; 65535us; 65535us; 65535us; 3us; 2us; 65535us; 7us; 1us; 7us; 2us; 7us; 7us; 5us; 6us; 7us; 65535us; 65535us; 65535us; 4us; 3us; 3us; 2us; 1us; 0us; 65535us; 0us; 1us; 2us; 65535us; 22us; 17us; 11us; 12us; 13us; 14us; 15us; 16us; 22us; 17us; 18us; 22us; 21us; 22us; 23us; 19us; 20us; 20us; 17us; 16us; 15us; 17us; 17us; 17us; 10us; 0us; 1us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 9us; 65535us; 65535us; 65535us; 8us; 65535us; 65535us; 7us; 65535us; 65535us; 5us; 65535us; 65535us; 65535us; 4us; 65535us; 65535us; 65535us; 65535us; 6us; 65535us; 65535us; 65535us; 3us; 2us; 65535us; |] let _fslex_tables = FSharp.Text.Lexing.UnicodeTables.Create(trans,actions) -let rec _fslex_dummy () = _fslex_dummy() +let rec _fslex_dummy () = _fslex_dummy() // Rule token and token lexbuf = match _fslex_tables.Interpret(65,lexbuf) with - | 0 -> ( + | 0 -> ( # 35 "fsyacclex.fsl" - let p = lexbuf.StartPos in header p (new StringBuilder 100) lexbuf + let p = lexbuf.StartPos in header p (new StringBuilder 100) lexbuf # 301 "fsyacclex.fs" ) - | 1 -> ( + | 1 -> ( # 36 "fsyacclex.fsl" - PERCENT_PERCENT + PERCENT_PERCENT # 306 "fsyacclex.fs" ) - | 2 -> ( + | 2 -> ( # 37 "fsyacclex.fsl" - typeDepth := 1; startPos := lexbuf.StartPos; clearBuf(); TOKEN (fs_type lexbuf) + typeDepth := 1; startPos := lexbuf.StartPos; clearBuf(); TOKEN (fs_type lexbuf) # 311 "fsyacclex.fs" ) - | 3 -> ( + | 3 -> ( # 38 "fsyacclex.fsl" - TOKEN (None) + TOKEN (None) # 316 "fsyacclex.fs" ) - | 4 -> ( + | 4 -> ( # 39 "fsyacclex.fsl" - START + START # 321 "fsyacclex.fs" ) - | 5 -> ( + | 5 -> ( # 40 "fsyacclex.fsl" - PREC + PREC # 326 "fsyacclex.fs" ) - | 6 -> ( + | 6 -> ( # 41 "fsyacclex.fsl" - typeDepth := 1; startPos := lexbuf.StartPos; clearBuf(); TYPE (match fs_type lexbuf with Some x -> x | None -> failwith "gettype") + typeDepth := 1; startPos := lexbuf.StartPos; clearBuf(); TYPE (match fs_type lexbuf with Some x -> x | None -> failwith "gettype") # 331 "fsyacclex.fs" ) - | 7 -> ( + | 7 -> ( # 42 "fsyacclex.fsl" - LEFT + LEFT # 336 "fsyacclex.fs" ) - | 8 -> ( + | 8 -> ( # 43 "fsyacclex.fsl" - RIGHT + RIGHT # 341 "fsyacclex.fs" ) - | 9 -> ( + | 9 -> ( # 44 "fsyacclex.fsl" - NONASSOC + NONASSOC # 346 "fsyacclex.fs" ) - | 10 -> ( + | 10 -> ( # 45 "fsyacclex.fsl" - ERROR + ERROR # 351 "fsyacclex.fs" ) - | 11 -> ( + | 11 -> ( # 46 "fsyacclex.fsl" - LESS + LESS # 356 "fsyacclex.fs" ) - | 12 -> ( + | 12 -> ( # 47 "fsyacclex.fsl" - GREATER + GREATER # 361 "fsyacclex.fs" ) - | 13 -> ( + | 13 -> ( # 48 "fsyacclex.fsl" - SEMI + SEMI # 366 "fsyacclex.fs" ) - | 14 -> ( + | 14 -> ( # 49 "fsyacclex.fsl" - let p = lexbuf.StartPos in + let p = lexbuf.StartPos in let buff = (new StringBuilder 100) in // adjust the first line to get even indentation for all lines w.r.t. the left hand margin buff.Append (String.replicate (lexbuf.StartPos.Column+1) " ") |> ignore; - code p buff lexbuf + code p buff lexbuf # 375 "fsyacclex.fs" ) - | 15 -> ( + | 15 -> ( # 54 "fsyacclex.fsl" - token lexbuf + token lexbuf # 380 "fsyacclex.fs" ) - | 16 -> ( + | 16 -> ( # 55 "fsyacclex.fsl" - newline lexbuf; token lexbuf + newline lexbuf; token lexbuf # 385 "fsyacclex.fs" ) - | 17 -> ( + | 17 -> ( # 56 "fsyacclex.fsl" - IDENT (lexeme lexbuf) + IDENT (lexeme lexbuf) # 390 "fsyacclex.fs" ) - | 18 -> ( + | 18 -> ( # 57 "fsyacclex.fsl" - BAR + BAR # 395 "fsyacclex.fs" ) - | 19 -> ( + | 19 -> ( # 58 "fsyacclex.fsl" - ignore(comment lexbuf); token lexbuf + ignore(comment lexbuf); token lexbuf # 400 "fsyacclex.fs" ) - | 20 -> ( + | 20 -> ( # 59 "fsyacclex.fsl" - token lexbuf + token lexbuf # 405 "fsyacclex.fs" ) - | 21 -> ( + | 21 -> ( # 60 "fsyacclex.fsl" - COLON + COLON # 410 "fsyacclex.fs" ) - | 22 -> ( + | 22 -> ( # 61 "fsyacclex.fsl" - unexpected_char lexbuf + unexpected_char lexbuf # 415 "fsyacclex.fs" ) - | 23 -> ( + | 23 -> ( # 62 "fsyacclex.fsl" - EOF + EOF # 420 "fsyacclex.fs" ) | _ -> failwith "token" // Rule fs_type and fs_type lexbuf = match _fslex_tables.Interpret(61,lexbuf) with - | 0 -> ( + | 0 -> ( # 65 "fsyacclex.fsl" incr typeDepth; appendBuf(lexeme lexbuf); fs_type lexbuf # 429 "fsyacclex.fs" ) - | 1 -> ( + | 1 -> ( # 67 "fsyacclex.fsl" - decr typeDepth; + decr typeDepth; if !typeDepth = 0 - then Some(string str_buf) - else appendBuf(lexeme lexbuf); fs_type lexbuf + then Some(string str_buf) + else appendBuf(lexeme lexbuf); fs_type lexbuf # 437 "fsyacclex.fs" ) - | 2 -> ( + | 2 -> ( # 71 "fsyacclex.fsl" - appendBuf(lexeme lexbuf); fs_type lexbuf + appendBuf(lexeme lexbuf); fs_type lexbuf # 442 "fsyacclex.fs" ) | _ -> failwith "fs_type" // Rule header and header p buff lexbuf = match _fslex_tables.Interpret(42,lexbuf) with - | 0 -> ( + | 0 -> ( # 74 "fsyacclex.fsl" - HEADER (buff.ToString(), p) + HEADER (buff.ToString(), p) # 451 "fsyacclex.fs" ) - | 1 -> ( + | 1 -> ( # 75 "fsyacclex.fsl" - newline lexbuf; - ignore <| buff.Append System.Environment.NewLine; - header p buff lexbuf + newline lexbuf; + ignore <| buff.Append System.Environment.NewLine; + header p buff lexbuf # 458 "fsyacclex.fs" ) - | 2 -> ( + | 2 -> ( # 79 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - header p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + header p buff lexbuf # 464 "fsyacclex.fs" ) - | 3 -> ( + | 3 -> ( # 82 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - header p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + header p buff lexbuf # 470 "fsyacclex.fs" ) - | 4 -> ( + | 4 -> ( # 85 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - header p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + header p buff lexbuf # 476 "fsyacclex.fs" ) - | 5 -> ( + | 5 -> ( # 88 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - ignore(codestring buff lexbuf); - header p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + ignore(codestring buff lexbuf); + header p buff lexbuf # 483 "fsyacclex.fs" ) - | 6 -> ( + | 6 -> ( # 91 "fsyacclex.fsl" - EOF + EOF # 488 "fsyacclex.fs" ) - | 7 -> ( + | 7 -> ( # 92 "fsyacclex.fsl" - ignore <| buff.Append(lexeme lexbuf).[0]; - header p buff lexbuf + ignore <| buff.Append(lexeme lexbuf).[0]; + header p buff lexbuf # 494 "fsyacclex.fs" ) | _ -> failwith "header" // Rule code and code p buff lexbuf = match _fslex_tables.Interpret(23,lexbuf) with - | 0 -> ( + | 0 -> ( # 95 "fsyacclex.fsl" - CODE (buff.ToString(), p) + CODE (buff.ToString(), p) # 503 "fsyacclex.fs" ) - | 1 -> ( + | 1 -> ( # 96 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - ignore(code p buff lexbuf); - ignore <| buff.Append "}"; - code p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + ignore(code p buff lexbuf); + ignore <| buff.Append "}"; + code p buff lexbuf # 511 "fsyacclex.fs" ) - | 2 -> ( + | 2 -> ( # 100 "fsyacclex.fsl" - newline lexbuf; - ignore <| buff.Append System.Environment.NewLine; - code p buff lexbuf + newline lexbuf; + ignore <| buff.Append System.Environment.NewLine; + code p buff lexbuf # 518 "fsyacclex.fs" ) - | 3 -> ( + | 3 -> ( # 104 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - code p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + code p buff lexbuf # 524 "fsyacclex.fs" ) - | 4 -> ( + | 4 -> ( # 106 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - ignore(codestring buff lexbuf); - code p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + ignore(codestring buff lexbuf); + code p buff lexbuf # 531 "fsyacclex.fs" ) - | 5 -> ( + | 5 -> ( # 110 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - code p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + code p buff lexbuf # 537 "fsyacclex.fs" ) - | 6 -> ( + | 6 -> ( # 113 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - code p buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + code p buff lexbuf # 543 "fsyacclex.fs" ) - | 7 -> ( + | 7 -> ( # 115 "fsyacclex.fsl" - EOF + EOF # 548 "fsyacclex.fs" ) - | 8 -> ( + | 8 -> ( # 116 "fsyacclex.fsl" - ignore <| buff.Append(lexeme lexbuf).[0]; - code p buff lexbuf + ignore <| buff.Append(lexeme lexbuf).[0]; + code p buff lexbuf # 554 "fsyacclex.fs" ) | _ -> failwith "code" // Rule codestring and codestring buff lexbuf = match _fslex_tables.Interpret(12,lexbuf) with - | 0 -> ( + | 0 -> ( # 122 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - codestring buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + codestring buff lexbuf # 564 "fsyacclex.fs" ) - | 1 -> ( + | 1 -> ( # 124 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - buff.ToString() + ignore <| buff.Append (lexeme lexbuf); + buff.ToString() # 570 "fsyacclex.fs" ) - | 2 -> ( + | 2 -> ( # 126 "fsyacclex.fsl" - newline lexbuf; - ignore <| buff.Append System.Environment.NewLine; - codestring buff lexbuf + newline lexbuf; + ignore <| buff.Append System.Environment.NewLine; + codestring buff lexbuf # 577 "fsyacclex.fs" ) - | 3 -> ( + | 3 -> ( # 130 "fsyacclex.fsl" - ignore <| buff.Append (lexeme lexbuf); - codestring buff lexbuf + ignore <| buff.Append (lexeme lexbuf); + codestring buff lexbuf # 583 "fsyacclex.fs" ) - | 4 -> ( + | 4 -> ( # 132 "fsyacclex.fsl" - failwith "unterminated string in code" + failwith "unterminated string in code" # 588 "fsyacclex.fs" ) - | 5 -> ( + | 5 -> ( # 133 "fsyacclex.fsl" - ignore <| buff.Append(lexeme lexbuf).[0]; - codestring buff lexbuf + ignore <| buff.Append(lexeme lexbuf).[0]; + codestring buff lexbuf # 594 "fsyacclex.fs" ) | _ -> failwith "codestring" // Rule comment and comment lexbuf = match _fslex_tables.Interpret(0,lexbuf) with - | 0 -> ( + | 0 -> ( # 138 "fsyacclex.fsl" - ignore(comment lexbuf); comment lexbuf + ignore(comment lexbuf); comment lexbuf # 603 "fsyacclex.fs" ) - | 1 -> ( + | 1 -> ( # 139 "fsyacclex.fsl" - newline lexbuf; comment lexbuf + newline lexbuf; comment lexbuf # 608 "fsyacclex.fs" ) - | 2 -> ( + | 2 -> ( # 140 "fsyacclex.fsl" - () + () # 613 "fsyacclex.fs" ) - | 3 -> ( + | 3 -> ( # 141 "fsyacclex.fsl" - failwith "end of file in comment" + failwith "end of file in comment" # 618 "fsyacclex.fs" ) - | 4 -> ( + | 4 -> ( # 142 "fsyacclex.fsl" - comment lexbuf + comment lexbuf # 623 "fsyacclex.fs" ) - | 5 -> ( + | 5 -> ( # 143 "fsyacclex.fsl" - comment lexbuf + comment lexbuf # 628 "fsyacclex.fs" ) | _ -> failwith "comment" diff --git a/buildtools/fsyacc/fsyaccpars.fs b/buildtools/fsyacc/fsyaccpars.fs index baa6748c6ea..55973c5f6e9 100644 --- a/buildtools/fsyacc/fsyaccpars.fs +++ b/buildtools/fsyacc/fsyaccpars.fs @@ -14,7 +14,7 @@ open FsLexYacc.FsYacc.AST # 18 "fsyaccpars.fs" // This type is the type of tokens accepted by the parser -type token = +type token = | TOKEN of (string option) | TYPE of (string) | BAR @@ -34,7 +34,7 @@ type token = | CODE of (AST.Code) | IDENT of (string) // This type is used to give symbolic names to token indexes, useful for error messages -type tokenId = +type tokenId = | TOKEN_TOKEN | TOKEN_TYPE | TOKEN_BAR @@ -56,7 +56,7 @@ type tokenId = | TOKEN_end_of_input | TOKEN_error // This type is used to give symbolic names to token indexes, useful for error messages -type nonTerminalId = +type nonTerminalId = | NONTERM__startspec | NONTERM_spec | NONTERM_headeropt @@ -73,132 +73,132 @@ type nonTerminalId = | NONTERM_optprec // This function maps tokens to integer indexes -let tagOfToken (t:token) = +let tagOfToken (t:token) = match t with - | TOKEN _ -> 0 - | TYPE _ -> 1 - | BAR -> 2 - | PERCENT_PERCENT -> 3 - | START -> 4 - | LEFT -> 5 - | RIGHT -> 6 - | NONASSOC -> 7 - | LESS -> 8 - | GREATER -> 9 - | COLON -> 10 - | PREC -> 11 - | SEMI -> 12 - | EOF -> 13 - | ERROR -> 14 - | HEADER _ -> 15 - | CODE _ -> 16 - | IDENT _ -> 17 + | TOKEN _ -> 0 + | TYPE _ -> 1 + | BAR -> 2 + | PERCENT_PERCENT -> 3 + | START -> 4 + | LEFT -> 5 + | RIGHT -> 6 + | NONASSOC -> 7 + | LESS -> 8 + | GREATER -> 9 + | COLON -> 10 + | PREC -> 11 + | SEMI -> 12 + | EOF -> 13 + | ERROR -> 14 + | HEADER _ -> 15 + | CODE _ -> 16 + | IDENT _ -> 17 // This function maps integer indexes to symbolic token ids -let tokenTagToTokenId (tokenIdx:int) = +let tokenTagToTokenId (tokenIdx:int) = match tokenIdx with - | 0 -> TOKEN_TOKEN - | 1 -> TOKEN_TYPE - | 2 -> TOKEN_BAR - | 3 -> TOKEN_PERCENT_PERCENT - | 4 -> TOKEN_START - | 5 -> TOKEN_LEFT - | 6 -> TOKEN_RIGHT - | 7 -> TOKEN_NONASSOC - | 8 -> TOKEN_LESS - | 9 -> TOKEN_GREATER - | 10 -> TOKEN_COLON - | 11 -> TOKEN_PREC - | 12 -> TOKEN_SEMI - | 13 -> TOKEN_EOF - | 14 -> TOKEN_ERROR - | 15 -> TOKEN_HEADER - | 16 -> TOKEN_CODE - | 17 -> TOKEN_IDENT + | 0 -> TOKEN_TOKEN + | 1 -> TOKEN_TYPE + | 2 -> TOKEN_BAR + | 3 -> TOKEN_PERCENT_PERCENT + | 4 -> TOKEN_START + | 5 -> TOKEN_LEFT + | 6 -> TOKEN_RIGHT + | 7 -> TOKEN_NONASSOC + | 8 -> TOKEN_LESS + | 9 -> TOKEN_GREATER + | 10 -> TOKEN_COLON + | 11 -> TOKEN_PREC + | 12 -> TOKEN_SEMI + | 13 -> TOKEN_EOF + | 14 -> TOKEN_ERROR + | 15 -> TOKEN_HEADER + | 16 -> TOKEN_CODE + | 17 -> TOKEN_IDENT | 20 -> TOKEN_end_of_input | 18 -> TOKEN_error | _ -> failwith "tokenTagToTokenId: bad token" /// This function maps production indexes returned in syntax errors to strings representing the non terminal that would be produced by that production -let prodIdxToNonTerminal (prodIdx:int) = +let prodIdxToNonTerminal (prodIdx:int) = match prodIdx with - | 0 -> NONTERM__startspec - | 1 -> NONTERM_spec - | 2 -> NONTERM_headeropt - | 3 -> NONTERM_headeropt - | 4 -> NONTERM_decls - | 5 -> NONTERM_decls - | 6 -> NONTERM_decl - | 7 -> NONTERM_decl - | 8 -> NONTERM_decl - | 9 -> NONTERM_decl - | 10 -> NONTERM_decl - | 11 -> NONTERM_decl - | 12 -> NONTERM_idents - | 13 -> NONTERM_idents - | 14 -> NONTERM_rules - | 15 -> NONTERM_rules - | 16 -> NONTERM_rule - | 17 -> NONTERM_optbar - | 18 -> NONTERM_optbar - | 19 -> NONTERM_optsemi - | 20 -> NONTERM_optsemi - | 21 -> NONTERM_clauses - | 22 -> NONTERM_clauses - | 23 -> NONTERM_clause - | 24 -> NONTERM_syms - | 25 -> NONTERM_syms - | 26 -> NONTERM_syms - | 27 -> NONTERM_optprec - | 28 -> NONTERM_optprec + | 0 -> NONTERM__startspec + | 1 -> NONTERM_spec + | 2 -> NONTERM_headeropt + | 3 -> NONTERM_headeropt + | 4 -> NONTERM_decls + | 5 -> NONTERM_decls + | 6 -> NONTERM_decl + | 7 -> NONTERM_decl + | 8 -> NONTERM_decl + | 9 -> NONTERM_decl + | 10 -> NONTERM_decl + | 11 -> NONTERM_decl + | 12 -> NONTERM_idents + | 13 -> NONTERM_idents + | 14 -> NONTERM_rules + | 15 -> NONTERM_rules + | 16 -> NONTERM_rule + | 17 -> NONTERM_optbar + | 18 -> NONTERM_optbar + | 19 -> NONTERM_optsemi + | 20 -> NONTERM_optsemi + | 21 -> NONTERM_clauses + | 22 -> NONTERM_clauses + | 23 -> NONTERM_clause + | 24 -> NONTERM_syms + | 25 -> NONTERM_syms + | 26 -> NONTERM_syms + | 27 -> NONTERM_optprec + | 28 -> NONTERM_optprec | _ -> failwith "prodIdxToNonTerminal: bad production index" -let _fsyacc_endOfInputTag = 20 +let _fsyacc_endOfInputTag = 20 let _fsyacc_tagOfErrorTerminal = 18 // This function gets the name of a token as a string -let token_to_string (t:token) = - match t with - | TOKEN _ -> "TOKEN" - | TYPE _ -> "TYPE" - | BAR -> "BAR" - | PERCENT_PERCENT -> "PERCENT_PERCENT" - | START -> "START" - | LEFT -> "LEFT" - | RIGHT -> "RIGHT" - | NONASSOC -> "NONASSOC" - | LESS -> "LESS" - | GREATER -> "GREATER" - | COLON -> "COLON" - | PREC -> "PREC" - | SEMI -> "SEMI" - | EOF -> "EOF" - | ERROR -> "ERROR" - | HEADER _ -> "HEADER" - | CODE _ -> "CODE" - | IDENT _ -> "IDENT" +let token_to_string (t:token) = + match t with + | TOKEN _ -> "TOKEN" + | TYPE _ -> "TYPE" + | BAR -> "BAR" + | PERCENT_PERCENT -> "PERCENT_PERCENT" + | START -> "START" + | LEFT -> "LEFT" + | RIGHT -> "RIGHT" + | NONASSOC -> "NONASSOC" + | LESS -> "LESS" + | GREATER -> "GREATER" + | COLON -> "COLON" + | PREC -> "PREC" + | SEMI -> "SEMI" + | EOF -> "EOF" + | ERROR -> "ERROR" + | HEADER _ -> "HEADER" + | CODE _ -> "CODE" + | IDENT _ -> "IDENT" // This function gets the data carried by a token as an object -let _fsyacc_dataOfToken (t:token) = - match t with - | TOKEN _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x - | TYPE _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x - | BAR -> (null : System.Object) - | PERCENT_PERCENT -> (null : System.Object) - | START -> (null : System.Object) - | LEFT -> (null : System.Object) - | RIGHT -> (null : System.Object) - | NONASSOC -> (null : System.Object) - | LESS -> (null : System.Object) - | GREATER -> (null : System.Object) - | COLON -> (null : System.Object) - | PREC -> (null : System.Object) - | SEMI -> (null : System.Object) - | EOF -> (null : System.Object) - | ERROR -> (null : System.Object) - | HEADER _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x - | CODE _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x - | IDENT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x +let _fsyacc_dataOfToken (t:token) = + match t with + | TOKEN _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x + | TYPE _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x + | BAR -> (null : System.Object) + | PERCENT_PERCENT -> (null : System.Object) + | START -> (null : System.Object) + | LEFT -> (null : System.Object) + | RIGHT -> (null : System.Object) + | NONASSOC -> (null : System.Object) + | LESS -> (null : System.Object) + | GREATER -> (null : System.Object) + | COLON -> (null : System.Object) + | PREC -> (null : System.Object) + | SEMI -> (null : System.Object) + | EOF -> (null : System.Object) + | ERROR -> (null : System.Object) + | HEADER _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x + | CODE _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x + | IDENT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x let _fsyacc_gotos = [| 0us; 65535us; 1us; 65535us; 0us; 1us; 1us; 65535us; 0us; 2us; 2us; 65535us; 2us; 3us; 7us; 8us; 2us; 65535us; 2us; 7us; 7us; 7us; 7us; 65535us; 9us; 10us; 11us; 12us; 13us; 14us; 15us; 16us; 17us; 18us; 19us; 20us; 21us; 22us; 2us; 65535us; 4us; 5us; 23us; 24us; 2us; 65535us; 4us; 23us; 23us; 23us; 1us; 65535us; 26us; 27us; 1us; 65535us; 28us; 29us; 2us; 65535us; 27us; 28us; 33us; 34us; 2us; 65535us; 27us; 32us; 33us; 32us; 4us; 65535us; 27us; 35us; 33us; 35us; 38us; 39us; 40us; 41us; 1us; 65535us; 35us; 36us; |] let _fsyacc_sparseGotoTableRowOffsets = [|0us; 1us; 3us; 5us; 8us; 11us; 19us; 22us; 25us; 27us; 29us; 32us; 35us; 40us; |] let _fsyacc_stateToProdIdxsTableElements = [| 1us; 0us; 1us; 0us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 2us; 1us; 5us; 1us; 5us; 1us; 6us; 1us; 6us; 1us; 7us; 1us; 7us; 1us; 8us; 1us; 8us; 1us; 9us; 1us; 9us; 1us; 10us; 1us; 10us; 1us; 11us; 1us; 11us; 1us; 12us; 1us; 12us; 2us; 14us; 15us; 1us; 14us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 18us; 1us; 20us; 2us; 21us; 22us; 1us; 21us; 1us; 21us; 1us; 23us; 1us; 23us; 1us; 23us; 1us; 24us; 1us; 24us; 1us; 25us; 1us; 25us; 1us; 28us; 1us; 28us; |] @@ -209,7 +209,7 @@ let _fsyacc_actionTableRowOffsets = [|0us; 2us; 3us; 10us; 12us; 14us; 15us; 16u let _fsyacc_reductionSymbolCounts = [|1us; 4us; 1us; 0us; 0us; 2us; 2us; 2us; 2us; 2us; 2us; 2us; 2us; 0us; 2us; 1us; 5us; 0us; 1us; 0us; 1us; 3us; 1us; 3us; 2us; 2us; 0us; 0us; 2us; |] let _fsyacc_productionToNonTerminalTable = [|0us; 1us; 2us; 2us; 3us; 3us; 4us; 4us; 4us; 4us; 4us; 4us; 5us; 5us; 6us; 6us; 7us; 8us; 8us; 9us; 9us; 10us; 10us; 11us; 12us; 12us; 12us; 13us; 13us; |] let _fsyacc_immediateActions = [|65535us; 49152us; 65535us; 65535us; 65535us; 16385us; 16386us; 65535us; 16389us; 65535us; 16390us; 65535us; 16391us; 65535us; 16392us; 65535us; 16393us; 65535us; 16394us; 65535us; 16395us; 65535us; 16396us; 65535us; 16398us; 65535us; 65535us; 65535us; 65535us; 16400us; 16402us; 16404us; 65535us; 65535us; 16405us; 65535us; 65535us; 16407us; 65535us; 16408us; 65535us; 16409us; 65535us; 16412us; |] -let _fsyacc_reductions () = [| +let _fsyacc_reductions () = [| # 216 "fsyaccpars.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> AST.ParserSpec in @@ -228,7 +228,7 @@ let _fsyacc_reductions () = [| ( ( # 25 "fsyaccpars.fsy" - List.foldBack (fun f x -> f x) _2 { Header=_1;Tokens=[];Types=[];Associativities=[];StartSymbols=[];Rules=_4 } + List.foldBack (fun f x -> f x) _2 { Header=_1;Tokens=[];Types=[];Associativities=[];StartSymbols=[];Rules=_4 } ) # 25 "fsyaccpars.fsy" : AST.ParserSpec)); @@ -239,7 +239,7 @@ let _fsyacc_reductions () = [| ( ( # 29 "fsyaccpars.fsy" - _1 + _1 ) # 29 "fsyaccpars.fsy" : 'gentype_headeropt)); @@ -259,7 +259,7 @@ let _fsyacc_reductions () = [| ( ( # 34 "fsyaccpars.fsy" - [] + [] ) # 34 "fsyaccpars.fsy" : 'gentype_decls)); @@ -271,7 +271,7 @@ let _fsyacc_reductions () = [| ( ( # 35 "fsyaccpars.fsy" - _1 :: _2 + _1 :: _2 ) # 35 "fsyaccpars.fsy" : 'gentype_decls)); @@ -283,7 +283,7 @@ let _fsyacc_reductions () = [| ( ( # 38 "fsyaccpars.fsy" - (fun x -> {x with Tokens = x.Tokens @ (List.map (fun x -> (x,_1)) _2)}) + (fun x -> {x with Tokens = x.Tokens @ (List.map (fun x -> (x,_1)) _2)}) ) # 38 "fsyaccpars.fsy" : 'gentype_decl)); @@ -295,7 +295,7 @@ let _fsyacc_reductions () = [| ( ( # 39 "fsyaccpars.fsy" - (fun x -> {x with Types = x.Types @ (List.map (fun x -> (x,_1)) _2)} ) + (fun x -> {x with Types = x.Types @ (List.map (fun x -> (x,_1)) _2)} ) ) # 39 "fsyaccpars.fsy" : 'gentype_decl)); @@ -306,7 +306,7 @@ let _fsyacc_reductions () = [| ( ( # 40 "fsyaccpars.fsy" - (fun x -> {x with StartSymbols = x.StartSymbols @ _2} ) + (fun x -> {x with StartSymbols = x.StartSymbols @ _2} ) ) # 40 "fsyaccpars.fsy" : 'gentype_decl)); @@ -317,7 +317,7 @@ let _fsyacc_reductions () = [| ( ( # 41 "fsyaccpars.fsy" - (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,LeftAssoc)) _2)]} ) + (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,LeftAssoc)) _2)]} ) ) # 41 "fsyaccpars.fsy" : 'gentype_decl)); @@ -328,7 +328,7 @@ let _fsyacc_reductions () = [| ( ( # 42 "fsyaccpars.fsy" - (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,RightAssoc)) _2)]} ) + (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,RightAssoc)) _2)]} ) ) # 42 "fsyaccpars.fsy" : 'gentype_decl)); @@ -339,7 +339,7 @@ let _fsyacc_reductions () = [| ( ( # 43 "fsyaccpars.fsy" - (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,NonAssoc)) _2)]} ) + (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,NonAssoc)) _2)]} ) ) # 43 "fsyaccpars.fsy" : 'gentype_decl)); @@ -351,7 +351,7 @@ let _fsyacc_reductions () = [| ( ( # 45 "fsyaccpars.fsy" - _1 :: _2 + _1 :: _2 ) # 45 "fsyaccpars.fsy" : 'gentype_idents)); @@ -361,7 +361,7 @@ let _fsyacc_reductions () = [| ( ( # 45 "fsyaccpars.fsy" - [] + [] ) # 45 "fsyaccpars.fsy" : 'gentype_idents)); @@ -373,7 +373,7 @@ let _fsyacc_reductions () = [| ( ( # 46 "fsyaccpars.fsy" - _1 :: _2 + _1 :: _2 ) # 46 "fsyaccpars.fsy" : 'gentype_rules)); @@ -384,7 +384,7 @@ let _fsyacc_reductions () = [| ( ( # 46 "fsyaccpars.fsy" - [_1] + [_1] ) # 46 "fsyaccpars.fsy" : 'gentype_rules)); @@ -398,7 +398,7 @@ let _fsyacc_reductions () = [| ( ( # 47 "fsyaccpars.fsy" - (_1,_4) + (_1,_4) ) # 47 "fsyaccpars.fsy" : 'gentype_rule)); @@ -408,7 +408,7 @@ let _fsyacc_reductions () = [| ( ( # 48 "fsyaccpars.fsy" - + ) # 48 "fsyaccpars.fsy" : 'gentype_optbar)); @@ -418,7 +418,7 @@ let _fsyacc_reductions () = [| ( ( # 48 "fsyaccpars.fsy" - + ) # 48 "fsyaccpars.fsy" : 'gentype_optbar)); @@ -428,7 +428,7 @@ let _fsyacc_reductions () = [| ( ( # 49 "fsyaccpars.fsy" - + ) # 49 "fsyaccpars.fsy" : 'gentype_optsemi)); @@ -438,7 +438,7 @@ let _fsyacc_reductions () = [| ( ( # 49 "fsyaccpars.fsy" - + ) # 49 "fsyaccpars.fsy" : 'gentype_optsemi)); @@ -450,7 +450,7 @@ let _fsyacc_reductions () = [| ( ( # 50 "fsyaccpars.fsy" - _1 :: _3 + _1 :: _3 ) # 50 "fsyaccpars.fsy" : 'gentype_clauses)); @@ -461,7 +461,7 @@ let _fsyacc_reductions () = [| ( ( # 50 "fsyaccpars.fsy" - [_1] + [_1] ) # 50 "fsyaccpars.fsy" : 'gentype_clauses)); @@ -474,7 +474,7 @@ let _fsyacc_reductions () = [| ( ( # 51 "fsyaccpars.fsy" - Rule(_1,_2,Some _3) + Rule(_1,_2,Some _3) ) # 51 "fsyaccpars.fsy" : 'gentype_clause)); @@ -486,7 +486,7 @@ let _fsyacc_reductions () = [| ( ( # 52 "fsyaccpars.fsy" - _1 :: _2 + _1 :: _2 ) # 52 "fsyaccpars.fsy" : 'gentype_syms)); @@ -497,7 +497,7 @@ let _fsyacc_reductions () = [| ( ( # 52 "fsyaccpars.fsy" - "error" :: _2 + "error" :: _2 ) # 52 "fsyaccpars.fsy" : 'gentype_syms)); @@ -507,7 +507,7 @@ let _fsyacc_reductions () = [| ( ( # 52 "fsyaccpars.fsy" - [] + [] ) # 52 "fsyaccpars.fsy" : 'gentype_syms)); @@ -517,7 +517,7 @@ let _fsyacc_reductions () = [| ( ( # 53 "fsyaccpars.fsy" - None + None ) # 53 "fsyaccpars.fsy" : 'gentype_optprec)); @@ -528,17 +528,17 @@ let _fsyacc_reductions () = [| ( ( # 53 "fsyaccpars.fsy" - Some _2 + Some _2 ) # 53 "fsyaccpars.fsy" : 'gentype_optprec)); |] # 539 "fsyaccpars.fs" -let tables : FSharp.Text.Parsing.Tables<_> = +let tables : FSharp.Text.Parsing.Tables<_> = { reductions= _fsyacc_reductions (); endOfInputTag = _fsyacc_endOfInputTag; tagOfToken = tagOfToken; - dataOfToken = _fsyacc_dataOfToken; + dataOfToken = _fsyacc_dataOfToken; actionTableElements = _fsyacc_actionTableElements; actionTableRowOffsets = _fsyacc_actionTableRowOffsets; stateToProdIdxsTableElements = _fsyacc_stateToProdIdxsTableElements; @@ -548,8 +548,8 @@ let tables : FSharp.Text.Parsing.Tables<_> = gotos = _fsyacc_gotos; sparseGotoTableRowOffsets = _fsyacc_sparseGotoTableRowOffsets; tagOfErrorTerminal = _fsyacc_tagOfErrorTerminal; - parseError = (fun (ctxt:FSharp.Text.Parsing.ParseErrorContext<_>) -> - match parse_error_rich with + parseError = (fun (ctxt:FSharp.Text.Parsing.ParseErrorContext<_>) -> + match parse_error_rich with | Some f -> f ctxt | None -> parse_error ctxt.Message); numTerminals = 21; diff --git a/docs/fcs-samples/EditorService/Program.fs b/docs/fcs-samples/EditorService/Program.fs index d457bf17c91..6dcdd96a6b0 100644 --- a/docs/fcs-samples/EditorService/Program.fs +++ b/docs/fcs-samples/EditorService/Program.fs @@ -5,13 +5,13 @@ open FSharp.Compiler.QuickParse // Create an interactive checker instance (ignore notifications) let checker = FSharpChecker.Create() -let parseWithTypeInfo (file, input) = +let parseWithTypeInfo (file, input) = let input = FSharp.Compiler.Text.SourceText.ofString input let checkOptions, _errors = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(checkOptions) let untypedRes = checker.ParseFile(file, input, parsingOptions) |> Async.RunSynchronously - - match checker.CheckFileInProject(untypedRes, file, 0, input, checkOptions) |> Async.RunSynchronously with + + match checker.CheckFileInProject(untypedRes, file, 0, input, checkOptions) |> Async.RunSynchronously with | FSharpCheckFileAnswer.Succeeded(res) -> untypedRes, res | res -> failwithf "Parsing did not finish... (%A)" res @@ -19,7 +19,7 @@ let parseWithTypeInfo (file, input) = // Example // ---------------------------------------------------------------------------- -let input = +let input = """ let foo() = let msg = "Hello world" @@ -39,8 +39,8 @@ printfn "%A" tip let partialName = GetPartialLongNameEx(inputLines.[4], 23) // Get declarations (autocomplete) for a location -let decls = - parsed.GetDeclarationListInfo(Some untyped, 5, inputLines.[4], partialName, (fun () -> [])) +let decls = + parsed.GetDeclarationListInfo(Some untyped, 5, inputLines.[4], partialName, (fun () -> [])) |> Async.RunSynchronously for item in decls.Items do diff --git a/docs/fcs-samples/FscExe/FscMain.fs b/docs/fcs-samples/FscExe/FscMain.fs index 6690d25f1e3..38fda0c58d8 100644 --- a/docs/fcs-samples/FscExe/FscMain.fs +++ b/docs/fcs-samples/FscExe/FscMain.fs @@ -201,18 +201,18 @@ module FSharpResidentCompiler = None #endif -module Driver = - let main argv = - let inline hasArgument name args = +module Driver = + let main argv = + let inline hasArgument name args = args |> Array.exists (fun x -> x = ("--" + name) || x = ("/" + name)) - let inline stripArgument name args = + let inline stripArgument name args = args |> Array.filter (fun x -> x <> ("--" + name) && x <> ("/" + name)) // Check for --pause as the very first step so that a compiler can be attached here. - if hasArgument "pause" argv then + if hasArgument "pause" argv then System.Console.WriteLine("Press any key to continue...") System.Console.ReadKey() |> ignore - + #if RESIDENT_COMPILER if hasArgument "resident" argv then let argv = stripArgument "resident" argv @@ -225,13 +225,13 @@ module Driver = let errors, exitCode = FSharpChecker.Create().Compile (argv) |> Async.RunSynchronously for error in errors do eprintfn "%s" (error.ToString()) exitCode -#endif +#endif else let errors, exitCode = FSharpChecker.Create().Compile (argv) |> Async.RunSynchronously for error in errors do eprintfn "%s" (error.ToString()) exitCode -[] +[] do () [] @@ -239,8 +239,8 @@ let main(argv) = System.Runtime.GCSettings.LatencyMode <- System.Runtime.GCLatencyMode.Batch use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter - try - Driver.main(Array.append [| "fsc.exe" |] argv); - with e -> - errorRecovery e FSharp.Compiler.Range.range0; + try + Driver.main(Array.append [| "fsc.exe" |] argv); + with e -> + errorRecovery e FSharp.Compiler.Range.range0; 1 diff --git a/docs/fcs-samples/FsiExe/console.fs b/docs/fcs-samples/FsiExe/console.fs index b52f682e156..97acbf82e08 100644 --- a/docs/fcs-samples/FsiExe/console.fs +++ b/docs/fcs-samples/FsiExe/console.fs @@ -12,54 +12,54 @@ type internal Style = Prompt | Out | Error /// Class managing the command History. type internal History() = let list = new List() - let mutable current = 0 + let mutable current = 0 member x.Count = list.Count - member x.Current = + member x.Current = if current >= 0 && current < list.Count then list.[current] else String.Empty member x.Clear() = list.Clear(); current <- -1 - member x.Add line = - match line with + member x.Add line = + match line with | null | "" -> () | _ -> list.Add(line) - member x.AddLast line = - match line with + member x.AddLast line = + match line with | null | "" -> () | _ -> list.Add(line); current <- list.Count - // Dead code + // Dead code // member x.First() = current <- 0; x.Current // member x.Last() = current <- list.Count - 1; x.Current; - member x.Previous() = + member x.Previous() = if (list.Count > 0) then current <- ((current - 1) + list.Count) % list.Count x.Current - member x.Next() = + member x.Next() = if (list.Count > 0) then current <- (current + 1) % list.Count x.Current /// List of available optionsCache -type internal Options() = +type internal Options() = inherit History() let mutable root = "" member x.Root with get() = root and set(v) = (root <- v) /// Cursor position management -module internal Utils = +module internal Utils = open System open System.Reflection open Microsoft.FSharp.Core open Microsoft.FSharp.Collections - let guard(f) = f() + let guard(f) = f() // Quick and dirty method lookup for inlined IL // In some situations, we can't use ldtoken to obtain a RuntimeMethodHandle, since the method @@ -68,25 +68,25 @@ module internal Utils = // In such a situation, we'll want to search out the MethodRef in a similar fashion to bindMethodBySearch // but since we can't use ldtoken to obtain System.Type objects, we'll need to do everything with strings. // This is the least fool-proof method for resolving the binding, but since the scenarios it's used in are - // so constrained, (fsi 2.0, methods with generic multi-dimensional arrays in their signatures), it's + // so constrained, (fsi 2.0, methods with generic multi-dimensional arrays in their signatures), it's // acceptable let findMethod (parentT:Type,nm,marity,argtys : string [],rty : string) = let staticOrInstanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly - let methInfos = parentT.GetMethods(staticOrInstanceBindingFlags) |> Array.toList + let methInfos = parentT.GetMethods(staticOrInstanceBindingFlags) |> Array.toList let methInfos = methInfos |> List.filter (fun methInfo -> methInfo.Name = nm) - match methInfos with - | [methInfo] -> + match methInfos with + | [methInfo] -> methInfo - | _ -> + | _ -> let select (methInfo:MethodInfo) = - let mtyargTIs = if methInfo.IsGenericMethod then methInfo.GetGenericArguments() else [| |] + let mtyargTIs = if methInfo.IsGenericMethod then methInfo.GetGenericArguments() else [| |] if mtyargTIs.Length <> marity then false else - let haveArgTs = - let parameters = Array.toList (methInfo.GetParameters()) - parameters |> List.map (fun param -> param.ParameterType) - let haveResT = methInfo.ReturnType + let haveArgTs = + let parameters = Array.toList (methInfo.GetParameters()) + parameters |> List.map (fun param -> param.ParameterType) + let haveResT = methInfo.ReturnType if argtys.Length <> haveArgTs.Length then false else let res = rty :: (Array.toList argtys) = (List.map (fun (t : System.Type) -> t.Name) (haveResT::haveArgTs)) @@ -94,12 +94,12 @@ module internal Utils = match List.tryFind select methInfos with | None -> failwith "Internal Error: cannot bind to method" - | Some methInfo -> methInfo + | Some methInfo -> methInfo [] type internal Cursor = - static member ResetTo(top,left) = - Utils.guard(fun () -> + static member ResetTo(top,left) = + Utils.guard(fun () -> Console.CursorTop <- min top (Console.BufferHeight - 1); Console.CursorLeft <- left) static member Move(inset, delta) = @@ -107,8 +107,8 @@ type internal Cursor = let top = position / (Console.BufferWidth - inset) let left = inset + position % (Console.BufferWidth - inset) Cursor.ResetTo(top,left) - -type internal Anchor = + +type internal Anchor = {top:int; left:int} static member Current(inset) = {top=Console.CursorTop;left= max inset Console.CursorLeft} @@ -127,12 +127,12 @@ type internal ReadLineConsole() = member x.Prompt = "> " member x.Prompt2 = "- " member x.Inset = x.Prompt.Length - + member x.GetOptions(input:string) = /// Tab optionsCache available in current context - let optionsCache = new Options() + let optionsCache = new Options() - let rec look parenCount i = + let rec look parenCount i = if i <= 0 then i else match input.Chars(i - 1) with | c when Char.IsLetterOrDigit(c) (* or Char.IsWhiteSpace(c) *) -> look parenCount (i-1) @@ -141,21 +141,21 @@ type internal ReadLineConsole() = | '(' | '{' | '[' -> look (parenCount-1) (i-1) | _ when parenCount > 0 -> look parenCount (i-1) | _ -> i - let start = look 0 input.Length + let start = look 0 input.Length let name = input.Substring(start, input.Length - start); if (name.Trim().Length > 0) then let lastDot = name.LastIndexOf('.'); - let attr, pref, root = + let attr, pref, root = if (lastDot < 0) then None, name, input.Substring(0, start) - else + else Some(name.Substring(0, lastDot)), name.Substring(lastDot + 1), input.Substring(0, start + lastDot + 1) - //printf "attr, pref, root = %s\n" (any_to_string (attr, pref, root)) - try - complete(attr,pref) + //printf "attr, pref, root = %s\n" (any_to_string (attr, pref, root)) + try + complete(attr,pref) |> Seq.filter(fun option -> option.StartsWith(pref,StringComparison.Ordinal)) |> Seq.iter (fun option -> optionsCache.Add(option)) // engine.Evaluate(String.Format("dir({0})", attr)) as IEnumerable; @@ -163,16 +163,16 @@ type internal ReadLineConsole() = with e -> optionsCache.Clear(); optionsCache,true; - else + else optionsCache,false; member x.MapCharacter(c) : string = - match c with + match c with | '\x1A'-> "^Z"; | _ -> "^?" member x.GetCharacterSize(c) = - if (Char.IsControl(c)) + if (Char.IsControl(c)) then x.MapCharacter(c).Length else 1 @@ -180,11 +180,11 @@ type internal ReadLineConsole() = member x.ReadLine() = - let checkLeftEdge(prompt) = - let currLeft = Console.CursorLeft - if currLeft < x.Inset then + let checkLeftEdge(prompt) = + let currLeft = Console.CursorLeft + if currLeft < x.Inset then if currLeft = 0 then Console.Write (if prompt then x.Prompt2 else String(' ',x.Inset)) - Utils.guard(fun () -> + Utils.guard(fun () -> Console.CursorTop <- min Console.CursorTop (Console.BufferHeight - 1); Console.CursorLeft <- x.Inset); @@ -200,12 +200,12 @@ type internal ReadLineConsole() = let changed = ref false /// Cache of optionsCache let optionsCache = ref (new Options()) - - let writeBlank() = + + let writeBlank() = Console.Write(' '); checkLeftEdge false - let writeChar(c) = - if Console.CursorTop = Console.BufferHeight - 1 && Console.CursorLeft = Console.BufferWidth - 1 then + let writeChar(c) = + if Console.CursorTop = Console.BufferHeight - 1 && Console.CursorLeft = Console.BufferWidth - 1 then //printf "bottom right!\n"; anchor := { !anchor with top = (!anchor).top - 1 }; checkLeftEdge true @@ -213,42 +213,42 @@ type internal ReadLineConsole() = let s = x.MapCharacter(c) Console.Write(s); rendered := !rendered + s.Length; - else + else Console.Write(c); rendered := !rendered + 1; checkLeftEdge true /// The console input buffer. - let input = new StringBuilder() + let input = new StringBuilder() /// Current position - index into the input buffer let current = ref 0; - let render() = + let render() = //printf "render\n"; let curr = !current (!anchor).PlaceAt(x.Inset,0); let output = new StringBuilder() let mutable position = -1 - for i = 0 to input.Length - 1 do + for i = 0 to input.Length - 1 do if (i = curr) then position <- output.Length let c = input.Chars(i) if (Char.IsControl(c)) then output.Append(x.MapCharacter(c)) |> ignore; - else + else output.Append(c) |> ignore; if (curr = input.Length) then position <- output.Length; // render the current text, computing a new value for "rendered" - let old_rendered = !rendered + let old_rendered = !rendered rendered := 0; - for i = 0 to input.Length - 1 do + for i = 0 to input.Length - 1 do writeChar(input.Chars(i)); // blank out any dangling old text - for i = !rendered to old_rendered - 1 do + for i = !rendered to old_rendered - 1 do writeBlank(); (!anchor).PlaceAt(x.Inset,position); @@ -256,7 +256,7 @@ type internal ReadLineConsole() = render(); let insertChar(c:char) = - if (!current = input.Length) then + if (!current = input.Length) then current := !current + 1; input.Append(c) |> ignore; writeChar(c) @@ -264,18 +264,18 @@ type internal ReadLineConsole() = input.Insert(!current, c) |> ignore; current := !current + 1; render(); - - let insertTab() = + + let insertTab() = for i = ReadLineConsole.TabSize - (!current % ReadLineConsole.TabSize) downto 1 do insertChar(' ') - - let moveLeft() = + + let moveLeft() = if (!current > 0 && (!current - 1 < input.Length)) then current := !current - 1 let c = input.Chars(!current) Cursor.Move(x.Inset, - x.GetCharacterSize(c)) - - let moveRight() = + + let moveRight() = if (!current < input.Length) then let c = input.Chars(!current); current := !current + 1; @@ -287,32 +287,32 @@ type internal ReadLineConsole() = current := input.Length; render() - let tabPress(shift) = - let opts,prefix = + let tabPress(shift) = + let opts,prefix = if !changed then changed := false; x.GetOptions(input.ToString()); else !optionsCache,false optionsCache := opts; - + if (opts.Count > 0) then - let part = + let part = if shift - then opts.Previous() + then opts.Previous() else opts.Next(); setInput(opts.Root + part); - else + else if (prefix) then Console.Beep(); - else + else insertTab(); - let delete() = + let delete() = if (input.Length > 0 && !current < input.Length) then input.Remove(!current, 1) |> ignore; render(); - + let deleteToEndOfLine() = if (!current < input.Length) then input.Remove (!current, input.Length - !current) |> ignore; @@ -324,35 +324,35 @@ type internal ReadLineConsole() = // REVIEW: looks like a relic of the port of readline, which is currently removable. let c = if (key.Key = ConsoleKey.F6) then '\x1A' else key.KeyChar insertChar(c); - - let backspace() = + + let backspace() = if (input.Length > 0 && !current > 0) then input.Remove(!current - 1, 1) |> ignore; current := !current - 1; render(); - - let enter() = + + let enter() = Console.Write("\n"); let line = input.ToString(); if (line = "\x1A") then null - else - if (line.Length > 0) then + else + if (line.Length > 0) then history.AddLast(line); line; - - let rec read() = + + let rec read() = let key = Console.ReadKey true match (key.Key) with - | ConsoleKey.Backspace -> + | ConsoleKey.Backspace -> backspace(); - change() - | ConsoleKey.Delete -> + change() + | ConsoleKey.Delete -> delete(); - change() - | ConsoleKey.Enter -> + change() + | ConsoleKey.Enter -> enter() - | ConsoleKey.Tab -> + | ConsoleKey.Tab -> tabPress(key.Modifiers &&& ConsoleModifiers.Shift <> enum 0); read() | ConsoleKey.UpArrow -> @@ -428,7 +428,7 @@ type internal ReadLineConsole() = // Skip and read again. read() - and change() = + and change() = changed := true; - read() + read() read() diff --git a/docs/fcs-samples/FsiExe/fsimain.fs b/docs/fcs-samples/FsiExe/fsimain.fs index e0ebdeef41e..0751d0adceb 100644 --- a/docs/fcs-samples/FsiExe/fsimain.fs +++ b/docs/fcs-samples/FsiExe/fsimain.fs @@ -4,7 +4,7 @@ //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- -// Copyright (c) 2002-2012 Microsoft Corporation. +// Copyright (c) 2002-2012 Microsoft Corporation. // All Rights Reserved. // // See License.txt in the project root for license information. @@ -27,7 +27,7 @@ open FSharp.Compiler #nowarn "55" [] -[] +[] do() /// Set the current ui culture for the current thread. @@ -37,13 +37,13 @@ let internal SetCurrentUICultureForThread (lcid : int option) = | None -> () ///Use a dummy to access protected member -type internal DummyForm() = - inherit Form() - member x.DoCreateHandle() = x.CreateHandle() +type internal DummyForm() = + inherit Form() + member x.DoCreateHandle() = x.CreateHandle() /// Creating the dummy form object can crash on Mono Mac, and then prints a nasty background /// error during finalization of the half-initialized object... override x.Finalize() = () - + #if USE_WINFORMS_EVENT_LOOP /// This is the event loop implementation for winforms let WinFormsEventLoop(lcid : int option) = @@ -93,17 +93,17 @@ let WinFormsEventLoop(lcid : int option) = #endif -let StartServer (fsiSession : FsiEvaluationSession) (fsiServerName) = +let StartServer (fsiSession : FsiEvaluationSession) (fsiServerName) = let server = {new Server.Shared.FSharpInteractiveServer() with - member this.Interrupt() = + member this.Interrupt() = //printf "FSI-SERVER: received CTRL-C request...\n" - try + try fsiSession.Interrupt() - with e -> - // Final sanity check! - catch all exns - but not expected + with e -> + // Final sanity check! - catch all exns - but not expected assert false - () + () } Server.Shared.FSharpInteractiveServer.StartServer(fsiServerName,server) @@ -112,18 +112,18 @@ let StartServer (fsiSession : FsiEvaluationSession) (fsiServerName) = // GUI runCodeOnMainThread //---------------------------------------------------------------------------- -let internal TrySetUnhandledExceptionMode() = - let i = ref 0 // stop inlining - try - Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException) - with _ -> +let internal TrySetUnhandledExceptionMode() = + let i = ref 0 // stop inlining + try + Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException) + with _ -> decr i;() // Mark the main thread as STAThread since it is a GUI thread [] -[] -[] -let MainMain argv = +[] +[] +let MainMain argv = ignore argv let argv = System.Environment.GetCommandLineArgs() @@ -132,17 +132,17 @@ let MainMain argv = let setupInformation = AppDomain.CurrentDomain.SetupInformation setupInformation.ShadowCopyFiles <- "true" let helper = AppDomain.CreateDomain("FSI_Domain", null, setupInformation) - helper.ExecuteAssemblyByName(Assembly.GetExecutingAssembly().GetName()) + helper.ExecuteAssemblyByName(Assembly.GetExecutingAssembly().GetName()) else // When VFSI is running, set the input/output encoding to UTF8. // Otherwise, unicode gets lost during redirection. // It is required only under Net4.5 or above (with unicode console feature). if argv |> Array.exists (fun x -> x.Contains "fsi-server") then - Console.InputEncoding <- System.Text.Encoding.UTF8 + Console.InputEncoding <- System.Text.Encoding.UTF8 Console.OutputEncoding <- System.Text.Encoding.UTF8 -#if DEBUG +#if DEBUG if argv |> Array.exists (fun x -> x = "/pause" || x = "--pause") then Console.WriteLine("Press any key to continue...") Console.ReadKey() |> ignore @@ -150,42 +150,42 @@ let MainMain argv = try let console = new FSharp.Compiler.Interactive.ReadLineConsole() - let getConsoleReadLine (probeToSeeIfConsoleWorks) = + let getConsoleReadLine (probeToSeeIfConsoleWorks) = let consoleIsOperational = - if probeToSeeIfConsoleWorks then + if probeToSeeIfConsoleWorks then //if progress then fprintfn outWriter "probing to see if console works..." try // Probe to see if the console looks functional on this version of .NET - let _ = Console.KeyAvailable + let _ = Console.KeyAvailable let c1 = Console.ForegroundColor let c2 = Console.BackgroundColor let _ = Console.CursorLeft <- Console.CursorLeft //if progress then fprintfn outWriter "probe succeeded, we might have a console, comparing foreground (%A) and background (%A) colors, if they are the same then we're running in emacs or VS on unix and we turn off readline by default..." c1 c2 c1 <> c2 - with _ -> + with _ -> //if progress then fprintfn outWriter "probe failed, we have no console..." - false + false else true - if consoleIsOperational then + if consoleIsOperational then Some (fun () -> console.ReadLine()) else None - + #if USE_FSharp_Compiler_Interactive_Settings let fsiConfig0 = FsiEvaluationSession.GetDefaultConfiguration(fsi) #else let fsiConfig0 = FsiEvaluationSession.GetDefaultConfiguration() -#endif - let rec fsiConfig = +#endif + let rec fsiConfig = { // Update the configuration to include 'StartServer' and 'OptionalConsoleReadLine' - new FsiEvaluationSessionHostConfig () with + new FsiEvaluationSessionHostConfig () with member __.FormatProvider = fsiConfig0.FormatProvider member __.FloatingPointFormat = fsiConfig0.FloatingPointFormat member __.AddedPrinters = fsiConfig0.AddedPrinters member __.ShowDeclarationValues = fsiConfig0.ShowDeclarationValues member __.ShowIEnumerable = fsiConfig0.ShowIEnumerable member __.ShowProperties = fsiConfig0.ShowProperties - member __.PrintSize = fsiConfig0.PrintSize + member __.PrintSize = fsiConfig0.PrintSize member __.PrintDepth = fsiConfig0.PrintDepth member __.PrintWidth = fsiConfig0.PrintWidth member __.PrintLength = fsiConfig0.PrintLength @@ -196,24 +196,24 @@ let MainMain argv = member __.UseFsiAuxLib = fsiConfig0.UseFsiAuxLib member __.StartServer(fsiServerName) = StartServer fsiSession fsiServerName - + // Connect the configuration through to the 'fsi' Event loop member __.GetOptionalConsoleReadLine(probe) = getConsoleReadLine(probe) } and fsiSession = FsiEvaluationSession.Create (fsiConfig, argv, Console.In, Console.Out, Console.Error) - if fsiSession.IsGui then - try - Application.EnableVisualStyles() - with _ -> + if fsiSession.IsGui then + try + Application.EnableVisualStyles() + with _ -> () // Route GUI application exceptions to the exception handlers Application.add_ThreadException(new ThreadExceptionEventHandler(fun _ args -> fsiSession.ReportUnhandledException args.Exception)); - try - TrySetUnhandledExceptionMode() - with _ -> + try + TrySetUnhandledExceptionMode() + with _ -> () #if USE_WINFORMS_EVENT_LOOP @@ -224,11 +224,11 @@ let MainMain argv = printfn "You can set different event loops for MonoMac, Gtk#, WinForms and other" printfn "UI toolkits. Drop the --gui argument if no event loop is required." #endif - + console.SetCompletionFunction(fun (s1,s2) -> fsiSession.GetCompletions (match s1 with | Some s -> s + "." + s2 | None -> s2)) - - fsiSession.Run() + + fsiSession.Run() with e -> printf "Exception by fsi.exe:\n%+A\n" e 0 diff --git a/docs/fcs-samples/FsiExe/fsiserver.fs b/docs/fcs-samples/FsiExe/fsiserver.fs index 6fafe5d1bcb..74b1f54f567 100644 --- a/docs/fcs-samples/FsiExe/fsiserver.fs +++ b/docs/fcs-samples/FsiExe/fsiserver.fs @@ -13,14 +13,14 @@ namespace FSharp.Compiler.Server.Shared // e.g. // - interrupt // - intellisense completion -// +// // This is done via remoting. // Here we define the service class. // This dll is required for both client (fsi-vs plugin) and server (spawned fsi). //[] [] -[] +[] do() open System @@ -31,22 +31,22 @@ open System.Runtime.Remoting.Lifetime [] type internal FSharpInteractiveServer() = - inherit System.MarshalByRefObject() + inherit System.MarshalByRefObject() abstract Interrupt : unit -> unit default x.Interrupt() = () [] static member StartServer(channelName:string,server:FSharpInteractiveServer) = - let chan = new Ipc.IpcChannel(channelName) - LifetimeServices.LeaseTime <- TimeSpan(7,0,0,0); // days,hours,mins,secs + let chan = new Ipc.IpcChannel(channelName) + LifetimeServices.LeaseTime <- TimeSpan(7,0,0,0); // days,hours,mins,secs LifetimeServices.LeaseManagerPollTime <- TimeSpan(7,0,0,0); LifetimeServices.RenewOnCallTime <- TimeSpan(7,0,0,0); LifetimeServices.SponsorshipTimeout <- TimeSpan(7,0,0,0); ChannelServices.RegisterChannel(chan,false); - let _ = RemotingServices.Marshal(server,"FSIServer") + let _ = RemotingServices.Marshal(server,"FSIServer") () static member StartClient(channelName) = - let T = Activator.GetObject(typeof,"ipc://" + channelName + "/FSIServer") - let x = T :?> FSharpInteractiveServer + let T = Activator.GetObject(typeof,"ipc://" + channelName + "/FSIServer") + let x = T :?> FSharpInteractiveServer x diff --git a/docs/fcs-samples/InteractiveService/Program.fs b/docs/fcs-samples/InteractiveService/Program.fs index 4b8d968864c..441544841e2 100644 --- a/docs/fcs-samples/InteractiveService/Program.fs +++ b/docs/fcs-samples/InteractiveService/Program.fs @@ -7,31 +7,31 @@ let sbErr = new Text.StringBuilder() let argv = System.Environment.GetCommandLineArgs() [] -let main (argv) = +let main (argv) = let inStream = new StringReader("") let outStream = new StringWriter(sbOut) let errStream = new StringWriter(sbErr) - + let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration() - let fsiSession = + let fsiSession = FsiEvaluationSession.Create - (fsiConfig, + (fsiConfig, [| yield "fsi.exe" yield! argv yield "--noninteractive" |], inStream, outStream, errStream) - + while true do - try + try let text = Console.ReadLine() - if text.StartsWith("=") then + if text.StartsWith("=") then match fsiSession.EvalExpression(text.Substring(1)) with | Some value -> printfn "%A" value.ReflectionValue | None -> printfn "Got no result!" - else + else fsiSession.EvalInteraction(text) printfn "Ok" - with e -> + with e -> match e.InnerException with | null -> printfn "Error evaluating expression (%s)" e.Message | err -> printfn "Error evaluating expression (%s)" err.Message diff --git a/docs/fcs-samples/Tokenizer/Program.fs b/docs/fcs-samples/Tokenizer/Program.fs index 6e36b59bbb5..b7c95e789f8 100644 --- a/docs/fcs-samples/Tokenizer/Program.fs +++ b/docs/fcs-samples/Tokenizer/Program.fs @@ -16,7 +16,7 @@ let tokenizeLines (lines:string[]) = | None, nstate -> state := nstate } yield n, parseLine() |> List.ofSeq ] -let tokenizedLines = +let tokenizedLines = tokenizeLines [| "// Sets the hello world variable" "let hello = \"Hello world\" " |] diff --git a/docs/fcs-samples/UntypedTree/Program.fs b/docs/fcs-samples/UntypedTree/Program.fs index 7203195a173..6f02317c712 100644 --- a/docs/fcs-samples/UntypedTree/Program.fs +++ b/docs/fcs-samples/UntypedTree/Program.fs @@ -8,7 +8,7 @@ let checker = FSharpChecker.Create() // ------------------------------------------------------------------ // Get untyped tree for a specified input -let getUntypedTree (file, input) = +let getUntypedTree (file, input) = let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| file |] } let untypedRes = checker.ParseFile(file, FSharp.Compiler.Text.SourceText.ofString input, parsingOptions) |> Async.RunSynchronously match untypedRes.ParseTree with @@ -17,7 +17,7 @@ let getUntypedTree (file, input) = // ------------------------------------------------------------------ -/// Walk over all module or namespace declarations +/// Walk over all module or namespace declarations /// (basically 'module Foo =' or 'namespace Foo.Bar') /// Note that there is one implicitly, even if the file /// does not explicitly define it.. @@ -27,10 +27,10 @@ let rec visitModulesAndNamespaces modulesOrNss = printfn "Namespace or module: %A" lid visitDeclarations decls -/// Walk over a pattern - this is for example used in +/// Walk over a pattern - this is for example used in /// let = or in the 'match' expression and visitPattern = function - | SynPat.Wild(_) -> + | SynPat.Wild(_) -> printfn " .. underscore pattern" | SynPat.Named(pat, name, _, _, _) -> visitPattern pat @@ -45,13 +45,13 @@ and visitExpression = function printfn "Conditional:" visitExpression cond visitExpression trueBranch - falseBranchOpt |> Option.iter visitExpression + falseBranchOpt |> Option.iter visitExpression | SynExpr.LetOrUse(_, _, bindings, body, _) -> printfn "LetOrUse with the following bindings:" for binding in bindings do let (Binding(access, kind, inlin, mutabl, attrs, xmlDoc, data, pat, retInfo, body, m, sp)) = binding - visitPattern pat + visitPattern pat printfn "And the following body:" visitExpression body | expr -> printfn " - not supported expression: %A" expr @@ -59,14 +59,14 @@ and visitExpression = function /// Walk over a list of declarations in a module. This is anything /// that you can write as a top-level inside module (let bindings, /// nested modules, type declarations etc.) -and visitDeclarations decls = +and visitDeclarations decls = for declaration in decls do match declaration with | SynModuleDecl.Let(isRec, bindings, range) -> for binding in bindings do let (Binding(access, kind, inlin, mutabl, attrs, xmlDoc, data, pat, retInfo, body, m, sp)) = binding - visitPattern pat - visitExpression body + visitPattern pat + visitExpression body | _ -> printfn " - not supported declaration: %A" declaration @@ -80,7 +80,7 @@ let input = """ printfn "%s" msg """ let file = "/home/user/Test.fsx" -let tree = getUntypedTree(file, input) +let tree = getUntypedTree(file, input) // Testing: Print the AST to see what it looks like // tree |> printfn "%A" diff --git a/tests/AheadOfTime/Equality/Program.fs b/tests/AheadOfTime/Equality/Program.fs index 052d2875da3..b3750a724a0 100644 --- a/tests/AheadOfTime/Equality/Program.fs +++ b/tests/AheadOfTime/Equality/Program.fs @@ -3,7 +3,7 @@ open NonStructuralComparison let failures = HashSet() -let reportFailure (s: string) = +let reportFailure (s: string) = stderr.Write " NO: " stderr.WriteLine s failures.Add s |> ignore @@ -39,7 +39,7 @@ module Arrays = test "test102" [|1uy|] [|1uy|] test "test103" [|box 1|] [|box 1|] -module Structs = +module Structs = test "test200" struct (1, 1) struct (1, 1) test "test201" struct (1, 1, 1) struct (1, 1, 1) test "test202" struct (1, 1, 1, 1) struct (1, 1, 1, 1) @@ -48,7 +48,7 @@ module Structs = test "test205" struct (1, 1, 1, 1, 1, 1, 1) struct (1, 1, 1, 1, 1, 1, 1) test "test206" struct (1, 1, 1, 1, 1, 1, 1, 1) struct (1, 1, 1, 1, 1, 1, 1, 1) -module OptionsAndCo = +module OptionsAndCo = open System test "test301" (Some 1) (Some 1) @@ -59,19 +59,19 @@ module OptionsAndCo = module Enums = open System - type SomeEnum = + type SomeEnum = | Case0 = 0 | Case1 = 1 - test "test401" (enum(1)) (enum(1)) - test "test402" (enum(1)) (enum(1)) + test "test401" (enum(1)) (enum(1)) + test "test402" (enum(1)) (enum(1)) [] let main _ = - match failures with - | set when set.Count = 0 -> + match failures with + | set when set.Count = 0 -> stdout.WriteLine "All tests passed" exit 0 - | _ -> + | _ -> stdout.WriteLine "Some tests failed" exit 1 diff --git a/tests/AheadOfTime/Trimming/Program.fs b/tests/AheadOfTime/Trimming/Program.fs index 2ab73bc9bb0..04c5c9d1de0 100644 --- a/tests/AheadOfTime/Trimming/Program.fs +++ b/tests/AheadOfTime/Trimming/Program.fs @@ -6,20 +6,20 @@ open System.Collections.Generic let failures = ref [] -let report_failure (s : string) = +let report_failure (s : string) = stderr.Write" NO: " stderr.WriteLine s failures := !failures @ [s] () -let check s e r = +let check s e r = if r <> e then (stderr.WriteLine ($"\n***** {s}: Expected: '{e}' Results: '{r}' = FAIL\n"); report_failure s) let test t (s1:Lazy) s2 = let s1 = s1.Force() - if s1 <> s2 then + if s1 <> s2 then report_failure ("test "+t+": expected \n\t'"+s2+"' but produced \n\t'"+s1+"'") stdout.WriteLine ("test "+t+": expected \n\t'"+s2+"' but produced \n\t'"+s1+"'") @@ -290,17 +290,17 @@ let testing1 () = let _ = test "weioj3ffd2" (lazy(try if true then failwithf "%s" "abc" else "d"with Failure "abc" -> "e")) "e" let _ = test "weioj3" (lazy(sprintf "%t" (fun () -> "10"))) "10" - + let bug600 = sprintf "%d" - let _ = test "bug600a1" (lazy(bug600 2)) "2" + let _ = test "bug600a1" (lazy(bug600 2)) "2" let _ = test "bug600b1" (lazy(bug600 2)) "2" (* not 22! *) let bug600b = sprintf "%s" - let _ = test "bug600a2" (lazy(bug600b "2")) "2" + let _ = test "bug600a2" (lazy(bug600b "2")) "2" let _ = test "bug600b2" (lazy(bug600b "2")) "2" (* not 22! *) let bug600c = sprintf "%x" - let _ = test "bug600a3" (lazy(bug600c 2)) "2" + let _ = test "bug600a3" (lazy(bug600c 2)) "2" let _ = test "bug600b3" (lazy(bug600c 2)) "2" (* not 22! *) let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFy)) ("ff") @@ -9370,7 +9370,7 @@ let testLazySimple () = check "lazy_simple" 12345 (f23()) let testSeqWithTryFinally () = - let result = + let result = seq { try yield 1 @@ -9402,11 +9402,11 @@ let main _ = testLazySimple () testSeqWithTryFinally () - match !failures with - | [] -> + match !failures with + | [] -> stdout.WriteLine "All tests passed" exit 0 - | _ -> + | _ -> stdout.WriteLine "Some tests failed" exit 1 0 \ No newline at end of file diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.Provider.fs b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.Provider.fs index 0d209d439ed..e78a6ffbbc3 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.Provider.fs +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.Provider.fs @@ -15,7 +15,7 @@ type BasicErasingProvider (config : TypeProviderConfig) as this = let asm = Assembly.GetExecutingAssembly() // check we contain a copy of runtime files, and are not referencing the runtime DLL - do assert (typeof.Assembly.GetName().Name = asm.GetName().Name) + do assert (typeof.Assembly.GetName().Name = asm.GetName().Name) let createTypes () = let myType = ProvidedTypeDefinition(asm, ns, "MyType", Some typeof) @@ -61,7 +61,7 @@ type BasicGenerativeProvider (config : TypeProviderConfig) as this = let asm = Assembly.GetExecutingAssembly() // check we contain a copy of runtime files, and are not referencing the runtime DLL - do assert (typeof.Assembly.GetName().Name = asm.GetName().Name) + do assert (typeof.Assembly.GetName().Name = asm.GetName().Name) let createType typeName (count:int) = let asm = ProvidedAssembly() @@ -73,7 +73,7 @@ type BasicGenerativeProvider (config : TypeProviderConfig) as this = let ctor2 = ProvidedConstructor([ProvidedParameter("InnerState", typeof)], invokeCode = fun args -> <@@ (%%(args.[1]):string) :> obj @@>) myType.AddMember(ctor2) - for i in 1 .. count do + for i in 1 .. count do let prop = ProvidedProperty("Property" + string i, typeof, getterCode = fun args -> <@@ i @@>) myType.AddMember(prop) @@ -83,7 +83,7 @@ type BasicGenerativeProvider (config : TypeProviderConfig) as this = myType - let myParamType = + let myParamType = let t = ProvidedTypeDefinition(asm, ns, "GenerativeProvider", Some typeof, isErased=false) t.DefineStaticParameters( [ProvidedStaticParameter("Count", typeof)], fun typeName args -> createType typeName (unbox args.[0])) t diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/Program.fs b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/Program.fs index 2ad94bd4a51..d03407304fd 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/Program.fs +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/Program.fs @@ -1,2 +1,2 @@ -module Program +module Program let [] main _ = 0 diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.Runtime.fs b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.Runtime.fs index 078dffb5dfd..87a7444adb8 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.Runtime.fs +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.Runtime.fs @@ -4,7 +4,7 @@ namespace BasicProvider.Helpers -type SomeRuntimeHelper() = +type SomeRuntimeHelper() = static member Help() = "help" #if !IS_DESIGNTIME diff --git a/tests/EndToEndBuildTests/ComboProvider/ComboProvider.Tests/Program.fs b/tests/EndToEndBuildTests/ComboProvider/ComboProvider.Tests/Program.fs index 2ad94bd4a51..d03407304fd 100644 --- a/tests/EndToEndBuildTests/ComboProvider/ComboProvider.Tests/Program.fs +++ b/tests/EndToEndBuildTests/ComboProvider/ComboProvider.Tests/Program.fs @@ -1,2 +1,2 @@ -module Program +module Program let [] main _ = 0 diff --git a/tests/EndToEndBuildTests/ComboProvider/ComboProvider/ComboProvider.fs b/tests/EndToEndBuildTests/ComboProvider/ComboProvider/ComboProvider.fs index 532094f6f0f..a9da5798fd2 100644 --- a/tests/EndToEndBuildTests/ComboProvider/ComboProvider/ComboProvider.fs +++ b/tests/EndToEndBuildTests/ComboProvider/ComboProvider/ComboProvider.fs @@ -8,11 +8,11 @@ open FSharp.Core.CompilerServices open System.Reflection -type SomeRuntimeHelper() = +type SomeRuntimeHelper() = static member Help() = "help" [] -type SomeRuntimeHelper2() = +type SomeRuntimeHelper2() = static member Help() = "help" [] @@ -23,7 +23,7 @@ type ComboProvider (config : TypeProviderConfig) as this = let asm = Assembly.GetExecutingAssembly() // check we contain a copy of runtime files, and are not referencing the runtime DLL - do assert (typeof.Assembly.GetName().Name = asm.GetName().Name) + do assert (typeof.Assembly.GetName().Name = asm.GetName().Name) let createTypes () = let myType = ProvidedTypeDefinition(asm, ns, "MyType", Some typeof) diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs index 7e93e9fd9c1..01bfd13196a 100644 --- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs +++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation, Tomas Petricek, Gustavo Guerra, and other contributors -// +// // Licensed under the MIT License see LICENSE.md in this project namespace ProviderImplementation.ProvidedTypes @@ -21,13 +21,13 @@ namespace ProviderImplementation.ProvidedTypes open Microsoft.FSharp.Core.CompilerServices [] - module Utils = + module Utils = let K x = (fun () -> x) let isNull x = match x with null -> true | _ -> false let isNil x = match x with [] -> true | _ -> false let isEmpty x = match x with [| |] -> true | _ -> false - module Option = + module Option = let toObj x = match x with None -> null | Some x -> x let ofObj x = match x with null -> None | _ -> Some x @@ -44,7 +44,7 @@ namespace ProviderImplementation.ProvidedTypes let USome v = uoption<'T>(true, v) let (|UNone|USome|) (x:uoption<'T>) = if x.HasValue then USome x.Value else UNone - module StructOption = + module StructOption = let toObj x = match x with UNone -> null | USome x -> x let ofObj x = match x with null -> UNone | x -> USome x @@ -92,22 +92,22 @@ namespace ProviderImplementation.ProvidedTypes let isAssignableFrom (ty: Type) (otherTy: Type) = eqTypes ty otherTy || (match otherTy.BaseType with null -> false | bt -> ty.IsAssignableFrom(bt)) - /// General implementation of .IsSubclassOf logic for System.Type, regardless of specific implementation, with + /// General implementation of .IsSubclassOf logic for System.Type, regardless of specific implementation, with /// an added hack to make the types usable with the FSharp.Core quotations implementation let isSubclassOf (this: Type) (otherTy: Type) = (this.IsClass && otherTy.IsClass && this.IsAssignableFrom(otherTy) && not (eqTypes this otherTy)) // The FSharp.Core implementation of FSharp.Quotations uses - // let isDelegateType (typ:Type) = + // let isDelegateType (typ:Type) = // if typ.IsSubclassOf(typeof) then ... // This means even target type definitions must process the case where ``otherTy`` is typeof rather than // the System.Delegate type for the target assemblies. - || (match this.BaseType with - | null -> false + || (match this.BaseType with + | null -> false | bt -> bt.FullName = "System.MulticastDelegate" && (let fn = otherTy.FullName in fn = "System.Delegate" || fn = "System.MulticastDelegate" )) - /// General implementation of .GetAttributeFlags logic for System.Type over symbol types - let getAttributeFlagsImpl (ty: Type) = + /// General implementation of .GetAttributeFlags logic for System.Type over symbol types + let getAttributeFlagsImpl (ty: Type) = if ty.IsGenericType then ty.GetGenericTypeDefinition().Attributes elif ty.IsArray then typeof.Attributes elif ty.IsPointer then typeof.MakePointerType().Attributes @@ -117,7 +117,7 @@ namespace ProviderImplementation.ProvidedTypes let bindAll = BindingFlags.DeclaredOnly ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Static ||| BindingFlags.Instance let bindSome isStatic = BindingFlags.DeclaredOnly ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| (if isStatic then BindingFlags.Static else BindingFlags.Instance) - let memberBinds isType (bindingFlags: BindingFlags) isStatic isPublic = + let memberBinds isType (bindingFlags: BindingFlags) isStatic isPublic = (isType || bindingFlags.HasFlag(if isStatic then BindingFlags.Static else BindingFlags.Instance)) && ((bindingFlags.HasFlag(BindingFlags.Public) && isPublic) || (bindingFlags.HasFlag(BindingFlags.NonPublic) && not isPublic)) @@ -144,13 +144,13 @@ namespace ProviderImplementation.ProvidedTypes else ty - let mutable token = 0 + let mutable token = 0 let genToken() = token <- token + 1; token /// Internal code of .NET expects the obj[] returned by GetCustomAttributes to be an Attribute[] even in the case of empty arrays let emptyAttributes = (([| |]: Attribute[]) |> box |> unbox) let nonNone str x = match x with None -> failwithf "No value has been specified for '%s', stacktrace = '%s'" str Environment.StackTrace | Some v -> v - let patchOption v f = match v with None -> f() | Some _ -> failwithf "Already patched, stacktrace = '%s'" Environment.StackTrace + let patchOption v f = match v with None -> f() | Some _ -> failwithf "Already patched, stacktrace = '%s'" Environment.StackTrace let notRequired this opname item = let msg = sprintf "The operation '%s' on item '%s' should not be called on provided type, member or parameter of type '%O'. Stack trace:\n%s" opname item (this.GetType()) Environment.StackTrace @@ -174,24 +174,24 @@ namespace ProviderImplementation.ProvidedTypes type ConstructorInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetConstructors(bindAll) + gdty.GetConstructors(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic constructor definition via metadata token, stacktrace = '%s'" m.DeclaringType m.Name Environment.StackTrace else m type PropertyInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetProperties(bindAll) + gdty.GetProperties(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic property definition via metadata token" m.DeclaringType m.Name else @@ -201,12 +201,12 @@ namespace ProviderImplementation.ProvidedTypes member p.IsPublic = p.CanRead && p.GetGetMethod().IsPublic || p.CanWrite && p.GetSetMethod().IsPublic type EventInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetEvents(bindAll) + gdty.GetEvents(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic event definition via metadata token" m.DeclaringType m.Name else @@ -216,33 +216,33 @@ namespace ProviderImplementation.ProvidedTypes member p.IsPublic = p.GetAddMethod().IsPublic || p.GetRemoveMethod().IsPublic type FieldInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetFields(bindAll) + gdty.GetFields(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic event definition via metadata token" m.DeclaringType m.Name else m type MethodInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType if (m.IsGenericMethod && not dty.IsGenericType) then m.GetGenericMethodDefinition() - elif (m.IsGenericMethod && (not m.IsGenericMethodDefinition || not dty.IsGenericTypeDefinition)) || - (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + elif (m.IsGenericMethod && (not m.IsGenericMethodDefinition || not dty.IsGenericTypeDefinition)) || + (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through ALL the methods on the original type definition looking for the one // with a matching metadata token let gdty = if dty.IsGenericType then dty.GetGenericTypeDefinition() else dty - gdty.GetMethods(bindSome m.IsStatic) + gdty.GetMethods(bindSome m.IsStatic) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind generic instantiation of %O::%s back to generic method definition via metadata token" m.DeclaringType m.Name else - m + m let canBindConstructor (bindingFlags: BindingFlags) (c: ConstructorInfo) = bindingFlags.HasFlag(BindingFlags.Public) && c.IsPublic || bindingFlags.HasFlag(BindingFlags.NonPublic) && not c.IsPublic @@ -413,19 +413,19 @@ namespace ProviderImplementation.ProvidedTypes let op = letOp.Invoke(null, [| |]) mkFE2.Invoke(null, [| box op; box e; box lam |]) :?> Expr - static member ForIntegerRangeLoopUnchecked (loopVariable, startExpr:Expr, endExpr:Expr, body:Expr) = + static member ForIntegerRangeLoopUnchecked (loopVariable, startExpr:Expr, endExpr:Expr, body:Expr) = let lam = Expr.Lambda(loopVariable, body) let op = forIntegerRangeLoopOp.Invoke(null, [| |]) mkFE3.Invoke(null, [| box op; box startExpr; box endExpr; box lam |] ) :?> Expr - static member WhileLoopUnchecked (guard:Expr, body:Expr) = + static member WhileLoopUnchecked (guard:Expr, body:Expr) = let op = whileLoopOp.Invoke(null, [| |]) mkFE2.Invoke(null, [| box op; box guard; box body |] ):?> Expr - static member IfThenElseUnchecked (e:Expr, t:Expr, f:Expr) = + static member IfThenElseUnchecked (e:Expr, t:Expr, f:Expr) = let op = ifThenElseOp.Invoke(null, [| |]) mkFE3.Invoke(null, [| box op; box e; box t; box f |] ):?> Expr - + type Shape = Shape of (Expr list -> Expr) let (|ShapeCombinationUnchecked|ShapeVarUnchecked|ShapeLambdaUnchecked|) e = @@ -523,7 +523,7 @@ namespace ProviderImplementation.ProvidedTypes | ProvidedTypeSymbolKind.Generic gty -> gty.DeclaringType | ProvidedTypeSymbolKind.FSharpTypeAbbreviation _ -> null - override __.Name = + override __.Name = match kind,typeArgs with | ProvidedTypeSymbolKind.SDArray,[| arg |] -> arg.Name + "[]" | ProvidedTypeSymbolKind.Array _,[| arg |] -> arg.Name + "[*]" @@ -675,7 +675,7 @@ namespace ProviderImplementation.ProvidedTypes override this.MakeArrayType arg = ProvidedTypeSymbol(ProvidedTypeSymbolKind.Array arg, [this]) :> Type - override __.MetadataToken = + override __.MetadataToken = match kind with | ProvidedTypeSymbolKind.SDArray -> typeof.MetadataToken | ProvidedTypeSymbolKind.Array _ -> typeof.MetadataToken @@ -837,14 +837,14 @@ namespace ProviderImplementation.ProvidedTypes let customAttributesImpl = CustomAttributesImpl(customAttributesData) - new (parameterName:string, parameterType:Type, ?parameterDefaultValue:obj) = + new (parameterName:string, parameterType:Type, ?parameterDefaultValue:obj) = ProvidedStaticParameter(false, parameterName, parameterType, parameterDefaultValue, (K [| |])) member __.AddXmlDocDelayed xmlDocFunction = customAttributesImpl.AddXmlDocDelayed xmlDocFunction member __.AddXmlDocComputed xmlDocFunction = customAttributesImpl.AddXmlDocComputed xmlDocFunction member __.AddXmlDoc xmlDoc = customAttributesImpl.AddXmlDoc xmlDoc - member __.ParameterDefaultValue = parameterDefaultValue + member __.ParameterDefaultValue = parameterDefaultValue member __.BelongsToTargetModel = isTgt override __.RawDefaultValue = defaultArg parameterDefaultValue null @@ -857,15 +857,15 @@ namespace ProviderImplementation.ProvidedTypes override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() type ProvidedParameter(isTgt: bool, parameterName:string, attrs, parameterType:Type, optionalValue:obj option, customAttributesData) = - + inherit ParameterInfo() let customAttributesImpl = CustomAttributesImpl(customAttributesData) - new (parameterName:string, parameterType:Type, ?isOut:bool, ?optionalValue:obj) = + new (parameterName:string, parameterType:Type, ?isOut:bool, ?optionalValue:obj) = ProvidedParameter(false, parameterName, parameterType, isOut, optionalValue) - new (_isTgt, parameterName:string, parameterType:Type, isOut:bool option, optionalValue:obj option) = + new (_isTgt, parameterName:string, parameterType:Type, isOut:bool option, optionalValue:obj option) = let isOut = defaultArg isOut false let attrs = (if isOut then ParameterAttributes.Out else enum 0) ||| (match optionalValue with None -> enum 0 | Some _ -> ParameterAttributes.Optional ||| ParameterAttributes.HasDefault) @@ -873,7 +873,7 @@ namespace ProviderImplementation.ProvidedTypes member __.IsParamArray with set(v) = customAttributesImpl.HasParamArray <- v member __.IsReflectedDefinition with set(v) = customAttributesImpl.HasReflectedDefinition <- v - member __.OptionalValue = optionalValue + member __.OptionalValue = optionalValue member __.HasDefaultParameterValue = Option.isSome optionalValue member __.BelongsToTargetModel = isTgt member __.AddCustomAttribute(attribute) = customAttributesImpl.AddCustomAttribute(attribute) @@ -885,11 +885,11 @@ namespace ProviderImplementation.ProvidedTypes override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() and ProvidedConstructor(isTgt: bool, attrs: MethodAttributes, parameters: ProvidedParameter[], invokeCode: (Expr list -> Expr), baseCall, isImplicitCtor, customAttributesData) = - + inherit ConstructorInfo() let parameterInfos = parameters |> Array.map (fun p -> p :> ParameterInfo) let mutable baseCall = baseCall - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let mutable isImplicitCtor = isImplicitCtor let mutable attrs = attrs let isStatic() = attrs.HasFlag(MethodAttributes.Static) @@ -946,7 +946,7 @@ namespace ProviderImplementation.ProvidedTypes inherit MethodInfo() let parameterInfos = parameters |> Array.map (fun p -> p :> ParameterInfo) - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let mutable attrs = attrs let mutable staticParams = staticParams let mutable staticParamsApply = staticParamsApply @@ -997,7 +997,7 @@ namespace ProviderImplementation.ProvidedTypes member this.IsErased = (nonNone "DeclaringType" this.DeclaringProvidedType).IsErased // Implement overloads - override __.GetParameters() = parameterInfos + override __.GetParameters() = parameterInfos override __.Attributes = attrs override __.Name = methodName override __.DeclaringType = declaringType |> nonNone "DeclaringType" :> Type @@ -1030,7 +1030,7 @@ namespace ProviderImplementation.ProvidedTypes and ProvidedProperty(isTgt: bool, propertyName: string, attrs: PropertyAttributes, propertyType: Type, isStatic: bool, getter: (unit -> MethodInfo) option, setter: (unit -> MethodInfo) option, indexParameters: ProvidedParameter[], customAttributesData) = inherit PropertyInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(customAttributesData) @@ -1052,11 +1052,11 @@ namespace ProviderImplementation.ProvidedTypes override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() member __.PatchDeclaringType x = - if not isTgt then + if not isTgt then match getter with Some f -> (match f() with (:? ProvidedMethod as g) -> g.PatchDeclaringType x | _ -> ()) | _ -> () match setter with Some f -> (match f() with (:? ProvidedMethod as s) -> s.PatchDeclaringType x | _ -> ()) | _ -> () patchOption declaringType (fun () -> declaringType <- Some x) - + member __.IsStatic = isStatic member __.IndexParameters = indexParameters member __.BelongsToTargetModel = isTgt @@ -1067,7 +1067,7 @@ namespace ProviderImplementation.ProvidedTypes override this.SetValue(_obj, _value, _invokeAttr, _binder, _index, _culture) = notRequired this "SetValue" propertyName override this.GetAccessors _nonPublic = notRequired this "nonPublic" propertyName override __.GetGetMethod _nonPublic = match getter with None -> null | Some g -> g() - override __.GetSetMethod _nonPublic = match setter with None -> null | Some s -> s() + override __.GetSetMethod _nonPublic = match setter with None -> null | Some s -> s() override __.GetIndexParameters() = [| for p in indexParameters -> upcast p |] override __.Attributes = attrs override __.CanRead = getter.IsSome @@ -1085,11 +1085,11 @@ namespace ProviderImplementation.ProvidedTypes and ProvidedEvent(isTgt: bool, eventName:string, attrs: EventAttributes, eventHandlerType:Type, isStatic: bool, adder: (unit -> MethodInfo), remover: (unit -> MethodInfo), customAttributesData) = inherit EventInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(customAttributesData) - new (eventName, eventHandlerType, adderCode, removerCode, ?isStatic) = + new (eventName, eventHandlerType, adderCode, removerCode, ?isStatic) = let isStatic = defaultArg isStatic false let pattrs = (if isStatic then MethodAttributes.Static else enum(0)) ||| MethodAttributes.Public ||| MethodAttributes.SpecialName let adder = ProvidedMethod(false, "add_" + eventName, pattrs, [| ProvidedParameter(false, "handler", eventHandlerType, isOut=Some false, optionalValue=None) |], typeof, adderCode, [], None, K [| |]) :> MethodInfo @@ -1102,7 +1102,7 @@ namespace ProviderImplementation.ProvidedTypes member __.AddDefinitionLocation(line,column,filePath) = customAttributesImpl.AddDefinitionLocation(line, column, filePath) member __.PatchDeclaringType x = - if not isTgt then + if not isTgt then match adder() with :? ProvidedMethod as a -> a.PatchDeclaringType x | _ -> () match remover() with :? ProvidedMethod as r -> r.PatchDeclaringType x | _ -> () patchOption declaringType (fun () -> declaringType <- Some x) @@ -1113,7 +1113,7 @@ namespace ProviderImplementation.ProvidedTypes member __.BelongsToTargetModel = isTgt override __.EventHandlerType = eventHandlerType - override __.GetAddMethod _nonPublic = adder() + override __.GetAddMethod _nonPublic = adder() override __.GetRemoveMethod _nonPublic = remover() override __.Attributes = attrs override __.Name = eventName @@ -1130,7 +1130,7 @@ namespace ProviderImplementation.ProvidedTypes and ProvidedField(isTgt: bool, fieldName:string, attrs, fieldType:Type, rawConstantValue: obj, customAttributesData) = inherit FieldInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(customAttributesData) let mutable attrs = attrs @@ -1167,10 +1167,10 @@ namespace ProviderImplementation.ProvidedTypes override this.GetValue(_obj): obj = notRequired this "GetValue" fieldName override this.FieldHandle = notRequired this "FieldHandle" fieldName - static member Literal(fieldName:string, fieldType:Type, literalValue: obj) = + static member Literal(fieldName:string, fieldType:Type, literalValue: obj) = ProvidedField(false, fieldName, (FieldAttributes.Static ||| FieldAttributes.Literal ||| FieldAttributes.Public), fieldType, literalValue, K [| |]) - + and ProvidedMeasureBuilder() = // TODO: this shouldn't be hardcoded, but without creating a dependency on FSharp.Compiler.Service @@ -1184,7 +1184,7 @@ namespace ProviderImplementation.ProvidedTypes static let unitSymbolsTypeAbbreviations = [ "m"; "kg"; "s"; "A"; "K"; "mol"; "cd"; "Hz"; "N"; "Pa"; "J"; "W"; "C" "V"; "F"; "S"; "Wb"; "T"; "lm"; "lx"; "Bq"; "Gy"; "Sv"; "kat"; "H" ] - |> Set.ofList + |> Set.ofList static member One = typeof static member Product (measure1, measure2) = typedefof>.MakeGenericType [| measure1;measure2 |] @@ -1212,8 +1212,8 @@ namespace ProviderImplementation.ProvidedTypes static member AnnotateType (basic, argument) = ProvidedTypeSymbol(Generic basic, argument) :> Type - and - [] + and + [] TypeContainer = | Namespace of (unit -> Assembly) * string // namespace | Type of ProvidedTypeDefinition @@ -1226,17 +1226,17 @@ namespace ProviderImplementation.ProvidedTypes | TypeContainer.Namespace _, Some logger when not isTgt -> logger (sprintf "Creating ProvidedTypeDefinition %s [%d]" className (System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode this)) | _ -> () - static let defaultAttributes isErased = - TypeAttributes.Public ||| - TypeAttributes.Class ||| - TypeAttributes.Sealed ||| + static let defaultAttributes isErased = + TypeAttributes.Public ||| + TypeAttributes.Class ||| + TypeAttributes.Sealed ||| enum (if isErased then int32 TypeProviderTypeAttributes.IsErased else 0) // state let mutable attrs = attrs let mutable enumUnderlyingType = lazy getEnumUnderlyingType() let mutable baseType = lazy getBaseType() - + /// Represents the evaluated members so far let members = ResizeArray() @@ -1252,8 +1252,8 @@ namespace ProviderImplementation.ProvidedTypes let methodOverrides = ResizeArray() let methodOverridesQueue = ResizeArray (ProvidedMethod * MethodInfo)[]>() - do match initialData with - | None -> () + do match initialData with + | None -> () | Some (getFreshMembers, getFreshInterfaces, getFreshMethodOverrides) -> membersQueue.Add getFreshMembers interfacesQueue.Add getFreshInterfaces @@ -1266,22 +1266,22 @@ namespace ProviderImplementation.ProvidedTypes for f in elems do for m in f() do members.Add m - + // Implicitly add the property and event methods (only for the source model where they are not explicitly declared) match m with | :? ProvidedProperty as p -> - if not p.BelongsToTargetModel then + if not p.BelongsToTargetModel then if p.CanRead then members.Add (p.GetGetMethod true) if p.CanWrite then members.Add (p.GetSetMethod true) | :? ProvidedEvent as e -> - if not e.BelongsToTargetModel then + if not e.BelongsToTargetModel then members.Add (e.GetAddMethod true) members.Add (e.GetRemoveMethod true) | _ -> () - + // re-add the getFreshMembers call from the initialData to make sure we fetch the latest translated members from the source model - match initialData with - | None -> () + match initialData with + | None -> () | Some (getFreshMembers, _getInterfaceImpls, _getMethodOverrides) -> membersQueue.Add getFreshMembers @@ -1297,8 +1297,8 @@ namespace ProviderImplementation.ProvidedTypes for f in elems do for i in f() do interfaceImpls.Add i - match initialData with - | None -> () + match initialData with + | None -> () | Some (_getFreshMembers, getInterfaces, _getMethodOverrides) -> interfacesQueue.Add getInterfaces @@ -1313,8 +1313,8 @@ namespace ProviderImplementation.ProvidedTypes for f in elems do for i in f() do methodOverrides.Add i - match initialData with - | None -> () + match initialData with + | None -> () | Some (_getFreshMembers, _getInterfaceImpls, getMethodOverrides) -> methodOverridesQueue.Add getMethodOverrides @@ -1330,7 +1330,7 @@ namespace ProviderImplementation.ProvidedTypes override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() - new (assembly:Assembly, namespaceName, className, baseType, ?hideObjectMethods, ?nonNullable, ?isErased) = + new (assembly:Assembly, namespaceName, className, baseType, ?hideObjectMethods, ?nonNullable, ?isErased) = let isErased = defaultArg isErased true let nonNullable = defaultArg nonNullable false let hideObjectMethods = defaultArg hideObjectMethods false @@ -1338,7 +1338,7 @@ namespace ProviderImplementation.ProvidedTypes //if not isErased && assembly.GetType().Name <> "ProvidedAssembly" then failwithf "a non-erased (i.e. generative) ProvidedTypeDefinition '%s.%s' was placed in an assembly '%s' that is not a ProvidedAssembly" namespaceName className (assembly.GetName().Name) ProvidedTypeDefinition(false, TypeContainer.Namespace (K assembly,namespaceName), className, K baseType, attrs, K None, [], None, None, K [| |], nonNullable, hideObjectMethods) - new (className:string, baseType, ?hideObjectMethods, ?nonNullable, ?isErased) = + new (className:string, baseType, ?hideObjectMethods, ?nonNullable, ?isErased) = let isErased = defaultArg isErased true let nonNullable = defaultArg nonNullable false let hideObjectMethods = defaultArg hideObjectMethods false @@ -1350,13 +1350,13 @@ namespace ProviderImplementation.ProvidedTypes override __.UnderlyingSystemType = typeof // Implement overloads - override __.Assembly = + override __.Assembly = match container with | TypeContainer.Namespace (theAssembly,_) -> theAssembly() | TypeContainer.Type t -> t.Assembly | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not yet added as a member to a declaring type, stacktrace = %s" className Environment.StackTrace - override __.FullName = + override __.FullName = match container with | TypeContainer.Type declaringType -> declaringType.FullName + "+" + className | TypeContainer.Namespace (_,namespaceName) -> @@ -1366,7 +1366,7 @@ namespace ProviderImplementation.ProvidedTypes | _ -> namespaceName + "." + className | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not added as a member to a declaring type" className - override __.Namespace = + override __.Namespace = match container with | TypeContainer.Namespace (_,nsp) -> nsp | TypeContainer.Type t -> t.Namespace @@ -1375,35 +1375,35 @@ namespace ProviderImplementation.ProvidedTypes override __.BaseType = match baseType.Value with Some ty -> ty | None -> null override __.GetConstructors bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? ConstructorInfo as c when memberBinds false bindingFlags c.IsStatic c.IsPublic -> Some c | _ -> None) override this.GetMethods bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? MethodInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetMethods(bindingFlags)))) override this.GetFields bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? FieldInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetFields(bindingFlags)))) override this.GetProperties bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? PropertyInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetProperties(bindingFlags)))) override this.GetEvents bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? EventInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetEvents(bindingFlags)))) override __.GetNestedTypes bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetNestedTypes(bindingFlags)))) - override this.GetConstructorImpl(bindingFlags, _binder, _callConventions, _types, _modifiers) = + override this.GetConstructorImpl(bindingFlags, _binder, _callConventions, _types, _modifiers) = let xs = this.GetConstructors bindingFlags |> Array.filter (fun m -> m.Name = ".ctor") if xs.Length > 1 then failwith "GetConstructorImpl. not support overloads" if xs.Length > 0 then xs.[0] else null @@ -1431,7 +1431,7 @@ namespace ProviderImplementation.ProvidedTypes override __.GetInterface(_name, _ignoreCase) = notRequired this "GetInterface" this.Name - override __.GetInterfaces() = getInterfaces() + override __.GetInterfaces() = getInterfaces() override __.MakeArrayType() = ProvidedTypeSymbol(ProvidedTypeSymbolKind.SDArray, [this]) :> Type @@ -1446,13 +1446,13 @@ namespace ProviderImplementation.ProvidedTypes // However, it's possible for the framework to generate other sets of flags in some corner cases (e.g. via use of `enum` with a provided type as the target) override __.GetMembers bindingFlags = [| for m in getMembers() do - match m with + match m with | :? ConstructorInfo as c when memberBinds false bindingFlags c.IsStatic c.IsPublic -> yield (c :> MemberInfo) | :? MethodInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? FieldInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? PropertyInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? EventInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) - | :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> yield (m :> _) + | :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> yield (m :> _) | _ -> () |] override this.GetMember(name,mt,_bindingFlags) = @@ -1460,15 +1460,15 @@ namespace ProviderImplementation.ProvidedTypes this.GetMembers() |> Array.filter (fun m -> 0 <> int(m.MemberType &&& mt) && m.Name = name) // Attributes, etc.. - override __.GetAttributeFlagsImpl() = adjustTypeAttributes this.IsNested attrs + override __.GetAttributeFlagsImpl() = adjustTypeAttributes this.IsNested attrs - override this.IsValueTypeImpl() = - match this.BaseType with - | null -> false - | bt -> bt.FullName = "System.Enum" || bt.FullName = "System.ValueType" || bt.IsValueType + override this.IsValueTypeImpl() = + match this.BaseType with + | null -> false + | bt -> bt.FullName = "System.Enum" || bt.FullName = "System.ValueType" || bt.IsValueType - override __.IsEnum = - match this.BaseType with + override __.IsEnum = + match this.BaseType with | null -> false | bt -> bt.FullName = "System.Enum" || bt.IsEnum @@ -1487,7 +1487,7 @@ namespace ProviderImplementation.ProvidedTypes override __.HasElementTypeImpl() = false override __.Name = className - override __.DeclaringType = + override __.DeclaringType = match container with | TypeContainer.Namespace _ -> null | TypeContainer.Type enclosingTyp -> (enclosingTyp :> Type) @@ -1528,8 +1528,8 @@ namespace ProviderImplementation.ProvidedTypes member __.BaseTypeRaw() = baseType.Force() member __.StaticParams = staticParams member __.StaticParamsApply = staticParamsApply - - // Fetch the members declared since the indicated position in the members list. This allows the target model to observe + + // Fetch the members declared since the indicated position in the members list. This allows the target model to observe // incremental additions made to the source model member __.GetMembersFromCursor(idx: int) = evalMembers(); members.GetRange(idx, members.Count - idx).ToArray(), members.Count @@ -1539,7 +1539,7 @@ namespace ProviderImplementation.ProvidedTypes // Fetch the method overrides declared since the indicated position in the list member __.GetMethodOverridesFromCursor(idx: int) = evalMethodOverrides(); methodOverrides.GetRange(idx, methodOverrides.Count - idx).ToArray(), methodOverrides.Count - // Fetch the method overrides + // Fetch the method overrides member __.GetMethodOverrides() = getMethodOverrides() member this.ErasedBaseType : Type = ProvidedTypeDefinition.EraseType(this.BaseType) @@ -1554,15 +1554,15 @@ namespace ProviderImplementation.ProvidedTypes member __.AddCustomAttribute attribute = customAttributesImpl.AddCustomAttribute attribute member __.SetEnumUnderlyingType(ty) = enumUnderlyingType <- lazy Some ty - member __.SetBaseType t = + member __.SetBaseType t = if baseType.IsValueCreated then failwithf "The base type has already been evaluated for this type. Please call SetBaseType before any operations which traverse the type hierarchy. stacktrace = %A" Environment.StackTrace baseType <- lazy Some t - member __.SetBaseTypeDelayed baseTypeFunction = + member __.SetBaseTypeDelayed baseTypeFunction = if baseType.IsValueCreated then failwithf "The base type has already been evaluated for this type. Please call SetBaseType before any operations which traverse the type hierarchy. stacktrace = %A" Environment.StackTrace baseType <- lazy (Some (baseTypeFunction())) member __.SetAttributes x = attrs <- x - member this.AddMembers(memberInfos:list<#MemberInfo>) = + member this.AddMembers(memberInfos:list<#MemberInfo>) = memberInfos |> List.iter this.PatchDeclaringTypeOfMember membersQueue.Add (fun () -> memberInfos |> List.toArray |> Array.map (fun x -> x :> MemberInfo )) @@ -1619,7 +1619,7 @@ namespace ProviderImplementation.ProvidedTypes staticParams <- parameters staticParamsApply <- Some instantiationFunction - /// Get ParameterInfo[] for the parametric type parameters + /// Get ParameterInfo[] for the parametric type parameters member __.GetStaticParametersInternal() = [| for p in staticParams -> p :> ParameterInfo |] /// Instantiate parametric type @@ -1651,8 +1651,8 @@ namespace ProviderImplementation.ProvidedTypes member __.AddInterfaceImplementationsDelayed interfacesFunction = interfacesQueue.Add (interfacesFunction >> Array.ofList) - member __.SetAssemblyInternal (assembly: unit -> Assembly) = - match container with + member __.SetAssemblyInternal (assembly: unit -> Assembly) = + match container with | TypeContainer.Namespace (_, ns) -> container <- TypeContainer.Namespace (assembly, ns) | TypeContainer.Type _ -> failwithf "can't set assembly of nested type '%s'" className | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not added as a member to a declaring type" className @@ -1684,10 +1684,10 @@ namespace ProviderImplementation.ProvidedTypes member this.PatchDeclaringTypeOfMember (m:MemberInfo) = match m with - | :? ProvidedConstructor as c -> c.PatchDeclaringType this - | :? ProvidedMethod as m -> m.PatchDeclaringType this - | :? ProvidedProperty as p -> p.PatchDeclaringType this - | :? ProvidedEvent as e -> e.PatchDeclaringType this + | :? ProvidedConstructor as c -> c.PatchDeclaringType this + | :? ProvidedMethod as m -> m.PatchDeclaringType this + | :? ProvidedProperty as p -> p.PatchDeclaringType this + | :? ProvidedEvent as e -> e.PatchDeclaringType this | :? ProvidedTypeDefinition as t -> t.PatchDeclaringType this | :? ProvidedField as l -> l.PatchDeclaringType this | _ -> () @@ -1724,13 +1724,13 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader // the public key. //--------------------------------------------------------------------- - // Little-endian encoding of int32 + // Little-endian encoding of int32 let b0 n = byte (n &&& 0xFF) let b1 n = byte ((n >>> 8) &&& 0xFF) let b2 n = byte ((n >>> 16) &&& 0xFF) let b3 n = byte ((n >>> 24) &&& 0xFF) - // Little-endian encoding of int64 + // Little-endian encoding of int64 let dw7 n = byte ((n >>> 56) &&& 0xFFL) let dw6 n = byte ((n >>> 48) &&& 0xFFL) let dw5 n = byte ((n >>> 40) &&& 0xFFL) @@ -1869,10 +1869,10 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader member x.ToAssemblyName() = let asmName = AssemblyName(Name=x.Name) - match x.PublicKey with + match x.PublicKey with | USome bytes -> asmName.SetPublicKeyToken(bytes.ToToken()) | UNone -> () - match x.Version with + match x.Version with | USome v -> asmName.Version <- v | UNone -> () #if NETSTANDARD @@ -2200,8 +2200,8 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader type ILCodeLabel = int // -------------------------------------------------------------------- - // Instruction set. - // -------------------------------------------------------------------- + // Instruction set. + // -------------------------------------------------------------------- type ILBasicType = | DT_R @@ -2220,52 +2220,52 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | DT_REF [] - type ILToken = - | ILType of ILType - | ILMethod of ILMethodSpec + type ILToken = + | ILType of ILType + | ILMethod of ILMethodSpec | ILField of ILFieldSpec [] - type ILConst = + type ILConst = | I4 of int32 | I8 of int64 | R4 of single | R8 of double - type ILTailcall = + type ILTailcall = | Tailcall | Normalcall - type ILAlignment = + type ILAlignment = | Aligned | Unaligned1 | Unaligned2 | Unaligned4 - type ILVolatility = + type ILVolatility = | Volatile | Nonvolatile - type ILReadonly = + type ILReadonly = | ReadonlyAddress | NormalAddress type ILVarArgs = ILTypes option [] - type ILComparisonInstr = - | I_beq - | I_bge - | I_bge_un - | I_bgt - | I_bgt_un - | I_ble - | I_ble_un - | I_blt - | I_blt_un - | I_bne_un - | I_brfalse - | I_brtrue + type ILComparisonInstr = + | I_beq + | I_bge + | I_bge_un + | I_bgt + | I_bgt_un + | I_ble + | I_ble_un + | I_blt + | I_blt_un + | I_bne_un + | I_brfalse + | I_brtrue #if DEBUG_INFO @@ -2290,42 +2290,42 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader #endif [] - type ILInstr = - | I_add + type ILInstr = + | I_add | I_add_ovf | I_add_ovf_un - | I_and - | I_div + | I_and + | I_div | I_div_un - | I_ceq - | I_cgt - | I_cgt_un - | I_clt - | I_clt_un + | I_ceq + | I_cgt + | I_cgt_un + | I_clt + | I_clt_un | I_conv of ILBasicType | I_conv_ovf of ILBasicType | I_conv_ovf_un of ILBasicType - | I_mul - | I_mul_ovf + | I_mul + | I_mul_ovf | I_mul_ovf_un - | I_rem - | I_rem_un - | I_shl - | I_shr + | I_rem + | I_rem_un + | I_shl + | I_shr | I_shr_un - | I_sub - | I_sub_ovf - | I_sub_ovf_un - | I_xor - | I_or - | I_neg - | I_not - | I_ldnull - | I_dup + | I_sub + | I_sub_ovf + | I_sub_ovf_un + | I_xor + | I_or + | I_neg + | I_not + | I_ldnull + | I_dup | I_pop - | I_ckfinite + | I_ckfinite | I_nop - | I_ldc of ILBasicType * ILConst + | I_ldc of ILBasicType * ILConst | I_ldarg of int | I_ldarga of int | I_ldind of ILAlignment * ILVolatility * ILBasicType @@ -2337,9 +2337,9 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_br of ILCodeLabel | I_jmp of ILMethodSpec - | I_brcmp of ILComparisonInstr * ILCodeLabel - | I_switch of ILCodeLabel list - | I_ret + | I_brcmp of ILComparisonInstr * ILCodeLabel + | I_switch of ILCodeLabel list + | I_ret | I_call of ILTailcall * ILMethodSpec * ILVarArgs | I_callvirt of ILTailcall * ILMethodSpec * ILVarArgs @@ -2347,7 +2347,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_calli of ILTailcall * ILCallingSignature * ILVarArgs | I_ldftn of ILMethodSpec | I_newobj of ILMethodSpec * ILVarArgs - + | I_throw | I_endfinally | I_endfilter @@ -2357,7 +2357,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_ldsfld of ILVolatility * ILFieldSpec | I_ldfld of ILAlignment * ILVolatility * ILFieldSpec | I_ldsflda of ILFieldSpec - | I_ldflda of ILFieldSpec + | I_ldflda of ILFieldSpec | I_stsfld of ILVolatility * ILFieldSpec | I_stfld of ILAlignment * ILVolatility * ILFieldSpec | I_ldstr of string @@ -2380,70 +2380,70 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_ldelema of ILReadonly * ILArrayShape * ILType | I_ldelem_any of ILArrayShape * ILType | I_stelem_any of ILArrayShape * ILType - | I_newarr of ILArrayShape * ILType + | I_newarr of ILArrayShape * ILType | I_ldlen | I_mkrefany of ILType - | I_refanytype + | I_refanytype | I_refanyval of ILType - | I_break + | I_break #if EMIT_DEBUG_INFO | I_seqpoint of ILSourceMarker #endif - | I_arglist + | I_arglist | I_localloc | I_cpblk of ILAlignment * ILVolatility | I_initblk of ILAlignment * ILVolatility - (* FOR EXTENSIONS, e.g. MS-ILX *) + (* FOR EXTENSIONS, e.g. MS-ILX *) | EI_ilzero of ILType | EI_ldlen_multi of int32 * int32 [] - type ILExceptionClause = + type ILExceptionClause = | Finally of (ILCodeLabel * ILCodeLabel) | Fault of (ILCodeLabel * ILCodeLabel) | FilterCatch of (ILCodeLabel * ILCodeLabel) * (ILCodeLabel * ILCodeLabel) | TypeCatch of ILType * (ILCodeLabel * ILCodeLabel) [] - type ILExceptionSpec = + type ILExceptionSpec = { Range: (ILCodeLabel * ILCodeLabel); Clause: ILExceptionClause } - /// Indicates that a particular local variable has a particular source - /// language name within a given set of ranges. This does not effect local - /// variable numbering, which is global over the whole method. + /// Indicates that a particular local variable has a particular source + /// language name within a given set of ranges. This does not effect local + /// variable numbering, which is global over the whole method. [] type ILLocalDebugMapping = { LocalIndex: int; LocalName: string; } [] - type ILLocalDebugInfo = + type ILLocalDebugInfo = { Range: (ILCodeLabel * ILCodeLabel); DebugMappings: ILLocalDebugMapping[] } [] - type ILCode = - { Labels: Dictionary - Instrs:ILInstr[] + type ILCode = + { Labels: Dictionary + Instrs:ILInstr[] Exceptions: ILExceptionSpec[] Locals: ILLocalDebugInfo[] } [] - type ILLocal = + type ILLocal = { Type: ILType; IsPinned: bool; DebugInfo: (string * int * int) option } - + type ILLocals = ILLocal[] [] - type ILMethodBody = + type ILMethodBody = { IsZeroInit: bool MaxStack: int32 Locals: ILLocals @@ -2460,9 +2460,9 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader type ILCustomAttrNamedArg = ILCustomAttrNamedArg of (string * ILType * obj) - type ILCustomAttribute = + type ILCustomAttribute = { Method: ILMethodSpec - Data: byte[] + Data: byte[] Elements: obj list} type ILCustomAttrs = @@ -2527,7 +2527,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader { Name: string Constraints: ILTypes Attributes: GenericParameterAttributes - CustomAttrs: ILCustomAttrs + CustomAttrs: ILCustomAttrs Token: int } member x.HasReferenceTypeConstraint= (x.Attributes &&& GenericParameterAttributes.ReferenceTypeConstraint) <> enum 0 @@ -2556,7 +2556,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader CustomAttrs: ILCustomAttrs } member x.ParameterTypes = x.Parameters |> Array.map (fun p -> p.ParameterType) static member ComputeIsStatic attrs = attrs &&& MethodAttributes.Static <> enum 0 - member x.IsStatic = ILMethodDef.ComputeIsStatic x.Attributes + member x.IsStatic = ILMethodDef.ComputeIsStatic x.Attributes member x.IsAbstract = x.Attributes &&& MethodAttributes.Abstract <> enum 0 member x.IsVirtual = x.Attributes &&& MethodAttributes.Virtual <> enum 0 member x.IsCheckAccessOnOverride = x.Attributes &&& MethodAttributes.CheckAccessOnOverride <> enum 0 @@ -2596,9 +2596,9 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader member __.Entries = larr.Force() member __.FindByName nm = getmap().[nm] member x.FindByNameAndArity (nm,arity) = x.FindByName nm |> Array.filter (fun x -> x.Parameters.Length = arity) - member x.TryFindUniqueByName name = + member x.TryFindUniqueByName name = match x.FindByName(name) with - | [| md |] -> Some md + | [| md |] -> Some md | [| |] -> None | _ -> failwithf "multiple methods exist with name %s" name @@ -2635,7 +2635,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader CustomAttrs: ILCustomAttrs Token: int } member x.IsStatic = (match x.CallingConv with ILThisConvention.Static -> true | _ -> false) - member x.IndexParameters = + member x.IndexParameters = x.IndexParameterTypes |> Array.mapi (fun i ty -> { Name = USome("arg"+string i) ParameterType = ty @@ -2706,13 +2706,13 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader and ILTypeDefLayoutInfo = { Size: int32 option - Pack: uint16 option } + Pack: uint16 option } type ILTypeDefAccess = | Public | Private | Nested of ILMemberAccess - static member OfFlags flags = + static member OfFlags flags = let f = (flags &&& 0x00000007) if f = 0x00000001 then ILTypeDefAccess.Public elif f = 0x00000002 then ILTypeDefAccess.Nested ILMemberAccess.Public @@ -2748,7 +2748,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader Properties: ILPropertyDefs CustomAttrs: ILCustomAttrs Token: int } - static member ComputeKind flags (super: ILType option) (nsp: string uoption) (nm: string) = + static member ComputeKind flags (super: ILType option) (nsp: string uoption) (nm: string) = if (flags &&& 0x00000020) <> 0x0 then ILTypeDefKind.Interface else let isEnum = (match super with None -> false | Some ty -> ty.TypeSpec.Namespace = USome "System" && ty.TypeSpec.Name = "Enum") let isDelegate = (match super with None -> false | Some ty -> ty.TypeSpec.Namespace = USome "System" && ty.TypeSpec.Name = "Delegate") @@ -2773,7 +2773,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader member x.Access = ILTypeDefAccess.OfFlags (int x.Attributes) member x.IsNested = - match x.Access with + match x.Access with | ILTypeDefAccess.Nested _ -> true | _ -> false @@ -2782,13 +2782,13 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | ILTypeDefKind.ValueType | ILTypeDefKind.Enum -> true | _ -> false - member x.Encoding = + member x.Encoding = let f = (int x.Attributes &&& 0x00030000) if f = 0x00020000 then ILDefaultPInvokeEncoding.Auto elif f = 0x00010000 then ILDefaultPInvokeEncoding.Unicode else ILDefaultPInvokeEncoding.Ansi - member x.InitSemantics = + member x.InitSemantics = if x.Kind = ILTypeDefKind.Interface then ILTypeInit.OnAny elif (int x.Attributes &&& 0x00100000) <> 0x0 then ILTypeInit.BeforeField else ILTypeInit.OnAny @@ -2834,10 +2834,10 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader { ScopeRef: ILScopeRef Namespace: string uoption Name: string - IsForwarder: bool - Access: ILTypeDefAccess; + IsForwarder: bool + Access: ILTypeDefAccess; Nested: ILNestedExportedTypesAndForwarders; - CustomAttrs: ILCustomAttrs } + CustomAttrs: ILCustomAttrs } override x.ToString() = "fwd " + x.Name and ILExportedTypesAndForwarders(larr:Lazy) = @@ -2890,10 +2890,10 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader member x.GetName() = let asmName = AssemblyName(Name=x.Name) - match x.PublicKey with + match x.PublicKey with | USome bytes -> asmName.SetPublicKey(bytes) | UNone -> () - match x.Version with + match x.Version with | USome v -> asmName.Version <- v | UNone -> () #if NETSTANDARD @@ -2916,7 +2916,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader SubSystemFlags: int32 IsDLL: bool IsILOnly: bool - Platform: ILPlatform option + Platform: ILPlatform option StackReserveSize: int32 option Is32Bit: bool Is32BitPreferred: bool @@ -3016,14 +3016,14 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let GenericParamConstraint = ILTableName 44 let UserStrings = ILTableName 0x70 (* Special encoding of embedded UserString tokens - See 1.9 Partition III *) - /// Which tables are sorted and by which column. + /// Which tables are sorted and by which column. // - // Sorted bit-vector as stored by CLR V1: 00fa 0133 0002 0000 - // But what does this mean? The ECMA spec does not say! - // Metainfo -schema reports sorting as shown below. - // But some sorting, e.g. EventMap does not seem to show - let sortedTableInfo = - [ (InterfaceImpl,0) + // Sorted bit-vector as stored by CLR V1: 00fa 0133 0002 0000 + // But what does this mean? The ECMA spec does not say! + // Metainfo -schema reports sorting as shown below. + // But some sorting, e.g. EventMap does not seem to show + let sortedTableInfo = + [ (InterfaceImpl,0) (Constant, 1) (CustomAttribute, 0) (FieldMarshal, 0) @@ -3035,7 +3035,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader (ImplMap, 1) (FieldRVA, 1) (Nested, 0) - (GenericParam, 2) + (GenericParam, 2) (GenericParamConstraint, 0) ] [] @@ -3196,7 +3196,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader type VarArgMethodData = VarArgMethodData of ILType * ILCallingConv * string * ILTypes * ILVarArgs * ILType * ILTypes [] - module Constants = + module Constants = let et_END = 0x00uy let et_VOID = 0x01uy let et_BOOLEAN = 0x02uy @@ -3289,221 +3289,221 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let idx = tok >>>& nbits TaggedIndex(f tag, idx) - let i_nop = 0x00 - let i_break = 0x01 - let i_ldarg_0 = 0x02 - let i_ldarg_1 = 0x03 - let i_ldarg_2 = 0x04 - let i_ldarg_3 = 0x05 - let i_ldloc_0 = 0x06 - let i_ldloc_1 = 0x07 - let i_ldloc_2 = 0x08 - let i_ldloc_3 = 0x09 - let i_stloc_0 = 0x0a - let i_stloc_1 = 0x0b - let i_stloc_2 = 0x0c - let i_stloc_3 = 0x0d - let i_ldarg_s = 0x0e - let i_ldarga_s = 0x0f - let i_starg_s = 0x10 - let i_ldloc_s = 0x11 - let i_ldloca_s = 0x12 - let i_stloc_s = 0x13 - let i_ldnull = 0x14 - let i_ldc_i4_m1 = 0x15 - let i_ldc_i4_0 = 0x16 - let i_ldc_i4_1 = 0x17 - let i_ldc_i4_2 = 0x18 - let i_ldc_i4_3 = 0x19 - let i_ldc_i4_4 = 0x1a - let i_ldc_i4_5 = 0x1b - let i_ldc_i4_6 = 0x1c - let i_ldc_i4_7 = 0x1d - let i_ldc_i4_8 = 0x1e - let i_ldc_i4_s = 0x1f - let i_ldc_i4 = 0x20 - let i_ldc_i8 = 0x21 - let i_ldc_r4 = 0x22 - let i_ldc_r8 = 0x23 - let i_dup = 0x25 - let i_pop = 0x26 - let i_jmp = 0x27 - let i_call = 0x28 - let i_calli = 0x29 - let i_ret = 0x2a - let i_br_s = 0x2b - let i_brfalse_s = 0x2c - let i_brtrue_s = 0x2d - let i_beq_s = 0x2e - let i_bge_s = 0x2f - let i_bgt_s = 0x30 - let i_ble_s = 0x31 - let i_blt_s = 0x32 - let i_bne_un_s = 0x33 - let i_bge_un_s = 0x34 - let i_bgt_un_s = 0x35 - let i_ble_un_s = 0x36 - let i_blt_un_s = 0x37 - let i_br = 0x38 - let i_brfalse = 0x39 - let i_brtrue = 0x3a - let i_beq = 0x3b - let i_bge = 0x3c - let i_bgt = 0x3d - let i_ble = 0x3e - let i_blt = 0x3f - let i_bne_un = 0x40 - let i_bge_un = 0x41 - let i_bgt_un = 0x42 - let i_ble_un = 0x43 - let i_blt_un = 0x44 - let i_switch = 0x45 - let i_ldind_i1 = 0x46 - let i_ldind_u1 = 0x47 - let i_ldind_i2 = 0x48 - let i_ldind_u2 = 0x49 - let i_ldind_i4 = 0x4a - let i_ldind_u4 = 0x4b - let i_ldind_i8 = 0x4c - let i_ldind_i = 0x4d - let i_ldind_r4 = 0x4e - let i_ldind_r8 = 0x4f - let i_ldind_ref = 0x50 - let i_stind_ref = 0x51 - let i_stind_i1 = 0x52 - let i_stind_i2 = 0x53 - let i_stind_i4 = 0x54 - let i_stind_i8 = 0x55 - let i_stind_r4 = 0x56 - let i_stind_r8 = 0x57 - let i_add = 0x58 - let i_sub = 0x59 - let i_mul = 0x5a - let i_div = 0x5b - let i_div_un = 0x5c - let i_rem = 0x5d - let i_rem_un = 0x5e - let i_and = 0x5f - let i_or = 0x60 - let i_xor = 0x61 - let i_shl = 0x62 - let i_shr = 0x63 - let i_shr_un = 0x64 - let i_neg = 0x65 - let i_not = 0x66 - let i_conv_i1 = 0x67 - let i_conv_i2 = 0x68 - let i_conv_i4 = 0x69 - let i_conv_i8 = 0x6a - let i_conv_r4 = 0x6b - let i_conv_r8 = 0x6c - let i_conv_u4 = 0x6d - let i_conv_u8 = 0x6e - let i_callvirt = 0x6f - let i_cpobj = 0x70 - let i_ldobj = 0x71 - let i_ldstr = 0x72 - let i_newobj = 0x73 - let i_castclass = 0x74 - let i_isinst = 0x75 - let i_conv_r_un = 0x76 - let i_unbox = 0x79 - let i_throw = 0x7a - let i_ldfld = 0x7b - let i_ldflda = 0x7c - let i_stfld = 0x7d - let i_ldsfld = 0x7e - let i_ldsflda = 0x7f - let i_stsfld = 0x80 - let i_stobj = 0x81 - let i_conv_ovf_i1_un= 0x82 - let i_conv_ovf_i2_un= 0x83 - let i_conv_ovf_i4_un= 0x84 - let i_conv_ovf_i8_un= 0x85 - let i_conv_ovf_u1_un= 0x86 - let i_conv_ovf_u2_un= 0x87 - let i_conv_ovf_u4_un= 0x88 - let i_conv_ovf_u8_un= 0x89 - let i_conv_ovf_i_un = 0x8a - let i_conv_ovf_u_un = 0x8b - let i_box = 0x8c - let i_newarr = 0x8d - let i_ldlen = 0x8e - let i_ldelema = 0x8f - let i_ldelem_i1 = 0x90 - let i_ldelem_u1 = 0x91 - let i_ldelem_i2 = 0x92 - let i_ldelem_u2 = 0x93 - let i_ldelem_i4 = 0x94 - let i_ldelem_u4 = 0x95 - let i_ldelem_i8 = 0x96 - let i_ldelem_i = 0x97 - let i_ldelem_r4 = 0x98 - let i_ldelem_r8 = 0x99 - let i_ldelem_ref = 0x9a - let i_stelem_i = 0x9b - let i_stelem_i1 = 0x9c - let i_stelem_i2 = 0x9d - let i_stelem_i4 = 0x9e - let i_stelem_i8 = 0x9f - let i_stelem_r4 = 0xa0 - let i_stelem_r8 = 0xa1 - let i_stelem_ref = 0xa2 - let i_conv_ovf_i1 = 0xb3 - let i_conv_ovf_u1 = 0xb4 - let i_conv_ovf_i2 = 0xb5 - let i_conv_ovf_u2 = 0xb6 - let i_conv_ovf_i4 = 0xb7 - let i_conv_ovf_u4 = 0xb8 - let i_conv_ovf_i8 = 0xb9 - let i_conv_ovf_u8 = 0xba - let i_refanyval = 0xc2 - let i_ckfinite = 0xc3 - let i_mkrefany = 0xc6 - let i_ldtoken = 0xd0 - let i_conv_u2 = 0xd1 - let i_conv_u1 = 0xd2 - let i_conv_i = 0xd3 - let i_conv_ovf_i = 0xd4 - let i_conv_ovf_u = 0xd5 - let i_add_ovf = 0xd6 - let i_add_ovf_un = 0xd7 - let i_mul_ovf = 0xd8 - let i_mul_ovf_un = 0xd9 - let i_sub_ovf = 0xda - let i_sub_ovf_un = 0xdb - let i_endfinally = 0xdc - let i_leave = 0xdd - let i_leave_s = 0xde - let i_stind_i = 0xdf - let i_conv_u = 0xe0 + let i_nop = 0x00 + let i_break = 0x01 + let i_ldarg_0 = 0x02 + let i_ldarg_1 = 0x03 + let i_ldarg_2 = 0x04 + let i_ldarg_3 = 0x05 + let i_ldloc_0 = 0x06 + let i_ldloc_1 = 0x07 + let i_ldloc_2 = 0x08 + let i_ldloc_3 = 0x09 + let i_stloc_0 = 0x0a + let i_stloc_1 = 0x0b + let i_stloc_2 = 0x0c + let i_stloc_3 = 0x0d + let i_ldarg_s = 0x0e + let i_ldarga_s = 0x0f + let i_starg_s = 0x10 + let i_ldloc_s = 0x11 + let i_ldloca_s = 0x12 + let i_stloc_s = 0x13 + let i_ldnull = 0x14 + let i_ldc_i4_m1 = 0x15 + let i_ldc_i4_0 = 0x16 + let i_ldc_i4_1 = 0x17 + let i_ldc_i4_2 = 0x18 + let i_ldc_i4_3 = 0x19 + let i_ldc_i4_4 = 0x1a + let i_ldc_i4_5 = 0x1b + let i_ldc_i4_6 = 0x1c + let i_ldc_i4_7 = 0x1d + let i_ldc_i4_8 = 0x1e + let i_ldc_i4_s = 0x1f + let i_ldc_i4 = 0x20 + let i_ldc_i8 = 0x21 + let i_ldc_r4 = 0x22 + let i_ldc_r8 = 0x23 + let i_dup = 0x25 + let i_pop = 0x26 + let i_jmp = 0x27 + let i_call = 0x28 + let i_calli = 0x29 + let i_ret = 0x2a + let i_br_s = 0x2b + let i_brfalse_s = 0x2c + let i_brtrue_s = 0x2d + let i_beq_s = 0x2e + let i_bge_s = 0x2f + let i_bgt_s = 0x30 + let i_ble_s = 0x31 + let i_blt_s = 0x32 + let i_bne_un_s = 0x33 + let i_bge_un_s = 0x34 + let i_bgt_un_s = 0x35 + let i_ble_un_s = 0x36 + let i_blt_un_s = 0x37 + let i_br = 0x38 + let i_brfalse = 0x39 + let i_brtrue = 0x3a + let i_beq = 0x3b + let i_bge = 0x3c + let i_bgt = 0x3d + let i_ble = 0x3e + let i_blt = 0x3f + let i_bne_un = 0x40 + let i_bge_un = 0x41 + let i_bgt_un = 0x42 + let i_ble_un = 0x43 + let i_blt_un = 0x44 + let i_switch = 0x45 + let i_ldind_i1 = 0x46 + let i_ldind_u1 = 0x47 + let i_ldind_i2 = 0x48 + let i_ldind_u2 = 0x49 + let i_ldind_i4 = 0x4a + let i_ldind_u4 = 0x4b + let i_ldind_i8 = 0x4c + let i_ldind_i = 0x4d + let i_ldind_r4 = 0x4e + let i_ldind_r8 = 0x4f + let i_ldind_ref = 0x50 + let i_stind_ref = 0x51 + let i_stind_i1 = 0x52 + let i_stind_i2 = 0x53 + let i_stind_i4 = 0x54 + let i_stind_i8 = 0x55 + let i_stind_r4 = 0x56 + let i_stind_r8 = 0x57 + let i_add = 0x58 + let i_sub = 0x59 + let i_mul = 0x5a + let i_div = 0x5b + let i_div_un = 0x5c + let i_rem = 0x5d + let i_rem_un = 0x5e + let i_and = 0x5f + let i_or = 0x60 + let i_xor = 0x61 + let i_shl = 0x62 + let i_shr = 0x63 + let i_shr_un = 0x64 + let i_neg = 0x65 + let i_not = 0x66 + let i_conv_i1 = 0x67 + let i_conv_i2 = 0x68 + let i_conv_i4 = 0x69 + let i_conv_i8 = 0x6a + let i_conv_r4 = 0x6b + let i_conv_r8 = 0x6c + let i_conv_u4 = 0x6d + let i_conv_u8 = 0x6e + let i_callvirt = 0x6f + let i_cpobj = 0x70 + let i_ldobj = 0x71 + let i_ldstr = 0x72 + let i_newobj = 0x73 + let i_castclass = 0x74 + let i_isinst = 0x75 + let i_conv_r_un = 0x76 + let i_unbox = 0x79 + let i_throw = 0x7a + let i_ldfld = 0x7b + let i_ldflda = 0x7c + let i_stfld = 0x7d + let i_ldsfld = 0x7e + let i_ldsflda = 0x7f + let i_stsfld = 0x80 + let i_stobj = 0x81 + let i_conv_ovf_i1_un= 0x82 + let i_conv_ovf_i2_un= 0x83 + let i_conv_ovf_i4_un= 0x84 + let i_conv_ovf_i8_un= 0x85 + let i_conv_ovf_u1_un= 0x86 + let i_conv_ovf_u2_un= 0x87 + let i_conv_ovf_u4_un= 0x88 + let i_conv_ovf_u8_un= 0x89 + let i_conv_ovf_i_un = 0x8a + let i_conv_ovf_u_un = 0x8b + let i_box = 0x8c + let i_newarr = 0x8d + let i_ldlen = 0x8e + let i_ldelema = 0x8f + let i_ldelem_i1 = 0x90 + let i_ldelem_u1 = 0x91 + let i_ldelem_i2 = 0x92 + let i_ldelem_u2 = 0x93 + let i_ldelem_i4 = 0x94 + let i_ldelem_u4 = 0x95 + let i_ldelem_i8 = 0x96 + let i_ldelem_i = 0x97 + let i_ldelem_r4 = 0x98 + let i_ldelem_r8 = 0x99 + let i_ldelem_ref = 0x9a + let i_stelem_i = 0x9b + let i_stelem_i1 = 0x9c + let i_stelem_i2 = 0x9d + let i_stelem_i4 = 0x9e + let i_stelem_i8 = 0x9f + let i_stelem_r4 = 0xa0 + let i_stelem_r8 = 0xa1 + let i_stelem_ref = 0xa2 + let i_conv_ovf_i1 = 0xb3 + let i_conv_ovf_u1 = 0xb4 + let i_conv_ovf_i2 = 0xb5 + let i_conv_ovf_u2 = 0xb6 + let i_conv_ovf_i4 = 0xb7 + let i_conv_ovf_u4 = 0xb8 + let i_conv_ovf_i8 = 0xb9 + let i_conv_ovf_u8 = 0xba + let i_refanyval = 0xc2 + let i_ckfinite = 0xc3 + let i_mkrefany = 0xc6 + let i_ldtoken = 0xd0 + let i_conv_u2 = 0xd1 + let i_conv_u1 = 0xd2 + let i_conv_i = 0xd3 + let i_conv_ovf_i = 0xd4 + let i_conv_ovf_u = 0xd5 + let i_add_ovf = 0xd6 + let i_add_ovf_un = 0xd7 + let i_mul_ovf = 0xd8 + let i_mul_ovf_un = 0xd9 + let i_sub_ovf = 0xda + let i_sub_ovf_un = 0xdb + let i_endfinally = 0xdc + let i_leave = 0xdd + let i_leave_s = 0xde + let i_stind_i = 0xdf + let i_conv_u = 0xe0 let i_arglist = 0xfe00 let i_ceq = 0xfe01 let i_cgt = 0xfe02 let i_cgt_un = 0xfe03 let i_clt = 0xfe04 let i_clt_un = 0xfe05 - let i_ldftn = 0xfe06 - let i_ldvirtftn = 0xfe07 - let i_ldarg = 0xfe09 - let i_ldarga = 0xfe0a - let i_starg = 0xfe0b - let i_ldloc = 0xfe0c - let i_ldloca = 0xfe0d - let i_stloc = 0xfe0e - let i_localloc = 0xfe0f - let i_endfilter = 0xfe11 - let i_unaligned = 0xfe12 - let i_volatile = 0xfe13 + let i_ldftn = 0xfe06 + let i_ldvirtftn = 0xfe07 + let i_ldarg = 0xfe09 + let i_ldarga = 0xfe0a + let i_starg = 0xfe0b + let i_ldloc = 0xfe0c + let i_ldloca = 0xfe0d + let i_stloc = 0xfe0e + let i_localloc = 0xfe0f + let i_endfilter = 0xfe11 + let i_unaligned = 0xfe12 + let i_volatile = 0xfe13 let i_constrained = 0xfe16 let i_readonly = 0xfe1e - let i_tail = 0xfe14 - let i_initobj = 0xfe15 - let i_cpblk = 0xfe17 - let i_initblk = 0xfe18 - let i_rethrow = 0xfe1a - let i_sizeof = 0xfe1c - let i_refanytype = 0xfe1d + let i_tail = 0xfe14 + let i_initobj = 0xfe15 + let i_cpblk = 0xfe17 + let i_initblk = 0xfe18 + let i_rethrow = 0xfe1a + let i_sizeof = 0xfe1c + let i_refanytype = 0xfe1d let i_ldelem_any = 0xa3 let i_stelem_any = 0xa4 @@ -3516,7 +3516,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader Array.init n (fun i -> ILType.Var (numtypars + i)) - let noArgInstrs = + let noArgInstrs = lazy [ i_ldc_i4_0, mk_ldc 0 i_ldc_i4_1, mk_ldc 1 i_ldc_i4_2, mk_ldc 2 @@ -3552,63 +3552,63 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader 0xfe04, I_clt 0xfe05, I_clt_un 0x67, I_conv DT_I1 - 0x68, I_conv DT_I2 + 0x68, I_conv DT_I2 0x69, I_conv DT_I4 - 0x6a, I_conv DT_I8 - 0xd3, I_conv DT_I - 0x6b, I_conv DT_R4 - 0x6c, I_conv DT_R8 - 0xd2, I_conv DT_U1 - 0xd1, I_conv DT_U2 - 0x6d, I_conv DT_U4 - 0x6e, I_conv DT_U8 - 0xe0, I_conv DT_U - 0x76, I_conv DT_R - 0xb3, I_conv_ovf DT_I1 - 0xb5, I_conv_ovf DT_I2 - 0xb7, I_conv_ovf DT_I4 - 0xb9, I_conv_ovf DT_I8 - 0xd4, I_conv_ovf DT_I - 0xb4, I_conv_ovf DT_U1 - 0xb6, I_conv_ovf DT_U2 - 0xb8, I_conv_ovf DT_U4 - 0xba, I_conv_ovf DT_U8 - 0xd5, I_conv_ovf DT_U - 0x82, I_conv_ovf_un DT_I1 - 0x83, I_conv_ovf_un DT_I2 - 0x84, I_conv_ovf_un DT_I4 - 0x85, I_conv_ovf_un DT_I8 - 0x8a, I_conv_ovf_un DT_I - 0x86, I_conv_ovf_un DT_U1 - 0x87, I_conv_ovf_un DT_U2 - 0x88, I_conv_ovf_un DT_U4 - 0x89, I_conv_ovf_un DT_U8 - 0x8b, I_conv_ovf_un DT_U - 0x9c, I_stelem DT_I1 + 0x6a, I_conv DT_I8 + 0xd3, I_conv DT_I + 0x6b, I_conv DT_R4 + 0x6c, I_conv DT_R8 + 0xd2, I_conv DT_U1 + 0xd1, I_conv DT_U2 + 0x6d, I_conv DT_U4 + 0x6e, I_conv DT_U8 + 0xe0, I_conv DT_U + 0x76, I_conv DT_R + 0xb3, I_conv_ovf DT_I1 + 0xb5, I_conv_ovf DT_I2 + 0xb7, I_conv_ovf DT_I4 + 0xb9, I_conv_ovf DT_I8 + 0xd4, I_conv_ovf DT_I + 0xb4, I_conv_ovf DT_U1 + 0xb6, I_conv_ovf DT_U2 + 0xb8, I_conv_ovf DT_U4 + 0xba, I_conv_ovf DT_U8 + 0xd5, I_conv_ovf DT_U + 0x82, I_conv_ovf_un DT_I1 + 0x83, I_conv_ovf_un DT_I2 + 0x84, I_conv_ovf_un DT_I4 + 0x85, I_conv_ovf_un DT_I8 + 0x8a, I_conv_ovf_un DT_I + 0x86, I_conv_ovf_un DT_U1 + 0x87, I_conv_ovf_un DT_U2 + 0x88, I_conv_ovf_un DT_U4 + 0x89, I_conv_ovf_un DT_U8 + 0x8b, I_conv_ovf_un DT_U + 0x9c, I_stelem DT_I1 0x9d, I_stelem DT_I2 - 0x9e, I_stelem DT_I4 - 0x9f, I_stelem DT_I8 - 0xa0, I_stelem DT_R4 - 0xa1, I_stelem DT_R8 - 0x9b, I_stelem DT_I - 0xa2, I_stelem DT_REF + 0x9e, I_stelem DT_I4 + 0x9f, I_stelem DT_I8 + 0xa0, I_stelem DT_R4 + 0xa1, I_stelem DT_R8 + 0x9b, I_stelem DT_I + 0xa2, I_stelem DT_REF 0x90, I_ldelem DT_I1 - 0x92, I_ldelem DT_I2 - 0x94, I_ldelem DT_I4 - 0x96, I_ldelem DT_I8 - 0x91, I_ldelem DT_U1 - 0x93, I_ldelem DT_U2 - 0x95, I_ldelem DT_U4 - 0x98, I_ldelem DT_R4 - 0x99, I_ldelem DT_R8 - 0x97, I_ldelem DT_I - 0x9a, I_ldelem DT_REF + 0x92, I_ldelem DT_I2 + 0x94, I_ldelem DT_I4 + 0x96, I_ldelem DT_I8 + 0x91, I_ldelem DT_U1 + 0x93, I_ldelem DT_U2 + 0x95, I_ldelem DT_U4 + 0x98, I_ldelem DT_R4 + 0x99, I_ldelem DT_R8 + 0x97, I_ldelem DT_I + 0x9a, I_ldelem DT_REF 0x5a, I_mul 0xd8, I_mul_ovf 0xd9, I_mul_ovf_un 0x5d, I_rem 0x5e, I_rem_un - 0x62, I_shl + 0x62, I_shl 0x63, I_shr 0x64, I_shr_un 0x59, I_sub @@ -3633,91 +3633,91 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader i_ldlen, I_ldlen i_rethrow, I_rethrow ] - let isNoArgInstr i = - match i with + let isNoArgInstr i = + match i with | I_ldc (DT_I4, ILConst.I4 n) when -1 <= n && n <= 8 -> true | I_stloc n | I_ldloc n | I_ldarg n when n <= 3 -> true | I_ret | I_add | I_add_ovf | I_add_ovf_un - | I_and - | I_div + | I_and + | I_div | I_div_un - | I_ceq - | I_cgt + | I_ceq + | I_cgt | I_cgt_un | I_clt | I_clt_un - | I_conv DT_I1 - | I_conv DT_I2 - | I_conv DT_I4 - | I_conv DT_I8 - | I_conv DT_I - | I_conv DT_R4 - | I_conv DT_R8 - | I_conv DT_U1 - | I_conv DT_U2 - | I_conv DT_U4 - | I_conv DT_U8 - | I_conv DT_U - | I_conv DT_R - | I_conv_ovf DT_I1 - | I_conv_ovf DT_I2 - | I_conv_ovf DT_I4 - | I_conv_ovf DT_I8 - | I_conv_ovf DT_I - | I_conv_ovf DT_U1 - | I_conv_ovf DT_U2 - | I_conv_ovf DT_U4 - | I_conv_ovf DT_U8 - | I_conv_ovf DT_U - | I_conv_ovf_un DT_I1 - | I_conv_ovf_un DT_I2 - | I_conv_ovf_un DT_I4 - | I_conv_ovf_un DT_I8 - | I_conv_ovf_un DT_I - | I_conv_ovf_un DT_U1 - | I_conv_ovf_un DT_U2 - | I_conv_ovf_un DT_U4 - | I_conv_ovf_un DT_U8 - | I_conv_ovf_un DT_U - | I_stelem DT_I1 - | I_stelem DT_I2 - | I_stelem DT_I4 - | I_stelem DT_I8 - | I_stelem DT_R4 - | I_stelem DT_R8 - | I_stelem DT_I - | I_stelem DT_REF - | I_ldelem DT_I1 - | I_ldelem DT_I2 - | I_ldelem DT_I4 - | I_ldelem DT_I8 - | I_ldelem DT_U1 - | I_ldelem DT_U2 - | I_ldelem DT_U4 - | I_ldelem DT_R4 - | I_ldelem DT_R8 - | I_ldelem DT_I - | I_ldelem DT_REF - | I_mul + | I_conv DT_I1 + | I_conv DT_I2 + | I_conv DT_I4 + | I_conv DT_I8 + | I_conv DT_I + | I_conv DT_R4 + | I_conv DT_R8 + | I_conv DT_U1 + | I_conv DT_U2 + | I_conv DT_U4 + | I_conv DT_U8 + | I_conv DT_U + | I_conv DT_R + | I_conv_ovf DT_I1 + | I_conv_ovf DT_I2 + | I_conv_ovf DT_I4 + | I_conv_ovf DT_I8 + | I_conv_ovf DT_I + | I_conv_ovf DT_U1 + | I_conv_ovf DT_U2 + | I_conv_ovf DT_U4 + | I_conv_ovf DT_U8 + | I_conv_ovf DT_U + | I_conv_ovf_un DT_I1 + | I_conv_ovf_un DT_I2 + | I_conv_ovf_un DT_I4 + | I_conv_ovf_un DT_I8 + | I_conv_ovf_un DT_I + | I_conv_ovf_un DT_U1 + | I_conv_ovf_un DT_U2 + | I_conv_ovf_un DT_U4 + | I_conv_ovf_un DT_U8 + | I_conv_ovf_un DT_U + | I_stelem DT_I1 + | I_stelem DT_I2 + | I_stelem DT_I4 + | I_stelem DT_I8 + | I_stelem DT_R4 + | I_stelem DT_R8 + | I_stelem DT_I + | I_stelem DT_REF + | I_ldelem DT_I1 + | I_ldelem DT_I2 + | I_ldelem DT_I4 + | I_ldelem DT_I8 + | I_ldelem DT_U1 + | I_ldelem DT_U2 + | I_ldelem DT_U4 + | I_ldelem DT_R4 + | I_ldelem DT_R8 + | I_ldelem DT_I + | I_ldelem DT_REF + | I_mul | I_mul_ovf | I_mul_ovf_un - | I_rem - | I_rem_un - | I_shl - | I_shr + | I_rem + | I_rem_un + | I_shl + | I_shr | I_shr_un - | I_sub + | I_sub | I_sub_ovf - | I_sub_ovf_un - | I_xor - | I_or - | I_neg - | I_not - | I_ldnull - | I_dup + | I_sub_ovf_un + | I_xor + | I_or + | I_neg + | I_not + | I_ldnull + | I_dup | I_pop | I_ckfinite | I_nop @@ -3732,7 +3732,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_rethrow -> true | _ -> false - let ILCmpInstrMap = + let ILCmpInstrMap = lazy ( let dict = Dictionary 12 dict.Add (I_beq , i_beq ) @@ -3750,7 +3750,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader dict ) - let ILCmpInstrRevMap = + let ILCmpInstrRevMap = lazy ( let dict = Dictionary 12 dict.Add ( I_beq , i_beq_s ) @@ -3768,7 +3768,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader dict ) - // From corhdr.h + // From corhdr.h let nt_VOID = 0x1uy let nt_BOOLEAN = 0x2uy @@ -3862,7 +3862,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let vt_ARRAY = 0x2000 let vt_BYREF = 0x4000 - + let e_CorILMethod_TinyFormat = 0x02uy let e_CorILMethod_FatFormat = 0x03uy @@ -3881,136 +3881,136 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let e_COR_ILEXCEPTION_CLAUSE_FAULT = 0x4 - module Bytes = + module Bytes = let dWw1 n = int32 ((n >>> 32) &&& 0xFFFFFFFFL) let dWw0 n = int32 (n &&& 0xFFFFFFFFL) - let get (b:byte[]) n = int32 (Array.get b n) - let zeroCreate n: byte[] = Array.zeroCreate n + let get (b:byte[]) n = int32 (Array.get b n) + let zeroCreate n: byte[] = Array.zeroCreate n - let sub ( b:byte[]) s l = Array.sub b s l - let blit (a:byte[]) b c d e = Array.blit a b c d e + let sub ( b:byte[]) s l = Array.sub b s l + let blit (a:byte[]) b c d e = Array.blit a b c d e - let ofInt32Array (arr:int[]) = Array.init arr.Length (fun i -> byte arr.[i]) + let ofInt32Array (arr:int[]) = Array.init arr.Length (fun i -> byte arr.[i]) - let stringAsUtf8NullTerminated (s:string) = - Array.append (Encoding.UTF8.GetBytes s) (ofInt32Array [| 0x0 |]) + let stringAsUtf8NullTerminated (s:string) = + Array.append (Encoding.UTF8.GetBytes s) (ofInt32Array [| 0x0 |]) - let stringAsUnicodeNullTerminated (s:string) = - Array.append (Encoding.Unicode.GetBytes s) (ofInt32Array [| 0x0;0x0 |]) + let stringAsUnicodeNullTerminated (s:string) = + Array.append (Encoding.Unicode.GetBytes s) (ofInt32Array [| 0x0;0x0 |]) - type ByteStream = - { bytes: byte[] - mutable pos: int + type ByteStream = + { bytes: byte[] + mutable pos: int max: int } - member b.ReadByte() = + member b.ReadByte() = if b.pos >= b.max then failwith "end of stream" let res = b.bytes.[b.pos] b.pos <- b.pos + 1 - res - member b.ReadUtf8String n = - let res = Encoding.UTF8.GetString(b.bytes,b.pos,n) - b.pos <- b.pos + n; res - - static member FromBytes (b:byte[],n,len) = + res + member b.ReadUtf8String n = + let res = Encoding.UTF8.GetString(b.bytes,b.pos,n) + b.pos <- b.pos + n; res + + static member FromBytes (b:byte[],n,len) = if n < 0 || (n+len) > b.Length then failwith "FromBytes" { bytes = b; pos = n; max = n+len } - member b.ReadBytes n = + member b.ReadBytes n = if b.pos + n > b.max then failwith "ReadBytes: end of stream" let res = Bytes.sub b.bytes b.pos n b.pos <- b.pos + n - res + res - member b.Position = b.pos + member b.Position = b.pos - type ByteBuffer = - { mutable bbArray: byte[] + type ByteBuffer = + { mutable bbArray: byte[] mutable bbCurrent: int } - member buf.Ensure newSize = - let oldBufSize = buf.bbArray.Length - if newSize > oldBufSize then - let old = buf.bbArray + member buf.Ensure newSize = + let oldBufSize = buf.bbArray.Length + if newSize > oldBufSize then + let old = buf.bbArray buf.bbArray <- Bytes.zeroCreate (max newSize (oldBufSize * 2)) Bytes.blit old 0 buf.bbArray 0 buf.bbCurrent member buf.Close () = Bytes.sub buf.bbArray 0 buf.bbCurrent - member buf.EmitIntAsByte (i:int) = - let newSize = buf.bbCurrent + 1 + member buf.EmitIntAsByte (i:int) = + let newSize = buf.bbCurrent + 1 buf.Ensure newSize buf.bbArray.[buf.bbCurrent] <- byte i - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize member buf.EmitByte (b:byte) = buf.EmitIntAsByte (int b) - member buf.EmitIntsAsBytes (arr:int[]) = + member buf.EmitIntsAsBytes (arr:int[]) = let n = arr.Length - let newSize = buf.bbCurrent + n + let newSize = buf.bbCurrent + n buf.Ensure newSize let bbarr = buf.bbArray let bbbase = buf.bbCurrent - for i = 0 to n - 1 do - bbarr.[bbbase + i] <- byte arr.[i] - buf.bbCurrent <- newSize + for i = 0 to n - 1 do + bbarr.[bbbase + i] <- byte arr.[i] + buf.bbCurrent <- newSize - member bb.FixupInt32 pos n = + member bb.FixupInt32 pos n = bb.bbArray.[pos] <- (b0 n |> byte) bb.bbArray.[pos + 1] <- (b1 n |> byte) bb.bbArray.[pos + 2] <- (b2 n |> byte) bb.bbArray.[pos + 3] <- (b3 n |> byte) - member buf.EmitInt32 n = - let newSize = buf.bbCurrent + 4 + member buf.EmitInt32 n = + let newSize = buf.bbCurrent + 4 buf.Ensure newSize buf.FixupInt32 buf.bbCurrent n - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize - member buf.EmitBytes (i:byte[]) = - let n = i.Length - let newSize = buf.bbCurrent + n + member buf.EmitBytes (i:byte[]) = + let n = i.Length + let newSize = buf.bbCurrent + n buf.Ensure newSize Bytes.blit i 0 buf.bbArray buf.bbCurrent n - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize - member buf.EmitInt32AsUInt16 n = - let newSize = buf.bbCurrent + 2 + member buf.EmitInt32AsUInt16 n = + let newSize = buf.bbCurrent + 2 buf.Ensure newSize buf.bbArray.[buf.bbCurrent] <- (b0 n |> byte) buf.bbArray.[buf.bbCurrent + 1] <- (b1 n |> byte) - buf.bbCurrent <- newSize - + buf.bbCurrent <- newSize + member buf.EmitBoolAsByte (b:bool) = buf.EmitIntAsByte (if b then 1 else 0) member buf.EmitUInt16 (x:uint16) = buf.EmitInt32AsUInt16 (int32 x) - member buf.EmitInt64 x = + member buf.EmitInt64 x = buf.EmitInt32 (Bytes.dWw0 x) buf.EmitInt32 (Bytes.dWw1 x) member buf.Position = buf.bbCurrent - static member Create sz = - { bbArray=Bytes.zeroCreate sz + static member Create sz = + { bbArray=Bytes.zeroCreate sz bbCurrent = 0 } - /// Z32 = compressed unsigned integer - static member Z32Size n = + /// Z32 = compressed unsigned integer + static member Z32Size n = if n <= 0x7F then 1 elif n <= 0x3FFF then 2 else 4 /// Emit int32 as compressed unsigned integer - member buf.EmitZ32 n = - if n >= 0 && n <= 0x7F then - buf.EmitIntAsByte n - elif n >= 0x80 && n <= 0x3FFF then + member buf.EmitZ32 n = + if n >= 0 && n <= 0x7F then + buf.EmitIntAsByte n + elif n >= 0x80 && n <= 0x3FFF then buf.EmitIntAsByte (0x80 ||| (n >>> 8)) - buf.EmitIntAsByte (n &&& 0xFF) - else + buf.EmitIntAsByte (n &&& 0xFF) + else buf.EmitIntAsByte (0xc0l ||| ((n >>> 24) &&& 0xFF)) buf.EmitIntAsByte ( (n >>> 16) &&& 0xFF) buf.EmitIntAsByte ( (n >>> 8) &&& 0xFF) @@ -4018,14 +4018,14 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader static member Z32 n = let bb = ByteBuffer.Create (ByteBuffer.Z32Size n) in bb.EmitZ32 n; bb.Close() - member buf.EmitPadding n = + member buf.EmitPadding n = for i = 0 to n-1 do buf.EmitByte 0x0uy // Emit compressed untagged integer - member buf.EmitZUntaggedIndex big idx = + member buf.EmitZUntaggedIndex big idx = if big then buf.EmitInt32 idx - elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) + elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) else buf.EmitInt32AsUInt16 idx // Emit compressed tagged integer @@ -4941,26 +4941,26 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let valIdx = seekReadBlobIdx &addr (parentIdx, typeIdx, valIdx) - //let seekReadFieldMarshalRow idx = + //let seekReadFieldMarshalRow idx = // let mutable addr = rowAddr TableNames.FieldMarshal idx // let parentIdx = seekReadHasFieldMarshalIdx &addr // let typeIdx = seekReadBlobIdx &addr // (parentIdx, typeIdx) - /// Read Table ClassLayout. + /// Read Table ClassLayout. let seekReadClassLayoutRow idx = let mutable addr = rowAddr ILTableNames.ClassLayout idx let pack = seekReadUInt16Adv &addr let size = seekReadInt32Adv &addr let tidx = seekReadUntaggedIdx ILTableNames.TypeDef &addr - (pack, size, tidx) + (pack, size, tidx) - /// Read Table FieldLayout. + /// Read Table FieldLayout. let seekReadFieldLayoutRow idx = let mutable addr = rowAddr ILTableNames.FieldLayout idx let offset = seekReadInt32Adv &addr let fidx = seekReadUntaggedIdx ILTableNames.Field &addr - (offset, fidx) + (offset, fidx) /// Read Table EventMap let seekReadEventMapRow idx = @@ -5005,7 +5005,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let tidx = seekReadUntaggedIdx ILTableNames.TypeDef &addr let mbodyIdx = seekReadMethodDefOrRefIdx &addr let mdeclIdx = seekReadMethodDefOrRefIdx &addr - (tidx, mbodyIdx, mdeclIdx) + (tidx, mbodyIdx, mdeclIdx) /// Read Table ILModuleRef let seekReadModuleRefRow idx = @@ -5182,7 +5182,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader Retargetable = 0 <> (flags &&& 0x100); DisableJitOptimizations = 0 <> (flags &&& 0x4000); JitTracking = 0 <> (flags &&& 0x8000) - IgnoreSymbolStoreSequencePoints = 0 <> (flags &&& 0x2000) + IgnoreSymbolStoreSequencePoints = 0 <> (flags &&& 0x2000) } and seekReadAssemblyRef idx = cacheAssemblyRef seekReadAssemblyRefUncached idx @@ -5395,16 +5395,16 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader and seekReadMethodDefOrRef numtypars (TaggedIndex(tag, idx)) = - match tag with - | tag when tag = MethodDefOrRefTag.MethodDef -> + match tag with + | tag when tag = MethodDefOrRefTag.MethodDef -> let (MethodData(enclTyp, cc, nm, argtys, retty, minst)) = seekReadMethodDefAsMethodData idx VarArgMethodData(enclTyp, cc, nm, argtys, None, retty, minst) - | tag when tag = MethodDefOrRefTag.MemberRef -> + | tag when tag = MethodDefOrRefTag.MemberRef -> seekReadMemberRefAsMethodData numtypars idx | _ -> failwith "seekReadMethodDefOrRef ctxt" and seekReadMethodDefOrRefNoVarargs numtypars x = - let (VarArgMethodData(enclTyp, cc, nm, argtys, varargs, retty, minst)) = seekReadMethodDefOrRef numtypars x + let (VarArgMethodData(enclTyp, cc, nm, argtys, varargs, retty, minst)) = seekReadMethodDefOrRef numtypars x MethodData(enclTyp, cc, nm, argtys, retty, minst) and seekReadCustomAttrType (TaggedIndex(tag,idx) ) = @@ -5462,7 +5462,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader if hasLayout && not isStatic then Some (seekReadIndexedRow (getNumRows ILTableNames.FieldLayout,seekReadFieldLayoutRow, snd,simpleIndexCompare idx,isSorted ILTableNames.FieldLayout,fst)) else None - CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.FieldDef,idx)) + CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.FieldDef,idx)) Token = idx } and seekReadFields (numtypars, hasLayout) fidx1 fidx2 = @@ -5791,7 +5791,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader RemoveMethod=seekReadMethodSemantics (0x0010,TaggedIndex(HasSemanticsTag.Event,idx)) //FireMethod=seekReadOptionalMethodSemantics (0x0020,TaggedIndex(HasSemanticsTag.Event,idx)) //OtherMethods = seekReadMultipleMethodSemantics (0x0004, TaggedIndex(HasSemanticsTag.Event, idx)) - CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.Event,idx)) + CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.Event,idx)) Token = idx} and seekReadEvents numtypars tidx = @@ -5862,7 +5862,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let data = match readBlobHeapOption valIdx with | USome bytes -> bytes - | UNone -> [| |] + | UNone -> [| |] { Method=seekReadCustomAttrType catIdx; Data= data Elements = [] } @@ -6065,17 +6065,17 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let (|ElementType|_|) (ty: ILType) = - match ty with - | ILType.Boxed tspec -> - match tspec.Namespace, tspec.Name with + match ty with + | ILType.Boxed tspec -> + match tspec.Namespace, tspec.Name with | USome "System", "String"-> Some et_STRING | USome "System", "Object"-> Some et_OBJECT | _ -> None - | ILType.Value tspec -> + | ILType.Value tspec -> match tspec.Namespace, tspec.Name with | USome "System", "Int32" -> Some et_I4 | USome "System", "SByte" -> Some et_I1 - | USome "System", "Int16"-> Some et_I2 + | USome "System", "Int16"-> Some et_I2 | USome "System", "Int64" -> Some et_I8 | USome "System", "IntPtr" -> Some et_I | USome "System", "Byte" -> Some et_U1 @@ -6091,22 +6091,22 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | _ -> None | _ -> None - let encodeCustomAttrString (s: string) = + let encodeCustomAttrString (s: string) = let arr = Encoding.UTF8.GetBytes s - Array.concat [ ByteBuffer.Z32 arr.Length; arr ] + Array.concat [ ByteBuffer.Z32 arr.Length; arr ] - let rec encodeCustomAttrElemType x = + let rec encodeCustomAttrElemType x = match x with - | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| 0x51uy |] + | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| 0x51uy |] | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Type" -> [| 0x50uy |] | ElementType et -> [| et |] | ILType.Value tspec -> Array.append [| 0x55uy |] (encodeCustomAttrString tspec.TypeRef.QualifiedName) - | ILType.Array (shape, elemType) when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, elemType) when shape = ILArrayShape.SingleDimensional -> Array.append [| et_SZARRAY |] (encodeCustomAttrElemType elemType) | _ -> failwith "encodeCustomAttrElemType: unrecognized custom element type" /// Given a custom attribute element, work out the type of the .NET argument for that element. - let rec encodeCustomAttrElemTypeForObject (x: obj) = + let rec encodeCustomAttrElemTypeForObject (x: obj) = match x with | :? string -> [| et_STRING |] | :? bool -> [| et_BOOLEAN |] @@ -6125,11 +6125,11 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | :? single -> [| et_R4 |] | :? double -> [| et_R8 |] | :? (obj[]) -> failwith "TODO: can't yet emit arrays in attrs" // [| yield et_SZARRAY; yield! encodeCustomAttrElemType elemTy |] - | _ -> failwith "unexpected value in custom attribute" + | _ -> failwith "unexpected value in custom attribute" /// Given a custom attribute element, encode it to a binary representation according to the rules in Ecma 335 Partition II. - let rec encodeCustomAttrPrimValue (c: obj) = - match c with + let rec encodeCustomAttrPrimValue (c: obj) = + match c with | :? bool as b -> [| (if b then 0x01uy else 0x00uy) |] | null -> [| 0xFFuy |] | :? string as s -> encodeCustomAttrString s @@ -6144,40 +6144,40 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | :? UInt64 as x -> u64AsBytes x | :? Single as x -> ieee32AsBytes x | :? Double as x -> ieee64AsBytes x - | :? ILType as ty -> encodeCustomAttrString ty.QualifiedName - | :? Type as ty -> encodeCustomAttrString ty.FullName - | :? (obj[]) as elems -> + | :? ILType as ty -> encodeCustomAttrString ty.QualifiedName + | :? Type as ty -> encodeCustomAttrString ty.FullName + | :? (obj[]) as elems -> [| yield! i32AsBytes elems.Length; for elem in elems do yield! encodeCustomAttrPrimValue elem |] | _ -> failwith "unexpected value in custom attribute" - and encodeCustomAttrValue ty (c: obj) = - match ty, c with - | ILType.Boxed tspec, _ when tspec.Namespace = USome "System" && tspec.Name = "Object" -> + and encodeCustomAttrValue ty (c: obj) = + match ty, c with + | ILType.Boxed tspec, _ when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| yield! encodeCustomAttrElemTypeForObject c; yield! encodeCustomAttrPrimValue c |] - | ILType.Array (shape, _), null when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, _), null when shape = ILArrayShape.SingleDimensional -> [| yield! i32AsBytes 0xFFFFFFFF |] - | ILType.Array (shape, elemType), (:? (obj[]) as elems) when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, elemType), (:? (obj[]) as elems) when shape = ILArrayShape.SingleDimensional -> [| yield! i32AsBytes elems.Length; for elem in elems do yield! encodeCustomAttrValue elemType elem |] - | _ -> + | _ -> encodeCustomAttrPrimValue c - let encodeCustomAttrNamedArg prop (ILCustomAttrNamedArg (nm, ty, elem)) = - [| yield (if prop then 0x54uy else 0x53uy) + let encodeCustomAttrNamedArg prop (ILCustomAttrNamedArg (nm, ty, elem)) = + [| yield (if prop then 0x54uy else 0x53uy) yield! encodeCustomAttrElemType ty yield! encodeCustomAttrString nm yield! encodeCustomAttrValue ty elem |] - let mkILCustomAttribMethRef (mspec:ILMethodSpec, fixedArgs: obj list, propArgs: ILCustomAttrNamedArg list, fieldArgs: ILCustomAttrNamedArg list) = + let mkILCustomAttribMethRef (mspec:ILMethodSpec, fixedArgs: obj list, propArgs: ILCustomAttrNamedArg list, fieldArgs: ILCustomAttrNamedArg list) = let argtys = mspec.MethodRef.ArgTypes let nnamed = propArgs.Length + fieldArgs.Length - let data = + let data = [| yield! [| 0x01uy; 0x00uy; |] for (argty,fixedArg) in Seq.zip argtys fixedArgs do yield! encodeCustomAttrValue argty fixedArg yield! u16AsBytes (uint16 nnamed ) - for arg in propArgs do + for arg in propArgs do yield! encodeCustomAttrNamedArg true arg - for arg in fieldArgs do + for arg in fieldArgs do yield! encodeCustomAttrNamedArg false arg |] //printfn "mkILCustomAttribMethRef, nnamed = %d, data.Length = %d, data = %A" nnamed data.Length data { Method = mspec; @@ -6447,7 +6447,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader if n = 0 then List.rev acc, sigptr else let v,sigptr = parseVal elemTy sigptr parseElems (v ::acc) (n-1) sigptr - let elems, sigptr = parseElems [] n sigptr + let elems, sigptr = parseElems [] n sigptr let elems = elems |> List.map snd |> List.toArray (argty, box elems), sigptr | ILType.Value _ -> (* assume it is an enumeration *) @@ -6500,7 +6500,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let named = parseNamed [] (int nnamed) sigptr fixedArgs, named - with err -> + with err -> failwithf "FAILED decodeILCustomAttribData, data.Length = %d, data = %A, meth = %A, argtypes = %A, fixedArgs=%A, nnamed = %A, sigptr before named = %A, innerError = %A" bytes.Length bytes ca.Method.EnclosingType ca.Method.FormalArgTypes fixedArgs nnamed sigptr (err.ToString()) type CacheValue = ILModuleReader @@ -6528,7 +6528,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let EcmaMscorlibScopeRef = ILScopeRef.Assembly (ILAssemblyRef("mscorlib", UNone, USome EcmaPublicKey, true, UNone, UNone)) //==================================================================================================== -// TargetAssembly +// TargetAssembly // // An implementation of reflection objects over on-disk assemblies, sufficient to give // System.Type, System.MethodInfo, System.ConstructorInfo etc. objects @@ -6736,7 +6736,7 @@ namespace ProviderImplementation.ProvidedTypes | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes dty that.DeclaringType && lengthsEqAndForall2 (gmd.GetGenericArguments()) (that.GetGenericArguments()) (=) | _ -> false - + override this.MethodHandle = notRequired this "MethodHandle" this.Name override this.ReturnParameter = notRequired this "ReturnParameter" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name @@ -6753,7 +6753,7 @@ namespace ProviderImplementation.ProvidedTypes /// Represents a constructor in an instantiated type type ConstructorSymbol (declTy: Type, inp: ConstructorInfo) = - inherit ConstructorInfo() + inherit ConstructorInfo() let gps = ((if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]), [| |]) override __.Name = ".ctor" @@ -6780,12 +6780,12 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_inherited) = notRequired this "GetCustomAttributes" this.Name override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name - override __.ToString() = sprintf "tgt constructor(...) in type %s" declTy.FullName + override __.ToString() = sprintf "tgt constructor(...) in type %s" declTy.FullName static member Make (declTy: Type) md = ConstructorSymbol (declTy, md) :> ConstructorInfo /// Represents a method in an instantiated type type MethodSymbol (declTy: Type, inp: MethodInfo) = - inherit MethodInfo() + inherit MethodInfo() let gps1 = (if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]) let gps2 = inp.GetGenericArguments() let gps = (gps1, gps2) @@ -6805,7 +6805,7 @@ namespace ProviderImplementation.ProvidedTypes override __.GetHashCode() = inp.GetHashCode() override this.Equals(that:obj) = match that with - | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType + | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType | _ -> false override this.MakeGenericMethod(args) = MethodSymbol2(this, args) :> MethodInfo @@ -6823,13 +6823,13 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_inherited) = notRequired this "GetCustomAttributes" this.Name override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name - override __.ToString() = sprintf "tgt method %s(...) in type %s" inp.Name declTy.FullName + override __.ToString() = sprintf "tgt method %s(...) in type %s" inp.Name declTy.FullName static member Make (declTy: Type) md = MethodSymbol (declTy, md) :> MethodInfo /// Represents a property in an instantiated type type PropertySymbol (declTy: Type, inp: PropertyInfo) = - inherit PropertyInfo() + inherit PropertyInfo() let gps = ((if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]), [| |]) override __.Name = inp.Name @@ -6860,7 +6860,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name - override __.ToString() = sprintf "tgt property %s(...) in type %s" inp.Name declTy.Name + override __.ToString() = sprintf "tgt property %s(...) in type %s" inp.Name declTy.Name static member Make (declTy: Type) md = PropertySymbol (declTy, md) :> PropertyInfo @@ -6892,13 +6892,13 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name - override __.ToString() = sprintf "tgt event %s(...) in type %s" inp.Name declTy.FullName + override __.ToString() = sprintf "tgt event %s(...) in type %s" inp.Name declTy.FullName static member Make (declTy: Type) md = EventSymbol (declTy, md) :> EventInfo /// Represents a field in an instantiated type type FieldSymbol (declTy: Type, inp: FieldInfo) = - inherit FieldInfo() + inherit FieldInfo() let gps = if declTy.IsGenericType then declTy.GetGenericArguments() else [| |] override __.Name = inp.Name @@ -6925,7 +6925,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetValue(_obj) = notRequired this "GetValue" this.Name override this.FieldHandle = notRequired this "FieldHandle" this.Name - override __.ToString() = sprintf "tgt literal field %s(...) in type %s" inp.Name declTy.FullName + override __.ToString() = sprintf "tgt literal field %s(...) in type %s" inp.Name declTy.FullName static member Make (declTy: Type) md = FieldSymbol (declTy, md) :> FieldInfo @@ -7022,71 +7022,71 @@ namespace ProviderImplementation.ProvidedTypes member __.Kind = kind member __.Args = typeArgs - override this.GetConstructors bindingFlags = + override this.GetConstructors bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Methods.Entries - |> Array.filter (fun md -> md.Name = ".ctor" || md.Name = ".cctor") - |> Array.map (gtd.MakeConstructorInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Methods.Entries + |> Array.filter (fun md -> md.Name = ".ctor" || md.Name = ".cctor") + |> Array.map (gtd.MakeConstructorInfo this) |> Array.filter (canBindConstructor bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetConstructors(bindingFlags) - |> Array.map (ConstructorSymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetConstructors(bindingFlags) + |> Array.map (ConstructorSymbol.Make this) | _ -> notRequired this "GetConstructors" this.Name - override this.GetMethods bindingFlags = + override this.GetMethods bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Methods.Entries - |> Array.filter (fun md -> md.Name <> ".ctor" && md.Name <> ".cctor") - |> Array.map (gtd.MakeMethodInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Methods.Entries + |> Array.filter (fun md -> md.Name <> ".ctor" && md.Name <> ".cctor") + |> Array.map (gtd.MakeMethodInfo this) |> Array.filter (canBindMethod bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetMethods(bindingFlags) - |> Array.map (MethodSymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetMethods(bindingFlags) + |> Array.map (MethodSymbol.Make this) | _ -> notRequired this "GetMethods" this.Name - override this.GetFields bindingFlags = + override this.GetFields bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Fields.Entries - |> Array.map (gtd.MakeFieldInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Fields.Entries + |> Array.map (gtd.MakeFieldInfo this) |> Array.filter (canBindField bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetFields(bindingFlags) - |> Array.map (FieldSymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetFields(bindingFlags) + |> Array.map (FieldSymbol.Make this) | _ -> notRequired this "GetFields" this.Name - override this.GetProperties bindingFlags = + override this.GetProperties bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Properties.Entries - |> Array.map (gtd.MakePropertyInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Properties.Entries + |> Array.map (gtd.MakePropertyInfo this) |> Array.filter (canBindProperty bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetProperties(bindingFlags) - |> Array.map (PropertySymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetProperties(bindingFlags) + |> Array.map (PropertySymbol.Make this) | _ -> notRequired this "GetProperties" this.Name - override this.GetEvents bindingFlags = + override this.GetEvents bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Events.Entries - |> Array.map (gtd.MakeEventInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Events.Entries + |> Array.map (gtd.MakeEventInfo this) |> Array.filter (canBindEvent bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetEvents(bindingFlags) - |> Array.map (EventSymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetEvents(bindingFlags) + |> Array.map (EventSymbol.Make this) | _ -> notRequired this "GetEvents" this.Name - override this.GetNestedTypes bindingFlags = + override this.GetNestedTypes bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.NestedTypes.Entries - |> Array.map (gtd.MakeNestedTypeInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.NestedTypes.Entries + |> Array.map (gtd.MakeNestedTypeInfo this) |> Array.filter (canBindNestedType bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetNestedTypes(bindingFlags) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetNestedTypes(bindingFlags) | _ -> notRequired this "GetNestedTypes" this.Name override this.GetConstructorImpl(bindingFlags, _binderBinder, _callConvention, types, _modifiers) = @@ -7094,68 +7094,68 @@ namespace ProviderImplementation.ProvidedTypes match ctors with | [| |] -> null | [| ci |] -> ci - | _ -> failwithf "multiple constructors exist" + | _ -> failwithf "multiple constructors exist" override this.GetMethodImpl(name, bindingFlags, _binderBinder, _callConvention, types, _modifiers) = match kind with | TypeSymbolKind.TargetGeneric gtd -> let md = match types with - | null -> gtd.Metadata.Methods.TryFindUniqueByName(name) + | null -> gtd.Metadata.Methods.TryFindUniqueByName(name) | _ -> - let mds = gtd.Metadata.Methods.FindByNameAndArity(name, types.Length) + let mds = gtd.Metadata.Methods.FindByNameAndArity(name, types.Length) match mds |> Array.filter (fun md -> eqTypesAndILTypesWithInst typeArgs types md.ParameterTypes) with | [| |] -> None | [| md |] -> Some md | _ -> failwithf "multiple methods exist with name %s" name md |> Option.map (gtd.MakeMethodInfo this) |> Option.toObj - | TypeSymbolKind.OtherGeneric _ -> + | TypeSymbolKind.OtherGeneric _ -> match this.GetMethods(bindingFlags) |> Array.filter (fun c -> name = c.Name && match types with null -> true | t -> c.GetParameters().Length = t.Length) with | [| |] -> null | [| mi |] -> mi | _ -> failwithf "multiple methods exist with name %s" name | _ -> notRequired this "GetMethodImpl" this.Name - override this.GetField(name, bindingFlags) = + override this.GetField(name, bindingFlags) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Fields.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakeFieldInfo this) + |> Option.map (gtd.MakeFieldInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetFields(bindingFlags) + gtd.GetFields(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (FieldSymbol.Make this) + |> Option.map (FieldSymbol.Make this) |> Option.toObj | _ -> notRequired this "GetField" this.Name - override this.GetPropertyImpl(name, bindingFlags, _binder, _returnType, _types, _modifiers) = + override this.GetPropertyImpl(name, bindingFlags, _binder, _returnType, _types, _modifiers) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Properties.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakePropertyInfo this) + |> Option.map (gtd.MakePropertyInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetProperties(bindingFlags) + gtd.GetProperties(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (PropertySymbol.Make this) + |> Option.map (PropertySymbol.Make this) |> Option.toObj | _ -> notRequired this "GetPropertyImpl" this.Name - override this.GetEvent(name, bindingFlags) = + override this.GetEvent(name, bindingFlags) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Events.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakeEventInfo this) + |> Option.map (gtd.MakeEventInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetEvents(bindingFlags) + gtd.GetEvents(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (EventSymbol.Make this) + |> Option.map (EventSymbol.Make this) |> Option.toObj | _ -> notRequired this "GetEvent" this.Name @@ -7279,7 +7279,7 @@ namespace ProviderImplementation.ProvidedTypes override this.Equals(that:obj) = match that with - | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType + | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType | _ -> false override this.MakeGenericMethod(args) = MethodSymbol2(this, args) :> MethodInfo @@ -7523,7 +7523,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "txILGenericParam: GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "txILGenericParam: IsDefined" this.Name override this.GetInterface(_name, _ignoreCase) = notRequired this "txILGenericParam: GetInterface" this.Name - override this.Module = notRequired this "txILGenericParam: Module" this.Name: Module + override this.Module = notRequired this "txILGenericParam: Module" this.Name: Module override this.GetElementType() = notRequired this "txILGenericParam: GetElementType" this.Name override this.InvokeMember(_name, _invokeAttr, _binder, _target, _args, _modifiers, _culture, _namedParameters) = notRequired this "txILGenericParam: InvokeMember" this.Name @@ -7586,21 +7586,21 @@ namespace ProviderImplementation.ProvidedTypes |> Array.filter (canBindNestedType bindingFlags) override this.GetConstructorImpl(_bindingFlags, _binder, _callConvention, types, _modifiers) = - let md = + let md = match types with | null -> inp.Methods.TryFindUniqueByName(".ctor") - | _ -> + | _ -> inp.Methods.FindByNameAndArity(".ctor", types.Length) |> Array.tryFind (fun md -> eqTypesAndILTypes types md.ParameterTypes) - md - |> Option.map (txILConstructorDef this) + md + |> Option.map (txILConstructorDef this) |> Option.toObj override this.GetMethodImpl(name, _bindingFlags, _binder, _callConvention, types, _modifiers) = - let md = + let md = match types with | null -> inp.Methods.TryFindUniqueByName(name) - | _ -> + | _ -> inp.Methods.FindByNameAndArity(name, types.Length) |> Array.tryFind (fun md -> eqTypesAndILTypes types md.ParameterTypes) md |> Option.map (txILMethodDef this) |> Option.toObj @@ -7647,8 +7647,8 @@ namespace ProviderImplementation.ProvidedTypes override __.IsValueTypeImpl() = inp.IsStructOrEnum - override __.IsEnum = - match this.BaseType with + override __.IsEnum = + match this.BaseType with | null -> false | bt -> bt.FullName = "System.Enum" || bt.IsEnum @@ -7719,10 +7719,10 @@ namespace ProviderImplementation.ProvidedTypes let getReader() = match reader with None -> failwith "the reader on the TargetAssembly has not been set" | Some r -> r let txILTypeDef (declTyOpt: Type option) (inp: ILTypeDef) = - txTable.Get inp.Token (fun () -> + txTable.Get inp.Token (fun () -> // We never create target types for the types of primitive values that are accepted by the F# compiler as Expr.Value nodes, // which fortunately also correspond to element types. We just use the design-time types instead. - match inp.Namespace, inp.Name with + match inp.Namespace, inp.Name with | USome "System", "Void"-> typeof (* | USome "System", "Boolean" -> typeof @@ -7740,9 +7740,9 @@ namespace ProviderImplementation.ProvidedTypes | USome "System", "UIntPtr" -> typeof | USome "System", "Double" -> typeof | USome "System", "Single" -> typeof - | USome "System", "Char" -> typeof + | USome "System", "Char" -> typeof *) - | _ -> + | _ -> TargetTypeDefinition(ilGlobals, tryBindAssembly, asm, declTyOpt, inp) :> System.Type) let types = lazy [| for td in getReader().ILModuleDef.TypeDefs.Entries -> txILTypeDef None td |] @@ -7795,8 +7795,8 @@ namespace ProviderImplementation.ProvidedTypes | ILScopeRef.Assembly aref2 -> let ass2opt = tryBindAssembly(aref2) match ass2opt with - | Choice1Of2 ass2 -> - match ass2.GetType(joinILTypeName nsp nm) with + | Choice1Of2 ass2 -> + match ass2.GetType(joinILTypeName nsp nm) with | null -> None | ty -> Some ty | Choice2Of2 _err -> None @@ -7815,10 +7815,10 @@ namespace ProviderImplementation.ProvidedTypes type ProvidedAssembly(isTgt: bool, assemblyName:AssemblyName, assemblyFileName: string) = - + inherit Assembly() let theTypes = ResizeArray() - + let addTypes (ptds:ProvidedTypeDefinition[], enclosingTypeNames: string list option) = for pt in ptds do if pt.IsErased then failwith ("The provided type "+pt.Name+"is marked as erased and cannot be converted to a generated type. Set 'IsErased=false' on the ProvidedTypeDefinition") @@ -7840,7 +7840,7 @@ namespace ProviderImplementation.ProvidedTypes override __.GetTypes () = theTypesArray.Force() - override x.GetType (nm: string) = + override x.GetType (nm: string) = if nm.Contains("+") then let i = nm.LastIndexOf("+") let enc,nm2 = nm.[0..i-1], nm.[i+1..] @@ -7848,29 +7848,29 @@ namespace ProviderImplementation.ProvidedTypes | null -> null | t -> t.GetNestedType(nm2,bindAll) else - theTypesArray.Force() - |> Array.tryPick (fun ty -> if ty.FullName = nm then Some ty else None) + theTypesArray.Force() + |> Array.tryPick (fun ty -> if ty.FullName = nm then Some ty else None) |> Option.toObj - - new () = + + new () = let tmpFile = Path.GetTempFileName() let assemblyFileName = Path.ChangeExtension(tmpFile, "dll") File.Delete(tmpFile) let simpleName = Path.GetFileNameWithoutExtension(assemblyFileName) ProvidedAssembly(AssemblyName(simpleName), assemblyFileName) - new (assemblyName, assemblyFileName) = + new (assemblyName, assemblyFileName) = ProvidedAssembly(false, assemblyName, assemblyFileName) member __.BelongsToTargetModel = isTgt - member __.AddNestedTypes (types, enclosingGeneratedTypeNames) = + member __.AddNestedTypes (types, enclosingGeneratedTypeNames) = addTypes (Array.ofList types, Some enclosingGeneratedTypeNames) - member __.AddTypes (types) = + member __.AddTypes (types) = addTypes (Array.ofList types, None) - member __.AddTheTypes (types, enclosingGeneratedTypeNames) = + member __.AddTheTypes (types, enclosingGeneratedTypeNames) = addTypes (types, enclosingGeneratedTypeNames) member __.GetTheTypes () = theTypes.ToArray() @@ -7932,7 +7932,7 @@ namespace ProviderImplementation.ProvidedTypes type ProvidedTypeBuilder() = - static let tupleNames = + static let tupleNames = [| "System.Tuple`1"; "System.Tuple`2"; "System.Tuple`3"; "System.Tuple`4"; "System.Tuple`5"; "System.Tuple`6"; "System.Tuple`7"; "System.Tuple`8"; "System.Tuple" @@ -7941,15 +7941,15 @@ namespace ProviderImplementation.ProvidedTypes "System.ValueTuple`7"; "System.ValueTuple`8"; "System.ValueTuple" |] - static member MakeGenericType(genericTypeDefinition: Type, genericArguments: Type list) = + static member MakeGenericType(genericTypeDefinition: Type, genericArguments: Type list) = if genericArguments.Length = 0 then genericTypeDefinition else - match genericTypeDefinition with + match genericTypeDefinition with | :? TargetTypeDefinition -> failwithf "unexpected target model in ProvidedTypeBuilder.MakeGenericType, stacktrace = %s " Environment.StackTrace | :? ProvidedTypeDefinition as ptd when ptd.BelongsToTargetModel -> failwithf "unexpected target model ptd in MakeGenericType, stacktrace = %s " Environment.StackTrace | :? ProvidedTypeDefinition -> ProvidedTypeSymbol(ProvidedTypeSymbolKind.Generic genericTypeDefinition, genericArguments) :> Type | _ -> TypeSymbol(TypeSymbolKind.OtherGeneric genericTypeDefinition, List.toArray genericArguments) :> Type - static member MakeGenericMethod(genericMethodDefinition, genericArguments: Type list) = + static member MakeGenericMethod(genericMethodDefinition, genericArguments: Type list) = if genericArguments.Length = 0 then genericMethodDefinition else MethodSymbol2(genericMethodDefinition, Array.ofList genericArguments) :> MethodInfo @@ -7960,7 +7960,7 @@ namespace ProviderImplementation.ProvidedTypes let n = min tys.Length maxTuple let tupleFullName = tupleNames.[n - 1 + (if isStruct then 9 else 0)] let ty = asm.GetType(tupleFullName) - if tys.Length >= maxTuple then + if tys.Length >= maxTuple then let tysA = (Array.ofList tys).[0..maxTuple-2] |> List.ofArray let tysB = (Array.ofList tys).[maxTuple-1..] |> List.ofArray let tyB = mkTupleType isStruct asm tysB @@ -7972,10 +7972,10 @@ namespace ProviderImplementation.ProvidedTypes //-------------------------------------------------------------------------------- // The quotation simplifier // - // This is invoked for each quotation specified by the type provider, as part of the translation to - /// the target model, i.e. before it is handed to the F# compiler (for erasing type providers) or - // the TPSDK IL code generator (for generative type providers). This allows a broader range of quotations - // to be used when authoring type providers than are strictly allowed by those tools. + // This is invoked for each quotation specified by the type provider, as part of the translation to + /// the target model, i.e. before it is handed to the F# compiler (for erasing type providers) or + // the TPSDK IL code generator (for generative type providers). This allows a broader range of quotations + // to be used when authoring type providers than are strictly allowed by those tools. // // Specifically we accept: // @@ -7999,7 +7999,7 @@ namespace ProviderImplementation.ProvidedTypes match q with #if !NO_GENERATIVE - // Convert NewTuple to the call to the constructor of the Tuple type (only for generated types, + // Convert NewTuple to the call to the constructor of the Tuple type (only for generated types, // the F# compile does the job for erased types when it receives the quotation) | NewTuple(items) when isGenerated -> let rec mkCtor args ty = @@ -8157,7 +8157,7 @@ namespace ProviderImplementation.ProvidedTypes // ... // body (body, vars) - ||> List.fold (fun b v -> Expr.LetUnchecked(varDict.[v.Name], init v.Type, b)) + ||> List.fold (fun b v -> Expr.LetUnchecked(varDict.[v.Name], init v.Type, b)) |> simplifyExpr @@ -8222,10 +8222,10 @@ namespace ProviderImplementation.ProvidedTypes yield resultType |] let fastFuncTy = match List.length args with - | 2 -> typedefof>.MakeGenericType(types) - | 3 -> typedefof>.MakeGenericType(types) - | 4 -> typedefof>.MakeGenericType(types) - | 5 -> typedefof>.MakeGenericType(types) + | 2 -> typedefof>.MakeGenericType(types) + | 3 -> typedefof>.MakeGenericType(types) + | 4 -> typedefof>.MakeGenericType(types) + | 5 -> typedefof>.MakeGenericType(types) | _ -> invalidArg "args" "incorrect number of arguments" fastFuncTy.GetMethod("Adapt") @@ -8382,7 +8382,7 @@ namespace ProviderImplementation.ProvidedTypes /// /// The ProvidedTypesContext acts as a way of creating provided objects where the replacement is automatically and /// systematically applied. - + /// Represents the type binding context for the type provider based on the set of assemblies /// referenced by the compilation. @@ -8431,7 +8431,7 @@ namespace ProviderImplementation.ProvidedTypes | None -> typeof.Assembly.GetName().Version // failwith "no reference to FSharp.Core found" | Some r -> r - let ilGlobals = + let ilGlobals = lazy mkILGlobals (systemRuntimeScopeRef.Force()) let mkReader ref = @@ -8442,18 +8442,18 @@ namespace ProviderImplementation.ProvidedTypes let targetAssembliesTable_ = ConcurrentDictionary>() let targetAssemblies_ = ResizeArray() let targetAssembliesQueue = ResizeArray<_>() - do targetAssembliesQueue.Add (fun () -> + do targetAssembliesQueue.Add (fun () -> for ref in referencedAssemblyPaths do - let reader = mkReader ref - let simpleName = Path.GetFileNameWithoutExtension ref + let reader = mkReader ref + let simpleName = Path.GetFileNameWithoutExtension ref targetAssembliesTable_.[simpleName] <- reader - match reader with - | Choice2Of2 _ -> () + match reader with + | Choice2Of2 _ -> () | Choice1Of2 asm -> targetAssemblies_.Add asm) - let flush() = + let flush() = let qs = targetAssembliesQueue.ToArray() targetAssembliesQueue.Clear() - for q in qs do q() + for q in qs do q() let getTargetAssemblies() = flush(); targetAssemblies_ let getTargetAssembliesTable() = flush(); targetAssembliesTable_ @@ -8466,8 +8466,8 @@ namespace ProviderImplementation.ProvidedTypes let sourceAssemblies_ = ResizeArray<_>() let sourceAssembliesQueue = ResizeArray<_>() - let enqueueReferencedAssemblies(asm: Assembly) = - do sourceAssembliesQueue.Add (fun () -> + let enqueueReferencedAssemblies(asm: Assembly) = + do sourceAssembliesQueue.Add (fun () -> [| for referencedAssemblyName in asm.GetReferencedAssemblies() do let referencedAssembly = try Assembly.Load(referencedAssemblyName) with _ -> null if not (isNull referencedAssembly) then @@ -8475,14 +8475,14 @@ namespace ProviderImplementation.ProvidedTypes do sourceAssembliesQueue.Add (fun () -> List.toArray sourceAssemblies) - let getSourceAssemblies() = + let getSourceAssemblies() = while sourceAssembliesQueue.Count > 0 do let qs = sourceAssembliesQueue.ToArray() sourceAssembliesQueue.Clear() - for q in qs do - for asm in q() do + for q in qs do + for asm in q() do let simpleName = asm.GetName().Name - if not (sourceAssembliesTable_.ContainsKey(simpleName)) then + if not (sourceAssembliesTable_.ContainsKey(simpleName)) then sourceAssembliesTable_.[simpleName] <- asm sourceAssemblies_.Add asm // Find the transitive closure of all referenced assemblies @@ -8539,13 +8539,13 @@ namespace ProviderImplementation.ProvidedTypes match table.TryGetValue(t) with | true, newT -> newT | false, _ -> - match t with - | :? ProvidedTypeDefinition as ptd when toTgt (* && ptd.IsErased *) -> + match t with + | :? ProvidedTypeDefinition as ptd when toTgt (* && ptd.IsErased *) -> if ptd.BelongsToTargetModel then failwithf "unexpected erased target ProvidedTypeDefinition '%O'" ptd // recursively get the provided type. convTypeDefToTgt t - - | _ -> + + | _ -> let asms = (if toTgt then getTargetAssemblies() else getSourceAssemblies()) let fullName = fixName t.FullName @@ -8599,7 +8599,7 @@ namespace ProviderImplementation.ProvidedTypes and convPropertyRefToTgt (p: PropertyInfo) = Debug.Assert((match p with :? ProvidedProperty as x -> not x.BelongsToTargetModel | _ -> true), "unexpected target ProvidedProperty") let t = convTypeToTgt p.DeclaringType - let bindingFlags = bindSome p.IsStatic + let bindingFlags = bindSome p.IsStatic let pT = t.GetProperty(p.Name, bindingFlags) if isNull pT then failwithf "Property '%O' of type '%O' not found. This property may be missing in the types available in the target assemblies." p t Debug.Assert((match pT with :? ProvidedProperty as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedProperty") @@ -8630,7 +8630,7 @@ namespace ProviderImplementation.ProvidedTypes declTyT.GetMethod(m.Name, bindSome m.IsStatic, null, parameterTypesT, null) match mT with | null -> failwithf "Method '%O' not found in type '%O'. This method may be missing in the types available in the target assemblies." m mT - | _ -> + | _ -> Debug.Assert((match mT with :? ProvidedMethod as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedMethod") mT @@ -8641,7 +8641,7 @@ namespace ProviderImplementation.ProvidedTypes let consT = declTyT.GetConstructor(parameterTypesT) match consT with | null -> failwithf "Constructor '%O' not found in type '%O'. This constructor may be missing in the types available in the target assemblies." cons declTyT - | _ -> + | _ -> Debug.Assert((match consT with :? ProvidedConstructor as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedConstructor") consT @@ -8739,7 +8739,7 @@ namespace ProviderImplementation.ProvidedTypes convExprToTgt <@@ (%%(tagExpr): int) = tagNumber @@> | Value (obj,ty) -> - match obj with + match obj with | :? Type as vty -> Expr.Value(convTypeToTgt vty, ty) | _ -> Expr.Value(obj, convTypeToTgt ty) @@ -8751,10 +8751,10 @@ namespace ProviderImplementation.ProvidedTypes | ShapeCombinationUnchecked (o, exprs) -> RebuildShapeCombinationUnchecked (o, List.map convExprToTgt exprs) - and convCodeToTgt (codeFun: Expr list -> Expr, isStatic, isCtor, parameters: ProvidedParameter[], isGenerated) = - (fun argsT -> + and convCodeToTgt (codeFun: Expr list -> Expr, isStatic, isCtor, parameters: ProvidedParameter[], isGenerated) = + (fun argsT -> let args = List.map convVarExprToSrc argsT - let paramNames = + let paramNames = // https://github.com/fsprojects/SwaggerProvider/blob/cfb7a665fada77fd0200591f62faba0ba44e172c/src/SwaggerProvider.DesignTime/SwaggerProviderConfig.fs#L79 // "Erased constructors should not pass the instance as the first argument when calling invokeCode!" // "Generated constructors should always pass the instance as the first argument when calling invokeCode!" @@ -8764,8 +8764,8 @@ namespace ProviderImplementation.ProvidedTypes let codeT = convExprToTgt code2 codeT) - and convBaseCallToTgt (codeFun: Expr list -> ConstructorInfo * Expr list, isGenerated) = - (fun argsT -> + and convBaseCallToTgt (codeFun: Expr list -> ConstructorInfo * Expr list, isGenerated) = + (fun argsT -> let args = List.map convVarExprToSrc argsT let ctor, argExprs = codeFun args let argExprs2 = List.map (QuotationSimplifier(isGenerated).TranslateExpression) argExprs @@ -8781,17 +8781,17 @@ namespace ProviderImplementation.ProvidedTypes match typeTableFwd.TryGetValue(x) with | true, newT -> (newT :?> ProvidedTypeDefinition) | false, _ -> - let container = - match x.Container with + let container = + match x.Container with | TypeContainer.Namespace(assemf, nm) -> - TypeContainer.Namespace((fun () -> - match assemf() with + TypeContainer.Namespace((fun () -> + match assemf() with | :? ProvidedAssembly as assembly -> convProvidedAssembly assembly - | assembly -> - assemblyReplacementMap - |> Seq.tryPick (fun (originalName, newName) -> + | assembly -> + assemblyReplacementMap + |> Seq.tryPick (fun (originalName, newName) -> if assembly.GetName().Name = originalName then - match this.TryBindSimpleAssemblyNameToTarget(newName) with + match this.TryBindSimpleAssemblyNameToTarget(newName) with | Choice1Of2 replacementAssembly -> Some replacementAssembly | Choice2Of2 _ -> None else @@ -8803,22 +8803,22 @@ namespace ProviderImplementation.ProvidedTypes // Create the type definition with contents mapped to the target // Use a 'let rec' to allow access to the target as the declaring // type of the contents in a delayed way. - let rec xT : ProvidedTypeDefinition = - ProvidedTypeDefinition(true, container, x.Name, - (x.BaseTypeRaw >> Option.map convTypeToTgt), - x.AttributesRaw, - (x.EnumUnderlyingTypeRaw >> Option.map convTypeToTgt), - x.StaticParams |> List.map convStaticParameterDefToTgt, - x.StaticParamsApply |> Option.map (fun f s p -> - let t = f s p + let rec xT : ProvidedTypeDefinition = + ProvidedTypeDefinition(true, container, x.Name, + (x.BaseTypeRaw >> Option.map convTypeToTgt), + x.AttributesRaw, + (x.EnumUnderlyingTypeRaw >> Option.map convTypeToTgt), + x.StaticParams |> List.map convStaticParameterDefToTgt, + x.StaticParamsApply |> Option.map (fun f s p -> + let t = f s p let tT = convProvidedTypeDefToTgt t tT), - Some ((let mutable idx = 0 in fun () -> let vs, idx2 = x.GetMembersFromCursor(idx) in idx <- idx2; vs |> Array.map (convMemberDefToTgt xT)), - (let mutable idx = 0 in fun () -> let vs, idx2 = x.GetInterfaceImplsFromCursor(idx) in idx <- idx2; vs |> Array.map convTypeToTgt), - (let mutable idx = 0 in fun () -> let vs, idx2 = x.GetMethodOverridesFromCursor(idx) in idx <- idx2; vs |> Array.map (fun (a,b) -> (convMethodRefToTgt a :?> ProvidedMethod), convMethodRefToTgt b))), + Some ((let mutable idx = 0 in fun () -> let vs, idx2 = x.GetMembersFromCursor(idx) in idx <- idx2; vs |> Array.map (convMemberDefToTgt xT)), + (let mutable idx = 0 in fun () -> let vs, idx2 = x.GetInterfaceImplsFromCursor(idx) in idx <- idx2; vs |> Array.map convTypeToTgt), + (let mutable idx = 0 in fun () -> let vs, idx2 = x.GetMethodOverridesFromCursor(idx) in idx <- idx2; vs |> Array.map (fun (a,b) -> (convMethodRefToTgt a :?> ProvidedMethod), convMethodRefToTgt b))), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt), - x.HideObjectMethods, - x.NonNullable) + x.HideObjectMethods, + x.NonNullable) Debug.Assert(not (typeTableFwd.ContainsKey(x))) typeTableFwd.[x] <- xT @@ -8828,63 +8828,63 @@ namespace ProviderImplementation.ProvidedTypes xT and convTypeDefToTgt (x: Type) = - match x with - | :? ProvidedTypeDefinition as x -> convProvidedTypeDefToTgt x :> Type + match x with + | :? ProvidedTypeDefinition as x -> convProvidedTypeDefToTgt x :> Type | _ -> x - and convParameterDefToTgt (x: ProvidedParameter) = + and convParameterDefToTgt (x: ProvidedParameter) = Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedParameter") - ProvidedParameter(true, x.Name, x.Attributes, - x.ParameterType |> convTypeToTgt, - x.OptionalValue, + ProvidedParameter(true, x.Name, x.Attributes, + x.ParameterType |> convTypeToTgt, + x.OptionalValue, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) - and convStaticParameterDefToTgt (x: ProvidedStaticParameter) = + and convStaticParameterDefToTgt (x: ProvidedStaticParameter) = Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedStaticParameter") - ProvidedStaticParameter(x.Name, convTypeToTgt x.ParameterType, ?parameterDefaultValue=x.ParameterDefaultValue) - - and convMemberDefToTgt declTyT (x: MemberInfo) = - let xT : MemberInfo = - match x with - | :? ProvidedField as x -> + ProvidedStaticParameter(x.Name, convTypeToTgt x.ParameterType, ?parameterDefaultValue=x.ParameterDefaultValue) + + and convMemberDefToTgt declTyT (x: MemberInfo) = + let xT : MemberInfo = + match x with + | :? ProvidedField as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedField") - ProvidedField(true, x.Name, x.Attributes, - x.FieldType |> convTypeToTgt, - x.GetRawConstantValue(), + ProvidedField(true, x.Name, x.Attributes, + x.FieldType |> convTypeToTgt, + x.GetRawConstantValue(), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedProperty as x -> + | :? ProvidedProperty as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedProperty") - ProvidedProperty(true, x.Name, x.Attributes, - x.PropertyType |> convTypeToTgt, + ProvidedProperty(true, x.Name, x.Attributes, + x.PropertyType |> convTypeToTgt, x.IsStatic, - x.Getter |> Option.map (fun f -> f >> convMethodRefToTgt), - x.Setter |> Option.map (fun f -> f >> convMethodRefToTgt), - x.IndexParameters |> Array.map convParameterDefToTgt, + x.Getter |> Option.map (fun f -> f >> convMethodRefToTgt), + x.Setter |> Option.map (fun f -> f >> convMethodRefToTgt), + x.IndexParameters |> Array.map convParameterDefToTgt, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedEvent as x -> + | :? ProvidedEvent as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedEvent") - ProvidedEvent(true, x.Name, x.Attributes, - x.EventHandlerType |> convTypeToTgt, + ProvidedEvent(true, x.Name, x.Attributes, + x.EventHandlerType |> convTypeToTgt, x.IsStatic, - (fun () -> convMethodRefToTgt x.Adder), - (fun () -> convMethodRefToTgt x.Remover), + (fun () -> convMethodRefToTgt x.Adder), + (fun () -> convMethodRefToTgt x.Remover), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedConstructor as x -> + | :? ProvidedConstructor as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedConstructor") - ProvidedConstructor(true, x.Attributes, - x.Parameters |> Array.map convParameterDefToTgt, - convCodeToTgt (x.GetInvokeCode, x.IsStatic, true, x.Parameters, not x.IsErased), + ProvidedConstructor(true, x.Attributes, + x.Parameters |> Array.map convParameterDefToTgt, + convCodeToTgt (x.GetInvokeCode, x.IsStatic, true, x.Parameters, not x.IsErased), (match x.BaseCall with None -> None | Some f -> Some (convBaseCallToTgt(f, not x.IsErased))), - x.IsImplicitConstructor, + x.IsImplicitConstructor, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedMethod as x -> + | :? ProvidedMethod as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedMethod") - ProvidedMethod(true, x.Name, x.Attributes, - x.Parameters |> Array.map convParameterDefToTgt, - x.ReturnType |> convTypeToTgt, - convCodeToTgt (x.GetInvokeCode, x.IsStatic, false, x.Parameters, not x.IsErased), - x.StaticParams |> List.map convStaticParameterDefToTgt, - x.StaticParamsApply |> Option.map (fun f s p -> f s p |> convProvidedMethodDefToTgt declTyT), + ProvidedMethod(true, x.Name, x.Attributes, + x.Parameters |> Array.map convParameterDefToTgt, + x.ReturnType |> convTypeToTgt, + convCodeToTgt (x.GetInvokeCode, x.IsStatic, false, x.Parameters, not x.IsErased), + x.StaticParams |> List.map convStaticParameterDefToTgt, + x.StaticParamsApply |> Option.map (fun f s p -> f s p |> convProvidedMethodDefToTgt declTyT), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ | :? ProvidedTypeDefinition as x -> convTypeDefToTgt x :> _ | _ -> failwith "unknown member type" @@ -8894,18 +8894,18 @@ namespace ProviderImplementation.ProvidedTypes Debug.Assert((xT.DeclaringType :?> ProvidedTypeDefinition).BelongsToTargetModel) xT - and convProvidedMethodDefToTgt declTyT (x: ProvidedMethod) = + and convProvidedMethodDefToTgt declTyT (x: ProvidedMethod) = convMemberDefToTgt declTyT x :?> ProvidedMethod - and convProvidedAssembly (assembly: ProvidedAssembly) = + and convProvidedAssembly (assembly: ProvidedAssembly) = match assemblyTableFwd.TryGetValue(assembly) with | true, newT -> newT | false, _ -> - let tgtAssembly = ProvidedAssembly(true, assembly.GetName(), assembly.Location) + let tgtAssembly = ProvidedAssembly(true, assembly.GetName(), assembly.Location) - for (types, enclosingGeneratedTypeNames) in assembly.GetTheTypes() do + for (types, enclosingGeneratedTypeNames) in assembly.GetTheTypes() do let typesT = Array.map convProvidedTypeDefToTgt types - tgtAssembly.AddTheTypes (typesT, enclosingGeneratedTypeNames) + tgtAssembly.AddTheTypes (typesT, enclosingGeneratedTypeNames) assemblyTableFwd.Add(assembly, tgtAssembly) this.AddSourceAssembly(assembly) @@ -8932,7 +8932,7 @@ namespace ProviderImplementation.ProvidedTypes member __.TryBindAssemblyNameToTarget(aref: AssemblyName): Choice = tryBindTargetAssemblySimple(aref.Name) - member __.TryBindSimpleAssemblyNameToTarget(assemblyName: string) = tryBindTargetAssemblySimple(assemblyName) + member __.TryBindSimpleAssemblyNameToTarget(assemblyName: string) = tryBindTargetAssemblySimple(assemblyName) member __.ILGlobals = ilGlobals.Value @@ -8944,22 +8944,22 @@ namespace ProviderImplementation.ProvidedTypes member __.FSharpCoreAssemblyVersion = fsharpCoreRefVersion.Force() - member this.ReadRelatedAssembly(fileName) = + member this.ReadRelatedAssembly(fileName) = let ilg = ilGlobals.Force() - let reader = ILModuleReaderAfterReadingAllBytes(fileName, ilg) + let reader = ILModuleReaderAfterReadingAllBytes(fileName, ilg) TargetAssembly(ilg, this.TryBindILAssemblyRefToTgt, Some reader, fileName) :> Assembly - member this.ReadRelatedAssembly(bytes:byte[]) = + member this.ReadRelatedAssembly(bytes:byte[]) = let fileName = "file.dll" let ilg = ilGlobals.Force() let reader = ILModuleReader(fileName, ByteFile(bytes), ilg, true) TargetAssembly(ilg, this.TryBindILAssemblyRefToTgt, Some reader, fileName) :> Assembly - member __.AddSourceAssembly(asm: Assembly) = + member __.AddSourceAssembly(asm: Assembly) = sourceAssembliesQueue.Add (fun () -> [| asm |]) - member __.AddTargetAssembly(asmName: AssemblyName, asm: Assembly) = - targetAssembliesQueue.Add (fun () -> + member __.AddTargetAssembly(asmName: AssemblyName, asm: Assembly) = + targetAssembliesQueue.Add (fun () -> targetAssembliesTable_.[asmName.Name] <- Choice1Of2 asm targetAssemblies_.Add asm) @@ -9071,10 +9071,10 @@ namespace ProviderImplementation.ProvidedTypes let getUncodedToken (tab:ILTableName) idx = ((tab.Index <<< 24) ||| idx) - let markerForUnicodeBytes (b:byte[]) = + let markerForUnicodeBytes (b:byte[]) = let len = b.Length - let rec scan i = - i < len/2 && + let rec scan i = + i < len/2 && (let b1 = Bytes.get b (i*2) let b2 = Bytes.get b (i*2+1) (b2 <> 0) @@ -9088,19 +9088,19 @@ namespace ProviderImplementation.ProvidedTypes marker - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Fixups - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /// Check that the data held at a fixup is some special magic value, as a sanity check /// to ensure the fixup is being placed at a ood location. - let checkFixup32 (data: byte[]) offset exp = + let checkFixup32 (data: byte[]) offset exp = if data.[offset + 3] <> b3 exp then failwith "fixup sanity check failed" if data.[offset + 2] <> b2 exp then failwith "fixup sanity check failed" if data.[offset + 1] <> b1 exp then failwith "fixup sanity check failed" if data.[offset] <> b0 exp then failwith "fixup sanity check failed" - let applyFixup32 (data:byte[]) offset v = + let applyFixup32 (data:byte[]) offset v = data.[offset] <- b0 v data.[offset+1] <- b1 v data.[offset+2] <- b2 v @@ -9110,7 +9110,7 @@ namespace ProviderImplementation.ProvidedTypes // TYPES FOR TABLES //--------------------------------------------------------------------- - module RowElementTags = + module RowElementTags = let [] UShort = 0 let [] ULong = 1 let [] Data = 2 @@ -9175,7 +9175,7 @@ namespace ProviderImplementation.ProvidedTypes let [] ResolutionScopeMax = 178 [] - type RowElement(tag:int32, idx: int32) = + type RowElement(tag:int32, idx: int32) = member __.Tag = tag member __.Val = idx @@ -9184,15 +9184,15 @@ namespace ProviderImplementation.ProvidedTypes let UShort (x:uint16) = RowElement(RowElementTags.UShort, int32 x) let ULong (x:int32) = RowElement(RowElementTags.ULong, x) /// Index into cenv.data or cenv.resources. Gets fixed up later once we known an overall - /// location for the data section. flag indicates if offset is relative to cenv.resources. + /// location for the data section. flag indicates if offset is relative to cenv.resources. let Data (x:int, k:bool) = RowElement((if k then RowElementTags.DataResources else RowElementTags.Data ), x) - /// pos. in guid array + /// pos. in guid array let Guid (x:int) = RowElement(RowElementTags.Guid, x) - /// pos. in blob array + /// pos. in blob array let Blob (x:int) = RowElement(RowElementTags.Blob, x) - /// pos. in string array + /// pos. in string array let StringE (x:int) = RowElement(RowElementTags.String, x) - /// pos. in some table + /// pos. in some table let SimpleIndex (t, x:int) = RowElement(RowElementTags.SimpleIndex t, x) let TypeDefOrRefOrSpec (t, x:int) = RowElement(RowElementTags.TypeDefOrRefOrSpec t, x) let TypeOrMethodDef (t, x:int) = RowElement(RowElementTags.TypeOrMethodDef t, x) @@ -9216,18 +9216,18 @@ namespace ProviderImplementation.ProvidedTypes let inline combineHash x2 acc = 37 * acc + x2 // (acc <<< 6 + acc >>> 2 + x2 + 0x9e3779b9) - let hashRow (elems:RowElement[]) = + let hashRow (elems:RowElement[]) = let mutable acc = 0 - for i in 0 .. elems.Length - 1 do - acc <- (acc <<< 1) + elems.[i].Tag + elems.[i].Val + 631 + for i in 0 .. elems.Length - 1 do + acc <- (acc <<< 1) + elems.[i].Tag + elems.[i].Val + 631 acc - let equalRows (elems:RowElement[]) (elems2:RowElement[]) = + let equalRows (elems:RowElement[]) (elems2:RowElement[]) = if elems.Length <> elems2.Length then false else let mutable ok = true let n = elems.Length - let mutable i = 0 - while ok && i < n do + let mutable i = 0 + while ok && i < n do if elems.[i].Tag <> elems2.[i].Tag || elems.[i].Val <> elems2.[i].Val then ok <- false i <- i + 1 ok @@ -9242,37 +9242,37 @@ namespace ProviderImplementation.ProvidedTypes type SharedRow(elems: RowElement[], hashCode: int) = member __.GenericRow = elems override __.GetHashCode() = hashCode - override __.Equals(obj:obj) = - match obj with + override __.Equals(obj:obj) = + match obj with | :? SharedRow as y -> equalRows elems y.GenericRow | _ -> false let SharedRow(elems: RowElement[]) = new SharedRow(elems, hashRow elems) /// Special representation: Note, only hashing by name - let AssemblyRefRow(s1, s2, s3, s4, l1, b1, nameIdx, str2, b2) = + let AssemblyRefRow(s1, s2, s3, s4, l1, b1, nameIdx, str2, b2) = let hashCode = hash nameIdx let genericRow = [| UShort s1; UShort s2; UShort s3; UShort s4; ULong l1; Blob b1; StringE nameIdx; StringE str2; Blob b2 |] new SharedRow(genericRow, hashCode) /// Special representation the computes the hash more efficiently - let MemberRefRow(mrp:RowElement, nmIdx:StringIndex, blobIdx:BlobIndex) = + let MemberRefRow(mrp:RowElement, nmIdx:StringIndex, blobIdx:BlobIndex) = let hashCode = combineHash (hash blobIdx) (combineHash (hash nmIdx) (hash mrp)) let genericRow = [| mrp; StringE nmIdx; Blob blobIdx |] new SharedRow(genericRow, hashCode) /// Unshared rows are used for definitional tables where elements do not need to be made unique - /// e.g. ILMethodDef and ILTypeDef. Most tables are like this. We don't precompute a + /// e.g. ILMethodDef and ILTypeDef. Most tables are like this. We don't precompute a /// hash code for these rows, and indeed the GetHashCode and Equals should not be needed. [] type UnsharedRow(elems: RowElement[]) = member __.GenericRow = elems override __.GetHashCode() = hashRow elems - override __.Equals(obj:obj) = - match obj with + override __.Equals(obj:obj) = + match obj with | :? UnsharedRow as y -> equalRows elems y.GenericRow | _ -> false - + //===================================================================== //===================================================================== @@ -9280,8 +9280,8 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== //===================================================================== - // This environment keeps track of how many generic parameters are in scope. - // This lets us translate AbsIL type variable number to IL type variable numbering + // This environment keeps track of how many generic parameters are in scope. + // This lets us translate AbsIL type variable number to IL type variable numbering type ILTypeWriterEnv = { EnclosingTyparCount: int } let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length } let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) } @@ -9294,21 +9294,21 @@ namespace ProviderImplementation.ProvidedTypes //--------------------------------------------------------------------- [] - type MetadataTable<'T> = + type MetadataTable<'T> = { name: string dict: Dictionary<'T, int> // given a row, find its entry number mutable rows: ResizeArray<'T> } member x.Count = x.rows.Count - static member New(nm, hashEq) = + static member New(nm, hashEq) = { name=nm dict = new Dictionary<_, _>(100, hashEq) rows= new ResizeArray<_>() } - member tbl.EntriesAsArray = + member tbl.EntriesAsArray = tbl.rows.ToArray() - member tbl.Entries = + member tbl.Entries = tbl.rows.ToArray() |> Array.toList member tbl.AddSharedEntry x = @@ -9329,9 +9329,9 @@ namespace ProviderImplementation.ProvidedTypes else tbl.AddSharedEntry x - /// This is only used in one special place - see further below. - member tbl.SetRowsOfTable (t: _[]) = - tbl.rows <- ResizeArray(t) + /// This is only used in one special place - see further below. + member tbl.SetRowsOfTable (t: _[]) = + tbl.rows <- ResizeArray(t) let h = tbl.dict h.Clear() t |> Array.iteri (fun i x -> h.[x] <- (i+1)) @@ -9340,22 +9340,22 @@ namespace ProviderImplementation.ProvidedTypes if tbl.dict.ContainsKey x then failwith ("duplicate entry '"+geterr x+"' in "+nm+" table") else tbl.AddSharedEntry x - member tbl.GetTableEntry x = tbl.dict.[x] + member tbl.GetTableEntry x = tbl.dict.[x] member tbl.GetTableKeys() = tbl.dict.Keys |> Seq.toArray //--------------------------------------------------------------------- // Keys into some of the tables //--------------------------------------------------------------------- - /// We use this key type to help find ILMethodDefs for MethodRefs + /// We use this key type to help find ILMethodDefs for MethodRefs type MethodDefKey(tidx:int, garity:int, nm:string, rty:ILType, argtys:ILTypes, isStatic:bool) = - // Precompute the hash. The hash doesn't include the return type or + // Precompute the hash. The hash doesn't include the return type or // argument types (only argument type count). This is very important, since // hashing these is way too expensive - let hashCode = - hash tidx - |> combineHash (hash garity) - |> combineHash (hash nm) + let hashCode = + hash tidx + |> combineHash (hash garity) + |> combineHash (hash nm) |> combineHash (hash argtys.Length) |> combineHash (hash isStatic) member __.TypeIdx = tidx @@ -9366,37 +9366,37 @@ namespace ProviderImplementation.ProvidedTypes member __.IsStatic = isStatic override __.ToString() = sprintf "%A" (tidx, garity, nm, rty, argtys, isStatic) override __.GetHashCode() = hashCode - override __.Equals(obj:obj) = - match obj with - | :? MethodDefKey as y -> - tidx = y.TypeIdx && - garity = y.GenericArity && - nm = y.Name && + override __.Equals(obj:obj) = + match obj with + | :? MethodDefKey as y -> + tidx = y.TypeIdx && + garity = y.GenericArity && + nm = y.Name && // note: these next two use structural equality on AbstractIL ILType values - rty = y.ReturnType && + rty = y.ReturnType && argtys = y.ArgTypes && isStatic = y.IsStatic | _ -> false /// We use this key type to help find ILFieldDefs for FieldRefs - type FieldDefKey(tidx:int, nm:string, ty:ILType) = - // precompute the hash. hash doesn't include the type - let hashCode = hash tidx |> combineHash (hash nm) + type FieldDefKey(tidx:int, nm:string, ty:ILType) = + // precompute the hash. hash doesn't include the type + let hashCode = hash tidx |> combineHash (hash nm) member __.TypeIdx = tidx member __.Name = nm member __.Type = ty override __.GetHashCode() = hashCode - override __.Equals(obj:obj) = - match obj with - | :? FieldDefKey as y -> - tidx = y.TypeIdx && - nm = y.Name && - ty = y.Type + override __.Equals(obj:obj) = + match obj with + | :? FieldDefKey as y -> + tidx = y.TypeIdx && + nm = y.Name && + ty = y.Type | _ -> false type PropertyTableKey = PropKey of int (* type. def. idx. *) * string * ILType * ILTypes type EventTableKey = EventKey of int (* type. def. idx. *) * string - type TypeDefTableKey = TdKey of string list * string uoption * string + type TypeDefTableKey = TdKey of string list * string uoption * string //--------------------------------------------------------------------- // The Writer Target @@ -9409,37 +9409,37 @@ namespace ProviderImplementation.ProvidedTypes member t.FindOrAddSharedEntry(x) = match t with Shared u -> u.FindOrAddSharedEntry(x) | Unshared u -> failwithf "FindOrAddSharedEntry: incorrect table kind, u.name = %s" u.name member t.AddSharedEntry(x) = match t with | Shared u -> u.AddSharedEntry(x) | Unshared u -> failwithf "AddSharedEntry: incorrect table kind, u.name = %s" u.name member t.AddUnsharedEntry(x) = match t with Unshared u -> u.AddUnsharedEntry(x) | Shared u -> failwithf "AddUnsharedEntry: incorrect table kind, u.name = %s" u.name - member t.GenericRowsOfTable = match t with Unshared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) | Shared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) + member t.GenericRowsOfTable = match t with Unshared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) | Shared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) member t.SetRowsOfSharedTable rows = match t with Shared u -> u.SetRowsOfTable (Array.map SharedRow rows) | Unshared u -> failwithf "SetRowsOfSharedTable: incorrect table kind, u.name = %s" u.name - member t.Count = match t with Unshared u -> u.Count | Shared u -> u.Count + member t.Count = match t with Unshared u -> u.Count | Shared u -> u.Count [] - type cenv = + type cenv = { ilg: ILGlobals emitTailcalls: bool deterministic: bool showTimes: bool desiredMetadataVersion: Version requiredDataFixups: ResizeArray<(int32 * (int * bool))> - /// References to strings in codestreams: offset of code and a (fixup-location , string token) list) + /// References to strings in codestreams: offset of code and a (fixup-location , string token) list) mutable requiredStringFixups: ResizeArray<(int32 * (int * int)[])> - codeChunks: ByteBuffer + codeChunks: ByteBuffer mutable nextCodeAddr: int32 - + // Collected debug information mutable moduleGuid: byte[] generatePdb: bool - /// Raw data, to go into the data section - data: ByteBuffer - /// Raw resource data, to go into the data section - resources: ByteBuffer - mutable entrypoint: (bool * int) option + /// Raw data, to go into the data section + data: ByteBuffer + /// Raw resource data, to go into the data section + resources: ByteBuffer + mutable entrypoint: (bool * int) option /// Caches trefCache: Dictionary - /// The following are all used to generate unique items in the output + /// The following are all used to generate unique items in the output tables: MetadataTable[] AssemblyRefs: MetadataTable fieldDefs: MetadataTable @@ -9447,16 +9447,16 @@ namespace ProviderImplementation.ProvidedTypes methodDefIdxs: Dictionary propertyDefs: MetadataTable eventDefs: MetadataTable - typeDefs: MetadataTable - guids: MetadataTable - blobs: MetadataTable - strings: MetadataTable + typeDefs: MetadataTable + guids: MetadataTable + blobs: MetadataTable + strings: MetadataTable userStrings: MetadataTable } member cenv.GetTable (tab:ILTableName) = cenv.tables.[tab.Index] - member cenv.AddCode ((reqdStringFixupsOffset, requiredStringFixups), code) = + member cenv.AddCode ((reqdStringFixupsOffset, requiredStringFixups), code) = cenv.requiredStringFixups.Add ((cenv.nextCodeAddr + reqdStringFixupsOffset, requiredStringFixups)) cenv.codeChunks.EmitBytes code cenv.nextCodeAddr <- cenv.nextCodeAddr + code.Length @@ -9473,24 +9473,24 @@ namespace ProviderImplementation.ProvidedTypes let AddUnsharedRow (cenv:cenv) tbl (x:UnsharedRow) = cenv.GetTable(tbl).AddUnsharedEntry x let metadataSchemaVersionSupportedByCLRVersion v = 2, 0 - - let headerVersionSupportedByCLRVersion v = - // The COM20HEADER version number - // Whidbey version numbers are 2.5 - // Earlier are 2.0 - // From an email from jeffschw: "Be built with a compiler that marks the COM20HEADER with Major >=2 and Minor >= 5. The V2.0 compilers produce images with 2.5, V1.x produces images with 2.0." + + let headerVersionSupportedByCLRVersion v = + // The COM20HEADER version number + // Whidbey version numbers are 2.5 + // Earlier are 2.0 + // From an email from jeffschw: "Be built with a compiler that marks the COM20HEADER with Major >=2 and Minor >= 5. The V2.0 compilers produce images with 2.5, V1.x produces images with 2.0." 2, 5 - let peOptionalHeaderByteByCLRVersion v = - // A flag in the PE file optional header seems to depend on CLI version - // Whidbey version numbers are 8 - // Earlier are 6 - // Tools are meant to ignore this, but the VS Profiler wants it to have the right value + let peOptionalHeaderByteByCLRVersion v = + // A flag in the PE file optional header seems to depend on CLI version + // Whidbey version numbers are 8 + // Earlier are 6 + // Tools are meant to ignore this, but the VS Profiler wants it to have the right value 8 - - // returned by writeBinaryAndReportMappings + + // returned by writeBinaryAndReportMappings [] - type ILTokenMappings = + type ILTokenMappings = { TypeDefTokenMap: ILTypeDef list * ILTypeDef -> int32 FieldDefTokenMap: ILTypeDef list * ILTypeDef -> ILFieldDef -> int32 MethodDefTokenMap: ILTypeDef list * ILTypeDef -> ILMethodDef -> int32 @@ -9498,295 +9498,295 @@ namespace ProviderImplementation.ProvidedTypes EventTokenMap: ILTypeDef list * ILTypeDef -> ILEventDef -> int32 } let recordRequiredDataFixup (requiredDataFixups: ResizeArray<_>) (buf: ByteBuffer) pos lab = - requiredDataFixups.Add((pos, lab)) - // Write a special value in that we check later when applying the fixup + requiredDataFixups.Add((pos, lab)) + // Write a special value in that we check later when applying the fixup buf.EmitInt32 0xdeaddddd //--------------------------------------------------------------------- // The UserString, BlobHeap, GuidHeap tables //--------------------------------------------------------------------- - let GetUserStringHeapIdx cenv s = + let GetUserStringHeapIdx cenv s = cenv.userStrings.FindOrAddSharedEntry s - let GetBytesAsBlobIdx cenv (bytes:byte[]) = - if bytes.Length = 0 then 0 + let GetBytesAsBlobIdx cenv (bytes:byte[]) = + if bytes.Length = 0 then 0 else cenv.blobs.FindOrAddSharedEntry bytes - let GetStringHeapIdx cenv s = - if s = "" then 0 + let GetStringHeapIdx cenv s = + if s = "" then 0 else cenv.strings.FindOrAddSharedEntry s let GetGuidIdx cenv info = cenv.guids.FindOrAddSharedEntry info let GetStringHeapIdxOption cenv sopt = - match sopt with + match sopt with | USome ns -> GetStringHeapIdx cenv ns | UNone -> 0 - let splitNameAt (nm:string) idx = + let splitNameAt (nm:string) idx = if idx < 0 then failwith "splitNameAt: idx < 0"; - let last = nm.Length - 1 + let last = nm.Length - 1 if idx > last then failwith "splitNameAt: idx > last"; (nm.Substring(0,idx)), (if idx < last then nm.Substring (idx+1,last - idx) else "") - module String = + module String = let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index for the character was not found in the string")) - let index (s:string) (c:char) = - let r = s.IndexOf(c) + let index (s:string) (c:char) = + let r = s.IndexOf(c) if r = -1 then indexNotFound() else r let rindex (s:string) (c:char) = - let r = s.LastIndexOf(c) + let r = s.LastIndexOf(c) if r = -1 then indexNotFound() else r - let contains (s:string) (c:char) = + let contains (s:string) (c:char) = s.IndexOf(c,0,String.length s) <> -1 - let splitTypeNameRightAux nm = - if String.contains nm '.' then + let splitTypeNameRightAux nm = + if String.contains nm '.' then let idx = String.rindex nm '.' let s1,s2 = splitNameAt nm idx - Some s1,s2 + Some s1,s2 else None, nm let splitTypeNameRight nm = splitTypeNameRightAux nm let GetTypeNameAsElemPair cenv (n1,n2) = - StringE (GetStringHeapIdxOption cenv n1), + StringE (GetStringHeapIdxOption cenv n1), StringE (GetStringHeapIdx cenv n2) //===================================================================== - // Pass 1 - allocate indexes for types + // Pass 1 - allocate indexes for types //===================================================================== let addILTypeName enc (td: ILTypeDef) = enc@[(if td.IsNested then td.Name else joinILTypeName td.Namespace td.Name)] - let rec GenTypeDefPass1 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass1 enc cenv (td:ILTypeDef) = ignore (cenv.typeDefs.AddUniqueEntry "type index" (fun (TdKey (_, _, n)) -> n) (TdKey (enc, td.Namespace, td.Name))) GenTypeDefsPass1 (addILTypeName enc td) cenv td.NestedTypes.Entries and GenTypeDefsPass1 enc cenv tds = Array.iter (GenTypeDefPass1 enc cenv) tds //===================================================================== - // Pass 2 - allocate indexes for methods and fields and write rows for types + // Pass 2 - allocate indexes for methods and fields and write rows for types //===================================================================== - let rec GetIdxForTypeDef cenv key = + let rec GetIdxForTypeDef cenv key = try cenv.typeDefs.GetTableEntry key - with - :? KeyNotFoundException -> + with + :? KeyNotFoundException -> let (TdKey (enc, nsp, n) ) = key failwithf "One of your modules expects the type '%s' to be defined within the module being emitted. keys = %A" (String.concat "." (enc@[joinILTypeName nsp n])) (cenv.typeDefs.GetTableKeys()) 0 - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Assembly and module references - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let rec GetAssemblyRefAsRow cenv (aref:ILAssemblyRef) = - AssemblyRefRow - ((match aref.Version with UNone -> 0us | USome v -> uint16 v.Major), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Minor), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Build), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Revision), + AssemblyRefRow + ((match aref.Version with UNone -> 0us | USome v -> uint16 v.Major), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Minor), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Build), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Revision), ((match aref.PublicKey with USome (PublicKey _) -> 0x0001 | _ -> 0x0000) - ||| (if aref.Retargetable then 0x0100 else 0x0000)), - BlobIndex (match aref.PublicKey with - | UNone -> 0 - | USome (PublicKey b | PublicKeyToken b) -> GetBytesAsBlobIdx cenv b), - StringIndex (GetStringHeapIdx cenv aref.Name), - StringIndex (match aref.Locale with UNone -> 0 | USome s -> GetStringHeapIdx cenv s), + ||| (if aref.Retargetable then 0x0100 else 0x0000)), + BlobIndex (match aref.PublicKey with + | UNone -> 0 + | USome (PublicKey b | PublicKeyToken b) -> GetBytesAsBlobIdx cenv b), + StringIndex (GetStringHeapIdx cenv aref.Name), + StringIndex (match aref.Locale with UNone -> 0 | USome s -> GetStringHeapIdx cenv s), BlobIndex (match aref.Hash with UNone -> 0 | USome s -> GetBytesAsBlobIdx cenv s)) - - and GetAssemblyRefAsIdx cenv aref = + + and GetAssemblyRefAsIdx cenv aref = FindOrAddSharedRow cenv ILTableNames.AssemblyRef (GetAssemblyRefAsRow cenv aref) and GetModuleRefAsRow cenv (mref:ILModuleRef) = - SharedRow + SharedRow [| StringE (GetStringHeapIdx cenv mref.Name) |] and GetModuleRefAsFileRow cenv (mref:ILModuleRef) = - SharedRow + SharedRow [| ULong (if mref.HasMetadata then 0x0000 else 0x0001) StringE (GetStringHeapIdx cenv mref.Name) (match mref.Hash with UNone -> Blob 0 | USome s -> Blob (GetBytesAsBlobIdx cenv s)) |] - and GetModuleRefAsIdx cenv mref = + and GetModuleRefAsIdx cenv mref = FindOrAddSharedRow cenv ILTableNames.ModuleRef (GetModuleRefAsRow cenv mref) - and GetModuleRefAsFileIdx cenv mref = + and GetModuleRefAsFileIdx cenv mref = FindOrAddSharedRow cenv ILTableNames.File (GetModuleRefAsFileRow cenv mref) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Does a ILScopeRef point to this module? - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let isScopeRefLocal scoref = (scoref = ILScopeRef.Local) + let isScopeRefLocal scoref = (scoref = ILScopeRef.Local) let rec isTypeRefLocal (tref:ILTypeRef) = - isILTypeScopeRefLocal tref.Scope + isILTypeScopeRefLocal tref.Scope and isILTypeScopeRefLocal (scoref:ILTypeRefScope) = - match scoref with + match scoref with | ILTypeRefScope.Top t -> isScopeRefLocal t | ILTypeRefScope.Nested tref -> isTypeRefLocal tref let rec enclosing (scoref:ILTypeRefScope) = - match scoref with + match scoref with | ILTypeRefScope.Top _ -> [] | ILTypeRefScope.Nested tref -> enclosing tref.Scope @ [joinILTypeName tref.Namespace tref.Name] let isTypeLocal (typ:ILType) = typ.IsNominal && isEmpty typ.GenericArgs && isTypeRefLocal typ.TypeRef - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Scopes to Implementation elements. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetScopeRefAsImplementationElem cenv scoref = - match scoref with + let GetScopeRefAsImplementationElem cenv scoref = + match scoref with | ILScopeRef.Local -> (ImplementationTag.AssemblyRef, 0) | ILScopeRef.Assembly aref -> (ImplementationTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) | ILScopeRef.Module mref -> (ImplementationTag.File, GetModuleRefAsFileIdx cenv mref) - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Type references, types etc. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetTypeRefAsTypeRefRow cenv (tref:ILTypeRef) = + let rec GetTypeRefAsTypeRefRow cenv (tref:ILTypeRef) = let nselem, nelem = GetTypeNameAsElemPair cenv (tref.Namespace, tref.Name) let rs1, rs2 = GetResolutionScopeAsElem cenv tref.Scope SharedRow [| ResolutionScope (rs1, rs2); nelem; nselem |] - and GetTypeRefAsTypeRefIdx cenv tref = + and GetTypeRefAsTypeRefIdx cenv tref = let mutable res = 0 - if cenv.trefCache.TryGetValue(tref, &res) then res else + if cenv.trefCache.TryGetValue(tref, &res) then res else let res = FindOrAddSharedRow cenv ILTableNames.TypeRef (GetTypeRefAsTypeRefRow cenv tref) cenv.trefCache.[tref] <- res res - and GetTypeDescAsTypeRefIdx cenv (enc, nsp, n) = + and GetTypeDescAsTypeRefIdx cenv (enc, nsp, n) = GetTypeRefAsTypeRefIdx cenv (ILTypeRef (enc, nsp, n)) - and GetResolutionScopeAsElem cenv scoref = - match scoref with - | ILTypeRefScope.Top s -> - match s with - | ILScopeRef.Local -> (ResolutionScopeTag.Module, 1) + and GetResolutionScopeAsElem cenv scoref = + match scoref with + | ILTypeRefScope.Top s -> + match s with + | ILScopeRef.Local -> (ResolutionScopeTag.Module, 1) | ILScopeRef.Assembly aref -> (ResolutionScopeTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) | ILScopeRef.Module mref -> (ResolutionScopeTag.ModuleRef, GetModuleRefAsIdx cenv mref) - - | ILTypeRefScope.Nested tref -> + + | ILTypeRefScope.Nested tref -> (ResolutionScopeTag.TypeRef, GetTypeRefAsTypeRefIdx cenv tref) - - let emitTypeInfoAsTypeDefOrRefEncoded cenv (bb: ByteBuffer) (scoref, nsp, nm) = - if isILTypeScopeRefLocal scoref then + + let emitTypeInfoAsTypeDefOrRefEncoded cenv (bb: ByteBuffer) (scoref, nsp, nm) = + if isILTypeScopeRefLocal scoref then let idx = GetIdxForTypeDef cenv (TdKey(enclosing scoref, nsp, nm)) - bb.EmitZ32 (idx <<< 2) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeDef - else + bb.EmitZ32 (idx <<< 2) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeDef + else let idx = GetTypeDescAsTypeRefIdx cenv (scoref, nsp, nm) - bb.EmitZ32 ((idx <<< 2) ||| 0x01) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeRef + bb.EmitZ32 ((idx <<< 2) ||| 0x01) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeRef let getTypeDefOrRefAsUncodedToken (tag, idx) = - let tab = - if tag = TypeDefOrRefOrSpecTag.TypeDef then ILTableNames.TypeDef - elif tag = TypeDefOrRefOrSpecTag.TypeRef then ILTableNames.TypeRef + let tab = + if tag = TypeDefOrRefOrSpecTag.TypeDef then ILTableNames.TypeDef + elif tag = TypeDefOrRefOrSpecTag.TypeRef then ILTableNames.TypeRef elif tag = TypeDefOrRefOrSpecTag.TypeSpec then ILTableNames.TypeSpec else failwith "getTypeDefOrRefAsUncodedToken" getUncodedToken tab idx // REVIEW: write into an accumulating buffer - let EmitArrayShape (bb: ByteBuffer) (ILArrayShape shape) = + let EmitArrayShape (bb: ByteBuffer) (ILArrayShape shape) = let sized = Array.filter (function (_, Some _) -> true | _ -> false) shape let lobounded = Array.filter (function (Some _, _) -> true | _ -> false) shape bb.EmitZ32 shape.Length bb.EmitZ32 sized.Length sized |> Array.iter (function (_, Some sz) -> bb.EmitZ32 sz | _ -> failwith "?") bb.EmitZ32 lobounded.Length - lobounded |> Array.iter (function (Some low, _) -> bb.EmitZ32 low | _ -> failwith "?") - + lobounded |> Array.iter (function (Some low, _) -> bb.EmitZ32 low | _ -> failwith "?") + let hasthisToByte hasthis = - match hasthis with + match hasthis with | ILThisConvention.Instance -> e_IMAGE_CEE_CS_CALLCONV_INSTANCE | ILThisConvention.InstanceExplicit -> e_IMAGE_CEE_CS_CALLCONV_INSTANCE_EXPLICIT | ILThisConvention.Static -> 0x00uy - let callconvToByte ntypars (Callconv (hasthis, bcc)) = + let callconvToByte ntypars (Callconv (hasthis, bcc)) = hasthisToByte hasthis ||| (if ntypars > 0 then e_IMAGE_CEE_CS_CALLCONV_GENERIC else 0x00uy) ||| - (match bcc with + (match bcc with | ILArgConvention.FastCall -> e_IMAGE_CEE_CS_CALLCONV_FASTCALL | ILArgConvention.StdCall -> e_IMAGE_CEE_CS_CALLCONV_STDCALL | ILArgConvention.ThisCall -> e_IMAGE_CEE_CS_CALLCONV_THISCALL | ILArgConvention.CDecl -> e_IMAGE_CEE_CS_CALLCONV_CDECL | ILArgConvention.Default -> 0x00uy | ILArgConvention.VarArg -> e_IMAGE_CEE_CS_CALLCONV_VARARG) - + // REVIEW: write into an accumulating buffer - let rec EmitTypeSpec cenv env (bb: ByteBuffer) (et, tspec:ILTypeSpec) = - if isEmpty tspec.GenericArgs then + let rec EmitTypeSpec cenv env (bb: ByteBuffer) (et, tspec:ILTypeSpec) = + if isEmpty tspec.GenericArgs then bb.EmitByte et emitTypeInfoAsTypeDefOrRefEncoded cenv bb (tspec.Scope, tspec.Namespace, tspec.Name) - else + else bb.EmitByte et_WITH bb.EmitByte et emitTypeInfoAsTypeDefOrRefEncoded cenv bb (tspec.Scope, tspec.Namespace, tspec.Name) bb.EmitZ32 tspec.GenericArgs.Length EmitTypes cenv env bb tspec.GenericArgs - and GetTypeAsTypeDefOrRef cenv env (ty:ILType) = - if isTypeLocal ty then + and GetTypeAsTypeDefOrRef cenv env (ty:ILType) = + if isTypeLocal ty then let tref = ty.TypeRef (TypeDefOrRefOrSpecTag.TypeDef, GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name))) elif ty.IsNominal && isEmpty ty.GenericArgs then (TypeDefOrRefOrSpecTag.TypeRef, GetTypeRefAsTypeRefIdx cenv ty.TypeRef) - else + else (TypeDefOrRefOrSpecTag.TypeSpec, GetTypeAsTypeSpecIdx cenv env ty) and GetTypeAsBytes cenv env ty = emitBytesViaBuffer (fun bb -> EmitType cenv env bb ty) - and GetTypeOfLocalAsBytes cenv env (l: ILLocal) = + and GetTypeOfLocalAsBytes cenv env (l: ILLocal) = emitBytesViaBuffer (fun bb -> EmitLocalInfo cenv env bb l) - and GetTypeAsBlobIdx cenv env (ty:ILType) = + and GetTypeAsBlobIdx cenv env (ty:ILType) = GetBytesAsBlobIdx cenv (GetTypeAsBytes cenv env ty) - and GetTypeAsTypeSpecRow cenv env (ty:ILType) = + and GetTypeAsTypeSpecRow cenv env (ty:ILType) = SharedRow [| Blob (GetTypeAsBlobIdx cenv env ty) |] - and GetTypeAsTypeSpecIdx cenv env ty = + and GetTypeAsTypeSpecIdx cenv env ty = FindOrAddSharedRow cenv ILTableNames.TypeSpec (GetTypeAsTypeSpecRow cenv env ty) and EmitType cenv env bb ty = - match ty with + match ty with | ElementType et -> bb.EmitByte et | ILType.Boxed tspec -> EmitTypeSpec cenv env bb (et_CLASS, tspec) | ILType.Value tspec -> EmitTypeSpec cenv env bb (et_VALUETYPE, tspec) - | ILType.Array (shape, ty) -> + | ILType.Array (shape, ty) -> if shape = ILArrayShape.SingleDimensional then (bb.EmitByte et_SZARRAY ; EmitType cenv env bb ty) else (bb.EmitByte et_ARRAY; EmitType cenv env bb ty; EmitArrayShape bb shape) - | ILType.Var tv -> + | ILType.Var tv -> let cgparams = env.EnclosingTyparCount - if int32 tv < cgparams then + if int32 tv < cgparams then bb.EmitByte et_VAR bb.EmitZ32 (int32 tv) else bb.EmitByte et_MVAR bb.EmitZ32 (int32 tv - cgparams) - | ILType.Byref typ -> + | ILType.Byref typ -> bb.EmitByte et_BYREF EmitType cenv env bb typ - | ILType.Ptr typ -> + | ILType.Ptr typ -> bb.EmitByte et_PTR EmitType cenv env bb typ - | ILType.Void -> - bb.EmitByte et_VOID + | ILType.Void -> + bb.EmitByte et_VOID | ILType.FunctionPointer x -> bb.EmitByte et_FNPTR EmitCallsig cenv env bb (x.CallingConv, x.ArgTypes, x.ReturnType, None, 0) @@ -9797,31 +9797,31 @@ namespace ProviderImplementation.ProvidedTypes | _ -> failwith "EmitType" and EmitLocalInfo cenv env (bb:ByteBuffer) (l:ILLocal) = - if l.IsPinned then + if l.IsPinned then bb.EmitByte et_PINNED EmitType cenv env bb l.Type - and EmitCallsig cenv env (bb:ByteBuffer) (callconv, args:ILTypes, ret, varargs:ILVarArgs, genarity) = + and EmitCallsig cenv env (bb:ByteBuffer) (callconv, args:ILTypes, ret, varargs:ILVarArgs, genarity) = bb.EmitByte (callconvToByte genarity callconv) if genarity > 0 then bb.EmitZ32 genarity bb.EmitZ32 ((args.Length + (match varargs with None -> 0 | Some l -> l.Length))) EmitType cenv env bb ret args |> Array.iter (EmitType cenv env bb) - match varargs with - | None -> ()// no extra arg = no sentinel - | Some tys -> - if isEmpty tys then () // no extra arg = no sentinel - else + match varargs with + | None -> ()// no extra arg = no sentinel + | Some tys -> + if isEmpty tys then () // no extra arg = no sentinel + else bb.EmitByte et_SENTINEL Array.iter (EmitType cenv env bb) tys and GetCallsigAsBytes cenv env x = emitBytesViaBuffer (fun bb -> EmitCallsig cenv env bb x) - and EmitTypes cenv env bb (inst: ILTypes) = - inst |> Array.iter (EmitType cenv env bb) + and EmitTypes cenv env bb (inst: ILTypes) = + inst |> Array.iter (EmitType cenv env bb) let GetTypeAsMemberRefParent cenv env ty = - match GetTypeAsTypeDefOrRef cenv env ty with + match GetTypeAsTypeDefOrRef cenv env ty with | (tag, _) when tag = TypeDefOrRefOrSpecTag.TypeDef -> printfn "GetTypeAsMemberRefParent: mspec should have been encoded as mdtMethodDef?"; MemberRefParent (MemberRefParentTag.TypeRef, 1) | (tag, tok) when tag = TypeDefOrRefOrSpecTag.TypeRef -> MemberRefParent (MemberRefParentTag.TypeRef, tok) | (tag, tok) when tag = TypeDefOrRefOrSpecTag.TypeSpec -> MemberRefParent (MemberRefParentTag.TypeSpec, tok) @@ -9830,16 +9830,16 @@ namespace ProviderImplementation.ProvidedTypes - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Native types - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldInitAsBlobIdx cenv (x:ILFieldInit) = + let rec GetFieldInitAsBlobIdx cenv (x:ILFieldInit) = GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> GetFieldInit bb x)) // REVIEW: write into an accumulating buffer - and GetFieldInit (bb: ByteBuffer) x = - match x with + and GetFieldInit (bb: ByteBuffer) x = + match x with | :? string as b -> bb.EmitBytes (Encoding.Unicode.GetBytes b) | :? bool as b -> bb.EmitByte (if b then 0x01uy else 0x00uy) | :? char as x -> bb.EmitUInt16 (uint16 x) @@ -9855,10 +9855,10 @@ namespace ProviderImplementation.ProvidedTypes | :? double as x -> bb.EmitInt64 (bitsOfDouble x) | _ -> bb.EmitInt32 0 - and GetFieldInitFlags (i: ILFieldInit) = - UShort + and GetFieldInitFlags (i: ILFieldInit) = + UShort (uint16 - (match i with + (match i with | :? string -> et_STRING | :? bool -> et_BOOLEAN | :? char -> et_CHAR @@ -9873,13 +9873,13 @@ namespace ProviderImplementation.ProvidedTypes | :? single -> et_R4 | :? double -> et_R8 | _ -> et_CLASS)) - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Type definitions - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetMemberAccessFlags access = - match access with + let GetMemberAccessFlags access = + match access with | ILMemberAccess.CompilerControlled -> 0x00000000 | ILMemberAccess.Public -> 0x00000006 | ILMemberAccess.Private -> 0x00000001 @@ -9888,8 +9888,8 @@ namespace ProviderImplementation.ProvidedTypes | ILMemberAccess.FamilyOrAssembly -> 0x00000005 | ILMemberAccess.Assembly -> 0x00000003 - let GetTypeAccessFlags access = - match access with + let GetTypeAccessFlags access = + match access with | ILTypeDefAccess.Public -> 0x00000001 | ILTypeDefAccess.Private -> 0x00000000 | ILTypeDefAccess.Nested ILMemberAccess.Public -> 0x00000002 @@ -9900,20 +9900,20 @@ namespace ProviderImplementation.ProvidedTypes | ILTypeDefAccess.Nested ILMemberAccess.Assembly -> 0x00000005 | ILTypeDefAccess.Nested ILMemberAccess.CompilerControlled -> failwith "bad type access" - let rec GetTypeDefAsRow cenv env _enc (td:ILTypeDef) = + let rec GetTypeDefAsRow cenv env _enc (td:ILTypeDef) = let nselem, nelem = GetTypeNameAsElemPair cenv (td.Namespace, td.Name) - let flags = + let flags = if td.Name = "" then 0x00000000 else - + int td.Attributes ||| - begin - match td.Layout with + begin + match td.Layout with | ILTypeDefLayout.Auto -> 0x00000000 | ILTypeDefLayout.Sequential _ -> 0x00000008 | ILTypeDefLayout.Explicit _ -> 0x00000010 end ||| - begin + begin match td.Kind with | ILTypeDefKind.Interface -> 0x00000020 | _ -> 0x00000000 @@ -9925,98 +9925,98 @@ namespace ProviderImplementation.ProvidedTypes 0x0 let tdorTag, tdorRow = GetTypeOptionAsTypeDefOrRef cenv env td.Extends - UnsharedRow - [| ULong flags - nelem - nselem - TypeDefOrRefOrSpec (tdorTag, tdorRow) - SimpleIndex (ILTableNames.Field, cenv.fieldDefs.Count + 1) - SimpleIndex (ILTableNames.Method, cenv.methodDefIdxsByKey.Count + 1) |] - - and GetTypeOptionAsTypeDefOrRef cenv env tyOpt = + UnsharedRow + [| ULong flags + nelem + nselem + TypeDefOrRefOrSpec (tdorTag, tdorRow) + SimpleIndex (ILTableNames.Field, cenv.fieldDefs.Count + 1) + SimpleIndex (ILTableNames.Method, cenv.methodDefIdxsByKey.Count + 1) |] + + and GetTypeOptionAsTypeDefOrRef cenv env tyOpt = match tyOpt with | None -> (TypeDefOrRefOrSpecTag.TypeDef, 0) | Some ty -> (GetTypeAsTypeDefOrRef cenv env ty) - and GetTypeDefAsPropertyMapRow cenv tidx = + and GetTypeDefAsPropertyMapRow cenv tidx = UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) - SimpleIndex (ILTableNames.Property, cenv.propertyDefs.Count + 1) |] + SimpleIndex (ILTableNames.Property, cenv.propertyDefs.Count + 1) |] - and GetTypeDefAsEventMapRow cenv tidx = + and GetTypeDefAsEventMapRow cenv tidx = UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) - SimpleIndex (ILTableNames.Event, cenv.eventDefs.Count + 1) |] - - and GetKeyForFieldDef tidx (fd: ILFieldDef) = + SimpleIndex (ILTableNames.Event, cenv.eventDefs.Count + 1) |] + + and GetKeyForFieldDef tidx (fd: ILFieldDef) = FieldDefKey (tidx, fd.Name, fd.FieldType) - and GenFieldDefPass2 cenv tidx fd = + and GenFieldDefPass2 cenv tidx fd = ignore (cenv.fieldDefs.AddUniqueEntry "field" (fun (fdkey:FieldDefKey) -> fdkey.Name) (GetKeyForFieldDef tidx fd)) - and GetKeyForMethodDef tidx (md: ILMethodDef) = + and GetKeyForMethodDef tidx (md: ILMethodDef) = MethodDefKey (tidx, md.GenericParams.Length, md.Name, md.Return.Type, md.ParameterTypes, md.CallingConv.IsStatic) - and GenMethodDefPass2 cenv tidx md = - let idx = + and GenMethodDefPass2 cenv tidx md = + let idx = cenv.methodDefIdxsByKey.AddUniqueEntry - "method" - (fun (key:MethodDefKey) -> + "method" + (fun (key:MethodDefKey) -> printfn "Duplicate in method table is:" printfn "%s" (" Type index: "+string key.TypeIdx) printfn "%s" (" Method name: "+key.Name) printfn "%s" (" Method arity (num generic params): "+string key.GenericArity) key.Name ) - (GetKeyForMethodDef tidx md) - + (GetKeyForMethodDef tidx md) + cenv.methodDefIdxs.[md] <- idx - and GetKeyForPropertyDef tidx (x: ILPropertyDef) = + and GetKeyForPropertyDef tidx (x: ILPropertyDef) = PropKey (tidx, x.Name, x.PropertyType, x.IndexParameterTypes) - and GenPropertyDefPass2 cenv tidx x = + and GenPropertyDefPass2 cenv tidx x = ignore (cenv.propertyDefs.AddUniqueEntry "property" (fun (PropKey (_, n, _, _)) -> n) (GetKeyForPropertyDef tidx x)) and GetTypeAsImplementsRow cenv env tidx ty = let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env ty - UnsharedRow - [| SimpleIndex (ILTableNames.TypeDef, tidx) + UnsharedRow + [| SimpleIndex (ILTableNames.TypeDef, tidx) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] and GenImplementsPass2 cenv env tidx ty = AddUnsharedRow cenv ILTableNames.InterfaceImpl (GetTypeAsImplementsRow cenv env tidx ty) |> ignore - - and GetKeyForEvent tidx (x: ILEventDef) = + + and GetKeyForEvent tidx (x: ILEventDef) = EventKey (tidx, x.Name) - and GenEventDefPass2 cenv tidx x = + and GenEventDefPass2 cenv tidx x = ignore (cenv.eventDefs.AddUniqueEntry "event" (fun (EventKey(_, b)) -> b) (GetKeyForEvent tidx x)) and GenTypeDefPass2 pidx enc cenv (td:ILTypeDef) = - try + try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) let tidx2 = AddUnsharedRow cenv ILTableNames.TypeDef (GetTypeDefAsRow cenv env enc td) if tidx <> tidx2 then failwith "index of typedef on second pass does not match index on first pass" - // Add entries to auxiliary mapping tables, e.g. Nested, PropertyMap etc. - // Note Nested is organised differently to the others... + // Add entries to auxiliary mapping tables, e.g. Nested, PropertyMap etc. + // Note Nested is organised differently to the others... if not (isNil enc) then - AddUnsharedRow cenv ILTableNames.Nested - (UnsharedRow - [| SimpleIndex (ILTableNames.TypeDef, tidx) + AddUnsharedRow cenv ILTableNames.Nested + (UnsharedRow + [| SimpleIndex (ILTableNames.TypeDef, tidx) SimpleIndex (ILTableNames.TypeDef, pidx) |]) |> ignore let props = td.Properties.Entries - if not (isEmpty props) then - AddUnsharedRow cenv ILTableNames.PropertyMap (GetTypeDefAsPropertyMapRow cenv tidx) |> ignore + if not (isEmpty props) then + AddUnsharedRow cenv ILTableNames.PropertyMap (GetTypeDefAsPropertyMapRow cenv tidx) |> ignore let events = td.Events.Entries - if not (isEmpty events) then + if not (isEmpty events) then AddUnsharedRow cenv ILTableNames.EventMap (GetTypeDefAsEventMapRow cenv tidx) |> ignore - // 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. + // 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. td.Implements |> Array.iter (GenImplementsPass2 cenv env tidx) props |> Array.iter (GenPropertyDefPass2 cenv tidx) events |> Array.iter (GenEventDefPass2 cenv tidx) @@ -10034,56 +10034,56 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== exception MethodDefNotFound - let FindMethodDefIdx cenv mdkey = + let FindMethodDefIdx cenv mdkey = try cenv.methodDefIdxsByKey.GetTableEntry mdkey - with :? KeyNotFoundException -> - let typeNameOfIdx i = - match - (cenv.typeDefs.dict - |> Seq.fold (fun sofar kvp -> - let tkey2 = kvp.Key - let tidx2 = kvp.Value - if i = tidx2 then - if sofar = None then - Some tkey2 - else failwith "multiple type names map to index" - else sofar) None) with + with :? KeyNotFoundException -> + let typeNameOfIdx i = + match + (cenv.typeDefs.dict + |> Seq.fold (fun sofar kvp -> + let tkey2 = kvp.Key + let tidx2 = kvp.Value + if i = tidx2 then + if sofar = None then + Some tkey2 + else failwith "multiple type names map to index" + else sofar) None) with | Some x -> x - | None -> raise MethodDefNotFound + | None -> raise MethodDefNotFound let (TdKey (tenc, tnsp, tname)) = typeNameOfIdx mdkey.TypeIdx printfn "%s" ("The local method '"+(String.concat "." (tenc@[tname]))+"'::'"+mdkey.Name+"' was referenced but not declared") printfn "generic arity: %s " (string mdkey.GenericArity) - cenv.methodDefIdxsByKey.dict |> Seq.iter (fun (KeyValue(mdkey2, _)) -> - if mdkey2.TypeIdx = mdkey.TypeIdx && mdkey.Name = mdkey2.Name then + cenv.methodDefIdxsByKey.dict |> Seq.iter (fun (KeyValue(mdkey2, _)) -> + if mdkey2.TypeIdx = mdkey.TypeIdx && mdkey.Name = mdkey2.Name then let (TdKey (tenc2, tnsp2, tname2)) = typeNameOfIdx mdkey2.TypeIdx printfn "%s" ("A method in '"+(String.concat "." (tenc2@[tname2]))+"' had the right name but the wrong signature:") - printfn "%s" ("generic arity: "+string mdkey2.GenericArity) + printfn "%s" ("generic arity: "+string mdkey2.GenericArity) printfn "mdkey2 = %s" (mdkey2.ToString())) raise MethodDefNotFound - let rec GetMethodDefIdx cenv md = + let rec GetMethodDefIdx cenv md = cenv.methodDefIdxs.[md] - and FindFieldDefIdx cenv fdkey = - try cenv.fieldDefs.GetTableEntry fdkey - with :? KeyNotFoundException -> + and FindFieldDefIdx cenv fdkey = + try cenv.fieldDefs.GetTableEntry fdkey + with :? KeyNotFoundException -> failwith ("The local field "+fdkey.Name+" was referenced but not declared") 1 - and GetFieldDefAsFieldDefIdx cenv tidx fd = - FindFieldDefIdx cenv (GetKeyForFieldDef tidx fd) + and GetFieldDefAsFieldDefIdx cenv tidx fd = + FindFieldDefIdx cenv (GetKeyForFieldDef tidx fd) - // -------------------------------------------------------------------- - // ILMethodRef --> ILMethodDef. - // - // Only successfully converts ILMethodRef's referring to + // -------------------------------------------------------------------- + // ILMethodRef --> ILMethodDef. + // + // Only successfully converts ILMethodRef's referring to // methods in the module being emitted. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let GetMethodRefAsMethodDefIdx cenv (mref:ILMethodRef) = let tref = mref.EnclosingTypeRef - try + try if not (isTypeRefLocal tref) then failwithf "method referred to by method impl, event or property is not in a type defined in this module, method ref is %A" mref let tidx = GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name)) @@ -10093,14 +10093,14 @@ namespace ProviderImplementation.ProvidedTypes failwithf "Error in GetMethodRefAsMethodDefIdx for mref = %A, error: %s" (mref.Name, tref.Name) e.Message let rec MethodRefInfoAsMemberRefRow cenv env fenv (nm, typ, callconv, args, ret, varargs, genarity) = - MemberRefRow(GetTypeAsMemberRefParent cenv env typ, - GetStringHeapIdx cenv nm, + MemberRefRow(GetTypeAsMemberRefParent cenv env typ, + GetStringHeapIdx cenv nm, GetMethodRefInfoAsBlobIdx cenv fenv (callconv, args, ret, varargs, genarity)) - and GetMethodRefInfoAsBlobIdx cenv env info = + and GetMethodRefInfoAsBlobIdx cenv env info = GetBytesAsBlobIdx cenv (GetCallsigAsBytes cenv env info) - let GetMethodRefInfoAsMemberRefIdx cenv env ((_, typ, _, _, _, _, _) as minfo) = + let GetMethodRefInfoAsMemberRefIdx cenv env ((_, typ, _, _, _, _, _) as minfo) = let fenv = envForMethodRef env typ FindOrAddSharedRow cenv ILTableNames.MemberRef (MethodRefInfoAsMemberRefRow cenv env fenv minfo) @@ -10112,39 +10112,39 @@ namespace ProviderImplementation.ProvidedTypes else (MethodDefOrRefTag.MemberRef, GetMethodRefInfoAsMemberRefIdx cenv env minfo) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodSpec --> ILMethodRef/ILMethodDef/ILMethodSpec - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetMethodSpecInfoAsMethodSpecIdx cenv env (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = + let rec GetMethodSpecInfoAsMethodSpecIdx cenv env (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = let mdorTag, mdorRow = GetMethodRefInfoAsMethodRefOrDef false cenv env (nm, typ, cc, args, ret, varargs, minst.Length) - let blob = - emitBytesViaBuffer (fun bb -> + let blob = + emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_GENERICINST bb.EmitZ32 minst.Length minst |> Array.iter (EmitType cenv env bb)) - FindOrAddSharedRow cenv ILTableNames.MethodSpec - (SharedRow + FindOrAddSharedRow cenv ILTableNames.MethodSpec + (SharedRow [| MethodDefOrRef (mdorTag, mdorRow) Blob (GetBytesAsBlobIdx cenv blob) |]) and GetMethodDefOrRefAsUncodedToken (tag, idx) = - let tab = + let tab = if tag = MethodDefOrRefTag.MethodDef then ILTableNames.Method - elif tag = MethodDefOrRefTag.MemberRef then ILTableNames.MemberRef + elif tag = MethodDefOrRefTag.MemberRef then ILTableNames.MemberRef else failwith "GetMethodDefOrRefAsUncodedToken" getUncodedToken tab idx and GetMethodSpecInfoAsUncodedToken cenv env ((_, _, _, _, _, _, minst:ILGenericArgs) as minfo) = - if minst.Length > 0 then + if minst.Length > 0 then getUncodedToken ILTableNames.MethodSpec (GetMethodSpecInfoAsMethodSpecIdx cenv env minfo) - else + else GetMethodDefOrRefAsUncodedToken (GetMethodRefInfoAsMethodRefOrDef false cenv env (GetMethodRefInfoOfMethodSpecInfo minfo)) - and GetMethodSpecAsUncodedToken cenv env mspec = + and GetMethodSpecAsUncodedToken cenv env mspec = GetMethodSpecInfoAsUncodedToken cenv env (InfoOfMethodSpec mspec) - and GetMethodRefInfoOfMethodSpecInfo (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = + and GetMethodRefInfoOfMethodSpecInfo (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = (nm, typ, cc, args, ret, varargs, minst.Length) and GetMethodSpecAsMethodDefOrRef cenv env (mspec, varargs) = @@ -10153,42 +10153,42 @@ namespace ProviderImplementation.ProvidedTypes and GetMethodSpecAsMethodDef cenv env (mspec, varargs) = GetMethodRefInfoAsMethodRefOrDef true cenv env (GetMethodRefInfoOfMethodSpecInfo (InfoOfMethodSpec (mspec, varargs))) - and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) = - (mspec.Name, - mspec.EnclosingType, - mspec.CallingConv, - mspec.MethodRef.ArgTypes, - mspec.FormalReturnType, - varargs, + and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) = + (mspec.Name, + mspec.EnclosingType, + mspec.CallingConv, + mspec.MethodRef.ArgTypes, + mspec.FormalReturnType, + varargs, mspec.GenericArgs) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // method_in_parent --> ILMethodRef/ILMethodDef - // + // // Used for MethodImpls. // -------------------------------------------------------------------- - let rec GetOverridesSpecAsMemberRefIdx cenv env ospec = + let rec GetOverridesSpecAsMemberRefIdx cenv env ospec = let fenv = envForOverrideSpec ospec let row = MethodRefInfoAsMemberRefRow cenv env fenv (ospec.MethodRef.Name, ospec.EnclosingType, ospec.MethodRef.CallingConv, ospec.MethodRef.ArgTypes, ospec.MethodRef.ReturnType, None, ospec.MethodRef.GenericArity) FindOrAddSharedRow cenv ILTableNames.MemberRef row - + and GetOverridesSpecAsMethodDefOrRef cenv env (ospec:ILOverridesSpec) = let typ = ospec.EnclosingType - if isTypeLocal typ then - if not typ.IsNominal then failwith "GetOverridesSpecAsMethodDefOrRef: unexpected local tref-typ" + if isTypeLocal typ then + if not typ.IsNominal then failwith "GetOverridesSpecAsMethodDefOrRef: unexpected local tref-typ" try (MethodDefOrRefTag.MethodDef, GetMethodRefAsMethodDefIdx cenv ospec.MethodRef) - with MethodDefNotFound -> (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) - else - (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) + with MethodDefNotFound -> (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) + else + (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodRef --> ILMethodRef/ILMethodDef - // + // // Used for Custom Attrs. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref:ILMethodRef) = + let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref:ILMethodRef) = let row = MethodRefInfoAsMemberRefRow cenv env fenv (mref.Name, ILType.Boxed (ILTypeSpec (mref.EnclosingTypeRef, [| |])), mref.CallingConv, mref.ArgTypes, mref.ReturnType, None, mref.GenericArity) FindOrAddSharedRow cenv ILTableNames.MemberRef row @@ -10201,14 +10201,14 @@ namespace ProviderImplementation.ProvidedTypes else (CustomAttributeTypeTag.MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mref) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILCustomAttrs --> CustomAttribute rows - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetCustomAttrDataAsBlobIdx cenv (data:byte[]) = + let rec GetCustomAttrDataAsBlobIdx cenv (data:byte[]) = if data.Length = 0 then 0 else GetBytesAsBlobIdx cenv data - and GetCustomAttrRow cenv hca attr = + and GetCustomAttrRow cenv hca attr = let cat = GetMethodRefAsCustomAttribType cenv attr.Method.MethodRef for element in attr.Elements do match element with @@ -10221,13 +10221,13 @@ namespace ProviderImplementation.ProvidedTypes Blob (GetCustomAttrDataAsBlobIdx cenv attr.Data) |] - and GenCustomAttrPass3Or4 cenv hca attr = + and GenCustomAttrPass3Or4 cenv hca attr = AddUnsharedRow cenv ILTableNames.CustomAttribute (GetCustomAttrRow cenv hca attr) |> ignore - and GenCustomAttrsPass3Or4 cenv hca (attrs: ILCustomAttrs) = - attrs.Entries |> Array.iter (GenCustomAttrPass3Or4 cenv hca) + and GenCustomAttrsPass3Or4 cenv hca (attrs: ILCustomAttrs) = + attrs.Entries |> Array.iter (GenCustomAttrPass3Or4 cenv hca) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILPermissionSet --> DeclSecurity rows // -------------------------------------------------------------------- *) @@ -10245,28 +10245,28 @@ namespace ProviderImplementation.ProvidedTypes List.iter (GenSecurityDeclPass3 cenv hds) attrs #endif - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILFieldSpec --> FieldRef or ILFieldDef row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldSpecAsMemberRefRow cenv env fenv (fspec:ILFieldSpec) = - MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.EnclosingType, - GetStringHeapIdx cenv fspec.Name, + let rec GetFieldSpecAsMemberRefRow cenv env fenv (fspec:ILFieldSpec) = + MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.EnclosingType, + GetStringHeapIdx cenv fspec.Name, GetFieldSpecSigAsBlobIdx cenv fenv fspec) - and GetFieldSpecAsMemberRefIdx cenv env fspec = + and GetFieldSpecAsMemberRefIdx cenv env fspec = let fenv = envForFieldSpec fspec FindOrAddSharedRow cenv ILTableNames.MemberRef (GetFieldSpecAsMemberRefRow cenv env fenv fspec) // REVIEW: write into an accumulating buffer - and EmitFieldSpecSig cenv env (bb: ByteBuffer) (fspec:ILFieldSpec) = + and EmitFieldSpecSig cenv env (bb: ByteBuffer) (fspec:ILFieldSpec) = bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD EmitType cenv env bb fspec.FormalType - and GetFieldSpecSigAsBytes cenv env x = - emitBytesViaBuffer (fun bb -> EmitFieldSpecSig cenv env bb x) + and GetFieldSpecSigAsBytes cenv env x = + emitBytesViaBuffer (fun bb -> EmitFieldSpecSig cenv env bb x) - and GetFieldSpecSigAsBlobIdx cenv env x = + and GetFieldSpecSigAsBlobIdx cenv env x = GetBytesAsBlobIdx cenv (GetFieldSpecSigAsBytes cenv env x) and GetFieldSpecAsFieldDefOrRef cenv env (fspec:ILFieldSpec) = @@ -10277,82 +10277,82 @@ namespace ProviderImplementation.ProvidedTypes let tidx = GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name)) let fdkey = FieldDefKey (tidx, fspec.Name, fspec.FormalType) (true, FindFieldDefIdx cenv fdkey) - else + else (false, GetFieldSpecAsMemberRefIdx cenv env fspec) and GetFieldDefOrRefAsUncodedToken (tag, idx) = let tab = if tag then ILTableNames.Field else ILTableNames.MemberRef getUncodedToken tab idx - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // callsig --> StandAloneSig - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetCallsigAsBlobIdx cenv env (callsig:ILCallingSignature, varargs) = - GetBytesAsBlobIdx cenv - (GetCallsigAsBytes cenv env (callsig.CallingConv, - callsig.ArgTypes, + let GetCallsigAsBlobIdx cenv env (callsig:ILCallingSignature, varargs) = + GetBytesAsBlobIdx cenv + (GetCallsigAsBytes cenv env (callsig.CallingConv, + callsig.ArgTypes, callsig.ReturnType, varargs, 0)) - - let GetCallsigAsStandAloneSigRow cenv env x = + + let GetCallsigAsStandAloneSigRow cenv env x = SharedRow [| Blob (GetCallsigAsBlobIdx cenv env x) |] - let GetCallsigAsStandAloneSigIdx cenv env info = + let GetCallsigAsStandAloneSigIdx cenv env info = FindOrAddSharedRow cenv ILTableNames.StandAloneSig (GetCallsigAsStandAloneSigRow cenv env info) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // local signatures --> BlobHeap idx - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let EmitLocalSig cenv env (bb: ByteBuffer) (locals: ILLocals) = + let EmitLocalSig cenv env (bb: ByteBuffer) (locals: ILLocals) = bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_LOCAL_SIG bb.EmitZ32 locals.Length locals |> Array.iter (EmitLocalInfo cenv env bb) - let GetLocalSigAsBlobHeapIdx cenv env locals = + let GetLocalSigAsBlobHeapIdx cenv env locals = GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> EmitLocalSig cenv env bb locals)) - let GetLocalSigAsStandAloneSigIdx cenv env locals = + let GetLocalSigAsStandAloneSigIdx cenv env locals = SharedRow [| Blob (GetLocalSigAsBlobHeapIdx cenv env locals) |] - type ExceptionClauseKind = - | FinallyClause - | FaultClause - | TypeFilterClause of int32 + type ExceptionClauseKind = + | FinallyClause + | FaultClause + | TypeFilterClause of int32 | FilterClause of int type ExceptionClauseSpec = (int * int * int * int * ExceptionClauseKind) - type CodeBuffer = + type CodeBuffer = - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Buffer to write results of emitting code into. Also record: // - branch sources (where fixups will occur) // - possible branch destinations // - locations of embedded handles into the string table // - the exception table - // -------------------------------------------------------------------- - { code: ByteBuffer - /// (instruction; optional short form); start of instr in code buffer; code loc for the end of the instruction the fixup resides in ; where is the destination of the fixup + // -------------------------------------------------------------------- + { code: ByteBuffer + /// (instruction; optional short form); start of instr in code buffer; code loc for the end of the instruction the fixup resides in ; where is the destination of the fixup mutable reqdBrFixups: ResizeArray<((int * int option) * int * ILCodeLabel list)> - availBrFixups: Dictionary - /// code loc to fixup in code buffer + availBrFixups: Dictionary + /// code loc to fixup in code buffer mutable reqdStringFixupsInMethod: ResizeArray<(int * int)> - /// data for exception handling clauses + /// data for exception handling clauses mutable seh: ResizeArray #if DEBUG_INFO seqpoints: ResizeArray #endif } - static member Create _nm = + static member Create _nm = { seh = ResizeArray() code= ByteBuffer.Create 200 reqdBrFixups= ResizeArray() reqdStringFixupsInMethod=ResizeArray() - availBrFixups = Dictionary<_, _>(10, HashIdentity.Structural) + availBrFixups = Dictionary<_, _>(10, HashIdentity.Structural) #if DEBUG_INFO seqpoints = new ResizeArray<_>(10) #endif @@ -10381,51 +10381,51 @@ namespace ProviderImplementation.ProvidedTypes member codebuf.EmitUncodedToken u = codebuf.EmitInt32 u - member codebuf.RecordReqdStringFixup stringidx = + member codebuf.RecordReqdStringFixup stringidx = codebuf.reqdStringFixupsInMethod.Add((codebuf.code.Position, stringidx)) - // Write a special value in that we check later when applying the fixup + // Write a special value in that we check later when applying the fixup codebuf.EmitInt32 0xdeadbeef - member codebuf.RecordReqdBrFixups i tgs = + member codebuf.RecordReqdBrFixups i tgs = codebuf.reqdBrFixups.Add ((i, codebuf.code.Position, tgs)) - // Write a special value in that we check later when applying the fixup - // Value is 0x11 {deadbbbb}* where 11 is for the instruction and deadbbbb is for each target - codebuf.EmitByte 0x11 // for the instruction - (if fst i = i_switch then + // Write a special value in that we check later when applying the fixup + // Value is 0x11 {deadbbbb}* where 11 is for the instruction and deadbbbb is for each target + codebuf.EmitByte 0x11 // for the instruction + (if fst i = i_switch then codebuf.EmitInt32 tgs.Length) List.iter (fun _ -> codebuf.EmitInt32 0xdeadbbbb) tgs member codebuf.RecordReqdBrFixup i tg = codebuf.RecordReqdBrFixups i [tg] - member codebuf.RecordAvailBrFixup tg = + member codebuf.RecordAvailBrFixup tg = codebuf.availBrFixups.[tg] <- codebuf.code.Position - module Codebuf = - // -------------------------------------------------------------------- + module Codebuf = + // -------------------------------------------------------------------- // Applying branch fixups. Use short versions of instructions // wherever possible. Sadly we can only determine if we can use a short - // version after we've layed out the code for all other instructions. - // This in turn means that using a short version may change + // version after we've layed out the code for all other instructions. + // This in turn means that using a short version may change // the various offsets into the code. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let binaryChop p (arr: 'T[]) = + let binaryChop p (arr: 'T[]) = let rec go n m = if n > m then raise (KeyNotFoundException("binary chop did not find element")) - else + else let i = (n+m)/2 - let c = p arr.[i] + let c = p arr.[i] if c = 0 then i elif c < 0 then go n (i-1) else go (i+1) m go 0 (Array.length arr) - let applyBrFixups (origCode :byte[]) origExnClauses origReqdStringFixups (origAvailBrFixups: Dictionary) origReqdBrFixups = + let applyBrFixups (origCode :byte[]) origExnClauses origReqdStringFixups (origAvailBrFixups: Dictionary) origReqdBrFixups = let orderedOrigReqdBrFixups = origReqdBrFixups |> Array.sortBy (fun (_, fixuploc, _) -> fixuploc) let newCode = ByteBuffer.Create origCode.Length - // Copy over all the code, working out whether the branches will be short - // or long and adjusting the branch destinations. Record an adjust function to adjust all the other - // gumpf that refers to fixed offsets in the code stream. - let newCode, newReqdBrFixups, adjuster = + // Copy over all the code, working out whether the branches will be short + // or long and adjusting the branch destinations. Record an adjust function to adjust all the other + // gumpf that refers to fixed offsets in the code stream. + let newCode, newReqdBrFixups, adjuster = let remainingReqdFixups = ref (Array.toList orderedOrigReqdBrFixups) let origWhere = ref 0 let newWhere = ref 0 @@ -10435,32 +10435,32 @@ namespace ProviderImplementation.ProvidedTypes let adjustments = ref [] while (not (isNil !remainingReqdFixups) || not !doneLast) do - let doingLast = isNil !remainingReqdFixups + let doingLast = isNil !remainingReqdFixups let origStartOfNoBranchBlock = !origWhere let newStartOfNoBranchBlock = !newWhere - let origEndOfNoBranchBlock = + let origEndOfNoBranchBlock = if doingLast then origCode.Length - else + else let (_, origStartOfInstr, _) = List.head !remainingReqdFixups origStartOfInstr - // Copy over a chunk of non-branching code + // Copy over a chunk of non-branching code let nobranch_len = origEndOfNoBranchBlock - origStartOfNoBranchBlock newCode.EmitBytes origCode.[origStartOfNoBranchBlock..origStartOfNoBranchBlock+nobranch_len-1] - - // Record how to adjust addresses in this range, including the branch instruction - // we write below, or the end of the method if we're doing the last bblock + + // Record how to adjust addresses in this range, including the branch instruction + // we write below, or the end of the method if we're doing the last bblock adjustments := (origStartOfNoBranchBlock, origEndOfNoBranchBlock, newStartOfNoBranchBlock) :: !adjustments - - // Increment locations to the branch instruction we're really interested in + + // Increment locations to the branch instruction we're really interested in origWhere := origEndOfNoBranchBlock newWhere := !newWhere + nobranch_len - - // Now do the branch instruction. Decide whether the fixup will be short or long in the new code - if doingLast then + + // Now do the branch instruction. Decide whether the fixup will be short or long in the new code + if doingLast then doneLast := true - else + else let (i, origStartOfInstr, tgs:ILCodeLabel list) = List.head !remainingReqdFixups remainingReqdFixups := List.tail !remainingReqdFixups if origCode.[origStartOfInstr] <> 0x11uy then failwith "br fixup sanity check failed (1)" @@ -10470,84 +10470,84 @@ namespace ProviderImplementation.ProvidedTypes let origEndOfInstr = origStartOfInstr + i_length + 4 * tgs.Length let newEndOfInstrIfSmall = !newWhere + i_length + 1 let newEndOfInstrIfBig = !newWhere + i_length + 4 * tgs.Length - - let short = - match i, tgs with - | (_, Some i_short), [tg] + + let short = + match i, tgs with + | (_, Some i_short), [tg] when - begin - // Use the original offsets to compute if the branch is small or large. This is - // a safe approximation because code only gets smaller. - if not (origAvailBrFixups.ContainsKey tg) then + begin + // Use the original offsets to compute if the branch is small or large. This is + // a safe approximation because code only gets smaller. + if not (origAvailBrFixups.ContainsKey tg) then printfn "%s" ("branch target " + formatCodeLabel tg + " not found in code") - let origDest = + let origDest = if origAvailBrFixups.ContainsKey tg then origAvailBrFixups.[tg] else 666666 let origRelOffset = origDest - origEndOfInstr -128 <= origRelOffset && origRelOffset <= 127 - end + end -> newCode.EmitIntAsByte i_short true | (i_long, _), _ -> newCode.EmitIntAsByte i_long - (if i_long = i_switch then + (if i_long = i_switch then newCode.EmitInt32 tgs.Length) false - + newWhere := !newWhere + i_length if !newWhere <> newCode.Position then printfn "mismatch between newWhere and newCode" tgs |> List.iter (fun tg -> let origFixupLoc = !origWhere checkFixup32 origCode origFixupLoc 0xdeadbbbb - - if short then + + if short then newReqdBrFixups := (!newWhere, newEndOfInstrIfSmall, tg, true) :: !newReqdBrFixups newCode.EmitIntAsByte 0x98 (* sanity check *) newWhere := !newWhere + 1 - else + else newReqdBrFixups := (!newWhere, newEndOfInstrIfBig, tg, false) :: !newReqdBrFixups newCode.EmitInt32 0xf00dd00f (* sanity check *) newWhere := !newWhere + 4 if !newWhere <> newCode.Position then printfn "mismatch between newWhere and newCode" origWhere := !origWhere + 4) - + if !origWhere <> origEndOfInstr then printfn "mismatch between origWhere and origEndOfInstr" - let adjuster = + let adjuster = let arr = Array.ofList (List.rev !adjustments) - fun addr -> - let i = - try binaryChop (fun (a1, a2, _) -> if addr < a1 then -1 elif addr > a2 then 1 else 0) arr - with - :? KeyNotFoundException -> + fun addr -> + let i = + try binaryChop (fun (a1, a2, _) -> if addr < a1 then -1 elif addr > a2 then 1 else 0) arr + with + :? KeyNotFoundException -> failwith ("adjuster: address "+string addr+" is out of range") let (origStartOfNoBranchBlock, _, newStartOfNoBranchBlock) = arr.[i] - addr - (origStartOfNoBranchBlock - newStartOfNoBranchBlock) + addr - (origStartOfNoBranchBlock - newStartOfNoBranchBlock) - newCode.Close(), - List.toArray !newReqdBrFixups, + newCode.Close(), + List.toArray !newReqdBrFixups, adjuster - // Now adjust everything - let newAvailBrFixups = - let tab = Dictionary<_, _>(10, HashIdentity.Structural) - for (KeyValue(tglab, origBrDest)) in origAvailBrFixups do + // Now adjust everything + let newAvailBrFixups = + let tab = Dictionary<_, _>(10, HashIdentity.Structural) + for (KeyValue(tglab, origBrDest)) in origAvailBrFixups do tab.[tglab] <- adjuster origBrDest tab let newReqdStringFixups = Array.map (fun (origFixupLoc, stok) -> adjuster origFixupLoc, stok) origReqdStringFixups #if EMIT_DEBUG_INFO let newSeqPoints = Array.map (fun (sp:PdbSequencePoint) -> {sp with Offset=adjuster sp.Offset}) origSeqPoints #endif - let newExnClauses = + let newExnClauses = origExnClauses |> Array.map (fun (st1, sz1, st2, sz2, kind) -> - (adjuster st1, (adjuster (st1 + sz1) - adjuster st1), - adjuster st2, (adjuster (st2 + sz2) - adjuster st2), - (match kind with + (adjuster st1, (adjuster (st1 + sz1) - adjuster st1), + adjuster st2, (adjuster (st2 + sz2) - adjuster st2), + (match kind with | FinallyClause | FaultClause | TypeFilterClause _ -> kind | FilterClause n -> FilterClause (adjuster n)))) - + #if EMIT_DEBUG_INFO let newScopes = let rec remap scope = @@ -10557,17 +10557,17 @@ namespace ProviderImplementation.ProvidedTypes Array.map remap origScopes #endif - // Now apply the adjusted fixups in the new code + // Now apply the adjusted fixups in the new code newReqdBrFixups |> Array.iter (fun (newFixupLoc, endOfInstr, tg, small) -> - if not (newAvailBrFixups.ContainsKey tg) then + if not (newAvailBrFixups.ContainsKey tg) then failwith ("target "+formatCodeLabel tg+" not found in new fixups") - try + try let n = newAvailBrFixups.[tg] let relOffset = (n - endOfInstr) - if small then + if small then if Bytes.get newCode newFixupLoc <> 0x98 then failwith "br fixupsanity check failed" newCode.[newFixupLoc] <- b0 relOffset - else + else checkFixup32 newCode newFixupLoc 0xf00dd00fl applyFixup32 newCode newFixupLoc relOffset with :? KeyNotFoundException -> ()) @@ -10575,91 +10575,91 @@ namespace ProviderImplementation.ProvidedTypes newCode, newReqdStringFixups, newExnClauses - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Structured residue of emitting instructions: SEH exception handling // and scopes for local variables. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - // Emitting instructions generates a tree of seh specifications - // We then emit the exception handling specs separately. - // nb. ECMA spec says the SEH blocks must be returned inside-out - type SEHTree = + // Emitting instructions generates a tree of seh specifications + // We then emit the exception handling specs separately. + // nb. ECMA spec says the SEH blocks must be returned inside-out + type SEHTree = | Node of ExceptionClauseSpec option * SEHTree[] - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Table of encodings for instructions without arguments, also indexes // for all instructions. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let encodingsForNoArgInstrs = Dictionary<_, _>(300, HashIdentity.Structural) - let _ = - List.iter + let _ = + List.iter (fun (x, mk) -> encodingsForNoArgInstrs.[mk] <- x) (noArgInstrs.Force()) let encodingsOfNoArgInstr si = encodingsForNoArgInstrs.[si] - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Emit instructions - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /// Emit the code for an instruction - let emitInstrCode (codebuf: CodeBuffer) i = - if i > 0xFF then - assert (i >>> 8 = 0xFE) - codebuf.EmitByte ((i >>> 8) &&& 0xFF) - codebuf.EmitByte (i &&& 0xFF) - else + let emitInstrCode (codebuf: CodeBuffer) i = + if i > 0xFF then + assert (i >>> 8 = 0xFE) + codebuf.EmitByte ((i >>> 8) &&& 0xFF) + codebuf.EmitByte (i &&& 0xFF) + else codebuf.EmitByte i - let emitTypeInstr cenv codebuf env i ty = - emitInstrCode codebuf i + let emitTypeInstr cenv codebuf env i ty = + emitInstrCode codebuf i codebuf.EmitUncodedToken (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env ty)) - let emitMethodSpecInfoInstr cenv codebuf env i mspecinfo = - emitInstrCode codebuf i + let emitMethodSpecInfoInstr cenv codebuf env i mspecinfo = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetMethodSpecInfoAsUncodedToken cenv env mspecinfo) - let emitMethodSpecInstr cenv codebuf env i mspec = - emitInstrCode codebuf i + let emitMethodSpecInstr cenv codebuf env i mspec = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetMethodSpecAsUncodedToken cenv env mspec) - let emitFieldSpecInstr cenv codebuf env i fspec = - emitInstrCode codebuf i + let emitFieldSpecInstr cenv codebuf env i fspec = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetFieldDefOrRefAsUncodedToken (GetFieldSpecAsFieldDefOrRef cenv env fspec)) - let emitShortUInt16Instr codebuf (i_short, i) x = + let emitShortUInt16Instr codebuf (i_short, i) x = let n = int32 x - if n <= 255 then - emitInstrCode codebuf i_short + if n <= 255 then + emitInstrCode codebuf i_short codebuf.EmitByte n - else - emitInstrCode codebuf i + else + emitInstrCode codebuf i codebuf.EmitUInt16 x - let emitShortInt32Instr codebuf (i_short, i) x = - if x >= (-128) && x <= 127 then - emitInstrCode codebuf i_short + let emitShortInt32Instr codebuf (i_short, i) x = + if x >= (-128) && x <= 127 then + emitInstrCode codebuf i_short codebuf.EmitByte (if x < 0x0 then x + 256 else x) - else - emitInstrCode codebuf i + else + emitInstrCode codebuf i codebuf.EmitInt32 x - let emitTailness (cenv: cenv) codebuf tl = + let emitTailness (cenv: cenv) codebuf tl = if tl = Tailcall && cenv.emitTailcalls then emitInstrCode codebuf i_tail //let emitAfterTailcall codebuf tl = // if tl = Tailcall then emitInstrCode codebuf i_ret - let emitVolatility codebuf tl = + let emitVolatility codebuf tl = if tl = Volatile then emitInstrCode codebuf i_volatile - let emitConstrained cenv codebuf env ty = + let emitConstrained cenv codebuf env ty = emitInstrCode codebuf i_constrained codebuf.EmitUncodedToken (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env ty)) - let emitAlignment codebuf tl = - match tl with + let emitAlignment codebuf tl = + match tl with | Aligned -> () | Unaligned1 -> emitInstrCode codebuf i_unaligned; codebuf.EmitByte 0x1 | Unaligned2 -> emitInstrCode codebuf i_unaligned; codebuf.EmitByte 0x2 @@ -10669,36 +10669,36 @@ namespace ProviderImplementation.ProvidedTypes match instr with | si when isNoArgInstr si -> emitInstrCode codebuf (encodingsOfNoArgInstr si) - | I_brcmp (cmp, tg1) -> + | I_brcmp (cmp, tg1) -> codebuf.RecordReqdBrFixup (ILCmpInstrMap.Value.[cmp], Some ILCmpInstrRevMap.Value.[cmp]) tg1 | I_br tg -> codebuf.RecordReqdBrFixup (i_br, Some i_br_s) tg #if EMIT_DEBUG_INFO | I_seqpoint s -> codebuf.EmitSeqPoint cenv s #endif | I_leave tg -> codebuf.RecordReqdBrFixup (i_leave, Some i_leave_s) tg - | I_call (tl, mspec, varargs) -> + | I_call (tl, mspec, varargs) -> emitTailness cenv codebuf tl emitMethodSpecInstr cenv codebuf env i_call (mspec, varargs) //emitAfterTailcall codebuf tl - | I_callvirt (tl, mspec, varargs) -> + | I_callvirt (tl, mspec, varargs) -> emitTailness cenv codebuf tl emitMethodSpecInstr cenv codebuf env i_callvirt (mspec, varargs) //emitAfterTailcall codebuf tl - | I_callconstraint (tl, ty, mspec, varargs) -> + | I_callconstraint (tl, ty, mspec, varargs) -> emitTailness cenv codebuf tl emitConstrained cenv codebuf env ty emitMethodSpecInstr cenv codebuf env i_callvirt (mspec, varargs) //emitAfterTailcall codebuf tl - | I_newobj (mspec, varargs) -> + | I_newobj (mspec, varargs) -> emitMethodSpecInstr cenv codebuf env i_newobj (mspec, varargs) - | I_ldftn mspec -> + | I_ldftn mspec -> emitMethodSpecInstr cenv codebuf env i_ldftn (mspec, None) - | I_ldvirtftn mspec -> + | I_ldvirtftn mspec -> emitMethodSpecInstr cenv codebuf env i_ldvirtftn (mspec, None) - | I_calli (tl, callsig, varargs) -> + | I_calli (tl, callsig, varargs) -> emitTailness cenv codebuf tl - emitInstrCode codebuf i_calli + emitInstrCode codebuf i_calli codebuf.EmitUncodedToken (getUncodedToken ILTableNames.StandAloneSig (GetCallsigAsStandAloneSigIdx cenv env (callsig, varargs))) //emitAfterTailcall codebuf tl @@ -10709,165 +10709,165 @@ namespace ProviderImplementation.ProvidedTypes | I_stloc x -> emitShortUInt16Instr codebuf (i_stloc_s, i_stloc) (uint16 x) | I_ldloca x -> emitShortUInt16Instr codebuf (i_ldloca_s, i_ldloca) (uint16 x) - | I_cpblk (al, vol) -> - emitAlignment codebuf al + | I_cpblk (al, vol) -> + emitAlignment codebuf al emitVolatility codebuf vol emitInstrCode codebuf i_cpblk - | I_initblk (al, vol) -> - emitAlignment codebuf al + | I_initblk (al, vol) -> + emitAlignment codebuf al emitVolatility codebuf vol emitInstrCode codebuf i_initblk - | (I_ldc (DT_I4, ILConst.I4 x)) -> + | (I_ldc (DT_I4, ILConst.I4 x)) -> emitShortInt32Instr codebuf (i_ldc_i4_s, i_ldc_i4) x - | (I_ldc (DT_I8, ILConst.I8 x)) -> - emitInstrCode codebuf i_ldc_i8 + | (I_ldc (DT_I8, ILConst.I8 x)) -> + emitInstrCode codebuf i_ldc_i8 codebuf.EmitInt64 x - | (I_ldc (_, ILConst.R4 x)) -> - emitInstrCode codebuf i_ldc_r4 + | (I_ldc (_, ILConst.R4 x)) -> + emitInstrCode codebuf i_ldc_r4 codebuf.EmitInt32 (bitsOfSingle x) - | (I_ldc (_, ILConst.R8 x)) -> - emitInstrCode codebuf i_ldc_r8 + | (I_ldc (_, ILConst.R8 x)) -> + emitInstrCode codebuf i_ldc_r8 codebuf.EmitInt64 (bitsOfDouble x) - | I_ldind (al, vol, dt) -> - emitAlignment codebuf al + | I_ldind (al, vol, dt) -> + emitAlignment codebuf al emitVolatility codebuf vol - emitInstrCode codebuf - (match dt with + emitInstrCode codebuf + (match dt with | DT_I -> i_ldind_i - | DT_I1 -> i_ldind_i1 - | DT_I2 -> i_ldind_i2 - | DT_I4 -> i_ldind_i4 - | DT_U1 -> i_ldind_u1 - | DT_U2 -> i_ldind_u2 - | DT_U4 -> i_ldind_u4 - | DT_I8 -> i_ldind_i8 - | DT_R4 -> i_ldind_r4 - | DT_R8 -> i_ldind_r8 + | DT_I1 -> i_ldind_i1 + | DT_I2 -> i_ldind_i2 + | DT_I4 -> i_ldind_i4 + | DT_U1 -> i_ldind_u1 + | DT_U2 -> i_ldind_u2 + | DT_U4 -> i_ldind_u4 + | DT_I8 -> i_ldind_i8 + | DT_R4 -> i_ldind_r4 + | DT_R8 -> i_ldind_r8 | DT_REF -> i_ldind_ref | _ -> failwith "ldind") - | I_stelem dt -> - emitInstrCode codebuf - (match dt with + | I_stelem dt -> + emitInstrCode codebuf + (match dt with | DT_I | DT_U -> i_stelem_i - | DT_U1 | DT_I1 -> i_stelem_i1 - | DT_I2 | DT_U2 -> i_stelem_i2 - | DT_I4 | DT_U4 -> i_stelem_i4 - | DT_I8 | DT_U8 -> i_stelem_i8 - | DT_R4 -> i_stelem_r4 - | DT_R8 -> i_stelem_r8 + | DT_U1 | DT_I1 -> i_stelem_i1 + | DT_I2 | DT_U2 -> i_stelem_i2 + | DT_I4 | DT_U4 -> i_stelem_i4 + | DT_I8 | DT_U8 -> i_stelem_i8 + | DT_R4 -> i_stelem_r4 + | DT_R8 -> i_stelem_r8 | DT_REF -> i_stelem_ref | _ -> failwith "stelem") - | I_ldelem dt -> - emitInstrCode codebuf - (match dt with + | I_ldelem dt -> + emitInstrCode codebuf + (match dt with | DT_I -> i_ldelem_i - | DT_I1 -> i_ldelem_i1 - | DT_I2 -> i_ldelem_i2 - | DT_I4 -> i_ldelem_i4 - | DT_I8 -> i_ldelem_i8 - | DT_U1 -> i_ldelem_u1 - | DT_U2 -> i_ldelem_u2 - | DT_U4 -> i_ldelem_u4 - | DT_R4 -> i_ldelem_r4 - | DT_R8 -> i_ldelem_r8 + | DT_I1 -> i_ldelem_i1 + | DT_I2 -> i_ldelem_i2 + | DT_I4 -> i_ldelem_i4 + | DT_I8 -> i_ldelem_i8 + | DT_U1 -> i_ldelem_u1 + | DT_U2 -> i_ldelem_u2 + | DT_U4 -> i_ldelem_u4 + | DT_R4 -> i_ldelem_r4 + | DT_R8 -> i_ldelem_r8 | DT_REF -> i_ldelem_ref | _ -> failwith "ldelem") - | I_stind (al, vol, dt) -> - emitAlignment codebuf al + | I_stind (al, vol, dt) -> + emitAlignment codebuf al emitVolatility codebuf vol - emitInstrCode codebuf - (match dt with + emitInstrCode codebuf + (match dt with | DT_U | DT_I -> i_stind_i - | DT_U1 | DT_I1 -> i_stind_i1 - | DT_U2 | DT_I2 -> i_stind_i2 - | DT_U4 | DT_I4 -> i_stind_i4 - | DT_U8 | DT_I8 -> i_stind_i8 - | DT_R4 -> i_stind_r4 - | DT_R8 -> i_stind_r8 + | DT_U1 | DT_I1 -> i_stind_i1 + | DT_U2 | DT_I2 -> i_stind_i2 + | DT_U4 | DT_I4 -> i_stind_i4 + | DT_U8 | DT_I8 -> i_stind_i8 + | DT_R4 -> i_stind_r4 + | DT_R8 -> i_stind_r8 | DT_REF -> i_stind_ref | _ -> failwith "stelem") | I_switch labs -> codebuf.RecordReqdBrFixups (i_switch, None) labs - | I_ldfld (al, vol, fspec) -> - emitAlignment codebuf al + | I_ldfld (al, vol, fspec) -> + emitAlignment codebuf al emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_ldfld fspec - | I_ldflda fspec -> + | I_ldflda fspec -> emitFieldSpecInstr cenv codebuf env i_ldflda fspec - | I_ldsfld (vol, fspec) -> + | I_ldsfld (vol, fspec) -> emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_ldsfld fspec - | I_ldsflda fspec -> + | I_ldsflda fspec -> emitFieldSpecInstr cenv codebuf env i_ldsflda fspec - | I_stfld (al, vol, fspec) -> - emitAlignment codebuf al + | I_stfld (al, vol, fspec) -> + emitAlignment codebuf al emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_stfld fspec - | I_stsfld (vol, fspec) -> + | I_stsfld (vol, fspec) -> emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_stsfld fspec - | I_ldtoken tok -> + | I_ldtoken tok -> emitInstrCode codebuf i_ldtoken - codebuf.EmitUncodedToken - (match tok with - | ILToken.ILType typ -> - match GetTypeAsTypeDefOrRef cenv env typ with + codebuf.EmitUncodedToken + (match tok with + | ILToken.ILType typ -> + match GetTypeAsTypeDefOrRef cenv env typ with | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeDef -> getUncodedToken ILTableNames.TypeDef idx | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeRef -> getUncodedToken ILTableNames.TypeRef idx | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeSpec -> getUncodedToken ILTableNames.TypeSpec idx | _ -> failwith "?" | ILToken.ILMethod mspec -> - match GetMethodSpecAsMethodDefOrRef cenv env (mspec, None) with + match GetMethodSpecAsMethodDefOrRef cenv env (mspec, None) with | (tag, idx) when tag = MethodDefOrRefTag.MethodDef -> getUncodedToken ILTableNames.Method idx | (tag, idx) when tag = MethodDefOrRefTag.MemberRef -> getUncodedToken ILTableNames.MemberRef idx | _ -> failwith "?" | ILToken.ILField fspec -> - match GetFieldSpecAsFieldDefOrRef cenv env fspec with + match GetFieldSpecAsFieldDefOrRef cenv env fspec with | (true, idx) -> getUncodedToken ILTableNames.Field idx | (false, idx) -> getUncodedToken ILTableNames.MemberRef idx) - | I_ldstr s -> + | I_ldstr s -> emitInstrCode codebuf i_ldstr codebuf.RecordReqdStringFixup (GetUserStringHeapIdx cenv s) | I_box ty -> emitTypeInstr cenv codebuf env i_box ty | I_unbox ty -> emitTypeInstr cenv codebuf env i_unbox ty - | I_unbox_any ty -> emitTypeInstr cenv codebuf env i_unbox_any ty + | I_unbox_any ty -> emitTypeInstr cenv codebuf env i_unbox_any ty - | I_newarr (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then + | I_newarr (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then emitTypeInstr cenv codebuf env i_newarr ty else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_newobj (".ctor", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Void, None, [| |]) - | I_stelem_any (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then - emitTypeInstr cenv codebuf env i_stelem_any ty - else + | I_stelem_any (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then + emitTypeInstr cenv codebuf env i_stelem_any ty + else let args = Array.init (shape.Rank+1) (fun i -> if i < shape.Rank then cenv.ilg.typ_Int32 else ty) emitMethodSpecInfoInstr cenv codebuf env i_call ("Set", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Void, None, [| |]) - | I_ldelem_any (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then - emitTypeInstr cenv codebuf env i_ldelem_any ty - else + | I_ldelem_any (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then + emitTypeInstr cenv codebuf env i_ldelem_any ty + else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_call ("Get", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ty, None, [| |]) - | I_ldelema (ro, shape, ty) -> + | I_ldelema (ro, shape, ty) -> if (ro = ReadonlyAddress) then emitInstrCode codebuf i_readonly - if (shape = ILArrayShape.SingleDimensional) then + if (shape = ILArrayShape.SingleDimensional) then emitTypeInstr cenv codebuf env i_ldelema ty - else + else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_call ("Address", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Byref ty, None, [| |]) @@ -10876,17 +10876,17 @@ namespace ProviderImplementation.ProvidedTypes | I_refanyval ty -> emitTypeInstr cenv codebuf env i_refanyval ty | I_mkrefany ty -> emitTypeInstr cenv codebuf env i_mkrefany ty | I_initobj ty -> emitTypeInstr cenv codebuf env i_initobj ty - | I_ldobj (al, vol, ty) -> - emitAlignment codebuf al + | I_ldobj (al, vol, ty) -> + emitAlignment codebuf al emitVolatility codebuf vol emitTypeInstr cenv codebuf env i_ldobj ty - | I_stobj (al, vol, ty) -> - emitAlignment codebuf al + | I_stobj (al, vol, ty) -> + emitAlignment codebuf al emitVolatility codebuf vol emitTypeInstr cenv codebuf env i_stobj ty | I_cpobj ty -> emitTypeInstr cenv codebuf env i_cpobj ty | I_sizeof ty -> emitTypeInstr cenv codebuf env i_sizeof ty - | EI_ldlen_multi (_, m) -> + | EI_ldlen_multi (_, m) -> emitShortInt32Instr codebuf (i_ldc_i4_s, i_ldc_i4) m let mspec = mkILMethSpecInTyRaw(cenv.ilg.typ_Array, ILCallingConv.Instance, "GetLength", [|cenv.ilg.typ_Int32|], cenv.ilg.typ_Int32, [| |]) emitInstr cenv codebuf env (mkNormalCall mspec) @@ -10897,20 +10897,20 @@ namespace ProviderImplementation.ProvidedTypes // Used to put local debug scopes and exception handlers into a tree form let rangeInsideRange (start_pc1, end_pc1) (start_pc2, end_pc2) = (start_pc1:int) >= start_pc2 && start_pc1 < end_pc2 && - (end_pc1:int) > start_pc2 && end_pc1 <= end_pc2 + (end_pc1:int) > start_pc2 && end_pc1 <= end_pc2 - let lranges_of_clause cl = - match cl with + let lranges_of_clause cl = + match cl with | ILExceptionClause.Finally r1 -> [r1] | ILExceptionClause.Fault r1 -> [r1] | ILExceptionClause.FilterCatch (r1, r2) -> [r1;r2] - | ILExceptionClause.TypeCatch (_ty, r1) -> [r1] + | ILExceptionClause.TypeCatch (_ty, r1) -> [r1] let labelsToRange (lab2pc: Dictionary) p = let (l1, l2) = p in lab2pc.[l1], lab2pc.[l2] - let labelRangeInsideLabelRange lab2pc ls1 ls2 = - rangeInsideRange (labelsToRange lab2pc ls1) (labelsToRange lab2pc ls2) + let labelRangeInsideLabelRange lab2pc ls1 ls2 = + rangeInsideRange (labelsToRange lab2pc ls1) (labelsToRange lab2pc ls2) // This file still gets used when targeting FSharp.Core 3.1.0.0, e.g. in FSharp.Data #if !ABOVE_FSCORE_4_0_0_0 @@ -10927,59 +10927,59 @@ namespace ProviderImplementation.ProvidedTypes acc <- s' res, acc #endif - let findRoots contains vs = + let findRoots contains vs = // For each item, either make it a root or make it a child of an existing root - let addToRoot roots x = + let addToRoot roots x = // Look to see if 'x' is inside one of the roots - let roots, found = - (false, roots) ||> mapFold (fun found (r, children) -> + let roots, found = + (false, roots) ||> mapFold (fun found (r, children) -> if found then ((r, children), true) - elif contains x r then ((r, Array.append [| x |] children), true) + elif contains x r then ((r, Array.append [| x |] children), true) else ((r, children), false)) - if found then roots - else + if found then roots + else // Find the ones that 'x' encompasses and collapse them let yes, others = roots |> Array.partition (fun (r, _) -> contains r x) let yesChild = yes |> Array.collect (fun (r, ch) -> Array.append [| r |] ch) Array.append [| (x, yesChild) |] others - + ([| |], vs) ||> Array.fold addToRoot - let rec makeSEHTree cenv env (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILExceptionSpec[]) = + let rec makeSEHTree cenv env (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILExceptionSpec[]) = let clause_inside_lrange cl lr = - List.forall (fun lr1 -> labelRangeInsideLabelRange lab2pc lr1 lr) (lranges_of_clause cl) + List.forall (fun lr1 -> labelRangeInsideLabelRange lab2pc lr1 lr) (lranges_of_clause cl) let tryspec_inside_lrange (tryspec1: ILExceptionSpec) lr = - (labelRangeInsideLabelRange lab2pc tryspec1.Range lr && clause_inside_lrange tryspec1.Clause lr) + (labelRangeInsideLabelRange lab2pc tryspec1.Range lr && clause_inside_lrange tryspec1.Clause lr) let tryspec_inside_clause tryspec1 cl = - List.exists (fun lr -> tryspec_inside_lrange tryspec1 lr) (lranges_of_clause cl) + List.exists (fun lr -> tryspec_inside_lrange tryspec1 lr) (lranges_of_clause cl) let tryspec_inside_tryspec tryspec1 (tryspec2: ILExceptionSpec) = tryspec_inside_lrange tryspec1 tryspec2.Range || tryspec_inside_clause tryspec1 tryspec2.Clause let roots = findRoots tryspec_inside_tryspec exs - let trees = - roots |> Array.map (fun (cl, ch) -> + let trees = + roots |> Array.map (fun (cl, ch) -> let r1 = labelsToRange lab2pc cl.Range let conv ((s1, e1), (s2, e2)) x = pc2pos.[s1], pc2pos.[e1] - pc2pos.[s1], pc2pos.[s2], pc2pos.[e2] - pc2pos.[s2], x let children = makeSEHTree cenv env pc2pos lab2pc ch - let n = - match cl.Clause with - | ILExceptionClause.Finally r2 -> + let n = + match cl.Clause with + | ILExceptionClause.Finally r2 -> conv (r1, labelsToRange lab2pc r2) ExceptionClauseKind.FinallyClause - | ILExceptionClause.Fault r2 -> + | ILExceptionClause.Fault r2 -> conv (r1, labelsToRange lab2pc r2) ExceptionClauseKind.FaultClause - | ILExceptionClause.FilterCatch ((filterStart, _), r3) -> + | ILExceptionClause.FilterCatch ((filterStart, _), r3) -> conv (r1, labelsToRange lab2pc r3) (ExceptionClauseKind.FilterClause (pc2pos.[lab2pc.[filterStart]])) - | ILExceptionClause.TypeCatch (typ, r2) -> + | ILExceptionClause.TypeCatch (typ, r2) -> conv (r1, labelsToRange lab2pc r2) (TypeFilterClause (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env typ))) SEHTree.Node (Some n, children) ) - trees + trees #if EMIT_DEBUG_INFO let rec makeLocalsTree cenv localSigs (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILLocalDebugInfo[]) = @@ -10998,14 +10998,14 @@ namespace ProviderImplementation.ProvidedTypes #endif - // Emit the SEH tree - let rec emitExceptionHandlerTree (codebuf: CodeBuffer) (Node (x, childSEH)) = - childSEH |> Array.iter (emitExceptionHandlerTree codebuf) // internal first - x |> Option.iter codebuf.EmitExceptionClause + // Emit the SEH tree + let rec emitExceptionHandlerTree (codebuf: CodeBuffer) (Node (x, childSEH)) = + childSEH |> Array.iter (emitExceptionHandlerTree codebuf) // internal first + x |> Option.iter codebuf.EmitExceptionClause - let emitCode cenv localSigs (codebuf: CodeBuffer) env (code: ILCode) = + let emitCode cenv localSigs (codebuf: CodeBuffer) env (code: ILCode) = let instrs = code.Instrs - + // Build a table mapping Abstract IL pcs to positions in the generated code buffer let pc2pos = Array.zeroCreate (instrs.Length+1) let pc2labs = Dictionary() @@ -11014,12 +11014,12 @@ namespace ProviderImplementation.ProvidedTypes // Emit the instructions for pc = 0 to instrs.Length do - if pc2labs.ContainsKey pc then + if pc2labs.ContainsKey pc then for lab in pc2labs.[pc] do codebuf.RecordAvailBrFixup lab pc2pos.[pc] <- codebuf.code.Position - if pc < instrs.Length then - match instrs.[pc] with + if pc < instrs.Length then + match instrs.[pc] with | I_br l when code.Labels.[l] = pc + 1 -> () // compress I_br to next instruction | i -> emitInstr cenv codebuf env i @@ -11033,7 +11033,7 @@ namespace ProviderImplementation.ProvidedTypes localsTree #endif - let EmitTopCode cenv localSigs env nm code = + let EmitTopCode cenv localSigs env nm code = let codebuf = CodeBuffer.Create nm let origScopes = emitCode cenv localSigs codebuf env code let origCode = codebuf.code.Close() @@ -11045,8 +11045,8 @@ namespace ProviderImplementation.ProvidedTypes let origSeqPoints = codebuf.seqpoints.ToArray() #endif - let newCode, newReqdStringFixups, newExnClauses = - applyBrFixups origCode origExnClauses origReqdStringFixups origAvailBrFixups origReqdBrFixups + let newCode, newReqdStringFixups, newExnClauses = + applyBrFixups origCode origExnClauses origReqdStringFixups origAvailBrFixups origReqdBrFixups #if EMIT_DEBUG_INFO let rootScope = @@ -11058,31 +11058,31 @@ namespace ProviderImplementation.ProvidedTypes (newReqdStringFixups, newExnClauses, newCode) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodBody --> bytes - // -------------------------------------------------------------------- - let GetFieldDefTypeAsBlobIdx cenv env ty = - let bytes = emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD + // -------------------------------------------------------------------- + let GetFieldDefTypeAsBlobIdx cenv env ty = + let bytes = emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD EmitType cenv env bb ty) GetBytesAsBlobIdx cenv bytes let GenILMethodBody mname cenv env (il: ILMethodBody) = - let localSigs = - if cenv.generatePdb then - il.Locals |> Array.map (fun l -> + let localSigs = + if cenv.generatePdb then + il.Locals |> Array.map (fun l -> // Write a fake entry for the local signature headed by e_IMAGE_CEE_CS_CALLCONV_FIELD. This is referenced by the PDB file ignore (FindOrAddSharedRow cenv ILTableNames.StandAloneSig (SharedRow [| Blob (GetFieldDefTypeAsBlobIdx cenv env l.Type) |])) // Now write the type - GetTypeOfLocalAsBytes cenv env l) - else + GetTypeOfLocalAsBytes cenv env l) + else [| |] let requiredStringFixups, seh, code (* , seqpoints, scopes *) = Codebuf.EmitTopCode cenv localSigs env mname il.Code let codeSize = code.Length let methbuf = ByteBuffer.Create (codeSize * 3) - // Do we use the tiny format? + // Do we use the tiny format? if isEmpty il.Locals && il.MaxStack <= 8 && isEmpty seh && codeSize < 64 then - // Use Tiny format + // Use Tiny format let alignedCodeSize = align 4 (codeSize + 1) let codePadding = (alignedCodeSize - (codeSize + 1)) let requiredStringFixups' = (1, requiredStringFixups) @@ -11091,68 +11091,68 @@ namespace ProviderImplementation.ProvidedTypes methbuf.EmitPadding codePadding 0x0, (requiredStringFixups', methbuf.Close()) // , seqpoints, scopes else - // Use Fat format - let flags = + // Use Fat format + let flags = e_CorILMethod_FatFormat ||| - (if not (isEmpty seh) then e_CorILMethod_MoreSects else 0x0uy) ||| + (if not (isEmpty seh) then e_CorILMethod_MoreSects else 0x0uy) ||| (if il.IsZeroInit then e_CorILMethod_InitLocals else 0x0uy) - let localToken = - if isEmpty il.Locals then 0x0 else + let localToken = + if isEmpty il.Locals then 0x0 else getUncodedToken ILTableNames.StandAloneSig (FindOrAddSharedRow cenv ILTableNames.StandAloneSig (GetLocalSigAsStandAloneSigIdx cenv env il.Locals)) let alignedCodeSize = align 0x4 codeSize let codePadding = (alignedCodeSize - codeSize) - - methbuf.EmitByte flags - methbuf.EmitByte 0x30uy // last four bits record size of fat header in 4 byte chunks - this is always 12 bytes = 3 four word chunks + + methbuf.EmitByte flags + methbuf.EmitByte 0x30uy // last four bits record size of fat header in 4 byte chunks - this is always 12 bytes = 3 four word chunks methbuf.EmitUInt16 (uint16 il.MaxStack) methbuf.EmitInt32 codeSize methbuf.EmitInt32 localToken methbuf.EmitBytes code methbuf.EmitPadding codePadding - if not (isEmpty seh) then - // Can we use the small exception handling table format? + if not (isEmpty seh) then + // Can we use the small exception handling table format? let smallSize = (seh.Length * 12 + 4) - let canUseSmall = + let canUseSmall = smallSize <= 0xFF && - seh |> Array.forall (fun (st1, sz1, st2, sz2, _) -> - st1 <= 0xFFFF && st2 <= 0xFFFF && sz1 <= 0xFF && sz2 <= 0xFF) - - let kindAsInt32 k = - match k with + seh |> Array.forall (fun (st1, sz1, st2, sz2, _) -> + st1 <= 0xFFFF && st2 <= 0xFFFF && sz1 <= 0xFF && sz2 <= 0xFF) + + let kindAsInt32 k = + match k with | FinallyClause -> e_COR_ILEXCEPTION_CLAUSE_FINALLY | FaultClause -> e_COR_ILEXCEPTION_CLAUSE_FAULT | FilterClause _ -> e_COR_ILEXCEPTION_CLAUSE_FILTER | TypeFilterClause _ -> e_COR_ILEXCEPTION_CLAUSE_EXCEPTION - let kindAsExtraInt32 k = - match k with + let kindAsExtraInt32 k = + match k with | FinallyClause | FaultClause -> 0x0 | FilterClause i -> i | TypeFilterClause uncoded -> uncoded - - if canUseSmall then + + if canUseSmall then methbuf.EmitByte e_CorILMethod_Sect_EHTable - methbuf.EmitByte (b0 smallSize |> byte) - methbuf.EmitByte 0x00uy + methbuf.EmitByte (b0 smallSize |> byte) + methbuf.EmitByte 0x00uy methbuf.EmitByte 0x00uy - seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> + seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> let k32 = kindAsInt32 kind - methbuf.EmitInt32AsUInt16 k32 - methbuf.EmitInt32AsUInt16 st1 - methbuf.EmitByte (b0 sz1 |> byte) - methbuf.EmitInt32AsUInt16 st2 + methbuf.EmitInt32AsUInt16 k32 + methbuf.EmitInt32AsUInt16 st1 + methbuf.EmitByte (b0 sz1 |> byte) + methbuf.EmitInt32AsUInt16 st2 methbuf.EmitByte (b0 sz2 |> byte) methbuf.EmitInt32 (kindAsExtraInt32 kind)) - else + else let bigSize = (seh.Length * 24 + 4) methbuf.EmitByte (e_CorILMethod_Sect_EHTable ||| e_CorILMethod_Sect_FatFormat) methbuf.EmitByte (b0 bigSize |> byte) methbuf.EmitByte (b1 bigSize |> byte) methbuf.EmitByte (b2 bigSize |> byte) - seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> + seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> let k32 = kindAsInt32 kind methbuf.EmitInt32 k32 methbuf.EmitInt32 st1 @@ -11160,27 +11160,27 @@ namespace ProviderImplementation.ProvidedTypes methbuf.EmitInt32 st2 methbuf.EmitInt32 sz2 methbuf.EmitInt32 (kindAsExtraInt32 kind)) - + let requiredStringFixups' = (12, requiredStringFixups) localToken, (requiredStringFixups', methbuf.Close()) //, seqpoints, scopes - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILFieldDef --> FieldDef Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldDefAsFieldDefRow cenv env (fd: ILFieldDef) = + let rec GetFieldDefAsFieldDefRow cenv env (fd: ILFieldDef) = let flags = int fd.Attributes ||| (if (fd.LiteralValue <> None) then 0x8000 else 0x0) //||| //(if (fd.Marshal <> None) then 0x1000 else 0x0) ||| //(if (fd.Data <> None) then 0x0100 else 0x0) - UnsharedRow - [| UShort (uint16 flags) + UnsharedRow + [| UShort (uint16 flags) StringE (GetStringHeapIdx cenv fd.Name) Blob (GetFieldDefSigAsBlobIdx cenv env fd ) |] and GetFieldDefSigAsBlobIdx cenv env fd = GetFieldDefTypeAsBlobIdx cenv env fd.FieldType - and GenFieldDefPass3 cenv env fd = + and GenFieldDefPass3 cenv env fd = let fidx = AddUnsharedRow cenv ILTableNames.Field (GetFieldDefAsFieldDefRow cenv env fd) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.FieldDef, fidx) fd.CustomAttrs #if EMIT_FIELD_DATA @@ -11200,29 +11200,29 @@ namespace ProviderImplementation.ProvidedTypes (UnsharedRow [| HasFieldMarshal (hfm_FieldDef, fidx) Blob (GetNativeTypeAsBlobIdx cenv ntyp) |]) |> ignore #endif - // Write Content table - match fd.LiteralValue with + // Write Content table + match fd.LiteralValue with | None -> () - | Some i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | Some i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.FieldDef, fidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore - // Write FieldLayout table - match fd.Offset with + // Write FieldLayout table + match fd.Offset with | None -> () - | Some offset -> - AddUnsharedRow cenv ILTableNames.FieldLayout + | Some offset -> + AddUnsharedRow cenv ILTableNames.FieldLayout (UnsharedRow [| ULong offset; SimpleIndex (ILTableNames.Field, fidx) |]) |> ignore - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // ILGenericParameterDef --> GenericParam Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetGenericParamAsGenericParamRow cenv _env idx owner (gp: ILGenericParameterDef) = - let flags = + let rec GetGenericParamAsGenericParamRow cenv _env idx owner (gp: ILGenericParameterDef) = + let flags = (if gp.IsCovariant then 0x0001 else 0x0000) ||| (if gp.IsContravariant then 0x0002 else 0x0000) ||| (if gp.HasReferenceTypeConstraint then 0x0004 else 0x0000) ||| @@ -11230,62 +11230,62 @@ namespace ProviderImplementation.ProvidedTypes (if gp.HasDefaultConstructorConstraint then 0x0010 else 0x0000) let mdVersionMajor, _ = metadataSchemaVersionSupportedByCLRVersion cenv.desiredMetadataVersion - if (mdVersionMajor = 1) then - SharedRow - [| UShort (uint16 idx) - UShort (uint16 flags) + if (mdVersionMajor = 1) then + SharedRow + [| UShort (uint16 idx) + UShort (uint16 flags) TypeOrMethodDef (fst owner, snd owner) StringE (GetStringHeapIdx cenv gp.Name) TypeDefOrRefOrSpec (TypeDefOrRefOrSpecTag.TypeDef, 0) (* empty kind field in deprecated metadata *) |] else - SharedRow - [| UShort (uint16 idx) - UShort (uint16 flags) + SharedRow + [| UShort (uint16 idx) + UShort (uint16 flags) TypeOrMethodDef (fst owner, snd owner) StringE (GetStringHeapIdx cenv gp.Name) |] - and GenTypeAsGenericParamConstraintRow cenv env gpidx ty = + and GenTypeAsGenericParamConstraintRow cenv env gpidx ty = let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env ty - UnsharedRow + UnsharedRow [| SimpleIndex (ILTableNames.GenericParam, gpidx) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] and GenGenericParamConstraintPass4 cenv env gpidx ty = AddUnsharedRow cenv ILTableNames.GenericParamConstraint (GenTypeAsGenericParamConstraintRow cenv env gpidx ty) |> ignore - and GenGenericParamPass3 cenv env idx owner gp = + and GenGenericParamPass3 cenv env idx owner gp = // here we just collect generic params, its constraints\custom attributes will be processed on pass4 // shared since we look it up again below in GenGenericParamPass4 - AddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) + AddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) |> ignore - and GenGenericParamPass4 cenv env idx owner (gp: ILGenericParameterDef) = + and GenGenericParamPass4 cenv env idx owner (gp: ILGenericParameterDef) = let gpidx = FindOrAddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.GenericParam, gpidx) gp.CustomAttrs - gp.Constraints |> Array.iter (GenGenericParamConstraintPass4 cenv env gpidx) + gp.Constraints |> Array.iter (GenGenericParamConstraintPass4 cenv env gpidx) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // param and return --> Param Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetParamAsParamRow cenv _env seq (param: ILParameter) = - let flags = + let rec GetParamAsParamRow cenv _env seq (param: ILParameter) = + let flags = (if param.IsIn then 0x0001 else 0x0000) ||| (if param.IsOut then 0x0002 else 0x0000) ||| (if param.IsOptional then 0x0010 else 0x0000) ||| (if param.Default.HasValue then 0x1000 else 0x0000) //||| //(if param.Marshal <> None then 0x2000 else 0x0000) - - UnsharedRow - [| UShort (uint16 flags) - UShort (uint16 seq) - StringE (GetStringHeapIdxOption cenv param.Name) |] - and GenParamPass3 cenv env seq (param: ILParameter) = - if not param.IsIn && not param.IsOut && not param.IsOptional && param.Default.IsNone && param.Name.IsNone // && Option.isNone param.Marshal + UnsharedRow + [| UShort (uint16 flags) + UShort (uint16 seq) + StringE (GetStringHeapIdxOption cenv param.Name) |] + + and GenParamPass3 cenv env seq (param: ILParameter) = + if not param.IsIn && not param.IsOut && not param.IsOptional && param.Default.IsNone && param.Name.IsNone // && Option.isNone param.Marshal then () - else + else let pidx = AddUnsharedRow cenv ILTableNames.Param (GetParamAsParamRow cenv env seq param) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ParamDef, pidx) param.CustomAttrs #if EMIT_FIELD_MARSHAL @@ -11299,21 +11299,21 @@ namespace ProviderImplementation.ProvidedTypes #endif match param.Default with | UNone -> () - | USome i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | USome i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.ParamDef, pidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore - let GenReturnAsParamRow (returnv: ILReturn) = + let GenReturnAsParamRow (returnv: ILReturn) = let flags = 0x0000 // || (if returnv.Marshal <> None then 0x2000 else 0x0000) - UnsharedRow - [| UShort (uint16 flags) + UnsharedRow + [| UShort (uint16 flags) UShort 0us (* sequence num. *) - StringE 0 |] + StringE 0 |] - let GenReturnPass3 cenv (returnv: ILReturn) = + let GenReturnPass3 cenv (returnv: ILReturn) = if (* Option.isSome returnv.Marshal || *) not (isEmpty returnv.CustomAttrs.Entries) then let pidx = AddUnsharedRow cenv ILTableNames.Param (GenReturnAsParamRow returnv) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ParamDef, pidx) returnv.CustomAttrs @@ -11327,31 +11327,31 @@ namespace ProviderImplementation.ProvidedTypes Blob (GetNativeTypeAsBlobIdx cenv ntyp) |]) |> ignore #endif - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodDef --> ILMethodDef Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetMethodDefSigAsBytes cenv env (mdef: ILMethodDef) = - emitBytesViaBuffer (fun bb -> + let GetMethodDefSigAsBytes cenv env (mdef: ILMethodDef) = + emitBytesViaBuffer (fun bb -> bb.EmitByte (callconvToByte mdef.GenericParams.Length mdef.CallingConv) if mdef.GenericParams.Length > 0 then bb.EmitZ32 mdef.GenericParams.Length bb.EmitZ32 mdef.Parameters.Length EmitType cenv env bb mdef.Return.Type mdef.ParameterTypes |> Array.iter (EmitType cenv env bb)) - let GenMethodDefSigAsBlobIdx cenv env mdef = + let GenMethodDefSigAsBlobIdx cenv env mdef = GetBytesAsBlobIdx cenv (GetMethodDefSigAsBytes cenv env mdef) - let GenMethodDefAsRow cenv env midx (md: ILMethodDef) = + let GenMethodDefAsRow cenv env midx (md: ILMethodDef) = let flags = int md.Attributes let implflags = int md.ImplAttributes - if md.IsEntryPoint then + if md.IsEntryPoint then if cenv.entrypoint <> None then failwith "duplicate entrypoint" else cenv.entrypoint <- Some (true, midx) - let codeAddr = - (match md.Body with - | Some ilmbody -> + let codeAddr = + (match md.Body with + | Some ilmbody -> let addr = cenv.nextCodeAddr let (localToken, code (* , seqpoints, rootScope *) ) = GenILMethodBody md.Name cenv env ilmbody @@ -11400,34 +11400,34 @@ namespace ProviderImplementation.ProvidedTypes #endif | _ -> 0x0000) - UnsharedRow - [| ULong codeAddr - UShort (uint16 implflags) - UShort (uint16 flags) - StringE (GetStringHeapIdx cenv md.Name) - Blob (GenMethodDefSigAsBlobIdx cenv env md) - SimpleIndex(ILTableNames.Param, cenv.GetTable(ILTableNames.Param).Count + 1) |] + UnsharedRow + [| ULong codeAddr + UShort (uint16 implflags) + UShort (uint16 flags) + StringE (GetStringHeapIdx cenv md.Name) + Blob (GenMethodDefSigAsBlobIdx cenv env md) + SimpleIndex(ILTableNames.Param, cenv.GetTable(ILTableNames.Param).Count + 1) |] let GenMethodImplPass3 cenv env _tgparams tidx mimpl = let midxTag, midxRow = GetMethodSpecAsMethodDef cenv env (mimpl.OverrideBy, None) let midx2Tag, midx2Row = GetOverridesSpecAsMethodDefOrRef cenv env mimpl.Overrides AddUnsharedRow cenv ILTableNames.MethodImpl - (UnsharedRow + (UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) MethodDefOrRef (midxTag, midxRow) MethodDefOrRef (midx2Tag, midx2Row) |]) |> ignore - - let GenMethodDefPass3 cenv env (md:ILMethodDef) = + + let GenMethodDefPass3 cenv env (md:ILMethodDef) = let midx = GetMethodDefIdx cenv md let idx2 = AddUnsharedRow cenv ILTableNames.Method (GenMethodDefAsRow cenv env midx md) if midx <> idx2 then failwith "index of method def on pass 3 does not match index on pass 2" - GenReturnPass3 cenv md.Return - md.Parameters |> Array.iteri (fun n param -> GenParamPass3 cenv env (n+1) param) - md.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.MethodDef, midx) + GenReturnPass3 cenv md.Return + md.Parameters |> Array.iteri (fun n param -> GenParamPass3 cenv env (n+1) param) + md.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.MethodDef, midx) #if EMIT_SECURITY_DECLS md.SecurityDecls.Entries |> GenSecurityDeclsPass3 cenv (hds_MethodDef, midx) #endif - md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) + md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) #if EMIT_PINVOKE match md.Body.Contents with | MethodBody.PInvoke attr -> @@ -11467,51 +11467,51 @@ namespace ProviderImplementation.ProvidedTypes | _ -> () #endif - let GenMethodDefPass4 cenv env md = + let GenMethodDefPass4 cenv env md = let midx = GetMethodDefIdx cenv md - md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) + md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) let GenPropertyMethodSemanticsPass3 cenv pidx kind mref = // REVIEW: why are we catching exceptions here? let midx = try GetMethodRefAsMethodDefIdx cenv mref with MethodDefNotFound -> 1 AddUnsharedRow cenv ILTableNames.MethodSemantics - (UnsharedRow + (UnsharedRow [| UShort (uint16 kind) SimpleIndex (ILTableNames.Method, midx) HasSemantics (HasSemanticsTag.Property, pidx) |]) |> ignore - - let rec GetPropertySigAsBlobIdx cenv env prop = + + let rec GetPropertySigAsBlobIdx cenv env prop = GetBytesAsBlobIdx cenv (GetPropertySigAsBytes cenv env prop) - and GetPropertySigAsBytes cenv env prop = - emitBytesViaBuffer (fun bb -> + and GetPropertySigAsBytes cenv env prop = + emitBytesViaBuffer (fun bb -> let b = ((hasthisToByte prop.CallingConv) ||| e_IMAGE_CEE_CS_CALLCONV_PROPERTY) bb.EmitByte b bb.EmitZ32 prop.IndexParameterTypes.Length EmitType cenv env bb prop.PropertyType prop.IndexParameterTypes |> Array.iter (EmitType cenv env bb)) - and GetPropertyAsPropertyRow cenv env (prop:ILPropertyDef) = - let flags = - (if prop.IsSpecialName then 0x0200 else 0x0) ||| - (if prop.IsRTSpecialName then 0x0400 else 0x0) ||| + and GetPropertyAsPropertyRow cenv env (prop:ILPropertyDef) = + let flags = + (if prop.IsSpecialName then 0x0200 else 0x0) ||| + (if prop.IsRTSpecialName then 0x0400 else 0x0) ||| (if prop.Init <> None then 0x1000 else 0x0) - UnsharedRow - [| UShort (uint16 flags) - StringE (GetStringHeapIdx cenv prop.Name) - Blob (GetPropertySigAsBlobIdx cenv env prop) |] + UnsharedRow + [| UShort (uint16 flags) + StringE (GetStringHeapIdx cenv prop.Name) + Blob (GetPropertySigAsBlobIdx cenv env prop) |] /// ILPropertyDef --> Property Row + MethodSemantics entries - and GenPropertyPass3 cenv env prop = + and GenPropertyPass3 cenv env prop = let pidx = AddUnsharedRow cenv ILTableNames.Property (GetPropertyAsPropertyRow cenv env prop) - prop.SetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0001) - prop.GetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0002) - // Write Constant table - match prop.Init with + prop.SetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0001) + prop.GetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0002) + // Write Constant table + match prop.Init with | None -> () - | Some i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | Some i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.Property, pidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore @@ -11520,42 +11520,42 @@ namespace ProviderImplementation.ProvidedTypes let rec GenEventMethodSemanticsPass3 cenv eidx kind mref = let addIdx = try GetMethodRefAsMethodDefIdx cenv mref with MethodDefNotFound -> 1 AddUnsharedRow cenv ILTableNames.MethodSemantics - (UnsharedRow + (UnsharedRow [| UShort (uint16 kind) SimpleIndex (ILTableNames.Method, addIdx) HasSemantics (HasSemanticsTag.Event, eidx) |]) |> ignore /// ILEventDef --> Event Row + MethodSemantics entries - and GenEventAsEventRow cenv env (md: ILEventDef) = - let flags = - (if md.IsSpecialName then 0x0200 else 0x0) ||| + and GenEventAsEventRow cenv env (md: ILEventDef) = + let flags = + (if md.IsSpecialName then 0x0200 else 0x0) ||| (if md.IsRTSpecialName then 0x0400 else 0x0) let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env md.EventHandlerType - UnsharedRow - [| UShort (uint16 flags) - StringE (GetStringHeapIdx cenv md.Name) + UnsharedRow + [| UShort (uint16 flags) + StringE (GetStringHeapIdx cenv md.Name) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] - and GenEventPass3 cenv env (md: ILEventDef) = + and GenEventPass3 cenv env (md: ILEventDef) = let eidx = AddUnsharedRow cenv ILTableNames.Event (GenEventAsEventRow cenv env md) - md.AddMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0008 - md.RemoveMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0010 - //Option.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0020) md.FireMethod + md.AddMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0008 + md.RemoveMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0010 + //Option.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0020) md.FireMethod //List.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0004) md.OtherMethods GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Event, eidx) md.CustomAttrs - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // resource --> generate ... - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetResourceAsManifestResourceRow cenv r = - let data, impl = + let rec GetResourceAsManifestResourceRow cenv r = + let data, impl = match r.Location with | ILResourceLocation.Local bf -> let b = bf() - // Embedded managed resources must be word-aligned. However resource format is - // not specified in ECMA. Some mscorlib resources appear to be non-aligned - it seems it doesn't matter.. + // Embedded managed resources must be word-aligned. However resource format is + // not specified in ECMA. Some mscorlib resources appear to be non-aligned - it seems it doesn't matter.. let offset = cenv.resources.Position let alignedOffset = (align 0x8 offset) let pad = alignedOffset - offset @@ -11563,24 +11563,24 @@ namespace ProviderImplementation.ProvidedTypes cenv.resources.EmitPadding pad cenv.resources.EmitInt32 resourceSize cenv.resources.EmitBytes b - Data (alignedOffset, true), (ImplementationTag.File, 0) + Data (alignedOffset, true), (ImplementationTag.File, 0) | ILResourceLocation.File (mref, offset) -> ULong offset, (ImplementationTag.File, GetModuleRefAsFileIdx cenv mref) | ILResourceLocation.Assembly aref -> ULong 0x0, (ImplementationTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) - UnsharedRow - [| data + UnsharedRow + [| data ULong (match r.Access with ILResourceAccess.Public -> 0x01 | ILResourceAccess.Private -> 0x02) - StringE (GetStringHeapIdx cenv r.Name) + StringE (GetStringHeapIdx cenv r.Name) Implementation (fst impl, snd impl) |] - and GenResourcePass3 cenv r = + and GenResourcePass3 cenv r = let idx = AddUnsharedRow cenv ILTableNames.ManifestResource (GetResourceAsManifestResourceRow cenv r) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ManifestResource, idx) r.CustomAttrs - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILTypeDef --> generate ILFieldDef, ILMethodDef, ILPropertyDef etc. rows - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GenTypeDefPass3 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass3 enc cenv (td:ILTypeDef) = try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) @@ -11589,22 +11589,22 @@ namespace ProviderImplementation.ProvidedTypes td.Fields.Entries |> Array.iter (GenFieldDefPass3 cenv env) td.Methods.Entries |> Array.iter (GenMethodDefPass3 cenv env) td.MethodImpls.Entries |> Array.iter (GenMethodImplPass3 cenv env td.GenericParams.Length tidx) - // ClassLayout entry if needed - match td.Layout with + // ClassLayout entry if needed + match td.Layout with | ILTypeDefLayout.Auto -> () - | ILTypeDefLayout.Sequential layout | ILTypeDefLayout.Explicit layout -> - if Option.isSome layout.Pack || Option.isSome layout.Size then + | ILTypeDefLayout.Sequential layout | ILTypeDefLayout.Explicit layout -> + if Option.isSome layout.Pack || Option.isSome layout.Size then AddUnsharedRow cenv ILTableNames.ClassLayout - (UnsharedRow + (UnsharedRow [| UShort (defaultArg layout.Pack (uint16 0x0)) ULong (defaultArg layout.Size 0x0) SimpleIndex (ILTableNames.TypeDef, tidx) |]) |> ignore - + #if EMIT_SECURITY_DECLS td.SecurityDecls.Entries |> GenSecurityDeclsPass3 cenv (hds_TypeDef, tidx) #endif td.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.TypeDef, tidx) - td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) + td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) td.NestedTypes.Entries |> GenTypeDefsPass3 (addILTypeName enc td) cenv with e -> failwith ("Error in pass3 for type "+td.Name+", error: "+e.Message) @@ -11617,12 +11617,12 @@ namespace ProviderImplementation.ProvidedTypes /// ILTypeDef --> generate generic params on ILMethodDef: ensures /// GenericParam table is built sorted by owner. - let rec GenTypeDefPass4 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass4 enc cenv (td:ILTypeDef) = try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) - td.Methods.Entries |> Array.iter (GenMethodDefPass4 cenv env) - td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) + td.Methods.Entries |> Array.iter (GenMethodDefPass4 cenv env) + td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) GenTypeDefsPass4 (addILTypeName enc td) cenv td.NestedTypes.Entries with e -> failwith ("Error in pass4 for type "+td.Name+", error: "+e.Message) @@ -11636,19 +11636,19 @@ namespace ProviderImplementation.ProvidedTypes let DateTime1970Jan01 = new System.DateTime(1970,1,1,0,0,0,System.DateTimeKind.Utc) (* ECMA Spec (Oct2002), Part II, 24.2.2 PE File Header. *) let timestamp = (System.DateTime.UtcNow - DateTime1970Jan01).TotalSeconds |> int - // -------------------------------------------------------------------- - // ILExportedTypesAndForwarders --> ILExportedTypeOrForwarder table - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- + // ILExportedTypesAndForwarders --> ILExportedTypeOrForwarder table + // -------------------------------------------------------------------- - let rec GenNestedExportedTypePass3 cenv cidx (ce: ILNestedExportedType) = + let rec GenNestedExportedTypePass3 cenv cidx (ce: ILNestedExportedType) = let flags = GetMemberAccessFlags ce.Access - let nidx = - AddUnsharedRow cenv ILTableNames.ExportedType - (UnsharedRow - [| ULong flags + let nidx = + AddUnsharedRow cenv ILTableNames.ExportedType + (UnsharedRow + [| ULong flags ULong 0x0 - StringE (GetStringHeapIdx cenv ce.Name) - StringE 0 + StringE (GetStringHeapIdx cenv ce.Name) + StringE 0 Implementation (ImplementationTag.ExportedType, cidx) |]) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ExportedType, nidx) ce.CustomAttrs GenNestedExportedTypesPass3 cenv nidx ce.Nested @@ -11656,39 +11656,39 @@ namespace ProviderImplementation.ProvidedTypes and GenNestedExportedTypesPass3 cenv nidx (nce: ILNestedExportedTypesAndForwarders) = nce.Entries |> Array.iter (GenNestedExportedTypePass3 cenv nidx) - and GenExportedTypePass3 cenv (ce: ILExportedTypeOrForwarder) = + and GenExportedTypePass3 cenv (ce: ILExportedTypeOrForwarder) = let nselem, nelem = GetTypeNameAsElemPair cenv (ce.Namespace, ce.Name) let flags = GetTypeAccessFlags ce.Access let flags = if ce.IsForwarder then 0x00200000 ||| flags else flags let impl = GetScopeRefAsImplementationElem cenv ce.ScopeRef - let cidx = - AddUnsharedRow cenv ILTableNames.ExportedType - (UnsharedRow - [| ULong flags + let cidx = + AddUnsharedRow cenv ILTableNames.ExportedType + (UnsharedRow + [| ULong flags ULong 0x0 - nelem - nselem + nelem + nselem Implementation (fst impl, snd impl) |]) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ExportedType, cidx) ce.CustomAttrs GenNestedExportedTypesPass3 cenv cidx ce.Nested - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // manifest --> generate Assembly row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - and GetManifestAsAssemblyRow cenv m = - UnsharedRow + and GetManifestAsAssemblyRow cenv m = + UnsharedRow [|ULong m.AuxModuleHashAlgorithm UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Major) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Minor) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Build) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Revision) - ULong - ( //(match m.AssemblyLongevity with + ULong + ( //(match m.AssemblyLongevity with //| ILAssemblyLongevity.Unspecified -> 0x0000 - //| ILAssemblyLongevity.Library -> 0x0002 + //| ILAssemblyLongevity.Library -> 0x0002 //| ILAssemblyLongevity.PlatformAppDomain -> 0x0004 // | ILAssemblyLongevity.PlatformProcess -> 0x0006 // | ILAssemblyLongevity.PlatformSystem -> 0x0008) ||| @@ -11696,27 +11696,27 @@ namespace ProviderImplementation.ProvidedTypes // Setting these causes peverify errors. Hence both ilread and ilwrite ignore them and refuse to set them. // Any debugging customattributes will automatically propagate // REVIEW: No longer appears to be the case - (if m.JitTracking then 0x8000 else 0x0) ||| + (if m.JitTracking then 0x8000 else 0x0) ||| (match m.PublicKey with UNone -> 0x0000 | USome _ -> 0x0001) ||| 0x0000) (match m.PublicKey with UNone -> Blob 0 | USome x -> Blob (GetBytesAsBlobIdx cenv x)) StringE (GetStringHeapIdx cenv m.Name) (match m.Locale with UNone -> StringE 0 | USome x -> StringE (GetStringHeapIdx cenv x)) |] - and GenManifestPass3 cenv m = + and GenManifestPass3 cenv m = let aidx = AddUnsharedRow cenv ILTableNames.Assembly (GetManifestAsAssemblyRow cenv m) #if EMIT_SECURITY_DECLS GenSecurityDeclsPass3 cenv (hds_Assembly, aidx) m.SecurityDecls.Entries #endif GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Assembly, aidx) m.CustomAttrs - m.ExportedTypes.Entries |> Array.iter (GenExportedTypePass3 cenv) - // Record the entrypoint decl if needed. + m.ExportedTypes.Entries |> Array.iter (GenExportedTypePass3 cenv) + // Record the entrypoint decl if needed. match m.EntrypointElsewhere with - | Some mref -> + | Some mref -> if cenv.entrypoint <> None then failwith "duplicate entrypoint" else cenv.entrypoint <- Some (false, GetModuleRefAsIdx cenv mref) | None -> () - and newGuid (modul: ILModuleDef) = + and newGuid (modul: ILModuleDef) = let n = timestamp let m = hash n let m2 = hash modul.Name @@ -11728,44 +11728,44 @@ namespace ProviderImplementation.ProvidedTypes let m2 = hash modul.Name [| b0 m; b1 m; b2 m; b3 m; b0 m2; b1 m2; b2 m2; b3 m2; 0xa7uy; 0x45uy; 0x03uy; 0x83uy; b0 n; b1 n; b2 n; b3 n |] - and GetModuleAsRow (cenv:cenv) (modul: ILModuleDef) = + and GetModuleAsRow (cenv:cenv) (modul: ILModuleDef) = // Store the generated MVID in the environment (needed for generating debug information) let modulGuid = if cenv.deterministic then deterministicGuid modul else newGuid modul cenv.moduleGuid <- modulGuid - UnsharedRow - [| UShort (uint16 0x0) - StringE (GetStringHeapIdx cenv modul.Name) - Guid (GetGuidIdx cenv modulGuid) - Guid 0 + UnsharedRow + [| UShort (uint16 0x0) + StringE (GetStringHeapIdx cenv modul.Name) + Guid (GetGuidIdx cenv modulGuid) + Guid 0 Guid 0 |] - let rowElemCompare (e1: RowElement) (e2: RowElement) = - let c = compare e1.Val e2.Val - if c <> 0 then c else + let rowElemCompare (e1: RowElement) (e2: RowElement) = + let c = compare e1.Val e2.Val + if c <> 0 then c else compare e1.Tag e2.Tag - module List = - let rec assoc x l = - match l with + module List = + let rec assoc x l = + match l with | [] -> failwith "index not found" | ((h,r)::t) -> if x = h then r else assoc x t - let rec memAssoc x l = - match l with + let rec memAssoc x l = + match l with | [] -> false | ((h,_)::t) -> x = h || memAssoc x t - let TableRequiresSorting tab = - List.memAssoc tab ILTableNames.sortedTableInfo + let TableRequiresSorting tab = + List.memAssoc tab ILTableNames.sortedTableInfo - let SortTableRows tab (rows:GenericRow[]) = + let SortTableRows tab (rows:GenericRow[]) = assert (TableRequiresSorting tab) let col = List.assoc tab ILTableNames.sortedTableInfo - rows + rows // This needs to be a stable sort, so we use List.sortWith |> Array.toList - |> List.sortWith (fun r1 r2 -> rowElemCompare r1.[col] r2.[col]) + |> List.sortWith (fun r1 r2 -> rowElemCompare r1.[col] r2.[col]) |> Array.ofList //|> Array.map SharedRow @@ -11786,38 +11786,38 @@ namespace ProviderImplementation.ProvidedTypes Properties=props Events=events Token=0 - //SecurityDecls=emptyILSecurityDecls; + //SecurityDecls=emptyILSecurityDecls; //HasSecurity=false; - } - let mkILTypeDefForGlobalFunctions ilg (methods,fields) = + } + let mkILTypeDefForGlobalFunctions ilg (methods,fields) = mkILSimpleClass ilg (UNone, typeNameForGlobalFunctions, methods, fields, emptyILTypeDefs, emptyILProperties, emptyILEvents, emptyILCustomAttrs) - let destTypeDefsWithGlobalFunctionsFirst ilg (tdefs: ILTypeDefs) = + let destTypeDefsWithGlobalFunctionsFirst ilg (tdefs: ILTypeDefs) = let l = tdefs.Entries let top,nontop = l |> Array.partition (fun td -> td.Name = typeNameForGlobalFunctions) let top2 = if isEmpty top then [| mkILTypeDefForGlobalFunctions ilg (emptyILMethods, emptyILFields) |] else top Array.append top2 nontop - let GenModule (cenv: cenv) (modul: ILModuleDef) = + let GenModule (cenv: cenv) (modul: ILModuleDef) = let midx = AddUnsharedRow cenv ILTableNames.Module (GetModuleAsRow cenv modul) - Array.iter (GenResourcePass3 cenv) modul.Resources.Entries + Array.iter (GenResourcePass3 cenv) modul.Resources.Entries let tds = destTypeDefsWithGlobalFunctionsFirst cenv.ilg modul.TypeDefs GenTypeDefsPass1 [] cenv tds GenTypeDefsPass2 0 [] cenv tds (match modul.Manifest with None -> () | Some m -> GenManifestPass3 cenv m) GenTypeDefsPass3 [] cenv tds GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Module, midx) modul.CustomAttrs - // GenericParam is the only sorted table indexed by Columns in other tables (GenericParamConstraint\CustomAttributes). - // Hence we need to sort it before we emit any entries in GenericParamConstraint\CustomAttributes that are attached to generic params. - // Note this mutates the rows in a table. 'SetRowsOfTable' clears - // the key --> index map since it is no longer valid + // GenericParam is the only sorted table indexed by Columns in other tables (GenericParamConstraint\CustomAttributes). + // Hence we need to sort it before we emit any entries in GenericParamConstraint\CustomAttributes that are attached to generic params. + // Note this mutates the rows in a table. 'SetRowsOfTable' clears + // the key --> index map since it is no longer valid cenv.GetTable(ILTableNames.GenericParam).SetRowsOfSharedTable (SortTableRows ILTableNames.GenericParam (cenv.GetTable(ILTableNames.GenericParam).GenericRowsOfTable)) GenTypeDefsPass4 [] cenv tds let generateIL requiredDataFixups (desiredMetadataVersion, generatePdb, ilg: ILGlobals, emitTailcalls, deterministic, showTimes) (m: ILModuleDef) cilStartAddress = let isDll = m.IsDLL - let cenv = + let cenv = { emitTailcalls=emitTailcalls deterministic = deterministic showTimes=showTimes @@ -11829,8 +11829,8 @@ namespace ProviderImplementation.ProvidedTypes nextCodeAddr = cilStartAddress data = ByteBuffer.Create 200 resources = ByteBuffer.Create 200 - tables= - Array.init 64 (fun i -> + tables= + Array.init 64 (fun i -> if (i = ILTableNames.AssemblyRef.Index || i = ILTableNames.MemberRef.Index || i = ILTableNames.ModuleRef.Index || @@ -11839,7 +11839,7 @@ namespace ProviderImplementation.ProvidedTypes i = ILTableNames.TypeSpec.Index || i = ILTableNames.MethodSpec.Index || i = ILTableNames.StandAloneSig.Index || - i = ILTableNames.GenericParam.Index) then + i = ILTableNames.GenericParam.Index) then MetadataTable.Shared (MetadataTable.New ("row table "+string i, EqualityComparer.Default)) else MetadataTable.Unshared (MetadataTable.New ("row table "+string i, EqualityComparer.Default))) @@ -11863,19 +11863,19 @@ namespace ProviderImplementation.ProvidedTypes // These must use structural comparison since they are keyed by arrays guids=MetadataTable<_>.New("guids", HashIdentity.Structural) blobs= MetadataTable<_>.New("blobs", HashIdentity.Structural) - strings= MetadataTable<_>.New("strings", EqualityComparer.Default) + strings= MetadataTable<_>.New("strings", EqualityComparer.Default) userStrings= MetadataTable<_>.New("user strings", EqualityComparer.Default) } - // Now the main compilation step + // Now the main compilation step GenModule cenv m // .exe files have a .entrypoint instruction. Do not write it to the entrypoint when writing dll. - let entryPointToken = - match cenv.entrypoint with - | Some (epHere, tok) -> + let entryPointToken = + match cenv.entrypoint with + | Some (epHere, tok) -> if isDll then 0x0 - else getUncodedToken (if epHere then ILTableNames.Method else ILTableNames.File) tok - | None -> + else getUncodedToken (if epHere then ILTableNames.Method else ILTableNames.File) tok + | None -> if not isDll then printfn "warning: no entrypoint specified in executable binary" 0x0 @@ -11899,9 +11899,9 @@ namespace ProviderImplementation.ProvidedTypes let userStrings = cenv.userStrings.EntriesAsArray |> Array.map Encoding.Unicode.GetBytes let blobs = cenv.blobs.EntriesAsArray let guids = cenv.guids.EntriesAsArray - let tables = cenv.tables - let code = cenv.GetCode() - // turn idx tbls into token maps + let tables = cenv.tables + let code = cenv.GetCode() + // turn idx tbls into token maps let mappings = { TypeDefTokenMap = (fun t -> getUncodedToken ILTableNames.TypeDef (idxForNestedTypeDef t)) @@ -11917,7 +11917,7 @@ namespace ProviderImplementation.ProvidedTypes EventTokenMap = (fun t ed -> let tidx = idxForNestedTypeDef t getUncodedToken ILTableNames.Event (cenv.eventDefs.GetTableEntry (EventKey (tidx, ed.Name)))) } - // New return the results + // New return the results let data = cenv.data.Close() let resources = cenv.resources.Close() (strings, userStrings, blobs, guids, tables, entryPointToken, code, cenv.requiredStringFixups, data, resources, pdbData, mappings) @@ -11926,47 +11926,47 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== // TABLES+BLOBS --> PHYSICAL METADATA+BLOBS //===================================================================== - let chunk sz next = ({addr=next; size=sz}, next + sz) + let chunk sz next = ({addr=next; size=sz}, next + sz) let nochunk next = ({addr= 0x0;size= 0x0; } , next) - let count f arr = - Array.fold (fun x y -> x + f y) 0x0 arr + let count f arr = + Array.fold (fun x y -> x + f y) 0x0 arr let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailcalls, deterministic, showTimes) modul cilStartAddress = - // When we know the real RVAs of the data section we fixup the references for the FieldRVA table. - // These references are stored as offsets into the metadata we return from this function + // When we know the real RVAs of the data section we fixup the references for the FieldRVA table. + // These references are stored as offsets into the metadata we return from this function let requiredDataFixups = ResizeArray() let next = cilStartAddress - let strings, userStrings, blobs, guids, tables, entryPointToken, code, requiredStringFixups, data, resources, pdbData, mappings = + let strings, userStrings, blobs, guids, tables, entryPointToken, code, requiredStringFixups, data, resources, pdbData, mappings = generateIL requiredDataFixups (desiredMetadataVersion, generatePdb, ilg, emitTailcalls, deterministic, showTimes) modul cilStartAddress let tableSize (tab: ILTableName) = tables.[tab.Index].Count - // Now place the code + // Now place the code let codeSize = code.Length let alignedCodeSize = align 0x4 codeSize let codep, next = chunk codeSize next let codePadding = Array.create (alignedCodeSize - codeSize) 0x0uy let _codePaddingChunk, next = chunk codePadding.Length next - // Now layout the chunks of metadata and IL + // Now layout the chunks of metadata and IL let metadataHeaderStartChunk, _next = chunk 0x10 next let numStreams = 0x05 let (mdtableVersionMajor, mdtableVersionMinor) = metadataSchemaVersionSupportedByCLRVersion desiredMetadataVersion - let version = + let version = Encoding.UTF8.GetBytes (sprintf "v%d.%d.%d" desiredMetadataVersion.Major desiredMetadataVersion.Minor desiredMetadataVersion.Build) let paddedVersionLength = align 0x4 (Array.length version) - // Most addresses after this point are measured from the MD root - // Switch to md-rooted addresses + // Most addresses after this point are measured from the MD root + // Switch to md-rooted addresses let next = metadataHeaderStartChunk.size let _metadataHeaderVersionChunk, next = chunk paddedVersionLength next let _metadataHeaderEndChunk, next = chunk 0x04 next @@ -11980,13 +11980,13 @@ namespace ProviderImplementation.ProvidedTypes let stringsStreamUnpaddedSize = count (fun (s:byte[]) -> s.Length) strings + 1 let stringsStreamPaddedSize = align 4 stringsStreamUnpaddedSize - + let userStringsStreamUnpaddedSize = count (fun (s:byte[]) -> let n = s.Length + 1 in n + ByteBuffer.Z32Size n) userStrings + 1 let userStringsStreamPaddedSize = align 4 userStringsStreamUnpaddedSize - + let guidsStreamUnpaddedSize = (Array.length guids) * 0x10 let guidsStreamPaddedSize = align 4 guidsStreamUnpaddedSize - + let blobsStreamUnpaddedSize = count (fun (blob:byte[]) -> let n = blob.Length in n + ByteBuffer.Z32Size n) blobs + 1 let blobsStreamPaddedSize = align 4 blobsStreamUnpaddedSize @@ -11994,30 +11994,30 @@ namespace ProviderImplementation.ProvidedTypes let stringsBig = stringsStreamPaddedSize >= 0x10000 let blobsBig = blobsStreamPaddedSize >= 0x10000 - // 64bit bitvector indicating which tables are in the metadata. - let (valid1, valid2), _ = - (((0, 0), 0), tables) ||> Array.fold (fun ((valid1, valid2) as valid, n) rows -> - let valid = + // 64bit bitvector indicating which tables are in the metadata. + let (valid1, valid2), _ = + (((0, 0), 0), tables) ||> Array.fold (fun ((valid1, valid2) as valid, n) rows -> + let valid = if rows.Count = 0 then valid else - ( (if n < 32 then valid1 ||| (1 <<< n ) else valid1), + ( (if n < 32 then valid1 ||| (1 <<< n ) else valid1), (if n >= 32 then valid2 ||| (1 <<< (n-32)) else valid2) ) (valid, n+1)) - // 64bit bitvector indicating which tables are sorted. - // Constant - REVIEW: make symbolic! compute from sorted table info! + // 64bit bitvector indicating which tables are sorted. + // Constant - REVIEW: make symbolic! compute from sorted table info! let sorted1 = 0x3301fa00 - let sorted2 = - // If there are any generic parameters in the binary we're emitting then mark that - // table as sorted, otherwise don't. This maximizes the number of assemblies we emit - // which have an ECMA-v.1. compliant set of sorted tables. - (if tableSize (ILTableNames.GenericParam) > 0 then 0x00000400 else 0x00000000) ||| - (if tableSize (ILTableNames.GenericParamConstraint) > 0 then 0x00001000 else 0x00000000) ||| + let sorted2 = + // If there are any generic parameters in the binary we're emitting then mark that + // table as sorted, otherwise don't. This maximizes the number of assemblies we emit + // which have an ECMA-v.1. compliant set of sorted tables. + (if tableSize (ILTableNames.GenericParam) > 0 then 0x00000400 else 0x00000000) ||| + (if tableSize (ILTableNames.GenericParamConstraint) > 0 then 0x00001000 else 0x00000000) ||| 0x00000200 - + let guidAddress n = (if n = 0 then 0 else (n - 1) * 0x10 + 0x01) - let stringAddressTable = + let stringAddressTable = let tab = Array.create (strings.Length + 1) 0 let pos = ref 1 for i = 1 to strings.Length do @@ -12026,11 +12026,11 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + s.Length tab - let stringAddress n = + let stringAddress n = if n >= Array.length stringAddressTable then failwith ("string index "+string n+" out of range") stringAddressTable.[n] - - let userStringAddressTable = + + let userStringAddressTable = let tab = Array.create (Array.length userStrings + 1) 0 let pos = ref 1 for i = 1 to Array.length userStrings do @@ -12040,11 +12040,11 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + n + ByteBuffer.Z32Size n tab - let userStringAddress n = + let userStringAddress n = if n >= Array.length userStringAddressTable then failwith "userString index out of range" userStringAddressTable.[n] - - let blobAddressTable = + + let blobAddressTable = let tab = Array.create (blobs.Length + 1) 0 let pos = ref 1 for i = 1 to blobs.Length do @@ -12053,42 +12053,42 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + blob.Length + ByteBuffer.Z32Size blob.Length tab - let blobAddress n = + let blobAddress n = if n >= blobAddressTable.Length then failwith "blob index out of range" blobAddressTable.[n] - - let sortedTables = - Array.init 64 (fun i -> + + let sortedTables = + Array.init 64 (fun i -> let tab = tables.[i] let tabName = ILTableName.FromIndex i let rows = tab.GenericRowsOfTable if TableRequiresSorting tabName then SortTableRows tabName rows else rows) - - let codedTables = - + + let codedTables = + let bignessTable = Array.map (fun rows -> Array.length rows >= 0x10000) sortedTables let bigness (tab:int32) = bignessTable.[tab] - + let codedBigness nbits tab = (tableSize tab) >= (0x10000 >>> nbits) - - let tdorBigness = - codedBigness 2 ILTableNames.TypeDef || - codedBigness 2 ILTableNames.TypeRef || + + let tdorBigness = + codedBigness 2 ILTableNames.TypeDef || + codedBigness 2 ILTableNames.TypeRef || codedBigness 2 ILTableNames.TypeSpec - - let tomdBigness = - codedBigness 1 ILTableNames.TypeDef || + + let tomdBigness = + codedBigness 1 ILTableNames.TypeDef || codedBigness 1 ILTableNames.Method - - let hcBigness = + + let hcBigness = codedBigness 2 ILTableNames.Field || codedBigness 2 ILTableNames.Param || codedBigness 2 ILTableNames.Property - - let hcaBigness = + + let hcaBigness = codedBigness 5 ILTableNames.Method || codedBigness 5 ILTableNames.Field || codedBigness 5 ILTableNames.TypeRef || @@ -12112,82 +12112,82 @@ namespace ProviderImplementation.ProvidedTypes codedBigness 5 ILTableNames.GenericParamConstraint || codedBigness 5 ILTableNames.MethodSpec - - let hfmBigness = - codedBigness 1 ILTableNames.Field || + + let hfmBigness = + codedBigness 1 ILTableNames.Field || codedBigness 1 ILTableNames.Param - - let hdsBigness = - codedBigness 2 ILTableNames.TypeDef || + + let hdsBigness = + codedBigness 2 ILTableNames.TypeDef || codedBigness 2 ILTableNames.Method || codedBigness 2 ILTableNames.Assembly - - let mrpBigness = + + let mrpBigness = codedBigness 3 ILTableNames.TypeRef || codedBigness 3 ILTableNames.ModuleRef || codedBigness 3 ILTableNames.Method || codedBigness 3 ILTableNames.TypeSpec - - let hsBigness = - codedBigness 1 ILTableNames.Event || - codedBigness 1 ILTableNames.Property - + + let hsBigness = + codedBigness 1 ILTableNames.Event || + codedBigness 1 ILTableNames.Property + let mdorBigness = - codedBigness 1 ILTableNames.Method || - codedBigness 1 ILTableNames.MemberRef - + codedBigness 1 ILTableNames.Method || + codedBigness 1 ILTableNames.MemberRef + let mfBigness = codedBigness 1 ILTableNames.Field || - codedBigness 1 ILTableNames.Method - + codedBigness 1 ILTableNames.Method + let iBigness = - codedBigness 2 ILTableNames.File || - codedBigness 2 ILTableNames.AssemblyRef || - codedBigness 2 ILTableNames.ExportedType - - let catBigness = - codedBigness 3 ILTableNames.Method || - codedBigness 3 ILTableNames.MemberRef - - let rsBigness = - codedBigness 2 ILTableNames.Module || - codedBigness 2 ILTableNames.ModuleRef || + codedBigness 2 ILTableNames.File || + codedBigness 2 ILTableNames.AssemblyRef || + codedBigness 2 ILTableNames.ExportedType + + let catBigness = + codedBigness 3 ILTableNames.Method || + codedBigness 3 ILTableNames.MemberRef + + let rsBigness = + codedBigness 2 ILTableNames.Module || + codedBigness 2 ILTableNames.ModuleRef || codedBigness 2 ILTableNames.AssemblyRef || codedBigness 2 ILTableNames.TypeRef let tablesBuf = ByteBuffer.Create 20000 - // Now the coded tables themselves - first the schemata header - tablesBuf.EmitIntsAsBytes - [| 0x00; 0x00; 0x00; 0x00; - mdtableVersionMajor // major version of table schemata - mdtableVersionMinor // minor version of table schemata - - ((if stringsBig then 0x01 else 0x00) ||| // bit vector for heap size - (if guidsBig then 0x02 else 0x00) ||| + // Now the coded tables themselves - first the schemata header + tablesBuf.EmitIntsAsBytes + [| 0x00; 0x00; 0x00; 0x00; + mdtableVersionMajor // major version of table schemata + mdtableVersionMinor // minor version of table schemata + + ((if stringsBig then 0x01 else 0x00) ||| // bit vector for heap size + (if guidsBig then 0x02 else 0x00) ||| (if blobsBig then 0x04 else 0x00)) 0x01 (* reserved, always 1 *) |] - + tablesBuf.EmitInt32 valid1 tablesBuf.EmitInt32 valid2 tablesBuf.EmitInt32 sorted1 tablesBuf.EmitInt32 sorted2 - - // Numbers of rows in various tables - for rows in sortedTables do - if rows.Length <> 0 then - tablesBuf.EmitInt32 rows.Length - - - - // The tables themselves + + // Numbers of rows in various tables for rows in sortedTables do - for row in rows do - for x in row do - // Emit the coded token for the array element + if rows.Length <> 0 then + tablesBuf.EmitInt32 rows.Length + + + + // The tables themselves + for rows in sortedTables do + for row in rows do + for x in row do + // Emit the coded token for the array element let t = x.Tag let n = x.Val - match t with + match t with | _ when t = RowElementTags.UShort -> tablesBuf.EmitUInt16 (uint16 n) | _ when t = RowElementTags.ULong -> tablesBuf.EmitInt32 n | _ when t = RowElementTags.Data -> recordRequiredDataFixup requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, false) @@ -12202,8 +12202,8 @@ namespace ProviderImplementation.ProvidedTypes | _ when t <= RowElementTags.HasCustomAttributeMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasCustomAttributeMin) 5 hcaBigness n | _ when t <= RowElementTags.HasFieldMarshalMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasFieldMarshalMin) 1 hfmBigness n | _ when t <= RowElementTags.HasDeclSecurityMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasDeclSecurityMin) 2 hdsBigness n - | _ when t <= RowElementTags.MemberRefParentMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberRefParentMin) 3 mrpBigness n - | _ when t <= RowElementTags.HasSemanticsMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasSemanticsMin) 1 hsBigness n + | _ when t <= RowElementTags.MemberRefParentMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberRefParentMin) 3 mrpBigness n + | _ when t <= RowElementTags.HasSemanticsMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasSemanticsMin) 1 hsBigness n | _ when t <= RowElementTags.MethodDefOrRefMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MethodDefOrRefMin) 1 mdorBigness n | _ when t <= RowElementTags.MemberForwardedMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberForwardedMin) 1 mfBigness n | _ when t <= RowElementTags.ImplementationMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.ImplementationMin) 2 iBigness n @@ -12215,8 +12215,8 @@ namespace ProviderImplementation.ProvidedTypes let tablesStreamUnpaddedSize = codedTables.Length - // QUERY: extra 4 empty bytes in array.exe - why? Include some extra padding after - // the tables just in case there is a mistake in the ECMA spec. + // QUERY: extra 4 empty bytes in array.exe - why? Include some extra padding after + // the tables just in case there is a mistake in the ECMA spec. let tablesStreamPaddedSize = align 4 (tablesStreamUnpaddedSize + 4) let tablesChunk, next = chunk tablesStreamPaddedSize next let tablesStreamPadding = tablesChunk.size - tablesStreamUnpaddedSize @@ -12228,24 +12228,24 @@ namespace ProviderImplementation.ProvidedTypes let guidsChunk, next = chunk (0x10 * guids.Length) next let blobsChunk, _next = chunk blobsStreamPaddedSize next let blobsStreamPadding = blobsChunk.size - blobsStreamUnpaddedSize - + let metadata, guidStart = - let mdbuf = ByteBuffer.Create 500000 - mdbuf.EmitIntsAsBytes - [| 0x42; 0x53; 0x4a; 0x42; // Magic signature - 0x01; 0x00; // Major version - 0x01; 0x00; // Minor version + let mdbuf = ByteBuffer.Create 500000 + mdbuf.EmitIntsAsBytes + [| 0x42; 0x53; 0x4a; 0x42; // Magic signature + 0x01; 0x00; // Major version + 0x01; 0x00; // Minor version |]; - mdbuf.EmitInt32 0x0; // Reserved + mdbuf.EmitInt32 0x0; // Reserved mdbuf.EmitInt32 paddedVersionLength; mdbuf.EmitBytes version; - for i = 1 to (paddedVersionLength - Array.length version) do + for i = 1 to (paddedVersionLength - Array.length version) do mdbuf.EmitIntAsByte 0x00; - mdbuf.EmitBytes - [| 0x00uy; 0x00uy; // flags, reserved + mdbuf.EmitBytes + [| 0x00uy; 0x00uy; // flags, reserved b0 numStreams; b1 numStreams; |]; mdbuf.EmitInt32 tablesChunk.addr; mdbuf.EmitInt32 tablesChunk.size; @@ -12262,46 +12262,46 @@ namespace ProviderImplementation.ProvidedTypes mdbuf.EmitInt32 blobsChunk.addr; mdbuf.EmitInt32 blobsChunk.size; mdbuf.EmitIntsAsBytes [| 0x23; 0x42; 0x6c; 0x6f; 0x62; 0x00; 0x00; 0x00; (* #Blob000 *)|]; - - // Now the coded tables themselves - mdbuf.EmitBytes codedTables; - for i = 1 to tablesStreamPadding do + + // Now the coded tables themselves + mdbuf.EmitBytes codedTables; + for i = 1 to tablesStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The string stream + // The string stream mdbuf.EmitByte 0x00uy; for s in strings do mdbuf.EmitBytes s; - for i = 1 to stringsStreamPadding do + for i = 1 to stringsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The user string stream + // The user string stream mdbuf.EmitByte 0x00uy; for s in userStrings do mdbuf.EmitZ32 (s.Length + 1); mdbuf.EmitBytes s; mdbuf.EmitIntAsByte (markerForUnicodeBytes s) - for i = 1 to userStringsStreamPadding do + for i = 1 to userStringsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The GUID stream + // The GUID stream let guidStart = mdbuf.Position Array.iter mdbuf.EmitBytes guids; - - // The blob stream + + // The blob stream mdbuf.EmitByte 0x00uy; - for s in blobs do + for s in blobs do mdbuf.EmitZ32 s.Length; mdbuf.EmitBytes s - for i = 1 to blobsStreamPadding do + for i = 1 to blobsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // Done - close the buffer and return the result. + // Done - close the buffer and return the result. mdbuf.Close(), guidStart - - // Now we know the user string tables etc. we can fixup the - // uses of strings in the code + + // Now we know the user string tables etc. we can fixup the + // uses of strings in the code for (codeStartAddr, l) in requiredStringFixups do - for (codeOffset, userStringIndex) in l do + for (codeOffset, userStringIndex) in l do if codeStartAddr < codep.addr || codeStartAddr >= codep.addr + codep.size then failwith "strings-in-code fixup: a group of fixups is located outside the code array"; let locInCode = ((codeStartAddr + codeOffset) - codep.addr) checkFixup32 code locInCode 0xdeadbeef; @@ -12315,17 +12315,17 @@ namespace ProviderImplementation.ProvidedTypes // PHYSICAL METADATA+BLOBS --> PHYSICAL PE FORMAT //--------------------------------------------------------------------- - // THIS LAYS OUT A 2-SECTION .NET PE BINARY - // SECTIONS + // THIS LAYS OUT A 2-SECTION .NET PE BINARY + // SECTIONS // TEXT: physical 0x0200 --> RVA 0x00020000 - // e.g. raw size 0x9600, + // e.g. raw size 0x9600, // e.g. virt size 0x9584 // RELOC: physical 0x9800 --> RVA 0x0000c000 // i.e. physbase --> rvabase // where physbase = textbase + text raw size // phsrva = roundup(0x2000, 0x0002000 + text virt size) - let msdosHeader: byte[] = + let msdosHeader: byte[] = [| 0x4duy; 0x5auy; 0x90uy; 0x00uy; 0x03uy; 0x00uy; 0x00uy; 0x00uy 0x04uy; 0x00uy; 0x00uy; 0x00uy; 0xFFuy; 0xFFuy; 0x00uy; 0x00uy 0xb8uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy @@ -12353,97 +12353,97 @@ namespace ProviderImplementation.ProvidedTypes os.Write (dw6 x); os.Write (dw7 x) - let writeInt32 (os: BinaryWriter) x = + let writeInt32 (os: BinaryWriter) x = os.Write (b0 x) os.Write (b1 x) os.Write (b2 x) - os.Write (b3 x) + os.Write (b3 x) - let writeInt32AsUInt16 (os: BinaryWriter) x = + let writeInt32AsUInt16 (os: BinaryWriter) x = os.Write (b0 x) os.Write (b1 x) - + let writeDirectory os dict = writeInt32 os (if dict.size = 0x0 then 0x0 else dict.addr); writeInt32 os dict.size - let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk, 0, chunk.Length) + let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk, 0, chunk.Length) let writeBinaryAndReportMappings (outfile: string, - ilg: ILGlobals, pdbfile: string option, (* signer: ILStrongNameSigner option, *) portablePDB, embeddedPDB, + ilg: ILGlobals, pdbfile: string option, (* signer: ILStrongNameSigner option, *) portablePDB, embeddedPDB, embedAllSource, embedSourceList, sourceLink, emitTailcalls, deterministic, showTimes, dumpDebugInfo ) modul = let isDll = modul.IsDLL - - let os = + + let os = try // Ensure the output directory exists otherwise it will fail let dir = Path.GetDirectoryName(outfile) if not (Directory.Exists(dir)) then Directory.CreateDirectory(dir) |>ignore new BinaryWriter(System.IO.File.OpenWrite(outfile)) - with e -> - failwith ("Could not open file for writing (binary mode): " + outfile + "\n" + e.ToString()) + with e -> + failwith ("Could not open file for writing (binary mode): " + outfile + "\n" + e.ToString()) let pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings = - try + try let imageBaseReal = modul.ImageBase // FIXED CHOICE let alignVirt = modul.VirtualAlignment // FIXED CHOICE let alignPhys = modul.PhysicalAlignment // FIXED CHOICE - + let isItanium = modul.Platform = Some(IA64) - - let numSections = 3 // .text, .sdata, .reloc + + let numSections = 3 // .text, .sdata, .reloc - // HEADERS + // HEADERS let next = 0x0 let headerSectionPhysLoc = 0x0 let headerAddr = next let next = headerAddr - + let msdosHeaderSize = 0x80 let msdosHeaderChunk, next = chunk msdosHeaderSize next - + let peSignatureSize = 0x04 let peSignatureChunk, next = chunk peSignatureSize next - + let peFileHeaderSize = 0x14 let peFileHeaderChunk, next = chunk peFileHeaderSize next - + let peOptionalHeaderSize = if modul.Is64Bit then 0xf0 else 0xe0 let peOptionalHeaderChunk, next = chunk peOptionalHeaderSize next - + let textSectionHeaderSize = 0x28 let textSectionHeaderChunk, next = chunk textSectionHeaderSize next - + let dataSectionHeaderSize = 0x28 let dataSectionHeaderChunk, next = chunk dataSectionHeaderSize next - + let relocSectionHeaderSize = 0x28 let relocSectionHeaderChunk, next = chunk relocSectionHeaderSize next - + let headerSize = next - headerAddr let nextPhys = align alignPhys (headerSectionPhysLoc + headerSize) let headerSectionPhysSize = nextPhys - headerSectionPhysLoc let next = align alignVirt (headerAddr + headerSize) - - // TEXT SECTION: 8 bytes IAT table 72 bytes CLI header + + // TEXT SECTION: 8 bytes IAT table 72 bytes CLI header let textSectionPhysLoc = nextPhys let textSectionAddr = next let next = textSectionAddr - + let importAddrTableChunk, next = chunk 0x08 next let cliHeaderPadding = (if isItanium then (align 16 next) else next) - next let next = next + cliHeaderPadding let cliHeaderChunk, next = chunk 0x48 next - - let desiredMetadataVersion = + + let desiredMetadataVersion = if modul.MetadataVersion <> "" then Version.Parse modul.MetadataVersion else - match ilg.systemRuntimeScopeRef with - | ILScopeRef.Local -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Local" + match ilg.systemRuntimeScopeRef with + | ILScopeRef.Local -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Local" | ILScopeRef.Module(_) -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Module" | ILScopeRef.Assembly(aref) -> match aref.Version with @@ -12455,9 +12455,9 @@ namespace ProviderImplementation.ProvidedTypes let _codeChunk, next = chunk code.Length next let _codePaddingChunk, next = chunk codePadding.Length next - + let metadataChunk, next = chunk metadata.Length next - + #if EMIT_STRONG_NAME let strongnameChunk, next = match signer with @@ -12468,7 +12468,7 @@ namespace ProviderImplementation.ProvidedTypes #endif let resourcesChunk, next = chunk resources.Length next - + let rawdataChunk, next = chunk data.Length next let vtfixupsChunk, next = nochunk next // Note: only needed for mixed mode assemblies @@ -12482,7 +12482,7 @@ namespace ProviderImplementation.ProvidedTypes let next = align 0x10 (next + 0x05) - 0x05 let importTableChunk = { addr=importTableChunk.addr; size = next - importTableChunk.addr} let importTableChunkPadding = importTableChunk.size - (0x28 + 0x14 + 0x0e + 0x0c) - + let next = next + 0x03 let entrypointCodeChunk, next = chunk 0x06 next let globalpointerCodeChunk, next = chunk (if isItanium then 0x8 else 0x0) next @@ -12537,13 +12537,13 @@ namespace ProviderImplementation.ProvidedTypes let nextPhys = align alignPhys (textSectionPhysLoc + textSectionSize) let textSectionPhysSize = nextPhys - textSectionPhysLoc let next = align alignVirt (textSectionAddr + textSectionSize) - - // .RSRC SECTION (DATA) + + // .RSRC SECTION (DATA) let dataSectionPhysLoc = nextPhys let dataSectionAddr = next let dataSectionVirtToPhys v = v - dataSectionAddr + dataSectionPhysLoc - - + + #if EMIT_NATIVE_RESOURCES let resourceFormat = if modul.Is64Bit then Support.X64 else Support.X86 let nativeResources = @@ -12564,15 +12564,15 @@ namespace ProviderImplementation.ProvidedTypes let nativeResourcesChunk, next = chunk 0x0 next #endif - + let dummydatap, next = chunk (if next = dataSectionAddr then 0x01 else 0x0) next - + let dataSectionSize = next - dataSectionAddr let nextPhys = align alignPhys (dataSectionPhysLoc + dataSectionSize) let dataSectionPhysSize = nextPhys - dataSectionPhysLoc let next = align alignVirt (dataSectionAddr + dataSectionSize) - - // .RELOC SECTION base reloc table: 0x0c size + + // .RELOC SECTION base reloc table: 0x0c size let relocSectionPhysLoc = nextPhys let relocSectionAddr = next let baseRelocTableChunk, next = chunk 0x0c next @@ -12582,64 +12582,64 @@ namespace ProviderImplementation.ProvidedTypes let relocSectionPhysSize = nextPhys - relocSectionPhysLoc let next = align alignVirt (relocSectionAddr + relocSectionSize) - // Now we know where the data section lies we can fix up the - // references into the data section from the metadata tables. - begin + // Now we know where the data section lies we can fix up the + // references into the data section from the metadata tables. + begin requiredDataFixups |> Array.iter - (fun (metadataOffset32, (dataOffset, kind)) -> + (fun (metadataOffset32, (dataOffset, kind)) -> let metadataOffset = metadataOffset32 if metadataOffset < 0 || metadataOffset >= metadata.Length - 4 then failwith "data RVA fixup: fixup located outside metadata"; checkFixup32 metadata metadataOffset 0xdeaddddd; - let dataRva = + let dataRva = if kind then let res = dataOffset if res >= resourcesChunk.size then printfn ("resource offset bigger than resource data section"); res - else + else let res = rawdataChunk.addr + dataOffset if res < rawdataChunk.addr then printfn ("data rva before data section"); if res >= rawdataChunk.addr + rawdataChunk.size then printfn "%s" ("data rva after end of data section, dataRva = "+string res+", rawdataChunk.addr = "+string rawdataChunk.addr+", rawdataChunk.size = "+string rawdataChunk.size); res applyFixup32 metadata metadataOffset dataRva); end; - - // IMAGE TOTAL SIZE + + // IMAGE TOTAL SIZE let imageEndSectionPhysLoc = nextPhys let imageEndAddr = next - let write p (os: BinaryWriter) chunkName chunk = - match p with - | None -> () - | Some pExpected -> - os.Flush(); + let write p (os: BinaryWriter) chunkName chunk = + match p with + | None -> () + | Some pExpected -> + os.Flush(); let pCurrent = int32 os.BaseStream.Position - if pCurrent <> pExpected then - failwith ("warning: "+chunkName+" not where expected, pCurrent = "+string pCurrent+", p.addr = "+string pExpected) - writeBytes os chunk - + if pCurrent <> pExpected then + failwith ("warning: "+chunkName+" not where expected, pCurrent = "+string pCurrent+", p.addr = "+string pExpected) + writeBytes os chunk + let writePadding (os: BinaryWriter) _comment sz = if sz < 0 then failwith "writePadding: size < 0"; - for i = 0 to sz - 1 do + for i = 0 to sz - 1 do os.Write 0uy - - // Now we've computed all the offsets, write the image - + + // Now we've computed all the offsets, write the image + write (Some msdosHeaderChunk.addr) os "msdos header" msdosHeader; - + write (Some peSignatureChunk.addr) os "pe signature" [| |]; - + writeInt32 os 0x4550; - + write (Some peFileHeaderChunk.addr) os "pe file header" [| |]; - + if (modul.Platform = Some(AMD64)) then - writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 + writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 elif isItanium then writeInt32AsUInt16 os 0x200 else - writeInt32AsUInt16 os 0x014c; // Machine - IMAGE_FILE_MACHINE_I386 - + writeInt32AsUInt16 os 0x014c; // Machine - IMAGE_FILE_MACHINE_I386 + writeInt32AsUInt16 os numSections; #if EMIT_DEBUG_INFO @@ -12672,193 +12672,193 @@ namespace ProviderImplementation.ProvidedTypes writeInt32 os timestamp // date since 1970 #endif - writeInt32 os 0x00; // Pointer to Symbol Table Always 0 - // 00000090 - writeInt32 os 0x00; // Number of Symbols Always 0 - writeInt32AsUInt16 os peOptionalHeaderSize; // Size of the optional header, the format is described below. - + writeInt32 os 0x00; // Pointer to Symbol Table Always 0 + // 00000090 + writeInt32 os 0x00; // Number of Symbols Always 0 + writeInt32AsUInt16 os peOptionalHeaderSize; // Size of the optional header, the format is described below. + // 64bit: IMAGE_FILE_32BIT_MACHINE ||| IMAGE_FILE_LARGE_ADDRESS_AWARE // 32bit: IMAGE_FILE_32BIT_MACHINE // Yes, 32BIT_MACHINE is set for AMD64... let iMachineCharacteristic = match modul.Platform with | Some IA64 -> 0x20 | Some AMD64 -> 0x0120 | _ -> 0x0100 - + writeInt32AsUInt16 os ((if isDll then 0x2000 else 0x0000) ||| 0x0002 ||| 0x0004 ||| 0x0008 ||| iMachineCharacteristic); - - // Now comes optional header + + // Now comes optional header let peOptionalHeaderByte = peOptionalHeaderByteByCLRVersion desiredMetadataVersion write (Some peOptionalHeaderChunk.addr) os "pe optional header" [| |]; if modul.Is64Bit then - writeInt32AsUInt16 os 0x020B // Magic number is 0x020B for 64-bit + writeInt32AsUInt16 os 0x020B // Magic number is 0x020B for 64-bit else - writeInt32AsUInt16 os 0x010b; // Always 0x10B (see Section 23.1). - writeInt32AsUInt16 os peOptionalHeaderByte; // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8 - writeInt32 os textSectionPhysSize; // Size of the code (text) section, or the sum of all code sections if there are multiple sections. - // 000000a0 - writeInt32 os dataSectionPhysSize; // Size of the initialized data section, or the sum of all such sections if there are multiple data sections. - writeInt32 os 0x00; // Size of the uninitialized data section, or the sum of all such sections if there are multiple uninitialized data sections. - writeInt32 os entrypointCodeChunk.addr; // RVA of entry point , needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 in a section marked execute/read for EXEs or 0 for DLLs e.g. 0x0000b57e - writeInt32 os textSectionAddr; // e.g. 0x0002000 - // 000000b0 + writeInt32AsUInt16 os 0x010b; // Always 0x10B (see Section 23.1). + writeInt32AsUInt16 os peOptionalHeaderByte; // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8 + writeInt32 os textSectionPhysSize; // Size of the code (text) section, or the sum of all code sections if there are multiple sections. + // 000000a0 + writeInt32 os dataSectionPhysSize; // Size of the initialized data section, or the sum of all such sections if there are multiple data sections. + writeInt32 os 0x00; // Size of the uninitialized data section, or the sum of all such sections if there are multiple uninitialized data sections. + writeInt32 os entrypointCodeChunk.addr; // RVA of entry point , needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 in a section marked execute/read for EXEs or 0 for DLLs e.g. 0x0000b57e + writeInt32 os textSectionAddr; // e.g. 0x0002000 + // 000000b0 if modul.Is64Bit then - writeInt64 os ((int64)imageBaseReal) // REVIEW: For 64-bit, we should use a 64-bit image base - else - writeInt32 os dataSectionAddr; // e.g. 0x0000c000 - writeInt32 os imageBaseReal; // Image Base Always 0x400000 (see Section 23.1). - QUERY: no it's not always 0x400000, e.g. 0x034f0000 - - writeInt32 os alignVirt; // Section Alignment Always 0x2000 (see Section 23.1). - writeInt32 os alignPhys; // File Alignment Either 0x200 or 0x1000. - // 000000c0 - writeInt32AsUInt16 os 0x04; // OS Major Always 4 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // OS Minor Always 0 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // User Major Always 0 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // User Minor Always 0 (see Section 23.1). + writeInt64 os ((int64)imageBaseReal) // REVIEW: For 64-bit, we should use a 64-bit image base + else + writeInt32 os dataSectionAddr; // e.g. 0x0000c000 + writeInt32 os imageBaseReal; // Image Base Always 0x400000 (see Section 23.1). - QUERY: no it's not always 0x400000, e.g. 0x034f0000 + + writeInt32 os alignVirt; // Section Alignment Always 0x2000 (see Section 23.1). + writeInt32 os alignPhys; // File Alignment Either 0x200 or 0x1000. + // 000000c0 + writeInt32AsUInt16 os 0x04; // OS Major Always 4 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // OS Minor Always 0 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // User Major Always 0 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // User Minor Always 0 (see Section 23.1). do let (major, minor) = modul.SubsystemVersion writeInt32AsUInt16 os major; writeInt32AsUInt16 os minor; - writeInt32 os 0x00; // Reserved Always 0 (see Section 23.1). - // 000000d0 - writeInt32 os imageEndAddr; // Image Size: Size, in bytes, of image, including all headers and padding; shall be a multiple of Section Alignment. e.g. 0x0000e000 - writeInt32 os headerSectionPhysSize; // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding; shall be a multiple of the file alignment. - writeInt32 os 0x00; // File Checksum Always 0 (see Section 23.1). QUERY: NOT ALWAYS ZERO - writeInt32AsUInt16 os modul.SubSystemFlags; // SubSystem Subsystem required to run this image. Shall be either IMAGE_SUBSYSTEM_WINDOWS_CE_GUI (0x3) or IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2). QUERY: Why is this 3 on the images ILASM produces + writeInt32 os 0x00; // Reserved Always 0 (see Section 23.1). + // 000000d0 + writeInt32 os imageEndAddr; // Image Size: Size, in bytes, of image, including all headers and padding; shall be a multiple of Section Alignment. e.g. 0x0000e000 + writeInt32 os headerSectionPhysSize; // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding; shall be a multiple of the file alignment. + writeInt32 os 0x00; // File Checksum Always 0 (see Section 23.1). QUERY: NOT ALWAYS ZERO + writeInt32AsUInt16 os modul.SubSystemFlags; // SubSystem Subsystem required to run this image. Shall be either IMAGE_SUBSYSTEM_WINDOWS_CE_GUI (0x3) or IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2). QUERY: Why is this 3 on the images ILASM produces // DLL Flags Always 0x400 (no unmanaged windows exception handling - see Section 23.1). - // Itanium: see notes at end of file - // IMAGE_DLLCHARACTERISTICS_NX_COMPAT: See FSharp 1.0 bug 5019 and http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx + // Itanium: see notes at end of file + // IMAGE_DLLCHARACTERISTICS_NX_COMPAT: See FSharp 1.0 bug 5019 and http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx // Itanium: IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE | IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT // x86: IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT // x64: IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT - let dllCharacteristics = - let flags = + let dllCharacteristics = + let flags = if modul.Is64Bit then (if isItanium then 0x8540 else 0x540) else 0x540 if modul.UseHighEntropyVA then flags ||| 0x20 // IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA else flags writeInt32AsUInt16 os dllCharacteristics - // 000000e0 + // 000000e0 // Note that the defaults differ between x86 and x64 if modul.Is64Bit then let size = defaultArg modul.StackReserveSize 0x400000 |> int64 - writeInt64 os size // Stack Reserve Size Always 0x400000 (4Mb) (see Section 23.1). - writeInt64 os 0x4000L // Stack Commit Size Always 0x4000 (16Kb) (see Section 23.1). - writeInt64 os 0x100000L // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt64 os 0x2000L // Heap Commit Size Always 0x800 (8Kb) (see Section 23.1). + writeInt64 os size // Stack Reserve Size Always 0x400000 (4Mb) (see Section 23.1). + writeInt64 os 0x4000L // Stack Commit Size Always 0x4000 (16Kb) (see Section 23.1). + writeInt64 os 0x100000L // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt64 os 0x2000L // Heap Commit Size Always 0x800 (8Kb) (see Section 23.1). else let size = defaultArg modul.StackReserveSize 0x100000 - writeInt32 os size // Stack Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt32 os 0x1000 // Stack Commit Size Always 0x1000 (4Kb) (see Section 23.1). - writeInt32 os 0x100000 // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt32 os 0x1000 // Heap Commit Size Always 0x1000 (4Kb) (see Section 23.1). - // 000000f0 - x86 location, moving on, for x64, add 0x10 - writeInt32 os 0x00 // Loader Flags Always 0 (see Section 23.1) - writeInt32 os 0x10 // Number of Data Directories: Always 0x10 (see Section 23.1). - writeInt32 os 0x00 - writeInt32 os 0x00 // Export Table Always 0 (see Section 23.1). - // 00000100 - writeDirectory os importTableChunk // Import Table RVA of Import Table, (see clause 24.3.1). e.g. 0000b530 - // Native Resource Table: ECMA says Always 0 (see Section 23.1), but mscorlib and other files with resources bound into executable do not. For the moment assume the resources table is always the first resource in the file. + writeInt32 os size // Stack Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt32 os 0x1000 // Stack Commit Size Always 0x1000 (4Kb) (see Section 23.1). + writeInt32 os 0x100000 // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt32 os 0x1000 // Heap Commit Size Always 0x1000 (4Kb) (see Section 23.1). + // 000000f0 - x86 location, moving on, for x64, add 0x10 + writeInt32 os 0x00 // Loader Flags Always 0 (see Section 23.1) + writeInt32 os 0x10 // Number of Data Directories: Always 0x10 (see Section 23.1). + writeInt32 os 0x00 + writeInt32 os 0x00 // Export Table Always 0 (see Section 23.1). + // 00000100 + writeDirectory os importTableChunk // Import Table RVA of Import Table, (see clause 24.3.1). e.g. 0000b530 + // Native Resource Table: ECMA says Always 0 (see Section 23.1), but mscorlib and other files with resources bound into executable do not. For the moment assume the resources table is always the first resource in the file. writeDirectory os nativeResourcesChunk - // 00000110 - writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). - // 00000120 - writeDirectory os baseRelocTableChunk - writeDirectory os debugDirectoryChunk // Debug Directory - // 00000130 - writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). - writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). - writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). - writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). - // 00000140 - writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). - // 00000150 - writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). - writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). - writeDirectory os importAddrTableChunk // Import Addr Table, (see clause 24.3.1). e.g. 0x00002000 - // 00000160 - writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). - writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). + // 00000110 + writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). + // 00000120 + writeDirectory os baseRelocTableChunk + writeDirectory os debugDirectoryChunk // Debug Directory + // 00000130 + writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). + writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). + writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). + writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). + // 00000140 + writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). + // 00000150 + writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). + writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). + writeDirectory os importAddrTableChunk // Import Addr Table, (see clause 24.3.1). e.g. 0x00002000 + // 00000160 + writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). + writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). writeDirectory os cliHeaderChunk - // 00000170 - writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). - writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). - + // 00000170 + writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). + writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). + write (Some textSectionHeaderChunk.addr) os "text section header" [| |] - - // 00000178 - writeBytes os [| 0x2euy; 0x74uy; 0x65uy; 0x78uy; 0x74uy; 0x00uy; 0x00uy; 0x00uy; |] // ".text\000\000\000" - // 00000180 - writeInt32 os textSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x00009584 - writeInt32 os textSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x00020000 - writeInt32 os textSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. 0x00009600 - writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200 - // 00000190 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 00000198 - writeInt32AsUInt16 os 0x00// NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section's characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ - + + // 00000178 + writeBytes os [| 0x2euy; 0x74uy; 0x65uy; 0x78uy; 0x74uy; 0x00uy; 0x00uy; 0x00uy; |] // ".text\000\000\000" + // 00000180 + writeInt32 os textSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x00009584 + writeInt32 os textSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x00020000 + writeInt32 os textSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. 0x00009600 + writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200 + // 00000190 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 00000198 + writeInt32AsUInt16 os 0x00// NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section's characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ + write (Some dataSectionHeaderChunk.addr) os "data section header" [| |] - - // 000001a0 - writeBytes os [| 0x2euy; 0x72uy; 0x73uy; 0x72uy; 0x63uy; 0x00uy; 0x00uy; 0x00uy; |] // ".rsrc\000\000\000" - // writeBytes os [| 0x2e; 0x73; 0x64; 0x61; 0x74; 0x61; 0x00; 0x00; |] // ".sdata\000\000" - writeInt32 os dataSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c + + // 000001a0 + writeBytes os [| 0x2euy; 0x72uy; 0x73uy; 0x72uy; 0x63uy; 0x00uy; 0x00uy; 0x00uy; |] // ".rsrc\000\000\000" + // writeBytes os [| 0x2e; 0x73; 0x64; 0x61; 0x74; 0x61; 0x00; 0x00; |] // ".sdata\000\000" + writeInt32 os dataSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c writeInt32 os dataSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000 - // 000001b0 - writeInt32 os dataSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. e.g. 0x00000200 - writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800 - // 000001b8 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 000001c0 - writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x40uy |] // Characteristics Flags: IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA - + // 000001b0 + writeInt32 os dataSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. e.g. 0x00000200 + writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800 + // 000001b8 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 000001c0 + writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x40uy |] // Characteristics Flags: IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA + write (Some relocSectionHeaderChunk.addr) os "reloc section header" [| |] - // 000001a0 - writeBytes os [| 0x2euy; 0x72uy; 0x65uy; 0x6cuy; 0x6fuy; 0x63uy; 0x00uy; 0x00uy; |] // ".reloc\000\000" - writeInt32 os relocSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c + // 000001a0 + writeBytes os [| 0x2euy; 0x72uy; 0x65uy; 0x6cuy; 0x6fuy; 0x63uy; 0x00uy; 0x00uy; |] // ".reloc\000\000" + writeInt32 os relocSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c writeInt32 os relocSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000 - // 000001b0 - writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00000200 - writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800 - // 000001b8 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 000001c0 - writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x42uy |] // Characteristics Flags: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | - + // 000001b0 + writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00000200 + writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800 + // 000001b8 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 000001c0 + writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x42uy |] // Characteristics Flags: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | + writePadding os "pad to text begin" (textSectionPhysLoc - headerSize) - - // TEXT SECTION: e.g. 0x200 - + + // TEXT SECTION: e.g. 0x200 + let textV2P v = v - textSectionAddr + textSectionPhysLoc - - // e.g. 0x0200 + + // e.g. 0x0200 write (Some (textV2P importAddrTableChunk.addr)) os "import addr table" [| |] - writeInt32 os importNameHintTableChunk.addr - writeInt32 os 0x00 // QUERY 4 bytes of zeros not 2 like ECMA 24.3.1 says - - // e.g. 0x0208 - - let flags = - (if modul.IsILOnly then 0x01 else 0x00) ||| - (if modul.Is32Bit then 0x02 else 0x00) ||| - (if modul.Is32BitPreferred then 0x00020003 else 0x00) ||| + writeInt32 os importNameHintTableChunk.addr + writeInt32 os 0x00 // QUERY 4 bytes of zeros not 2 like ECMA 24.3.1 says + + // e.g. 0x0208 + + let flags = + (if modul.IsILOnly then 0x01 else 0x00) ||| + (if modul.Is32Bit then 0x02 else 0x00) ||| + (if modul.Is32BitPreferred then 0x00020003 else 0x00) ||| #if EMIT_STRONG_NAME (if (match signer with None -> false | Some s -> s.IsFullySigned) then 0x08 else 0x00) ||| #endif @@ -12866,36 +12866,36 @@ namespace ProviderImplementation.ProvidedTypes let headerVersionMajor, headerVersionMinor = headerVersionSupportedByCLRVersion desiredMetadataVersion - writePadding os "pad to cli header" cliHeaderPadding + writePadding os "pad to cli header" cliHeaderPadding write (Some (textV2P cliHeaderChunk.addr)) os "cli header" [| |] - writeInt32 os 0x48 // size of header - writeInt32AsUInt16 os headerVersionMajor // Major part of minimum version of CLR reqd. - writeInt32AsUInt16 os headerVersionMinor // Minor part of minimum version of CLR reqd. ... - // e.g. 0x0210 + writeInt32 os 0x48 // size of header + writeInt32AsUInt16 os headerVersionMajor // Major part of minimum version of CLR reqd. + writeInt32AsUInt16 os headerVersionMinor // Minor part of minimum version of CLR reqd. ... + // e.g. 0x0210 writeDirectory os metadataChunk writeInt32 os flags - - writeInt32 os entryPointToken + + writeInt32 os entryPointToken write None os "rest of cli header" [| |] - - // e.g. 0x0220 + + // e.g. 0x0220 writeDirectory os resourcesChunk writeDirectory os strongnameChunk - // e.g. 0x0230 - writeInt32 os 0x00 // code manager table, always 0 - writeInt32 os 0x00 // code manager table, always 0 - writeDirectory os vtfixupsChunk - // e.g. 0x0240 - writeInt32 os 0x00 // export addr table jumps, always 0 - writeInt32 os 0x00 // export addr table jumps, always 0 - writeInt32 os 0x00 // managed native header, always 0 - writeInt32 os 0x00 // managed native header, always 0 - + // e.g. 0x0230 + writeInt32 os 0x00 // code manager table, always 0 + writeInt32 os 0x00 // code manager table, always 0 + writeDirectory os vtfixupsChunk + // e.g. 0x0240 + writeInt32 os 0x00 // export addr table jumps, always 0 + writeInt32 os 0x00 // export addr table jumps, always 0 + writeInt32 os 0x00 // managed native header, always 0 + writeInt32 os 0x00 // managed native header, always 0 + writeBytes os code write None os "code padding" codePadding - + writeBytes os metadata - + #if EMIT_STRONG_NAME // write 0x80 bytes of empty space for encrypted SHA1 hash, written by SN.EXE or call to signing API if signer <> None then @@ -12909,9 +12909,9 @@ namespace ProviderImplementation.ProvidedTypes writePadding os "start of import table" importTableChunkPrePadding - // vtfixups would go here + // vtfixups would go here write (Some (textV2P importTableChunk.addr)) os "import table" [| |] - + writeInt32 os importLookupTableChunk.addr writeInt32 os 0x00 writeInt32 os 0x00 @@ -12921,38 +12921,38 @@ namespace ProviderImplementation.ProvidedTypes writeInt32 os 0x00 writeInt32 os 0x00 writeInt32 os 0x00 - writeInt32 os 0x00 - + writeInt32 os 0x00 + write (Some (textV2P importLookupTableChunk.addr)) os "import lookup table" [| |] - writeInt32 os importNameHintTableChunk.addr - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - + writeInt32 os importNameHintTableChunk.addr + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + write (Some (textV2P importNameHintTableChunk.addr)) os "import name hint table" [| |] - // Two zero bytes of hint, then Case sensitive, null-terminated ASCII string containing name to import. + // Two zero bytes of hint, then Case sensitive, null-terminated ASCII string containing name to import. // Shall _CorExeMain a .exe file _CorDllMain for a .dll file. - if isDll then + if isDll then writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy ; 0x6fuy; 0x72uy; 0x44uy; 0x6cuy; 0x6cuy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] - else + else writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy; 0x6fuy; 0x72uy; 0x45uy; 0x78uy; 0x65uy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] - + write (Some (textV2P mscoreeStringChunk.addr)) os "mscoree string" [| 0x6duy; 0x73uy; 0x63uy; 0x6fuy ; 0x72uy; 0x65uy ; 0x65uy; 0x2euy ; 0x64uy; 0x6cuy ; 0x6cuy; 0x00uy ; |] - + writePadding os "end of import tab" importTableChunkPadding - + writePadding os "head of entrypoint" 0x03 let ep = (imageBaseReal + textSectionAddr) write (Some (textV2P entrypointCodeChunk.addr)) os " entrypoint code" [| 0xFFuy; 0x25uy; (* x86 Instructions for entry *) b0 ep; b1 ep; b2 ep; b3 ep |] - if isItanium then + if isItanium then write (Some (textV2P globalpointerCodeChunk.addr)) os " itanium global pointer" [| 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy |] - if pdbfile.IsSome then + if pdbfile.IsSome then write (Some (textV2P debugDirectoryChunk.addr)) os "debug directory" (Array.create debugDirectoryChunk.size 0x0uy) write (Some (textV2P debugDataChunk.addr)) os "debug data" (Array.create debugDataChunk.size 0x0uy) @@ -12960,8 +12960,8 @@ namespace ProviderImplementation.ProvidedTypes write (Some (textV2P debugEmbeddedPdbChunk.addr)) os "debug data" (Array.create debugEmbeddedPdbChunk.size 0x0uy) writePadding os "end of .text" (dataSectionPhysLoc - textSectionPhysLoc - textSectionSize) - - // DATA SECTION + + // DATA SECTION #if EMIT_NATIVE_RESOURCES match nativeResources with | [||] -> () @@ -12973,41 +12973,41 @@ namespace ProviderImplementation.ProvidedTypes if dummydatap.size <> 0x0 then write (Some (dataSectionVirtToPhys dummydatap.addr)) os "dummy data" [| 0x0uy |] - writePadding os "end of .rsrc" (relocSectionPhysLoc - dataSectionPhysLoc - dataSectionSize) - - // RELOC SECTION + writePadding os "end of .rsrc" (relocSectionPhysLoc - dataSectionPhysLoc - dataSectionSize) + + // RELOC SECTION - // See ECMA 24.3.2 + // See ECMA 24.3.2 let relocV2P v = v - relocSectionAddr + relocSectionPhysLoc - + let entrypointFixupAddr = entrypointCodeChunk.addr + 0x02 let entrypointFixupBlock = (entrypointFixupAddr / 4096) * 4096 let entrypointFixupOffset = entrypointFixupAddr - entrypointFixupBlock let reloc = (if modul.Is64Bit then 0xA000 (* IMAGE_REL_BASED_DIR64 *) else 0x3000 (* IMAGE_REL_BASED_HIGHLOW *)) ||| entrypointFixupOffset // For the itanium, you need to set a relocation entry for the global pointer - let reloc2 = - if not isItanium then + let reloc2 = + if not isItanium then 0x0 else 0xA000 ||| (globalpointerCodeChunk.addr - ((globalpointerCodeChunk.addr / 4096) * 4096)) - - write (Some (relocV2P baseRelocTableChunk.addr)) os "base reloc table" + + write (Some (relocV2P baseRelocTableChunk.addr)) os "base reloc table" [| b0 entrypointFixupBlock; b1 entrypointFixupBlock; b2 entrypointFixupBlock; b3 entrypointFixupBlock; 0x0cuy; 0x00uy; 0x00uy; 0x00uy; - b0 reloc; b1 reloc; + b0 reloc; b1 reloc; b0 reloc2; b1 reloc2; |] writePadding os "end of .reloc" (imageEndSectionPhysLoc - relocSectionPhysLoc - relocSectionSize) os.Dispose() - + pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings // Looks like a finally - with e -> - (try + with e -> + (try os.Dispose() - File.Delete outfile - with _ -> ()) + File.Delete outfile + with _ -> ()) reraise() //Finished writing and signing the binary and debug info... @@ -13030,8 +13030,8 @@ namespace ProviderImplementation.ProvidedTypes dumpDebugInfo:bool } let WriteILBinary (outfile, (args: options), modul) = - writeBinaryAndReportMappings (outfile, - args.ilg, args.pdbfile, (* args.signer, *) args.portablePDB, args.embeddedPDB, args.embedAllSource, + writeBinaryAndReportMappings (outfile, + args.ilg, args.pdbfile, (* args.signer, *) args.portablePDB, args.embeddedPDB, args.embedAllSource, args.embedSourceList, args.sourceLink, args.emitTailcalls, args.deterministic, args.showTimes, args.dumpDebugInfo) modul |> ignore @@ -13058,7 +13058,7 @@ namespace ProviderImplementation.ProvidedTypes open ProviderImplementation.ProvidedTypes open ProviderImplementation.ProvidedTypes.AssemblyReader open ProviderImplementation.ProvidedTypes.UncheckedQuotations - + type ILLocalBuilder(i: int) = member __.LocalIndex = i @@ -13069,18 +13069,18 @@ namespace ProviderImplementation.ProvidedTypes let mutable labelCount = 0 let mutable labels = Dictionary() - member __.Content = + member __.Content = { IsZeroInit = true MaxStack = instrs.Count Locals = locals.ToArray() - Code = + Code = { Labels=labels Instrs=instrs.ToArray() Exceptions = [| |] // TODO Locals = [| |] (* TODO ILLocalDebugInfo *) } } - member __.DeclareLocal(ty: ILType) = + member __.DeclareLocal(ty: ILType) = let idx = locals.Count let local = { Type = ty; IsPinned = false; DebugInfo = None } locals.Add(local) @@ -13109,7 +13109,7 @@ namespace ProviderImplementation.ProvidedTypes LiteralValue = lit Attributes = attrs Offset = None - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken() } override __.ToString() = "builder for " + nm @@ -13124,7 +13124,7 @@ namespace ProviderImplementation.ProvidedTypes member __.Content = { Name=nm Constraints= constraints.ToArray() - Attributes = attrs + Attributes = attrs CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken() } override __.ToString() = "builder for " + nm @@ -13140,7 +13140,7 @@ namespace ProviderImplementation.ProvidedTypes member __.SetConstant(obj) = dflt <- USome obj member __.SetCustomAttribute(ca) = cattrs.Add(ca) - member __.Content = + member __.Content = { Name=nm ParameterType=ty Default=dflt @@ -13159,19 +13159,19 @@ namespace ProviderImplementation.ProvidedTypes member __.DefineParameter(i, attrs, parameterName) = ilParams.[i].SetData(attrs, parameterName) ; ilParams.[i] member __.SetCustomAttribute(ca) = cattrs.Add(ca) member __.GetILGenerator() = let ilg = ILGenerator(methodName) in body <- Some ilg; ilg - member __.FormalMethodRef = + member __.FormalMethodRef = let cc = (if ILMethodDef.ComputeIsStatic attrs then ILCallingConv.Static else ILCallingConv.Instance) ILMethodRef (enclosing.TypeRef, cc, gparams.Count, methodName, argtys, retty) - member this.FormalMethodSpec = + member this.FormalMethodSpec = ILMethodSpec(this.FormalMethodRef, enclosing, mkILFormalGenericArgs enclosing.TypeSpec.GenericArgs.Length gparams.Count) - member __.Content = + member __.Content = { Token = genToken() Name = methodName Attributes = attrs ImplAttributes = implflags - GenericParams = [| for x in gparams -> x.Content |] - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + GenericParams = [| for x in gparams -> x.Content |] + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Parameters = [| for p in ilParams.[1..] -> p.Content |] CallingConv = (if attrs &&& MethodAttributes.Static <> enum<_>(0) then ILCallingConv.Static else ILCallingConv.Instance) Return = (let p = ilParams.[0].Content in { Type = p.ParameterType; CustomAttrs = p.CustomAttrs }) @@ -13184,24 +13184,24 @@ namespace ProviderImplementation.ProvidedTypes let mutable setMethod = None let mutable getMethod = None let cattrs = ResizeArray() - + member __.SetGetMethod(mb: ILMethodBuilder) = getMethod <- Some mb member __.SetSetMethod(mb: ILMethodBuilder) = setMethod <- Some mb member __.SetCustomAttribute(ca) = cattrs.Add(ca) - member __.Content = + member __.Content = { Name=nm - CallingConv = - (if (getMethod.IsSome && getMethod.Value.Content.IsStatic) || - (setMethod.IsSome && setMethod.Value.Content.IsStatic) then - ILThisConvention.Static + CallingConv = + (if (getMethod.IsSome && getMethod.Value.Content.IsStatic) || + (setMethod.IsSome && setMethod.Value.Content.IsStatic) then + ILThisConvention.Static else ILThisConvention.Instance) Attributes = attrs GetMethod = (getMethod |> Option.map (fun mb -> mb.FormalMethodRef)) SetMethod = (setMethod |> Option.map (fun mb -> mb.FormalMethodRef)) - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) PropertyType=retty - Init= None // TODO if (attrs &&& PropertyAttributes.HasDefault) = 0 then None else + Init= None // TODO if (attrs &&& PropertyAttributes.HasDefault) = 0 then None else IndexParameterTypes=argtys Token = genToken() } override __.ToString() = "builder for " + nm @@ -13215,12 +13215,12 @@ namespace ProviderImplementation.ProvidedTypes member __.SetAddOnMethod(mb: ILMethodBuilder) = addMethod <- Some mb member __.SetRemoveOnMethod(mb: ILMethodBuilder) = removeMethod <- Some mb member __.SetCustomAttribute(ca) = cattrs.Add(ca) - member __.Content = + member __.Content = { Name = nm Attributes = attrs AddMethod = addMethod.Value.FormalMethodRef RemoveMethod = removeMethod.Value.FormalMethodRef - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken()} override __.ToString() = "builder for " + nm @@ -13239,7 +13239,7 @@ namespace ProviderImplementation.ProvidedTypes member __.ILTypeRef = ILTypeRef(scoref, nsp, nm) member this.ILTypeSpec = ILTypeSpec(this.ILTypeRef, mkILFormalGenericArgs 0 gparams.Count) - member this.ILType = + member this.ILType = match ILTypeDef.ComputeKind (int attrs) extends nsp nm with | ILTypeDefKind.ValueType | ILTypeDefKind.Enum -> ILType.Value this.ILTypeSpec | _ -> ILType.Boxed this.ILTypeSpec @@ -13257,8 +13257,8 @@ namespace ProviderImplementation.ProvidedTypes member __.AddInterfaceImplementation(ty) = implements.Add(ty) member this.DefineTypeInitializer () = let mb = ILMethodBuilder(this.ILType, ".cctor", MethodAttributes.Static ||| MethodAttributes.SpecialName, ILType.Void, [| |]) in methods.Add mb; mb member __.SetParent ty = (extends <- Some ty) - member this.DefineDefaultConstructor(attrs, baseCtor: ILMethodSpec) = - let ctor = this.DefineConstructor(attrs, [| |]) + member this.DefineDefaultConstructor(attrs, baseCtor: ILMethodSpec) = + let ctor = this.DefineConstructor(attrs, [| |]) let ilg = ctor.GetILGenerator() ilg.Emit(I_ldarg 0) ilg.Emit(I_call (Normalcall, baseCtor, None)) @@ -13266,24 +13266,24 @@ namespace ProviderImplementation.ProvidedTypes ctor - member __.Content = + member __.Content = { Namespace=nsp Name=nm - GenericParams= [| for x in gparams -> x.Content |] + GenericParams= [| for x in gparams -> x.Content |] Implements = implements.ToArray() Attributes = attrs Layout=ILTypeDefLayout.Auto Extends=extends Token=genToken() - //SecurityDecls=emptyILSecurityDecls; + //SecurityDecls=emptyILSecurityDecls; //HasSecurity=false; - NestedTypes = ILTypeDefs( lazy [| for x in nestedTypes -> let td = x.Content in td.Namespace, td.Name, lazy td |] ) - Fields = { new ILFieldDefs with member __.Entries = [| for x in fields -> x.Content |] } - Properties = { new ILPropertyDefs with member __.Entries = [| for x in props -> x.Content |] } - Events = { new ILEventDefs with member __.Entries = [| for x in events -> x.Content |] } + NestedTypes = ILTypeDefs( lazy [| for x in nestedTypes -> let td = x.Content in td.Namespace, td.Name, lazy td |] ) + Fields = { new ILFieldDefs with member __.Entries = [| for x in fields -> x.Content |] } + Properties = { new ILPropertyDefs with member __.Entries = [| for x in props -> x.Content |] } + Events = { new ILEventDefs with member __.Entries = [| for x in events -> x.Content |] } Methods = ILMethodDefs (lazy [| for x in methods -> x.Content |]) - MethodImpls = { new ILMethodImplDefs with member __.Entries = methodImpls.ToArray() } - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + MethodImpls = { new ILMethodImplDefs with member __.Entries = methodImpls.ToArray() } + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) } override __.ToString() = "builder for " + joinILTypeName nsp nm @@ -13294,7 +13294,7 @@ namespace ProviderImplementation.ProvidedTypes member __.DefineType(nsp, name, attrs) = let tb = ILTypeBuilder(ILTypeRefScope.Top scoref, nsp, name, attrs) in typeDefs.Add tb; tb member __.SetCustomAttribute(ca) = cattrs.Add(ca) - member __.Content = + member __.Content = { Manifest=manifest Name=moduleName SubsystemVersion = (4, 0) @@ -13312,13 +13312,13 @@ namespace ProviderImplementation.ProvidedTypes ImageBase=0x034f0000 MetadataVersion="" Resources=ILResources (lazy [| |]) - TypeDefs = ILTypeDefs( lazy [| for x in typeDefs-> let td = x.Content in td.Namespace, td.Name, lazy td |] ) + TypeDefs = ILTypeDefs( lazy [| for x in typeDefs-> let td = x.Content in td.Namespace, td.Name, lazy td |] ) CustomAttrs = { new ILCustomAttrs with member __.Entries = cattrs.ToArray() } - } + } override __.ToString() = "builder for " + moduleName type ILAssemblyBuilder(assemblyName: AssemblyName, fileName, ilg) = - let manifest = + let manifest = { Name = assemblyName.Name AuxModuleHashAlgorithm = 0x8004 // SHA1 PublicKey = UNone @@ -13334,19 +13334,19 @@ namespace ProviderImplementation.ProvidedTypes EntrypointElsewhere=None } let mb = ILModuleBuilder(ILScopeRef.Local, "MainModule", Some manifest) member __.MainModule = mb - member __.Save() = + member __.Save() = let il = mb.Content let options: BinaryWriter.options = { ilg = ilg; pdbfile = None; portablePDB = false; embeddedPDB = false; embedAllSource = false; embedSourceList = []; sourceLink = ""; emitTailcalls = true; deterministic = false; showTimes = false; dumpDebugInfo = false } BinaryWriter.WriteILBinary (fileName, options, il) override __.ToString() = "builder for " + (assemblyName.ToString()) - + type ExpectedStackState = | Empty = 1 | Address = 2 | Value = 3 - type CodeGenerator(assemblyMainModule: ILModuleBuilder, + type CodeGenerator(assemblyMainModule: ILModuleBuilder, genUniqueTypeName: (unit -> string), implicitCtorArgsAsFields: ILFieldBuilder list, convTypeToTgt: Type -> Type, @@ -13355,8 +13355,8 @@ namespace ProviderImplementation.ProvidedTypes transMeth: MethodInfo -> ILMethodSpec, transMethRef: MethodInfo -> ILMethodRef, transCtorSpec: ConstructorInfo -> ILMethodSpec, - ilg: ILGenerator, - localsMap:Dictionary, + ilg: ILGenerator, + localsMap:Dictionary, parameterVars) = // TODO: this works over FSharp.Core 4.4.0.0 types and methods. These types need to be retargeted to the target runtime. @@ -13602,9 +13602,9 @@ namespace ProviderImplementation.ProvidedTypes match objOpt with | Some obj when meth.IsAbstract || meth.IsVirtual -> - if obj.Type.IsValueType then + if obj.Type.IsValueType then ilg.Emit(I_callconstraint (Normalcall, transType obj.Type, mappedMeth, None)) - else + else ilg.Emit(I_callvirt (Normalcall, mappedMeth, None)) | _ -> ilg.Emit(mkNormalCall mappedMeth) @@ -13751,7 +13751,7 @@ namespace ProviderImplementation.ProvidedTypes //------------------------------------------------------------------------------------------------- // AssemblyCompiler: the assembly compiler for generative type providers. - /// Implements System.Reflection.Assembly backed by ILModuleReader over generated bytes + /// Implements System.Reflection.Assembly backed by ILModuleReader over generated bytes type AssemblyCompiler(targetAssembly: ProvidedAssembly, context: ProvidedTypesContext) = @@ -13776,7 +13776,7 @@ namespace ProviderImplementation.ProvidedTypes if pntd.IsErased then failwith ("The nested provided type "+pntd.Name+" is marked as erased and cannot be converted to a generated type. Set 'IsErased=false' on the ProvidedTypeDefinition") Debug.Assert(pntd.BelongsToTargetModel, "expected a target ProvidedTypeDefinition in nested type") // Adjust the attributes - we're codegen'ing this type as nested - let attributes = adjustTypeAttributes true ntd.Attributes + let attributes = adjustTypeAttributes true ntd.Attributes let ntb = tb.DefineNestedType(pntd.Name,attributes) typeMap.[pntd] <- ntb defineNestedTypes ntb pntd @@ -13799,51 +13799,51 @@ namespace ProviderImplementation.ProvidedTypes else ILType.Boxed (transTypeSpec ty) and transTypeSpec (ty: Type) = - if ty.IsGenericType then + if ty.IsGenericType then ILTypeSpec(transTypeRef (ty.GetGenericTypeDefinition()), Array.map transType (ty.GetGenericArguments())) - else + else ILTypeSpec(transTypeRef ty, [| |]) - and transTypeRef (ty: Type) = + and transTypeRef (ty: Type) = let ty = if ty.IsGenericType then ty.GetGenericTypeDefinition() else ty ILTypeRef(transTypeRefScope ty, StructOption.ofObj (if ty.IsNested then null else ty.Namespace), ty.Name) - and transTypeRefScope (ty: Type): ILTypeRefScope = - match ty.DeclaringType with - | null -> + and transTypeRefScope (ty: Type): ILTypeRefScope = + match ty.DeclaringType with + | null -> if ty.Assembly = null then failwithf "null assembly for type %s" ty.FullName ILTypeRefScope.Top (transScopeRef ty.Assembly) | dt -> ILTypeRefScope.Nested (transTypeRef dt) - and transScopeRef (assem: Assembly): ILScopeRef = - // Note: this simple equality check on assembly objects doesn't work on Mono, there must be some small difference in the + and transScopeRef (assem: Assembly): ILScopeRef = + // Note: this simple equality check on assembly objects doesn't work on Mono, there must be some small difference in the // implementation of equality on System.Assembly objects // if assem = (targetAssembly :> Assembly) then ILScopeRef.Local if assem.GetName().Name = targetAssembly.GetName().Name then ILScopeRef.Local else ILScopeRef.Assembly (ILAssemblyRef.FromAssemblyName (assem.GetName())) - let transCtorRef (m:ConstructorInfo) = + let transCtorRef (m:ConstructorInfo) = // Remove the generic instantiations to get the uninstantiated identity of the method let m2 = m.GetDefinition() let cc = (if m2.IsStatic then ILCallingConv.Static else ILCallingConv.Instance) let ptys = [| for p in m2.GetParameters() -> transType p.ParameterType |] ILMethodRef (transTypeRef m2.DeclaringType, cc, 0, m2.Name, ptys, ILType.Void) - let transCtorSpec (f:ConstructorInfo) = + let transCtorSpec (f:ConstructorInfo) = if (match f with :? ProvidedConstructor as f -> not f.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" f - match f with + match f with | :? ProvidedConstructor as pc when ctorMap.ContainsKey pc -> ctorMap.[pc].FormalMethodSpec | m -> ILMethodSpec(transCtorRef f, transType m.DeclaringType, [| |]) - let transFieldSpec (f:FieldInfo) = + let transFieldSpec (f:FieldInfo) = if (match f with :? ProvidedField as f -> not f.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" f - match f with + match f with | :? ProvidedField as pf when fieldMap.ContainsKey pf -> fieldMap.[pf].FormalFieldSpec - | f -> + | f -> let f2 = f.GetDefinition() ILFieldSpec(ILFieldRef (transTypeRef f2.DeclaringType, f2.Name, transType f2.FieldType), transType f.DeclaringType) - let transMethRef (m:MethodInfo) = + let transMethRef (m:MethodInfo) = if (match m with :? ProvidedMethod as m -> not m.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" m // Remove the generic instantiations to get the uninstantiated identity of the method let m2 = m.GetDefinition() @@ -13852,10 +13852,10 @@ namespace ProviderImplementation.ProvidedTypes let cc = (if m2.IsStatic then ILCallingConv.Static else ILCallingConv.Instance) ILMethodRef (transTypeRef m2.DeclaringType, cc, genarity, m2.Name, ptys, transType m2.ReturnType) - let transMeth (m:MethodInfo): ILMethodSpec = - match m with + let transMeth (m:MethodInfo): ILMethodSpec = + match m with | :? ProvidedMethod as pm when methMap.ContainsKey pm -> methMap.[pm].FormalMethodSpec - | m -> + | m -> //Debug.Assert (m.Name <> "get_Item1" || m.DeclaringType.Name <> "Tuple`2") let mref = transMethRef m let minst = (if m.IsGenericMethod then Array.map transType (m.GetGenericArguments()) else [| |]) @@ -13888,12 +13888,12 @@ namespace ProviderImplementation.ProvidedTypes let defineCustomAttrs f (cattrs: IList) = for attr in cattrs do let constructorArgs = [ for x in attr.ConstructorArguments -> x.Value ] - let transValue (o:obj) = - match o with + let transValue (o:obj) = + match o with | :? Type as t -> box (transType t) | v -> v - let namedProps = [ for x in attr.NamedArguments do match x.MemberInfo with :? PropertyInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] - let namedFields = [ for x in attr.NamedArguments do match x.MemberInfo with :? FieldInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] + let namedProps = [ for x in attr.NamedArguments do match x.MemberInfo with :? PropertyInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] + let namedFields = [ for x in attr.NamedArguments do match x.MemberInfo with :? FieldInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] let ca = mkILCustomAttribMethRef (transCtorSpec attr.Constructor, constructorArgs, namedProps, namedFields) f ca @@ -13937,10 +13937,10 @@ namespace ProviderImplementation.ProvidedTypes let attributes = adjustTypeAttributes otb.IsSome attributes let tb = match otb with - | None -> + | None -> let nsp, n = splitILTypeName n assemblyMainModule.DefineType(nsp, n,attributes) - | Some (otb:ILTypeBuilder) -> + | Some (otb:ILTypeBuilder) -> otb.DefineNestedType(n,attributes) typeMapExtra.[fullName] <- tb tb @@ -13953,8 +13953,8 @@ namespace ProviderImplementation.ProvidedTypes match ptdT with | None -> () | Some ptdT -> - match ptdT.BaseType with - | null -> () + match ptdT.BaseType with + | null -> () | bt -> tb.SetParent(transType bt)) // phase 2 - emit member definitions @@ -13986,7 +13986,7 @@ namespace ProviderImplementation.ProvidedTypes | :? ProvidedField as pinfo -> let fb = tb.DefineField(finfo.Name, transType finfo.FieldType, finfo.Attributes) - if finfo.IsLiteral then + if finfo.IsLiteral then fb.SetConstant (pinfo.GetRawConstantValue()) defineCustomAttrs fb.SetCustomAttribute (pinfo.GetCustomAttributesData()) @@ -14167,7 +14167,7 @@ namespace ProviderImplementation.ProvidedTypes let bytes = reader.Bytes // Use a real Reflection Load when running in F# Interactive - if isHostedExecution then + if isHostedExecution then let realTargetAssembly = Assembly.Load(bytes) for (ptdT,_) in providedTypeDefinitionsT do ptdT.SetAssemblyInternal (K realTargetAssembly) @@ -14209,12 +14209,12 @@ namespace ProviderImplementation.ProvidedTypes #if !NO_GENERATIVE let theTable = ConcurrentDictionary() - // When using hosted execution (i.e. in F# Interactive), ensure the generated assembly for a generated type is + // When using hosted execution (i.e. in F# Interactive), ensure the generated assembly for a generated type is // actually fully compiled and loaded as a reflection-load assembly before handing the type back to the API. let ensureCompiled (t: Type) = - match t with + match t with | :? ProvidedTypeDefinition as pt when pt.IsErased || pt.GetStaticParametersInternal().Length > 0 || not config.IsHostedExecution -> t - | _ -> + | _ -> let origAssembly = t.Assembly // We expect the results reported by t.Assembly to actually change after this call, because the act of compilation @@ -14230,11 +14230,11 @@ namespace ProviderImplementation.ProvidedTypes let newAssemblyName = newAssembly.GetName().Name let origAssemblyName = origAssembly.GetName().Name // check the assembly was generated with the correct name - if newAssemblyName <> origAssemblyName then + if newAssemblyName <> origAssemblyName then failwithf "expected identical assembly name keys '%s' and '%s'" origAssemblyName newAssemblyName // check the type really exists - if t.Assembly.GetType(tyName) = null then + if t.Assembly.GetType(tyName) = null then failwithf "couldn't find type '%s' in assembly '%O'" tyName t.Assembly t @@ -14245,7 +14245,7 @@ namespace ProviderImplementation.ProvidedTypes let makeProvidedNamespace (namespaceName:string) (typesSrc:ProvidedTypeDefinition list) = let typesSrc = [| for ty in typesSrc -> ty :> Type |] - let nsSrc = + let nsSrc = { new IProvidedNamespace with member __.GetNestedNamespaces() = [| |] member __.NamespaceName = namespaceName @@ -14256,7 +14256,7 @@ namespace ProviderImplementation.ProvidedTypes let namespacesT = ResizeArray() - do for (namespaceName,types) in namespacesAndTypes do + do for (namespaceName,types) in namespacesAndTypes do namespacesT.Add (makeProvidedNamespace namespaceName types) let invalidateE = new Event() @@ -14270,12 +14270,12 @@ namespace ProviderImplementation.ProvidedTypes do AppDomain.CurrentDomain.add_AssemblyResolve handler #endif - new (config, namespaceName, types, ?sourceAssemblies, ?assemblyReplacementMap) = + new (config, namespaceName, types, ?sourceAssemblies, ?assemblyReplacementMap) = let sourceAssemblies = defaultArg sourceAssemblies [ Assembly.GetCallingAssembly() ] let assemblyReplacementMap = defaultArg assemblyReplacementMap [] new TypeProviderForNamespaces(config, [(namespaceName,types)], assemblyReplacementMap=assemblyReplacementMap, sourceAssemblies=sourceAssemblies) - new (config, ?sourceAssemblies, ?assemblyReplacementMap) = + new (config, ?sourceAssemblies, ?assemblyReplacementMap) = let sourceAssemblies = defaultArg sourceAssemblies [ Assembly.GetCallingAssembly() ] let assemblyReplacementMap = defaultArg assemblyReplacementMap [] new TypeProviderForNamespaces(config, [], assemblyReplacementMap=assemblyReplacementMap, sourceAssemblies=sourceAssemblies) @@ -14349,7 +14349,7 @@ namespace ProviderImplementation.ProvidedTypes /// This checks that the GetInvokeCodeInternal doesn't return things containing calls to other provided methods or constructors. let rec check expr = match expr with - | NewObject((:? ProvidedConstructor), _) + | NewObject((:? ProvidedConstructor), _) | Call(_, :? ProvidedMethod, _) -> failwithf "The invokeCode for a ProvidedConstructor or ProvidedMethod included a use or another ProvidedConstructor or ProvidedMethod '%A'. This is not allowed. Instead, the invokeCode should be the compiled representation without invoking other provided objects" expr | ShapeCombinationUnchecked(shape, args) -> RebuildShapeCombinationUnchecked(shape, List.map check args) | ShapeVarUnchecked v -> Expr.Var v @@ -14388,7 +14388,7 @@ namespace ProviderImplementation.ProvidedTypes member __.ApplyStaticArguments(ty, typePathAfterArguments:string[], objs) = let typePathAfterArguments = typePathAfterArguments.[typePathAfterArguments.Length-1] match ty with - | :? ProvidedTypeDefinition as t -> + | :? ProvidedTypeDefinition as t -> let ty = (t.ApplyStaticArguments(typePathAfterArguments, objs) :> Type) ensureCompiled ty @@ -14403,8 +14403,8 @@ namespace ProviderImplementation.ProvidedTypes match theTable.TryGetValue key with | true,bytes -> bytes | _ -> - let bytes = - match assembly with + let bytes = + match assembly with | :? ProvidedAssembly as targetAssembly -> AssemblyCompiler(targetAssembly, ctxt).Compile(config.IsHostedExecution) | _ -> File.ReadAllBytes assembly.ManifestModule.FullyQualifiedName theTable.[key] <- bytes @@ -14414,8 +14414,8 @@ namespace ProviderImplementation.ProvidedTypes member __.RegisterGeneratedTargetAssembly (fileName:string) = let assemblyBytes = File.ReadAllBytes fileName //printfn "registering assembly in '%s'" fileName - let assembly = - if config.IsHostedExecution then + let assembly = + if config.IsHostedExecution then Assembly.Load(assemblyBytes) // we need a real on-disk assembly else ctxt.ReadRelatedAssembly(fileName) @@ -14424,6 +14424,6 @@ namespace ProviderImplementation.ProvidedTypes theTable.[key] <- assemblyBytes assembly -#endif +#endif #endif diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fsi b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fsi index 5da7a352a41..5b2455b28b4 100644 --- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fsi +++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fsi @@ -340,13 +340,13 @@ namespace ProviderImplementation.ProvidedTypes member AddDefinitionLocation: line:int * column:int * filePath:string -> unit /// Suppress Object entries in intellisense menus in instances of this provided type - member HideObjectMethods: bool + member HideObjectMethods: bool /// Disallows the use of the null literal. member NonNullable: bool /// Get a flag indicating if the ProvidedTypeDefinition is erased - member IsErased: bool + member IsErased: bool /// Get or set a flag indicating if the ProvidedTypeDefinition has type-relocation suppressed [] @@ -403,13 +403,13 @@ namespace ProviderImplementation.ProvidedTypes [] /// Represents the context for which code is to be generated. Normally you should not need to use this directly. - type ProvidedTypesContext = - + type ProvidedTypesContext = + /// Try to find the given target assembly in the context - member TryBindAssemblyNameToTarget: aref: AssemblyName -> Choice + member TryBindAssemblyNameToTarget: aref: AssemblyName -> Choice /// Try to find the given target assembly in the context - member TryBindSimpleAssemblyNameToTarget: assemblyName: string -> Choice + member TryBindSimpleAssemblyNameToTarget: assemblyName: string -> Choice /// Get the list of referenced assemblies determined by the type provider configuration member ReferencedAssemblyPaths: string list @@ -453,7 +453,7 @@ namespace ProviderImplementation.ProvidedTypes /// The transitive dependencies of these assemblies are also included. By default /// Assembly.GetCallingAssembly() and its transitive dependencies are used. /// - /// + /// /// /// Optionally specify a map of assembly names from source model to referenced assemblies. /// @@ -465,7 +465,7 @@ namespace ProviderImplementation.ProvidedTypes /// The transitive dependencies of these assemblies are also included. By default /// Assembly.GetCallingAssembly() and its transitive dependencies are used. /// - /// + /// /// /// Optionally specify a map of assembly names from source model to referenced assemblies. /// @@ -510,7 +510,7 @@ namespace ProviderImplementation.ProvidedTypes member Disposing: IEvent /// The context for which code is eventually to be generated. You should not normally - /// need to use this property directly, as translation from the compiler-hosted context to + /// need to use this property directly, as translation from the compiler-hosted context to /// the design-time context will normally be performed automatically. member TargetContext: ProvidedTypesContext diff --git a/tests/FSharp.Build.UnitTests/WriteCodeFragmentTests.fs b/tests/FSharp.Build.UnitTests/WriteCodeFragmentTests.fs index 56de7ceb197..88e47669104 100644 --- a/tests/FSharp.Build.UnitTests/WriteCodeFragmentTests.fs +++ b/tests/FSharp.Build.UnitTests/WriteCodeFragmentTests.fs @@ -39,47 +39,47 @@ type WriteCodeFragmentFSharpTests() = [] member _.``Named parameters with _IsLiteral suffix``() = verifyAttribute "SomeAttribute" [("Bool", "true"); ("Bool_IsLiteral", "true")] "SomeAttribute(Bool = true)" - + [] member _.``Multiple named parameters with _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("Number", "42"); - ("Number_IsLiteral", "true"); - ("Bool", "false"); + ("Number", "42"); + ("Number_IsLiteral", "true"); + ("Bool", "false"); ("Bool_IsLiteral", "true") - ] + ] "SomeAttribute(Bool = false, Number = 42)" - + [] member _.``Mixed named parameters with and without _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("Number", "42"); - ("Number_IsLiteral", "true"); + ("Number", "42"); + ("Number_IsLiteral", "true"); ("Text", "hello") - ] + ] "SomeAttribute(Number = 42, Text = \"hello\")" - + [] member _.``Mixed unnamed parameters and named parameters with _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ ("_Parameter1", "1"); - ("Number", "42"); - ("Number_IsLiteral", "true"); - ("Bool", "false"); + ("Number", "42"); + ("Number_IsLiteral", "true"); + ("Bool", "false"); ("Bool_IsLiteral", "true") - ] + ] "SomeAttribute(\"1\", Bool = false, Number = 42)" - + [] member _.``Enum _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("EnumValue", "System.StringComparison.OrdinalIgnoreCase"); + ("EnumValue", "System.StringComparison.OrdinalIgnoreCase"); ("EnumValue_IsLiteral", "true") - ] + ] "SomeAttribute(EnumValue = System.StringComparison.OrdinalIgnoreCase)" type WriteCodeFragmentCSharpTests() = @@ -90,7 +90,7 @@ type WriteCodeFragmentCSharpTests() = let actualAttributeText = (new WriteCodeFragment()).GenerateAttribute (taskItem :> ITaskItem, "c#") let fullExpectedAttributeText = "[assembly: " + expectedAttributeText + "]" Assert.Equal(fullExpectedAttributeText, actualAttributeText) - + [] member _.``No parameters``() = verifyAttribute "SomeAttribute" [] "SomeAttribute()" @@ -111,51 +111,51 @@ type WriteCodeFragmentCSharpTests() = member _.``Escaped string parameters``() = verifyAttribute "SomeAttribute" [("_Parameter1", "\"uno\"")] "SomeAttribute(\"\\\"uno\\\"\")" // this should look like: SomeAttribute("\"uno\"") - + [] member _.``Named parameters with _IsLiteral suffix``() = verifyAttribute "SomeAttribute" [("Bool", "true"); ("Bool_IsLiteral", "true")] "SomeAttribute(Bool = true)" - + [] member _.``Multiple named parameters with _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("Number", "42"); - ("Number_IsLiteral", "true"); - ("Bool", "false"); + ("Number", "42"); + ("Number_IsLiteral", "true"); + ("Bool", "false"); ("Bool_IsLiteral", "true") - ] + ] "SomeAttribute(Bool = false, Number = 42)" - + [] member _.``Mixed named parameters with and without _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("Number", "42"); - ("Number_IsLiteral", "true"); + ("Number", "42"); + ("Number_IsLiteral", "true"); ("Text", "hello") - ] + ] "SomeAttribute(Number = 42, Text = \"hello\")" - + [] member _.``Mixed unnamed parameters and named parameters with _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ ("_Parameter1", "1"); - ("Number", "42"); - ("Number_IsLiteral", "true"); - ("Bool", "false"); + ("Number", "42"); + ("Number_IsLiteral", "true"); + ("Bool", "false"); ("Bool_IsLiteral", "true") - ] + ] "SomeAttribute(\"1\", Bool = false, Number = 42)" - + [] member _.``Enum _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("EnumValue", "System.StringComparison.OrdinalIgnoreCase"); + ("EnumValue", "System.StringComparison.OrdinalIgnoreCase"); ("EnumValue_IsLiteral", "true") - ] + ] "SomeAttribute(EnumValue = System.StringComparison.OrdinalIgnoreCase)" @@ -188,50 +188,50 @@ type WriteCodeFragmentVisualBasicTests() = member _.``Escaped string parameters``() = verifyAttribute "SomeAttribute" [("_Parameter1", "\"uno\"")] "SomeAttribute(\"\\\"uno\\\"\")" // this should look like: SomeAttribute("\"uno\"") - + [] member _.``Named parameters with _IsLiteral suffix``() = verifyAttribute "SomeAttribute" [("Bool", "true"); ("Bool_IsLiteral", "true")] "SomeAttribute(Bool = true)" - + [] member _.``Multiple named parameters with _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("Number", "42"); - ("Number_IsLiteral", "true"); - ("Bool", "false"); + ("Number", "42"); + ("Number_IsLiteral", "true"); + ("Bool", "false"); ("Bool_IsLiteral", "true") - ] + ] "SomeAttribute(Bool = false, Number = 42)" - + [] member _.``Mixed named parameters with and without _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("Number", "42"); - ("Number_IsLiteral", "true"); + ("Number", "42"); + ("Number_IsLiteral", "true"); ("Text", "hello") - ] + ] "SomeAttribute(Number = 42, Text = \"hello\")" - + [] member _.``Mixed unnamed parameters and named parameters with _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ ("_Parameter1", "1"); - ("Number", "42"); - ("Number_IsLiteral", "true"); - ("Bool", "false"); + ("Number", "42"); + ("Number_IsLiteral", "true"); + ("Bool", "false"); ("Bool_IsLiteral", "true") - ] + ] "SomeAttribute(\"1\", Bool = false, Number = 42)" - + [] member _.``Enum _IsLiteral suffix``() = - verifyAttribute "SomeAttribute" + verifyAttribute "SomeAttribute" [ - ("EnumValue", "System.StringComparison.OrdinalIgnoreCase"); + ("EnumValue", "System.StringComparison.OrdinalIgnoreCase"); ("EnumValue_IsLiteral", "true") - ] + ] "SomeAttribute(EnumValue = System.StringComparison.OrdinalIgnoreCase)" diff --git a/tests/FSharp.Compiler.ComponentTests/Attributes/AttributeCtorSetPropAccess.fs b/tests/FSharp.Compiler.ComponentTests/Attributes/AttributeCtorSetPropAccess.fs index 3fdcf10bf52..b48935b5108 100644 --- a/tests/FSharp.Compiler.ComponentTests/Attributes/AttributeCtorSetPropAccess.fs +++ b/tests/FSharp.Compiler.ComponentTests/Attributes/AttributeCtorSetPropAccess.fs @@ -35,17 +35,17 @@ module AttributeCtorSetPropAccess = [] [] let ``Cannot set property outside its accessibility scope``(modifier: string): unit = - FSharp fsCode - |> withReferences [(CSharp <| csLib.Replace("%s", modifier))] - |> compile + FSharp fsCode + |> withReferences [(CSharp <| csLib.Replace("%s", modifier))] + |> compile |> shouldFail - |> withDiagnostics [ (ErrorType.Error 3248, Line 8, Col 28, Line 8, Col 31, "Property 'X' cannot be set because the setter is private") ] + |> withDiagnostics [ (ErrorType.Error 3248, Line 8, Col 28, Line 8, Col 31, "Property 'X' cannot be set because the setter is private") ] |> ignore [] let ``Can set property inside its accessibility scope``(): unit = - FSharp fsCode - |> withReferences [(CSharp <| csLib.Replace("%s", ""))] - |> compile + FSharp fsCode + |> withReferences [(CSharp <| csLib.Replace("%s", ""))] + |> compile |> shouldSucceed |> ignore \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs index 6eef92698cd..37ffbe7c1dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs @@ -35,7 +35,7 @@ module Line = printfn "" ) """ - + [] let private case2 = """module A ( @@ -43,7 +43,7 @@ printfn "" printfn "" ) """ - + [] let private case3 = """module A ( @@ -340,7 +340,7 @@ namespace CSharpLib csharpLibSource |> CSharp |> withFileName "CallerInfoLib.cs" - + fsharpSource |> FSharp |> withFileName "CallerInfo.fs" @@ -348,17 +348,17 @@ namespace CSharpLib |> withReferences [csharp] |> compileExeAndRun |> shouldSucceed - + let sourceIdSource = """ #line 100 "/temp/target.fs" let dir = __SOURCE_DIRECTORY__ let d = dir[dir.Length - 4 ..] printf $"{__LINE__} in {__SOURCE_FILE__} in {d}" -""" +""" [] let ``LineDirectivesAreAppliedToSourceIdentifiers`` () = - let result = + let result = sourceIdSource |> FSharp |> withFileName "original.fs" @@ -371,4 +371,3 @@ printf $"{__LINE__} in {__SOURCE_FILE__} in {d}" | _ -> Assert.Fail "unexpected: no execution output" - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs index 1ba1f9a4a6b..e6047cc4962 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs @@ -23,7 +23,7 @@ module Nowarn = let private fsSub lines = fs ("namespace A" :: "module B =" :: (lines |> List.map (fun s -> " " + s))) let private fsi = String.concat Environment.NewLine >> FsiSource let private fsx = String.concat Environment.NewLine >> FsxSourceCode - + let private fsiSource44 = [ "namespace A" "[]" @@ -36,7 +36,7 @@ module Nowarn = "#nowarn 44" "type T5 = T" ] - + let private fsSource44 = [ "namespace A" "#nowarn 44" @@ -47,7 +47,7 @@ module Nowarn = "type T4 = T" "type T5 = T" ] - + let private testData = [ vp, [], [fsMod [make20]], [W20, 2] @@ -133,7 +133,7 @@ module Nowarn = print $" actual diagnostics:" for d in actual do print $" {d.Error} in line {d.Range.StartLine}" Assert.Fail(string sb) - + [] [] let testWarnScopes testId langVersion flags (sourceArray: SourceCodeFileKind array) expectedDiags = diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/lib/lib.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/lib/lib.fs index 7638219029a..bd1474214c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/lib/lib.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/lib/lib.fs @@ -37,7 +37,7 @@ exit 0 [] [] // error01.fs - [] // error02.fs + [] // error02.fs [] // error03.fs [] // error05.fs (case-sensitive) [] // error06.fs (case-sensitive) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs index 7cf37742698..6af1f55c890 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSharp1.0:2249 - defaultof<> unexpectedly requires parens diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs index 7421bd50261..fc5e6d51a31 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs @@ -21,7 +21,7 @@ module Checked = [] let ``fsc-unchecked - unchecked01_fs --checked`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--checked"] |> compile @@ -31,7 +31,7 @@ module Checked = [] let ``fsc-unchecked - unchecked01_fs --checked+`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--checked+"] |> compile @@ -41,7 +41,7 @@ module Checked = [] let ``fsc-unchecked - unchecked01_fs --checked-`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--checked-"] |> compile @@ -51,7 +51,7 @@ module Checked = [] let ``fsi-unchecked - unchecked01_fs --checked-`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--checked-"] |> compile @@ -61,7 +61,7 @@ module Checked = [] let ``fsi-checked - checked01_fs --checked`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--checked"] |> compile @@ -71,7 +71,7 @@ module Checked = [] let ``fsi-checked - checked01_fs --checked+`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--checked+"] |> compile @@ -81,7 +81,7 @@ module Checked = [] let ``fsi-checked - checked01_fs --checked-`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--checked-"] |> compile @@ -94,7 +94,7 @@ module Checked = [] let ``fsc-checked - checked01_fs --checked --checked+`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--checked"; "--checked+"] |> compile @@ -104,7 +104,7 @@ module Checked = [] let ``fsc-checked - checked01_fs --checked- --checked+`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--checked-"; "--checked+"] |> compile @@ -114,7 +114,7 @@ module Checked = [] let ``fsc-checked - unchecked01_fs --checked+ --checked-`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--checked+"; "--checked-"] |> compile @@ -124,7 +124,7 @@ module Checked = [] let ``fsi-checked - checked01_fs --checked --checked+`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--checked"; "--checked+"] |> compile @@ -134,7 +134,7 @@ module Checked = [] let ``fsi-checked - checked01_fs --checked- --checked+`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--checked-"; "--checked+"] |> compile @@ -144,7 +144,7 @@ module Checked = [] let ``fsi-checked - unchecked01_fs --checked+ --checked-`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--checked+"; "--checked-"] |> compile @@ -155,7 +155,7 @@ module Checked = [] let ``fsc-checked - unchecked01_fs Checked`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--Checked"] |> compile @@ -168,7 +168,7 @@ module Checked = [] let ``fsc-checked - unchecked01_fs --checked-star`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--checked*"] |> compile @@ -181,7 +181,7 @@ module Checked = [] let ``fsc-checked - UncheckedDefaultOf01`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> asExe |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked01.fs index 50ca84a7df7..bf9aff08826 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked01.fs @@ -1,122 +1,122 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions // Regression test for FSHARP1.0:891 // --checked[+|-] option // This file is supposed to be compiled with checked ON // module M -let t1 = +let t1 = try let a = System.Int32.MaxValue + 1 // will throw! false - with + with | _ -> true -let t2 = +let t2 = try let a = System.Int32.MinValue - 1 // will throw! false - with + with | _ -> true -let t3 = +let t3 = try let a = System.Int64.MaxValue + 1L // will throw! false - with + with | _ -> true -let t4 = +let t4 = try let a = System.Int64.MinValue - 1L // will throw! false - with + with | _ -> true -let t5 = +let t5 = try let a = System.Int16.MaxValue + 1s // will throw! false - with + with | _ -> true -let t6 = +let t6 = try let a = System.Int16.MinValue - 1s // will throw! false - with + with | _ -> true -let t7 = +let t7 = try let a = System.SByte.MaxValue + 1y // will throw! false - with + with | _ -> true -let t8 = +let t8 = try let a = System.SByte.MinValue - 1y // will throw! false - with + with | _ -> true -let t1u = +let t1u = try let a = System.UInt32.MaxValue + 1u // will throw! false - with + with | _ -> true -let t2u = +let t2u = try let a = System.UInt32.MinValue - 1u // will throw! false - with + with | _ -> true -let t3u = +let t3u = try let a = System.UInt64.MaxValue + 1UL // will throw! false - with + with | _ -> true -let t4u = +let t4u = try let a = System.UInt64.MinValue - 1UL // will throw! false - with + with | _ -> true -let t5u = +let t5u = try let a = System.UInt16.MaxValue + 1us // will throw! false - with + with | _ -> true -let t6u = +let t6u = try let a = System.UInt16.MinValue - 1us // will throw! false - with + with | _ -> true -let t7u = +let t7u = try let a = System.Byte.MaxValue + 1uy // will throw! false - with + with | _ -> true -let t8u = +let t8u = try let a = System.Byte.MinValue - 1uy // will throw! false - with + with | _ -> true diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unchecked01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unchecked01.fs index 58aeb424d78..adcb6421b69 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unchecked01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unchecked01.fs @@ -1,122 +1,122 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions // Regression test for FSHARP1.0:891 // --checked[+|-] option // This file is supposed to be compiled with checked OFF // module M -let t1 = +let t1 = try let a = System.Int32.MaxValue + 1 // will NOT throw! true - with + with | _ -> false -let t2 = +let t2 = try let a = System.Int32.MinValue - 1 // will NOT throw! true - with + with | _ -> false -let t3 = +let t3 = try let a = System.Int64.MaxValue + 1L // will NOT throw! true - with + with | _ -> false -let t4 = +let t4 = try let a = System.Int64.MinValue - 1L // will NOT throw! true - with + with | _ -> false -let t5 = +let t5 = try let a = System.Int16.MaxValue + 1s // will NOT throw! true - with + with | _ -> false -let t6 = +let t6 = try let a = System.Int16.MinValue - 1s // will NOT throw! true - with + with | _ -> false -let t7 = +let t7 = try let a = System.SByte.MaxValue + 1y // will NOT throw! true - with + with | _ -> false -let t8 = +let t8 = try let a = System.SByte.MinValue - 1y // will NOT throw! true - with + with | _ -> false -let t1u = +let t1u = try let a = System.UInt32.MaxValue + 1u // will NOT throw! true - with + with | _ -> false -let t2u = +let t2u = try let a = System.UInt32.MinValue - 1u // will NOT throw! true - with + with | _ -> false -let t3u = +let t3u = try let a = System.UInt64.MaxValue + 1UL // will NOT throw! true - with + with | _ -> false -let t4u = +let t4u = try let a = System.UInt64.MinValue - 1UL // will NOT throw! true - with + with | _ -> false -let t5u = +let t5u = try let a = System.UInt16.MaxValue + 1us // will NOT throw! true - with + with | _ -> false -let t6u = +let t6u = try let a = System.UInt16.MinValue - 1us // will NOT throw! true - with + with | _ -> false -let t7u = +let t7u = try let a = System.Byte.MaxValue + 1uy // will NOT throw! true - with + with | _ -> false -let t8u = +let t8u = try let a = System.Byte.MinValue - 1uy // will NOT throw! true - with + with | _ -> false diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs index 8a591a55ee8..13957b2f894 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/E_InvalidArgument.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/E_InvalidArgument.fs index ce39f3e7a5e..bd41cad6456 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/E_InvalidArgument.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/E_InvalidArgument.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // --codepage 65536 // Actual message is: error FS0191: Valid values are between 0 and 65535, inclusive. // Parameter Name: codepage diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/ReferenceBoth.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/ReferenceBoth.fs index a7df7926e3e..bd77476d3a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/ReferenceBoth.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/ReferenceBoth.fs @@ -1,4 +1,4 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions // This test is designed to test the --codepage options. // - The same source file (libCodepage.fs) is compile twice, with different --codepage options // - The library file is designed so that it gets compiled to slightly different assemblies diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/Zero.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/Zero.fs index 4fb48dff85b..90c273c565a 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/Zero.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/Zero.fs @@ -1,4 +1,4 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions // --codepage 0 // It does not mean much to me... // diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/libCodepage.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/libCodepage.fs index 7b62b4907ef..51add2abcfb 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/libCodepage.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/libCodepage.fs @@ -3,7 +3,7 @@ namespace N -module M = +module M = type á = class static member M() = 11 end diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/crossoptimize.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/crossoptimize.fs index fa640ae2b6a..f8361bef6f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/crossoptimize.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/crossoptimize.fs @@ -11,7 +11,7 @@ open FSharp.Test.Compiler //# Sanity check - simply check that the option is valid module crossoptimize = - // SOURCE=crossoptimize.fs SCFLAGS="--crossoptimize" + // SOURCE=crossoptimize.fs SCFLAGS="--crossoptimize" [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs index 89bb46021d6..39123af4636 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs @@ -1,4 +1,4 @@ -// #NoMT #CompilerOptions #RequiresENU +// #NoMT #CompilerOptions #RequiresENU //section='- OUTPUT FILES - ' ! option=out kind=OptionString //section='- OUTPUT FILES - ' ! option=target kind=OptionString //section='- OUTPUT FILES - ' ! option=target kind=OptionString diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs index c75810c3381..3a0974f3c4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions #RequiresENU +// #Regression #NoMT #CompilerOptions #RequiresENU // Test that without [--flaterrors] flag multi-line errors are emitted in a regular way, i.e. spanned to more that one line // ''a list' diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs index 511987567fc..2a4855425af 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Test that using [--flaterrors] flag multi-line errors are flattened, i.e. concatenated into one-line error message. //This expression was expected to have type. ''a list' .but here has type. 'seq<'b>' diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs index 023e419d510..b28787371db 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Test that using [--flaterrors] does not make an impact on regular single-line error messages diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine04.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine04.fs index 31c3bf614e8..09542163a91 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine04.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine04.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Used by various [--flaterrors] tests //Unrecognized option: '.+' diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/gccerrors/gccerrors01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/gccerrors/gccerrors01.fs index 91ba04052f7..1f2fe0de40d 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/gccerrors/gccerrors01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/gccerrors/gccerrors01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:6108 module M diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/PublicSign.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/PublicSign.fs index 1b5af677538..43fa86edfba 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/PublicSign.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/PublicSign.fs @@ -27,7 +27,7 @@ let x = 42 // Resolve the path to sha1full.snk relative to this source file's directory // Path: tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc -> tests/fsharp/core/signedtests/sha1full.snk - let snkPath: string = + let snkPath: string = Path.Combine(__SOURCE_DIRECTORY__, "..", "..", "..", "..", "fsharp", "core", "signedtests", "sha1full.snk") // Compile with --publicsign+ and --keyfile to exercise the Offset 8 code path @@ -42,7 +42,7 @@ let x = 42 result |> shouldSucceed |> ignore // Safely extract the output DLL path using pattern matching - let outputDll: string = + let outputDll: string = match result.OutputPath with | Some path -> path | None -> failwith "Compilation did not produce an output DLL" @@ -65,10 +65,10 @@ let x = 42 else let mutable found = false for i in 0 .. (data.Length - magic.Length) do - if not found && - data.[i] = magic.[0] && - data.[i + 1] = magic.[1] && - data.[i + 2] = magic.[2] && + if not found && + data.[i] = magic.[0] && + data.[i + 1] = magic.[1] && + data.[i + 2] = magic.[2] && data.[i + 3] = magic.[3] then found <- true found diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/misc.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/misc.fs index 6d9631dc609..dfb26ae24ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/misc.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/misc.fs @@ -23,7 +23,7 @@ module help_options = |> verifyOutputWithBaseline (Path.Combine(__SOURCE_DIRECTORY__, "compiler_help_output.bsl")) |> shouldSucceed - // ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt /? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help40.txt help40.437.1033.bsl" # --help + // ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt /? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help40.txt help40.437.1033.bsl" # --help [] let ``Help - variant 2``() = FSharp "" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework.fs index 4b046928e9d..b7f950af3fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework.fs @@ -13,7 +13,7 @@ module Noframework = [] let ``noframework - noframework02_fs - --noframework`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--noframework"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework01.fs index 38bd3d5cd92..f32519e79fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:5976 // System.Func<...> is in System.Core.dll (NetFx3.5) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework02.fs index 8bc2ae3691f..a9e2704a6ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:5976 // See FSHARP1.0:6181 - it is no longer an error to specify --noframework and not specify -r to mscorlib/fscore // diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_03.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_03.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_03.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_03.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_04.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_04.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_04.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_04.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_05.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_05.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_05.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_05.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_06.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_06.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_06.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_06.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_07.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_07.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_07.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_07.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_08.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_08.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_08.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_08.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_09.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_09.fs index 1b2d4603e12..1a1cdb2dcdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_09.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_09.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_10.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_10.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_10.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_10.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_11.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_11.fs index 1b2d4603e12..1a1cdb2dcdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_11.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_11.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_12.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_12.fs index 1b2d4603e12..1a1cdb2dcdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_12.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_12.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_13.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_13.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_13.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_13.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_15.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_15.fs index 8fa5ee03684..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_15.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_15.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_16.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_16.fs index 581e41236a9..1c837952f05 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_16.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_16.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions module M printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs index e52f293e8cf..a07a18b618e 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs @@ -9,11 +9,11 @@ open FSharp.Test.Compiler module Platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_16_fs - --target:library --platform:anycpu32bitpreferred`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--target:library"; "--platform:anycpu32bitpreferred"] |> compile @@ -23,11 +23,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_01_fs - --PLATFORM:anycpu`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--PLATFORM:anycpu"] |> compile @@ -37,11 +37,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_02_fs - --PlatForm:anycpu`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--PlatForm:anycpu"] |> compile @@ -51,11 +51,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_03_fs - --platform:ITANIUM`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:ITANIUM"] |> compile @@ -65,11 +65,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_04_fs - --platform:ANYCPU`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:ANYCPU"] |> compile @@ -79,11 +79,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_05_fs - --platform:X86`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:X86"] |> compile @@ -93,11 +93,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_06_fs - --platform:X64`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:X64"] |> compile @@ -107,11 +107,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_07_fs - --platform:IA64`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:IA64"] |> compile @@ -121,11 +121,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_08_fs - --platform:i386`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:i386"] |> compile @@ -135,11 +135,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_09_fs - --platform:AMD64`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:AMD64"] |> compile @@ -149,11 +149,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_10_fs - --platform:PPC`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:PPC"] |> compile @@ -163,11 +163,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_15_fs - --platform:ARM`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform:ARM"] |> compile @@ -177,11 +177,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_11_fs - --platform-:anycpu`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--platform-:anycpu"] |> compile @@ -191,11 +191,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_12_fs - --PLATFORM+:anycpu`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--PLATFORM+:anycpu"] |> compile @@ -205,11 +205,11 @@ module Platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - + [] let ``platform - error_13_fs - ---platform:anycpu`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["---platform:anycpu"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/sourceFiles.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/sourceFiles.fs index 37543e02e37..638b6177152 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/sourceFiles.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/sourceFiles.fs @@ -10,7 +10,7 @@ open FSharp.Test.Compiler [] let ``Reports duplicate sources via warning``() = let file = SourceCodeFileKind.Fs({FileName="test.fs"; SourceText=Some """printfn "Hello" """ }) - + fsFromString file |> FS |> asExe diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/E_MayNotIncludeEXE.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/E_MayNotIncludeEXE.fs index d7dd0729175..bca144e98c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/E_MayNotIncludeEXE.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/E_MayNotIncludeEXE.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:3508 // --standalone option can't include .EXE //Static linking may not include a \.EXE diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/E_MayNotIncludeEXERef.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/E_MayNotIncludeEXERef.fs index 1c80f11249a..86a6de06c76 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/E_MayNotIncludeEXERef.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/E_MayNotIncludeEXERef.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:3508 // Note: the code here has nothing to do with the // test itself. Any F# code would pretty much do. diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/W_MissingTransitiveRef.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/W_MissingTransitiveRef.fs index 7c9607e99eb..e96d3368640 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/W_MissingTransitiveRef.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/standalone/W_MissingTransitiveRef.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions #NoMono +// #Regression #NoMT #CompilerOptions #NoMono // Regression test for FSharp1.0:5189 // Title: Make missing transitive references with --standalone a warning instead of an error // Note: A reference to PresentationFramework.dll is needed for compilation. diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_FileNotFound.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_FileNotFound.fs index 355c1ad8fbe..2bd04592e59 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_FileNotFound.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_FileNotFound.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Verify error when using --standalone to reference a file // which doesn't exist. // See also FSHARP1.0:5133 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_StaticLinkingErrorDLL.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_StaticLinkingErrorDLL.fs index 546be6c940c..c80896707a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_StaticLinkingErrorDLL.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_StaticLinkingErrorDLL.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:5133 // --staticlink emits a reasonable error message when things go wrong (e.g. when F# compiler has optimized away the dependencies on the target DLL // From Don's note: "This can only happen if the target code is pure (such as the "let a = 1" binding). " diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_StaticLinkingErrorEXE.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_StaticLinkingErrorEXE.fs index a27d1cb599d..6fff39c9c19 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_StaticLinkingErrorEXE.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/staticlink/E_StaticLinkingErrorEXE.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:5133 // --staticlink emits a reasonable error message when things go wrong (e.g. when F# compiler has optimized away the dependencies on the target DLL // From Don's note: "This can only happen if the target code is pure (such as the "let a = 1" binding). " diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tailcalls/tailcalls01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tailcalls/tailcalls01.fs index 34fc0fe3692..fd8fbf88bc5 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tailcalls/tailcalls01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tailcalls/tailcalls01.fs @@ -1,3 +1,3 @@ -// #NoMT #CompilerOptions #TailCalls +// #NoMT #CompilerOptions #TailCalls module tailcalls01 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/error01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/error01.fs index c969349d136..60345927738 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/error01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/error01.fs @@ -1,3 +1,3 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions //Unrecognized option: '--a' exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/error02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/error02.fs index cbb333cf647..46561be8e44 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/error02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/error02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions //The file extension of '//a' is not recognized\. Source files must have extension \.fs, \.fsi, \.fsx or \.fsscript$ exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_01.fs index 1b2d4603e12..1a1cdb2dcdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_02.fs index 1b2d4603e12..1a1cdb2dcdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_03.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_03.fs index 1b2d4603e12..1a1cdb2dcdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_03.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_03.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs index 6e4847ee498..9982789e470 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs @@ -13,11 +13,11 @@ open System.IO module Times = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - + [] let ``times - error_01_fs - --Times`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--Times"] |> typecheck @@ -27,11 +27,11 @@ module Times = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - + [] let ``times - error_02_fs - --times-`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--times-"] |> typecheck @@ -41,11 +41,11 @@ module Times = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - + [] let ``times - error_03_fs - --times+`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--times+"] |> typecheck @@ -57,12 +57,12 @@ module Times = [] let ``times - to console`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withBufferWidth 120 |> withOptions ["--times"] |> ignoreWarnings - |> compile + |> compile |> verifyOutputContains [| "Parse inputs" "Typecheck" @@ -78,14 +78,14 @@ module Times = member this.Dispose() = File.Delete(tempPath) } compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--times:"+tempPath] - |> ignoreWarnings + |> ignoreWarnings |> compile |> shouldSucceed |> ignore - + let csvContents = File.ReadAllLines(tempPath) Assert.Contains("Name,StartTime,EndTime,Duration(s),Id,ParentId,RootId",csvContents[0]) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times01.fs index 373ff85a1ae..b43933e0da3 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times01.fs @@ -1,4 +1,4 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions namespace N diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tokenize/tokenize01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tokenize/tokenize01.fs index 90cdb300fea..7a86baa87ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tokenize/tokenize01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tokenize/tokenize01.fs @@ -1,4 +1,4 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions namespace N diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tokenize/tokenize02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tokenize/tokenize02.fs index 782b52d530b..6f54d326a30 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tokenize/tokenize02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/tokenize/tokenize02.fs @@ -1,4 +1,4 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions namespace N diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn.fs index 7f7d7accda8..a64f9ae67ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:3789 // Unfixable warning 45 // diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_readonlystruct.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_readonlystruct.fs index 2a4f0152709..81675321add 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_readonlystruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_readonlystruct.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // See DevDiv:364238 open System.Collections.Generic diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror01.fs index 458844f51d0..af4fd4e216f 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:4867 // nowarn has no effect if "Warning level = 4" and "Warnings as errors" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror02.fs index 125259add60..3ea5a567b4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:4867 // nowarn has no effect if "Warning level = 4" and "Warnings as errors" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror03.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror03.fs index 475d86a7456..ad92d768eef 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror03.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror03.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:4867 // nowarn has no effect if "Warning level = 4" and "Warnings as errors" //FS0040 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn.fs index 153bff74a70..1bd61116258 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn.fs @@ -11,7 +11,7 @@ module CompilerWarningLevel = [] let ``warn_level0_fs --warn:0`` compilation = compilation - |> getCompilation + |> getCompilation |> withLangVersion80 |> asExe |> withOptions ["--warn:0"] @@ -22,7 +22,7 @@ module CompilerWarningLevel = [] let ``warn_level1_fs --warn:1 --warnaserror:52`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warn:1"; "--warnaserror:52"] |> compile @@ -31,7 +31,7 @@ module CompilerWarningLevel = [] let ``warn_level2_fs --warn:2 --warnaserror:52`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warn:2"; "--warnaserror:52"] |> compile @@ -40,7 +40,7 @@ module CompilerWarningLevel = [] let ``warn_level3_fs --warn:3 --warnaserror:52`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warn:3"; "--warnaserror:52"] |> compile @@ -49,7 +49,7 @@ module CompilerWarningLevel = [] let ``warn_level4_fs --warn:4 --warnaserror:52`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warn:4"; "--warnaserror:52"] |> compile @@ -58,7 +58,7 @@ module CompilerWarningLevel = [] let ``warn_level5_fs --warn:5 --warnaserror:52`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warn:5"; "--warnaserror:52"] |> compile @@ -70,7 +70,7 @@ module CompilerWarningLevel = [] let ``warn_level5_fs --warn:5`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warn:5"] |> compile @@ -79,7 +79,7 @@ module CompilerWarningLevel = |> 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 +#if NETSTANDARD // This test works with KeyValuePair, which is not a 'readonly struct' in net472 [] let ``no error 52 with readonly struct`` compilation = @@ -95,7 +95,7 @@ module CompilerWarningLevel = [] let ``warn_level6_fs --warn:6`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warn:6"] |> compile @@ -107,7 +107,7 @@ module CompilerWarningLevel = [] let ``nowarn_fs --warnaserror`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warnaserror"] |> compileAndRun @@ -117,7 +117,7 @@ module CompilerWarningLevel = [] let ``warn40_fs`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -131,7 +131,7 @@ module CompilerWarningLevel = [] let ``warn40_fs --warnaserror`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--warnaserror"] |> compile @@ -146,7 +146,7 @@ module CompilerWarningLevel = [] let ``warn40_fs --nowarn:40;21`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--nowarn:40;21"] |> compileAndRun @@ -156,7 +156,7 @@ module CompilerWarningLevel = [] let ``warn40_fs --nowarn:NU0000;FS40;NU0001`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--nowarn:NU0000;FS40;NU0001;FS21"] |> compileAndRun @@ -166,7 +166,7 @@ module CompilerWarningLevel = [] let ``warn40_fs --nowarn:FS0040`` compilation = compilation - |> getCompilation + |> getCompilation |> asExe |> withOptions ["--nowarn:FS0040"; "--nowarn:FS0021"] |> compileAndRun diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn40.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn40.fs index c9d56fe2004..6cd68c8eead 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn40.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn40.fs @@ -1,5 +1,5 @@ // This causes a warning 40 [] -let main argv = +let main argv = let rec x = lazy(x.Value) 0 // return an integer exit code diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level0.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level0.fs index f86e84e25f7..11adaa41048 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level0.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level0.fs @@ -1,4 +1,4 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions [] /// Meh - Informational diagnostics "XML comment is not placed on a valid language element." diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level1.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level1.fs index 8d8e176f6d0..8e4467f5235 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level1.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level1.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // // diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level2.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level2.fs index 8d8e176f6d0..8e4467f5235 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level2.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level2.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // // diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level3.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level3.fs index 8d8e176f6d0..8e4467f5235 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level3.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level3.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // // diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level4.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level4.fs index 8d8e176f6d0..8e4467f5235 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level4.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level4.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // // diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level5.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level5.fs index 2b6115e5718..98fcac27a38 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level5.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level5.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // See DevDiv:364238 open System.Collections.Generic diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level6.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level6.fs index 585191cf226..19b4981f2b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level6.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level6.fs @@ -1,3 +1,3 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon.fs index bdae02a2c43..db7f794b1b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon.fs @@ -13,7 +13,7 @@ module CompilerWarnOn = [] let ``warnon - warnon01_fs - --warnon:1182 --test:ErrorRanges`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--warnon:1182"; "--test:ErrorRanges"] |> compile @@ -27,7 +27,7 @@ module CompilerWarnOn = [] let ``warnon - warnon01_fs - --warnon:NU0001;FS1182;NU0001 --test:ErrorRanges`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withOptions ["--warnon:NU0001;FS1182;NU0001"; "--test:ErrorRanges"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon01.fs index 7fb6ba890e7..bc32eeecd8e 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:6108 // Note: --warnon *WAS* for test purposes only, now it is NOT. //The command-line option '--warnon' is for test purposes only @@ -15,5 +15,5 @@ let ff x = match [x] with //| [X(s,n) as r] -> () | [] -> () - | X(s,n) as r::_ -> ignore r; () + | X(s,n) as r::_ -> ignore r; () diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs index 070d0837acc..bfc240e4df8 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs @@ -241,7 +241,7 @@ let ``Job keeps running if only one requestor cancels`` () = do! awaitHandle jobCanComplete return key * 2 } - + let memoize = AsyncMemoize<_, int, _>() let events = observe memoize @@ -386,7 +386,7 @@ let ``Stress test`` () = |> Task.WhenAll if not (test.Wait testTimeoutMs) then failwith "Test timed out - most likely deadlocked" - + Assert.Equal (threads * iterations, started) // Assert.Equal((0,0,0,0,0),(started, completed, canceled, failed, timeout)) Assert.Equal (started, completed + canceled + failed + timeout) @@ -414,7 +414,7 @@ let ``Cancel running jobs with the same key`` () = let cts = new CancellationTokenSource() - let jobsToCancel = + let jobsToCancel = [ for i in 1 .. 10 -> Async.StartAsTask(cache.Get(key i , work), cancellationToken = cts.Token) ] waitUntil events (countOf Started >> (=) 10) @@ -455,12 +455,12 @@ type DummyException(msg) = inherit Exception(msg) [] -let ``Preserve thread static diagnostics`` () = +let ``Preserve thread static diagnostics`` () = let seed = System.Random().Next() let rng = System.Random seed - + let job1Cache = AsyncMemoize() let job2Cache = AsyncMemoize() @@ -472,7 +472,7 @@ let ``Preserve thread static diagnostics`` () = } let job2 (input: int) = async { - + DiagnosticsThreadStatics.DiagnosticsLogger.Warning(DummyException("job2 error 1")) let! _ = Async.Sleep (rng.Next(1, 30)) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/Caches.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/Caches.fs index c00f1af81ba..5adf5572320 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/Caches.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/Caches.fs @@ -24,7 +24,7 @@ let defaultStructural() = CacheOptions.getDefault HashIdentity.Structural [] let ``Create and dispose many`` () = - let caches = + let caches = [ for _ in 1 .. 100 do new Cache(defaultStructural(), name = "Create and dispose many") :> IDisposable ] @@ -204,7 +204,7 @@ let ``GetOrAdd with reference identity`` () = let t2 = BoxedKey (1, 2) let t3 = BoxedKey (1, 2) let mutable createdCOunter = 0 - let factory _ = + let factory _ = createdCOunter <- createdCOunter + 1 createdCOunter diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs index 486316c3126..c084b9401f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs @@ -204,7 +204,7 @@ namespace Consumer } """ |> withName "CSLib" - + let fsharp = FSharp """ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_BaseIFaceLessAccessible01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_BaseIFaceLessAccessible01.fs index 88744aba13b..bc67f037f27 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_BaseIFaceLessAccessible01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_BaseIFaceLessAccessible01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSHARP1.0:5265 // It is *ok* to implement internalized interfaces //The type 'I1' is less accessible than the value, member or type 'IAmAnInterface1' it is used in.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ExposeLessVisible01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ExposeLessVisible01.fs index c4523e978ed..c327e909983 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ExposeLessVisible01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ExposeLessVisible01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility type internal A = { x : int } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_LocalLetBinding02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_LocalLetBinding02.fs index d4de396d610..563b4526a5e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_LocalLetBinding02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_LocalLetBinding02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Let bindings in classes are always private type internal A() = class end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass01.fs index 17de14bc669..b984f2b413f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Verify error associated with more accessible base class than super class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass02.fs index 50232b13bbf..963c7555ccb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass02.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Verify error when inheriting from less accessible base class -// Delegate signature: +// Delegate signature: type private I2 = abstract P: int @@ -15,6 +15,6 @@ type D = delegate of I2 -> unit type private I3= abstract P: int -type IAmAnotherInterface = +type IAmAnotherInterface = abstract Q : I3 -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_PrivateImplicitCtor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_PrivateImplicitCtor01.fs index b1930a5b04d..f7b919b05f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_PrivateImplicitCtor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_PrivateImplicitCtor01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Verify error when using a private implicit constructor diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ProtectedThingsInaccessible01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ProtectedThingsInaccessible01.fs index f80799d2a14..49b773b5476 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ProtectedThingsInaccessible01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ProtectedThingsInaccessible01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSharp1.0:4227 - protected access checks are not correctly implemented diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible.fs index 3dd086a4ed0..a02aa584e2e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible.fs @@ -1,24 +1,24 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility //The value 'somePrivateField' is not accessible from this code location$ //The value 'somePrivateMethod' is not accessible from this code location$ //The member or object constructor 'PrivateMethod' is not accessible\. Private members may only be accessed from within the declaring type\. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions\.$ module Module1 = - + let private somePrivateField = true let private somePrivateMethod x y = x ** y - + type Foo() = member this.PublicMethod() = true member private this.PrivateMethod() = false - + module Module2 = - // Private in public module + // Private in public module let test1 = Module1.somePrivateField let test2 = Module1.somePrivateMethod 2.0 8.0 - - // Private methods + + // Private methods let x = new Module1.Foo() let test3 = x.PrivateMethod() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible02.fs index c0cfd857365..74c7a941481 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible02.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Private modules -// Private type or module is private to its immediately enclosing module. This means the module PrivateModule in the repro -// is indeed accessible to the rest of the implicit enclosing module. +// Private type or module is private to its immediately enclosing module. This means the module PrivateModule in the repro +// is indeed accessible to the rest of the implicit enclosing module. @@ -10,7 +10,7 @@ -module M = +module M = let private y = 42 let private g y = y * y @@ -21,7 +21,7 @@ module M = module public PublicModule = let x = 1 let f x = x * x + y - + module Module1 = let test4 = M.PrivateModule.x // Error let test5 = M.PrivateModule.f 2 // Error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible03.fs index f803007448b..81fe58bb08f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible03.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSHARP1.0:2738 -module M = +module M = module private PrivateModule = let x = 1 - + module Module1 = let _ = M.PrivateModule.x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible04.fs index 135155f7542..fa097a85b7d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible04.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Private modules -// Private type or module is private to its immediately enclosing module. This means the module PrivateModule in the repro -// is indeed accessible to the rest of the implicit enclosing module. +// Private type or module is private to its immediately enclosing module. This means the module PrivateModule in the repro +// is indeed accessible to the rest of the implicit enclosing module. -module M = +module M = let private y = 42 let private g y = y * y @@ -19,7 +19,7 @@ module M = module public PublicModule = let x = 1 let f x = x * x + y - + module Module2 = open M let test4 = PrivateModule.x // Error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible05.fs index 3df5fa06128..849d594a8e0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible05.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSharp1.0:2236 - unexpected "record field" in accessibility error -type Foo = +type Foo = class val mutable private foo : int new() = { foo = 12 } - end - + end + let f = (new Foo()).foo diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InterfaceImplementationVisibility.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InterfaceImplementationVisibility.fs index ec012d52f76..3f982006eff 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InterfaceImplementationVisibility.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InterfaceImplementationVisibility.fs @@ -7,7 +7,7 @@ module Definitions = type PublicArg() = class end - type private IPrivateInterface = + type private IPrivateInterface = abstract A : PublicArg -> InternalArg abstract B : PublicArg -> PrivateArg abstract C : InternalArg -> PrivateArg diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InternalMethodsWorkCorrectly.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InternalMethodsWorkCorrectly.fs index c4663a1e34d..d787b8c736f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InternalMethodsWorkCorrectly.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InternalMethodsWorkCorrectly.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Accessibility +// #Conformance #DeclarationElements #Accessibility module internal InternalModule = @@ -9,7 +9,7 @@ module internal InternalModule = type internal InternalClass (x : string) = let m_innards = x member internal this.InternalMethod_GetDevoweledString() = deVowelStr m_innards - + module testModule = let startingValue = InternalModule.initialString @@ -18,6 +18,6 @@ module testModule = let internal x = new InternalModule.InternalClass(startingValue) let result = x.InternalMethod_GetDevoweledString() - + if result <> InternalModule.deVowelStr startingValue then failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InternalizedIFaces02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InternalizedIFaces02.fs index c3959b59f7c..a0083558173 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InternalizedIFaces02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/InternalizedIFaces02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSHARP1.0:5042 // It is *ok* to implement internalized interfaces // @@ -6,12 +6,12 @@ module N.M type StdGen = A | B - type IGen = + type IGen = abstract AsGenObject : Gen - and Gen<'a> = - | Gen of (int -> StdGen -> 'a) + and Gen<'a> = + | Gen of (int -> StdGen -> 'a) member x.Map f = failwith "" interface IGen with member x.AsGenObject = x.Map box diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/LessOrMoreAccessibleCode01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/LessOrMoreAccessibleCode01.fs index 10769e28fbd..b4facb66256 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/LessOrMoreAccessibleCode01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/LessOrMoreAccessibleCode01.fs @@ -1,18 +1,18 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSHARP1.0:4137 - CTP: Encapsulation/accessibility in F# -module internal HelperModule = +module internal HelperModule = type Data = private { Datum: int } let handle (data:Data): int = data.Datum let make x = { Datum = x } - -module public Module = + +module public Module = type public Data = private { Thing: HelperModule.Data } let public getInt (data:Data): int = HelperModule.handle data.Thing let makeData x = { Thing = HelperModule.make x } - + let internal a = HelperModule.make 2 let b = Module.makeData 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/LocalLetBinding01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/LocalLetBinding01.fs index f10d65a84b7..198d85181af 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/LocalLetBinding01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/LocalLetBinding01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSHARP1.0:4679 // module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_InterfaceImpl01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_InterfaceImpl01.fs index 185e992a739..37d6b3e75d4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_InterfaceImpl01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_InterfaceImpl01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #Overloading +// #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on interface implementation @@ -13,7 +13,7 @@ type Foo1() = class interface IFoo with member this.M1(x) = () end - + type Foo2() = class interface IFoo with member public this.M1(x) = () // err diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides01.fs index 506d9e42250..a151f1836a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #Overloading +// #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on overrides (class inheritance) @@ -7,7 +7,7 @@ type C() = class abstract member M : int end - + type C1() = class inherit C() override public x.M = 11 // err diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides02.fs index 7c448fd77fc..5f1aef1f6a4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #Overloading +// #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on overrides (class inheritance) @@ -20,7 +20,7 @@ type D2() = class override x.P with private get () = 1 and set (a : int) = () end - + type D3() = class inherit D() override x.P with internal get () = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides03.fs index 603027363c7..8fe6cad207a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #Overloading +// #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on overrides (class inheritance) @@ -21,7 +21,7 @@ type D2a() = class override x.P with get () = 1 and private set (a : int) = () end - + type D3a() = class inherit D() override x.P with get () = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides04.fs index 8262a98c8a5..7835ae2ca11 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #Overloading +// #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on overrides (class inheritance) @@ -20,7 +20,7 @@ type D2b() = class override x.P with private get () = 1 and public set (a : int) = () end - + type D3b() = class inherit D() override x.P with internal get () = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides05.fs index 0475e9bd564..04106e89c7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #Overloading +// #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility desc on overrides (inheritance chain) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/AccessProtectedInstance01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/AccessProtectedInstance01.fs index 4072df095bb..5d3b8cb15b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/AccessProtectedInstance01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/AccessProtectedInstance01.fs @@ -5,9 +5,9 @@ open TestBaseClass type DerivedClass() = class inherit BaseClass() - + member x.SomeMethod() = x.ProtectedInstance() - static member AnotherMethod() = + static member AnotherMethod() = let x = DerivedClass() x.ProtectedInstance() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/AccessProtectedStatic01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/AccessProtectedStatic01.fs index b85a8f4ed54..fab6048656e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/AccessProtectedStatic01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/AccessProtectedStatic01.fs @@ -4,7 +4,7 @@ open TestBaseClass type DerivedClass() = class inherit BaseClass() - + member x.SomeMethod() = BaseClass.ProtectedStatic() static member AnotherMethod() = BaseClass.ProtectedStatic() end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_AccessPrivateMember01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_AccessPrivateMember01.fs index 170af8fcc35..ce2a2094337 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_AccessPrivateMember01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_AccessPrivateMember01.fs @@ -1,14 +1,14 @@ // #Regression #Conformance #Accessibility #ObjectOrientedTypes //Dev11:211080, used to give an internal error here //The member or object constructor 'Impl' is not accessible\. Private members may only be accessed from within the declaring type\. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions\.$ -namespace Tim +namespace Tim -module Correlation = - type SpecMulti() = - member private t.Impl _ _ = () - type SpecSet = { - Inner : SpecMulti - } with - member t.Generate arg = - let fn _ = () - t.Inner.Impl fn arg \ No newline at end of file +module Correlation = + type SpecMulti() = + member private t.Impl _ _ = () + type SpecSet = { + Inner : SpecMulti + } with + member t.Generate arg = + let fn _ = () + t.Inner.Impl fn arg \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_AccessProtectedInstance01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_AccessProtectedInstance01.fs index 7aba4c34ce3..47ce37be03c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_AccessProtectedInstance01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_AccessProtectedInstance01.fs @@ -7,7 +7,7 @@ open TestBaseClass type DerivedClass() = class inherit BaseClass() - + member x.SomeMethod2() = BaseClass().ProtectedInstance() static member AnotherMethod2() = BaseClass().ProtectedInstance() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty01.fs index 3f4f182c304..21d4975d919 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #DeclarationElements #Accessibility #MethodsAndProperties #MemberDefinitions // Regression test for FSharp1.0:4169 // Title: Accessibility modifier in front of property is ignored if either get() or set() is mentioned explicitly // Verify 'private' is honored everywhere expected and is not accessible @@ -21,23 +21,23 @@ type T() = // Getters member this.test1 with private get () = 0 member private this.test2 with get () = 0 - + // Setters member this.test3 with private set (x : int) = () member private this.test4 with set (x : int) = () - + // Getters & Setters together member this.test5 with private get () = 0 and private set (x : int) = () member private this.test6 with get () = 0 and set (x : int) = () - + // Different accessibility on getter and setter member this.test7 with public get () = 0 and private set (x : int) = () member this.test8 with private get () = 0 and public set (x : int) = () - + let a = T() a.Foo + a.test1 + a.test2 + a.test5 + a.test6 + a.test7 + a.test8 |> ignore a.test3 <- 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty02.fs index ed13f1fea2a..5502d8ade74 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #DeclarationElements #Accessibility #MethodsAndProperties #MemberDefinitions // Regression test for FSharp1.0:4169 // Title: Accessibility modifier in front of property is ignored if either get() or set() is mentioned explicitly // Verify accessibility annotations cannot be duplicated in various places with properties @@ -14,10 +14,10 @@ type T() = // Getters member this.test1 with private get private () = 0 member private this.test2 with private get () = 0 - + // Setters member public this.test3 with private set (x : int) = () member private this.test4 with set private (x : int) = () - + // Getters & Setters together member this.test5 with private public get () = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/OnProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/OnProperty01.fs index e55743f129f..87e655c8abe 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/OnProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/OnProperty01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #DeclarationElements #Accessibility #MethodsAndProperties #MemberDefinitions // Regression test for FSharp1.0:4169 // Title: Accessibility modifier in front of property is ignored if either get() or set() is mentioned explicitly // Verify 'public' is honored everywhere expected @@ -9,17 +9,17 @@ type T() = // explicit public member public this.Bar = 200 - + // getters member this.test1 with public get () = "test1" member this.test2 with get () = "test2" member public this.test3 with get () = "test3" - + // setters member this.test4 with public set (x : int) = () member this.test5 with set (x : int) = () member public this.test6 with set (x : int) = () - + // getters and setters together member this.test7 with public get () = "test7_get" and public set (x : string) = () @@ -27,13 +27,13 @@ type T() = and set (x : string) = () member public this.test9 with get () = "test9_get" and set (x : string) = () - + // different accessibility on getter and setter member this.test10 with public get () = "test10_get" and private set (x : string) = () member this.test11 with private get () = "test11_get" and public set (x : string) = () - + let a = T() a.Foo + a.Bar |> ignore a.test1 + a.test2 + a.test3 |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface.fs index 7bb030ec557..a25804df7ec 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility //\(17,14-18,12\): error FS0191: abstract slots always have the same visibility as the enclosing type @@ -10,7 +10,7 @@ type public IDoStuffAsWell = abstract SomeStuff : int -> unit - + type internal IMightDoStuffAsWell = abstract SomeStuff : int -> unit @@ -21,4 +21,4 @@ type private IDoStuff = abstract public SomeStuffb1 : int -> int -> (int * int) abstract private SomeStuffb2 : int -> int -> (int * int) abstract internal SomeStuffb3 : int -> int -> (int * int) - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface01.fs index 05329b5bf9b..5b1e1d9ff8e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // //Accessibility modifiers are not allowed on this member\. Abstract slots always have the same visibility as the enclosing type // type public IDoStuffAsWell = abstract SomeStuff : int -> unit - + type internal IMightDoStuffAsWell = abstract SomeStuff : int -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface02.fs index 598f532f006..87b77b1fc7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // //Accessibility modifiers are not allowed on this member\. Abstract slots always have the same visibility as the enclosing type // @@ -7,7 +7,7 @@ type public IDoStuffAsWell = abstract SomeStuff : int -> unit - + type internal IMightDoStuffAsWell = abstract SomeStuff : int -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface03.fs index 6e7d3937ac7..e8c5658cd70 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // //Accessibility modifiers are not allowed on this member\. Abstract slots always have the same visibility as the enclosing type // @@ -7,7 +7,7 @@ type public IDoStuffAsWell = abstract SomeStuff : int -> unit - + type internal IMightDoStuffAsWell = abstract SomeStuff : int -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface04.fs index 840cc6f703f..468b217391b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // //Unexpected keyword 'public' in member definition\. Expected identifier, '\(', '\(\*\)' or other token\.$ // @@ -7,7 +7,7 @@ type public IDoStuffAsWell = abstract SomeStuff : int -> unit - + type internal IMightDoStuffAsWell = abstract SomeStuff : int -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface05.fs index 1380b4ec556..aa13f3a75c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // //Unexpected keyword 'private' in member definition\. Expected identifier, '\(', '\(\*\)' or other token\.$ // @@ -7,7 +7,7 @@ type public IDoStuffAsWell = abstract SomeStuff : int -> unit - + type internal IMightDoStuffAsWell = abstract SomeStuff : int -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface06.fs index 952bd2eaeee..e9c9341e252 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnInterface06.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // //Unexpected keyword 'internal' in member definition\. Expected identifier, '\(', '\(\*\)' or other token\.$ // @@ -7,7 +7,7 @@ type public IDoStuffAsWell = abstract SomeStuff : int -> unit - + type internal IMightDoStuffAsWell = abstract SomeStuff : int -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords.fs index cf4f481519e..b3cb011f491 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // See bug 1537. @@ -6,22 +6,22 @@ -type Person = { - public Name : string; - internal Age : int; - private ID : int +type Person = { + public Name : string; + internal Age : int; + private ID : int } exit 0 (* // Bug repro steps -type Person2 = - { Name : string; - Age : int; - ID : int - } +type Person2 = + { Name : string; + Age : int; + ID : int + } static member CreatePerson() = {Name = "bob"; Age = 10; ID = 2} - + let t1 = {Name = "Bob"; Age = 25; ID = 0} @@ -29,15 +29,15 @@ let t1 = {Name = "Bob"; Age = 25; ID = 0} let t1 = {Name = "Bob"; Age = 25; ID = 0} let t2 = {Name = "Joe"; Age = 25} (* -The record field 'ID' is not accessible from this code location. 5 10 -The record field 'ID' is not accessible from this code location. 5 10 -no assignment given for field 'ID'. 6 10 +The record field 'ID' is not accessible from this code location. 5 10 +The record field 'ID' is not accessible from this code location. 5 10 +no assignment given for field 'ID'. 6 10 *) // Using a static factor on the record type itself let p = Person.CreatePerson() let {Name = x; Age = y; ID = z} = p -// The record field 'ID' is not accessible from this code location. 18 6 +// The record field 'ID' is not accessible from this code location. 18 6 // If we consider allowing accessibility modifiers on records, then this // should work, but does not. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords02.fs index b334c1d8f61..4fd83a97213 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSHARP1.0:1537 // The warning is emitted _and_ the code compiles just fine. // As of 1/16/2009, the warning is now an error - so this code does not compile! diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_let01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_let01.fs index c2ddc7889a4..22f2f067bab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_let01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_let01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // On let diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_member01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_member01.fs index 9df54551bbc..c9d6cf1a53c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_member01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_member01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // On member module M = - type Foo() = class + type Foo() = class public member this.Stuff() = 42 // here - end + end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_module01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_module01.fs index 7783f5eb2f9..6f09720936e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_module01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_module01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // On module diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_type01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_type01.fs index 47a30c01ec1..0d838d91969 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_type01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_type01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DeclarationElements #Accessibility +// #Regression #Conformance #DeclarationElements #Accessibility // On type module M = - private type Foo() = class - end + private type Foo() = class + end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/PermittedLocations.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/PermittedLocations.fs index b8ded929963..8bbc6252436 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/PermittedLocations.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/PermittedLocations.fs @@ -179,7 +179,7 @@ type A = static abstract internal B2: int ->int static abstract member internal E2: int ->int static abstract member C2: int with internal get, private set - static abstract internal D2: int with get, set""" + static abstract internal D2: int with get, set""" |> withOptions ["--nowarn:3535"] |> verifyCompile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ArgumentsOfAllTypes/FSharpAttrLibrary.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ArgumentsOfAllTypes/FSharpAttrLibrary.fs index 12f92ecfc30..749b327e71a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ArgumentsOfAllTypes/FSharpAttrLibrary.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ArgumentsOfAllTypes/FSharpAttrLibrary.fs @@ -241,7 +241,7 @@ type System_TypeArray(p1 : System.Type[]) = [>, N1 = typedefof>)>] [] [ |], N1 = [| typeof |])>] -type ClassWithAttrs() = +type ClassWithAttrs() = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ArgumentsOfAllTypes/Generator/Generator.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ArgumentsOfAllTypes/Generator/Generator.fs index fe688dcec26..74dcf29ffa5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ArgumentsOfAllTypes/Generator/Generator.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ArgumentsOfAllTypes/Generator/Generator.fs @@ -4,21 +4,21 @@ // [] // type T1() = class end // let t1 = (typeof.GetCustomAttributes(false) |> Array.map (fun x -> x :?> System.Attribute)).[0] -// t1 +// t1 // // val it: System.Attribute = // // CSAttributes.A1Attribute {PositionalString = "X"; // // TypeId = CSAttributes.A1Attribute; -// // pa_int = 1;} +// // pa_int = 1;} // //module OnePositionalAndByNameStringOneNamedInt = // [] // type T1() = class end // let t1 = (typeof.GetCustomAttributes(false) |> Array.map (fun x -> x :?> System.Attribute)).[0] -// t1 +// t1 // // val it: System.Attribute = // // CSAttributes.A1Attribute {PositionalString = "A"; // // TypeId = CSAttributes.A1Attribute; -// // pa_int = 2;} +// // pa_int = 2;} let attr_template = """ [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)] @@ -44,7 +44,7 @@ let attr_template = """ }} /* * * * */ """ - + let attr_template_fsharp = """ [] type {1}(p1 : {0}) = @@ -60,15 +60,15 @@ type {1}(p1 : {0}) = (* * * * *) """ -let types = [| - ("System.Int16", "System_Int16", "10s", "10"); - ("System.Int32", "System_Int32", "2147483647", "2147483647"); - ("System.Int64", "System_Int64", "9223372036854775807L", "9223372036854775807L"); - ("System.UInt16", "System_UInt16", "65535us", "65535"); - ("System.UInt32", "System_UInt32", "4294967295u", "4294967295"); - ("System.UInt64", "System_UInt64", "18446744073709551615UL", "18446744073709551615UL"); +let types = [| + ("System.Int16", "System_Int16", "10s", "10"); + ("System.Int32", "System_Int32", "2147483647", "2147483647"); + ("System.Int64", "System_Int64", "9223372036854775807L", "9223372036854775807L"); + ("System.UInt16", "System_UInt16", "65535us", "65535"); + ("System.UInt32", "System_UInt32", "4294967295u", "4294967295"); + ("System.UInt64", "System_UInt64", "18446744073709551615UL", "18446744073709551615UL"); ("System.Char", "System_Char", "'A'", "'A'"); - ("System.Byte", "System_Byte", "255uy", "255"); + ("System.Byte", "System_Byte", "255uy", "255"); ("System.SByte", "System_SByte", "127y", "127"); ("System.Single", "System_Single", "System.Single.MaxValue", "System.Single.MaxValue"); ("System.Double", "System_Double", "System.Double.MaxValue", "System.Double.MaxValue"); @@ -106,14 +106,14 @@ namespace CSAttributes printfn " public class ClassWithAttrs {" types |> Array.iter (fun (ty,name,_,csvalue) -> printfn " [%s(%s, N1 = %s)]" name csvalue csvalue) - + printfn """ public static System.Collections.Generic.IEnumerable MethodWithAttrs() { for(int i = 0; i< 10; i++) yield return System.Guid.Empty; } """ types |> Array.iter (fun (ty,name,_,csvalue) -> printfn " [%s(%s, N1 = %s)]" name csvalue csvalue) - + printfn """ public static System.Type MethodWithAttrsThatReturnsAType() { return typeof(ClassWithAttrs); } @@ -135,14 +135,14 @@ namespace CSAttributes printfn " public class ClassWithAttrs {" types |> Array.iter (fun (ty,name,_,csvalue) -> printfn " [%s(%s, N1 = %s)]" name csvalue csvalue) - + printfn """ public static System.Collections.Generic.IEnumerable MethodWithAttrs() { for(int i = 0; i< 10; i++) yield return System.Guid.Empty; } """ types |> Array.iter (fun (ty,name,_,csvalue) -> printfn " [%s(%s, N1 = %s)]" name csvalue csvalue) - + printfn """ public static System.Type MethodWithAttrsThatReturnsAType() { return typeof(ClassWithAttrs); } @@ -166,11 +166,11 @@ open System printfn "type ClassWithAttrs() = " types |> Array.iter (fun (ty,name,fsvalue,_) -> printfn " [<%s(%s, N1 = %s)>]" name fsvalue fsvalue) - + printfn """ static member MethodWithAttrs() = seq {for i in [1 .. 10] -> System.Guid.Empty}""" types |> Array.iter (fun (ty,name,fsvalue,_) -> printfn " [<%s(%s, N1 = %s)>]" name fsvalue fsvalue) - + printfn """ static member MethodWithAttrsThatReturnsAType() = typeof""" // // Now same thing, with nested classes @@ -188,14 +188,14 @@ open System // printfn " public class ClassWithAttrs {" // // types |> Array.iter (fun (ty,name,_,csvalue) -> printfn " [%s(%s, N1 = %s)]" name csvalue csvalue) -// +// // printfn """ public static System.Collections.Generic.IEnumerable MethodWithAttrs() { // for(int i = 0; i< 10; i++) yield return System.Guid.Empty; // } //""" // // types |> Array.iter (fun (ty,name,_,csvalue) -> printfn " [%s(%s, N1 = %s)]" name csvalue csvalue) -// +// // printfn """ public static System.Type MethodWithAttrsThatReturnsAType() { // return typeof(ClassWithAttrs); // } @@ -203,7 +203,7 @@ open System // } //}""" -let csharpconsumercode = +let csharpconsumercode = use f = new System.IO.StreamWriter("CSharpConsumer.cs", false) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AllowNullLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AllowNullLiteral01.fs index a51ad77a443..047bffb9542 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AllowNullLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AllowNullLiteral01.fs @@ -1,3 +1,3 @@ [] -type D() = +type D() = member x.P = 1 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion01.fs index e0f0348b8d4..7d5a32a92e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression for 6227 [] -do +do () let asm = System.Reflection.Assembly.GetExecutingAssembly().GetName() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion02.fs index b80b5788670..9809083e290 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion02.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes [] -do +do () let asm = System.Reflection.Assembly.GetExecutingAssembly().GetName() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion03.fs index 95de386b7f0..d4bd54c48c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes open System.Text.RegularExpressions [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion04.fs index fd876e72abb..391d6df8c03 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AssemblyVersion04.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes open System.Text.RegularExpressions [] -do +do () let asm = System.Reflection.Assembly.GetExecutingAssembly().GetName() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsClass.fs index 0c9af2292e4..50f5ddd6170 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsClass.fs @@ -45,6 +45,6 @@ type ClassUnionId = Id type ClassUnionId2 = Id [] -type UnionCase = +type UnionCase = | UnionCase of int | UnionCase2 of string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsCtor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsCtor01.fs index 5ff6cf89560..30eeaa81a97 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsCtor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsCtor01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // FSharp1.0:4780 - Attributes targeting constructors are not allowed on explicit constructors 'new() = { ... }' // Make sure custom attributes can be applied to explicit and implicit constructors @@ -9,17 +9,17 @@ open System [] type TestAttribute1() = inherit Attribute() - + [] type TestAttribute2() = inherit Attribute() - -type TestType1 [] (x) = + +type TestType1 [] (x) = let a = x [] new () = new TestType1(0) [] new (a, b) = new TestType1(1) - -type TestType2 [] (x) = + +type TestType2 [] (x) = let a = x [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsDelegate01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsDelegate01.fs index 1fa686c1666..967667048e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsDelegate01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsDelegate01.fs @@ -3,6 +3,6 @@ open System [] type CustomDelegateAttribute() = inherit Attribute() - + [] type Delegate1 = delegate of int -> int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsInterface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsInterface.fs index 028bd8979f4..82c42a48b53 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsInterface.fs @@ -10,8 +10,8 @@ type IFoo = interface end [] type IFoo2 = abstract A :int - -[] + +[] [] type IFoo3 = abstract A :int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsMethod01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsMethod01.fs index 4018ae74be8..49b75c5128c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsMethod01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsMethod01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSharp1.0:5172 // Title: "method" attribute target is not recognized // Descr: Verify that attribute target 'method' is recognized by F# compiler correctly. @@ -8,31 +8,31 @@ open System.Reflection type Foo() = inherit Attribute() -type C() = +type C() = class [] let bar z = z * 1 - + [] member this.f x = x + 1 - + [] static member g x = x - 1 end - + [] let foo x = x * x [] let goo = fun x -> 100 -type Interface1 = +type Interface1 = [] abstract Foo : int -> int // test that count of methods with 'Foo' attribute in the assembly is exactly 6 -let test1 = +let test1 = System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Seq.map ( fun tp -> tp.GetMethods( @@ -46,7 +46,7 @@ let test1 = |> Seq.filter ( fun m -> m.IsDefined(typeof, false)) |> Seq.length |> (=) 6 - + if not test1 then failwith "Failed: 1" [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsStruct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsStruct.fs index 9269f786c0e..ec5f2acf16c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsStruct.fs @@ -42,12 +42,12 @@ type StructUnionId2 = Id [] [] -type Union1 = +type Union1 = | UnionCase of a: int | UnionCase2 of string [] [] -type Union2 = +type Union2 = | UnionCase of a: int * b: int | UnionCase2 of c: string * d: string \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs index e962f16e6de..641e7a973ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -74,7 +74,7 @@ module CustomAttributes_AttributeUsage = compilation |> verifyCompileAndRun |> shouldSucceed - + // SOURCE=AttributeTargetsIsMethod01.fs # AttributeTargetsIsMethod01.fs [] let ``Preview: AttributeTargetsIsMethod01_fs opt-in warning`` compilation = @@ -90,7 +90,7 @@ module CustomAttributes_AttributeUsage = |> withLangVersion80 |> verifyCompile |> shouldSucceed - + // SOURCE=AttributeTargetsIsProperty.fs # AttributeTargetsIsProperty.fs [] let ``AttributeTargetsIsProperty_fs`` compilation = @@ -131,9 +131,9 @@ module CustomAttributes_AttributeUsage = (Warning 842, Line 14, Col 7, Line 14, Col 34, "This attribute cannot be applied to field. Valid targets are: class, struct, enum, constructor, method, property, field, event, interface, delegate"); (Warning 842, Line 24, Col 7, Line 24, Col 36, "This attribute cannot be applied to property, event, return value. Valid targets are: class, struct, enum, constructor, method, property, field, event, interface, delegate"); (Warning 842, Line 29, Col 15, Line 29, Col 47, "This attribute cannot be applied to method, event, return value. Valid targets are: class, struct, enum, constructor, method, property, field, event, interface, delegate"); - (Error 3172, Line 28, Col 14, Line 28, Col 17, "A property's getter and setter must have the same type. Property 'Foo' has getter of type 'int' but setter of type 'obj'.") + (Error 3172, Line 28, Col 14, Line 28, Col 17, "A property's getter and setter must have the same type. Property 'Foo' has getter of type 'int' but setter of type 'obj'.") ] - + // SOURCE=E_AttributeTargetIsField01.fs # E_AttributeTargetIsField01.fs [] let ``E_AttributeTargetIsField01_fs 9_0`` compilation = @@ -142,7 +142,7 @@ module CustomAttributes_AttributeUsage = |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsField01.fs # E_AttributeTargetIsField01.fs [] let ``E_AttributeTargetIsField01_fs`` compilation = @@ -169,7 +169,7 @@ module CustomAttributes_AttributeUsage = (Warning 842, Line 64, Col 3, Line 64, Col 12, "This attribute cannot be applied to method, return value. Valid targets are: field") (Warning 842, Line 66, Col 7, Line 66, Col 16, "This attribute cannot be applied to method, return value. Valid targets are: field") ] - + // SOURCE=E_AttributeTargetIsField02.fs # E_AttributeTargetIsField02.fs [] let ``E_AttributeTargetIsField02_fs 9.0`` compilation = @@ -178,7 +178,7 @@ module CustomAttributes_AttributeUsage = |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsField02.fs # E_AttributeTargetIsField02.fs [] let ``E_AttributeTargetIsField02_fs`` compilation = @@ -186,7 +186,7 @@ module CustomAttributes_AttributeUsage = |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsMethod02.fs # E_AttributeTargetIsMethod02.fs [] let ``E_AttributeTargetIsMethod02_fs 9_0`` compilation = @@ -195,7 +195,7 @@ module CustomAttributes_AttributeUsage = |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsMethod02.fs # E_AttributeTargetIsMethod02.fs [] let ``E_AttributeTargetIsMethod02_fs`` compilation = @@ -216,7 +216,7 @@ module CustomAttributes_AttributeUsage = (Warning 842, Line 34, Col 3, Line 34, Col 13, "This attribute cannot be applied to property, field, return value. Valid targets are: method") (Warning 842, Line 39, Col 3, Line 39, Col 13, "This attribute cannot be applied to property, field, return value. Valid targets are: method") ] - + // SOURCE=E_AttributeTargetIsMethod03.fs # E_AttributeTargetIsMethod03.fs [] let ``E_AttributeTargetIsMethod03_fs 9_0`` compilation = @@ -225,7 +225,7 @@ module CustomAttributes_AttributeUsage = |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsMethod03.fs # E_AttributeTargetIsMethod03.fs [] let ``E_AttributeTargetIsMethod03_fs`` compilation = @@ -250,7 +250,7 @@ module CustomAttributes_AttributeUsage = (Warning 842, Line 13, Col 3, Line 13, Col 15, "This attribute cannot be applied to class, struct, enum, interface, delegate. Valid targets are: method") (Warning 842, Line 13, Col 3, Line 13, Col 15, "This attribute cannot be applied to struct. Valid targets are: method") ] - + // SOURCE=E_ConditionalAttribute.fs SCFLAGS="--test:ErrorRanges" # E_ConditionalAttribute.fs [] let ``E_ConditionalAttribute_fs`` compilation = @@ -293,7 +293,7 @@ module CustomAttributes_AttributeUsage = (Warning 842, Line 12, Col 3, Line 12, Col 6, "This attribute cannot be applied to method, property, field, return value. Valid targets are: assembly, class") (Warning 842, Line 12, Col 3, Line 12, Col 6, "This attribute cannot be applied to property, field, return value. Valid targets are: assembly, class") ] - + // SOURCE=AttributeTargetIsStruct.fs # AttributeTargetIsStruct.fs [] let ``AttributeTargetIsStruct_fs 9.0`` compilation = @@ -301,14 +301,14 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=AttributeTargetIsStruct.fs # AttributeTargetIsStruct.fs [] let ``AttributeTargetIsStruct_fs`` compilation = compilation |> verifyCompile |> shouldSucceed - + // SOURCE=AttributeTargetIsClass.fs # AttributeTargetIsClass.fs [] let ``AttributeTargetIsClass_fs 9.0`` compilation = @@ -316,14 +316,14 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=AttributeTargetIsClass.fs # AttributeTargetIsClass.fs [] let ``AttributeTargetIsClass_fs`` compilation = compilation |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsStruct.fs # E_AttributeTargetIsStruct.fs [] let ``E_AttributeTargetIsStruct_fs 9.0`` compilation = @@ -331,7 +331,7 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsStruct.fs # E_AttributeTargetIsStruct.fs [] let ``E_AttributeTargetIsStruct_fs`` compilation = @@ -360,7 +360,7 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsClass.fs # E_AttributeTargetIsClass.fs [] let ``E_AttributeTargetIsClass_fs`` compilation = @@ -372,7 +372,7 @@ module CustomAttributes_AttributeUsage = (Warning 842, Line 19, Col 3, Line 19, Col 15, "This attribute cannot be applied to class. Valid targets are: struct") (Warning 842, Line 22, Col 10, Line 22, Col 22, "This attribute cannot be applied to class. Valid targets are: struct") ] - + // SOURCE=E_AttributeTargetIsClass01.fs # E_AttributeTargetIsClass01.fs [] let ``E_AttributeTargetIsClass01_fs 9_0`` compilation = @@ -380,7 +380,7 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsClass01.fs # E_AttributeTargetIsClass01.fs [] let ``E_AttributeTargetIsClass01_fs`` compilation = @@ -466,7 +466,7 @@ module CustomAttributes_AttributeUsage = |> withDiagnostics [ (Warning 2003, Line 5, Col 59, Line 5, Col 68, "The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9.8.*.6', but this value is invalid and has been ignored") ] - + // SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs [] let ``E_AttributeTargetIsField03_fs 9_0`` compilation = @@ -477,7 +477,7 @@ module CustomAttributes_AttributeUsage = |> withDiagnostics [ (Warning 842, Line 14, Col 5, Line 14, Col 15, "This attribute cannot be applied to method, property. Valid targets are: field") ] - + // SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs [] let ``E_AttributeTargetIsField03_fs opt-in warning`` compilation = @@ -489,7 +489,7 @@ module CustomAttributes_AttributeUsage = |> withDiagnostics [ (Warning 842, Line 14, Col 5, Line 14, Col 15, "This attribute cannot be applied to method, property. Valid targets are: field") ] - + // SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs [] let ``E_AttributeTargetIsField03_fs`` compilation = @@ -499,7 +499,7 @@ module CustomAttributes_AttributeUsage = |> withDiagnostics [ (Warning 842, Line 14, Col 5, Line 14, Col 15, "This attribute cannot be applied to method, property. Valid targets are: field") ] - + // SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs [] let ``Preview: E_AttributeTargetIsField03_fs opt-in warning`` compilation = @@ -512,7 +512,7 @@ module CustomAttributes_AttributeUsage = (Warning 3878, Line 14, Col 18, Line 14, Col 23, "This attribute is not valid for use on union cases with fields.") (Warning 3878, Line 15, Col 28, Line 15, Col 33, "This attribute is not valid for use on union cases with fields.") ] - + // SOURCE=E_AttributeTargetIsProperty01.fs # E_AttributeTargetIsField03.fs [] let ``E_AttributeTargetIsProperty01_fs 9_0`` compilation = @@ -520,14 +520,14 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsProperty01.fs # E_AttributeTargetIsField03.fs [] let ``E_AttributeTargetIsProperty01_fs`` compilation = compilation |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsCtor01.fs # E_AttributeTargetIsCtor01.fs [] let ``E_AttributeTargetIsCtor01_fs 9_0`` compilation = @@ -535,7 +535,7 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsCtor01.fs # E_AttributeTargetIsCtor01.fs [] let ``E_AttributeTargetIsCtor01_fs`` compilation = @@ -548,7 +548,7 @@ module CustomAttributes_AttributeUsage = (Warning 842, Line 14, Col 15, Line 14, Col 27, "This attribute cannot be applied to constructor. Valid targets are: method") (Warning 842, Line 17, Col 16, Line 17, Col 28, "This attribute cannot be applied to constructor. Valid targets are: method") ] - + // SOURCE=AttributeTargetsIsEnum01.fs # AttributeTargetsIsEnum01.fs [] let ``AttributeTargetsIsEnum01_fs 9.0`` compilation = @@ -556,14 +556,14 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=AttributeTargetsIsEnum01.fs # AttributeTargetsIsEnum01.fs [] let ``AttributeTargetsIsEnum01_fs`` compilation = compilation |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsEnum01.fs # E_AttributeTargetIsEnum01.fs [] let ``E_AttributeTargetIsEnum01_fs 9_0`` compilation = @@ -571,7 +571,7 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsEnum01.fs # E_AttributeTargetIsEnum01.fs [] let ``E_AttributeTargetIsEnum01_fs`` compilation = @@ -583,7 +583,7 @@ module CustomAttributes_AttributeUsage = (Warning 842, Line 20, Col 3, Line 20, Col 14, "This attribute cannot be applied to enum. Valid targets are: class") (Warning 842, Line 21, Col 3, Line 21, Col 18, "This attribute cannot be applied to enum. Valid targets are: interface") (Warning 842, Line 22, Col 3, Line 22, Col 17, "This attribute cannot be applied to enum. Valid targets are: delegate") - ] + ] // SOURCE=AttributeTargetsIsDelegate01.fs # AttributeTargetsIsDelegate01.fs [] @@ -592,14 +592,14 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=AttributeTargetsIsDelegate01.fs # AttributeTargetsIsDelegate01.fs [] let ``AttributeTargetsIsDelegate01_fs`` compilation = compilation |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsDelegate01.fs # E_AttributeTargetIsDelegate01.fs [] let ``E_AttributeTargetIsDelegate01_fs 9.0`` compilation = @@ -607,7 +607,7 @@ module CustomAttributes_AttributeUsage = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsDelegate01.fs # E_AttributeTargetIsDelegate01.fs [] let ``E_AttributeTargetsIsDelegate01_fs`` compilation = @@ -631,7 +631,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = """ |> compile |> shouldSucceed - + // SOURCE=AttributeTargetsIsInterface.fs # AttributeTargetsIsInterface.fs [] let ``AttributeTargetsIsInterface_fs 9.0`` compilation = @@ -639,7 +639,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=AttributeTargetsIsInterface.fs # AttributeTargetsIsInterface.fs [] let ``AttributeTargetsIsInterface_fs`` compilation = @@ -647,7 +647,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsInterface.fs # E_AttributeTargetIsInterface.fs [] let ``E_AttributeTargetIsInterface_fs 9_0`` compilation = @@ -655,7 +655,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsInterface.fs # E_AttributeTargetIsInterface.fs [] let ``E_AttributeTargetIsInterface_fs`` compilation = @@ -676,7 +676,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=E_AttributeTargetIsClass02.fs # E_AttributeTargetIsClass02.fs [] let ``E_AttributeTargetIsClass02_fs`` compilation = @@ -697,7 +697,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Warning 842, Line 47, Col 3, Line 47, Col 14, "This attribute cannot be applied to struct. Valid targets are: class") (Warning 842, Line 48, Col 3, Line 48, Col 18, "This attribute cannot be applied to struct. Valid targets are: interface") ] - + // SOURCE= CLIMutableAttribute01.fs # CLIMutableAttribute01.fs [] let ``CLIMutableAttribute01 8.0`` compilation = @@ -705,7 +705,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion80 |> verifyCompile |> shouldSucceed - + // SOURCE=CLIMutableAttribute01.fs # CLIMutableAttribute01.fs [] let ``CLIMutableAttribute01 90`` compilation = @@ -713,7 +713,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE= E_CLIMutableAttribute.fs # E_CLIMutableAttribute.fs [] let ``E_CLIMutableAttribute 8.0`` compilation = @@ -731,7 +731,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 3132, Line 22, Col 8, Line 22, Col 17, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") (Error 3132, Line 25, Col 8, Line 25, Col 18, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") ] - + // SOURCE=E_CLIMutableAttribute.fs # E_CLIMutableAttribute.fs [] let ``E_CLIMutableAttribute 90`` compilation = @@ -768,7 +768,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Warning 842, Line 44, Col 7, Line 44, Col 23, "This attribute cannot be applied to method, property, field, return value. Valid targets are: class, interface") (Error 935, Line 54, Col 10, Line 54, Col 11, "Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal") ] - + // SOURCE=E_AllowNullLiteral.fs # E_AllowNullLiteral.fs [] let ``E_AllowNullLiteral 90`` compilation = @@ -787,7 +787,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Warning 842, Line 44, Col 7, Line 44, Col 23, "This attribute cannot be applied to method, property, field, return value. Valid targets are: class, interface"); (Error 935, Line 54, Col 10, Line 54, Col 11, "Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal") ] - + // SOURCE= AllowNullLiteral01.fs # AllowNullLiteral01.fs [] let ``AllowNullLiteral01 8.0`` compilation = @@ -795,7 +795,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion80 |> verifyCompile |> shouldSucceed - + // SOURCE=AllowNullLiteral01.fs # AllowNullLiteral01.fs [] let ``AllowNullLiteral01 90`` compilation = @@ -803,7 +803,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE= E_VolatileField.fs # E_VolatileField.fs [] let ``E_VolatileField 9.0`` compilation = @@ -824,7 +824,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 879, Line 20, Col 9, Line 20, Col 11, "Volatile fields must be marked 'mutable' and cannot be thread-static") (Error 879, Line 23, Col 9, Line 23, Col 10, "Volatile fields must be marked 'mutable' and cannot be thread-static") ] - + // SOURCE=E_VolatileField.fs # E_VolatileField.fs [] let ``E_VolatileField 90`` compilation = @@ -845,7 +845,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 879, Line 20, Col 9, Line 20, Col 11, "Volatile fields must be marked 'mutable' and cannot be thread-static") (Error 879, Line 23, Col 9, Line 23, Col 10, "Volatile fields must be marked 'mutable' and cannot be thread-static") ] - + // SOURCE= VolatileField01.fs # VolatileField01.fs [] let ``VolatileField01 9.0`` compilation = @@ -853,7 +853,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE=VolatileField01.fs # VolatileField01.fs [] let ``VolatileField01 90`` compilation = @@ -861,7 +861,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> withLangVersion90 |> verifyCompile |> shouldSucceed - + // SOURCE= E_SealedAttribute01.fs # E_SealedAttribute01.fs [] let ``E_SealedAttribute01 9.0`` compilation = @@ -874,7 +874,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 948, Line 8, Col 6, Line 8, Col 24, "Interface types cannot be sealed") (Error 942, Line 14, Col 6, Line 14, Col 33, "Delegate types are always sealed") ] - + // SOURCE=E_SealedAttribute01.fs # E_SealedAttribute01.fs [] let ``E_SealedAttribute01 90`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributesWithArrays.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributesWithArrays.fs index ddbba230461..6dfefe1df60 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributesWithArrays.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributesWithArrays.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression for FSB 6162, Attribute constructors don't always accept arrays as arguments open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/ConditionalAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/ConditionalAttribute.fs index e769269cfdb..8e849a88753 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/ConditionalAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/ConditionalAttribute.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression for FSHARP1.0:6098 // conditionalattribute on a class should fail with a diagnostic // No error here because Foo inherits from Attribute @@ -10,7 +10,7 @@ open System.Diagnostics [] type Foo() = inherit System.Attribute() - + [] member x.Gar() = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AllowNullLiteral.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AllowNullLiteral.fs index 0f376db3122..5f37cf9f34c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AllowNullLiteral.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AllowNullLiteral.fs @@ -1,20 +1,20 @@ module AllowNullLiteralTest = begin //[] - type I = + type I = interface abstract P : int end //[] - type C() = + type C() = member x.P = 1 [] - type D() = + type D() = inherit C() - interface I with + interface I with member x.P = 2 member x.P = 1 @@ -25,25 +25,25 @@ module AllowNullLiteralTest = begin [] // expect an error here type S(c:int) = struct end - + [] // expect an error here - type R = { r : int } - + type R = { r : int } + [] // expect an error here type U = A | B of int - + [] // expect an error here type E = A = 1 | B = 2 - + [] // expect an error here type Del = delegate of int -> int - + [] // expect an error here let x = 1 - + [] // expect an error here let f x = 1 - + end module AllowNullLiteralWithArgumentTest = begin @@ -54,4 +54,3 @@ module AllowNullLiteralWithArgumentTest = begin type B() = inherit A() end - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsClass02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsClass02.fs index 532509f0ad5..255a3eb6fc2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsClass02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsClass02.fs @@ -27,7 +27,7 @@ type StructRecord = { Prop: string } [] [] [] -type UnionCase = +type UnionCase = | UnionCase of a: int | UnionCase2 of string @@ -35,7 +35,7 @@ type UnionCase = [] [] [] -type UnionCase2 = +type UnionCase2 = | UnionCase of a: int * b: int | UnionCase2 of c: string * d: string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsDelegate01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsDelegate01.fs index 0ea6a74827a..23d6fcaf5c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsDelegate01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsDelegate01.fs @@ -3,11 +3,11 @@ open System [] type CustomClassAttribute() = inherit Attribute() - + [] type CustomStructAttribute() = inherit Attribute() - + [] type CustomInterfaceAttribute() = inherit Attribute() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsField01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsField01.fs index 1e3e48516c9..ad4ff226826 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsField01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsField01.fs @@ -3,65 +3,65 @@ open System [] -type FieldOnlyAttribute() = +type FieldOnlyAttribute() = inherit Attribute() [] // Should fail let func1 () = "someFunction" [] // Should fail -let func2 a = a + 1 +let func2 a = a + 1 [] // Should fail -let func3 (a, b) = a + b +let func3 (a, b) = a + b [] // Should fail let func4 (a: int) : int = a + 1 [] // Should fail -let func5 a b = [ a; b ] +let func5 a b = [ a; b ] [] // Should fail -let func6<'a> = "someTypedFunction" +let func6<'a> = "someTypedFunction" [] // Should fail -let func7<'a> (x : 'a) = "someTypedFunction2" +let func7<'a> (x : 'a) = "someTypedFunction2" [] // Should fail -let func8 = fun x -> x +let func8 = fun x -> x [] // Should fail let func9 = id [] // Should fail -let __func10<'a> = false +let __func10<'a> = false [] // Should fail -let __func11<'a> : bool = false +let __func11<'a> : bool = false [] // Should fail -let (|Bool|_|) = function "true" -> Some true | "false" -> Some false | _ -> None +let (|Bool|_|) = function "true" -> Some true | "false" -> Some false | _ -> None [] // Should fail [] -let (|BoolExpr2|_|) = function "true" -> ValueSome true | "false" -> ValueSome false | _ -> ValueNone +let (|BoolExpr2|_|) = function "true" -> ValueSome true | "false" -> ValueSome false | _ -> ValueNone [] // Should fail let (|BoolExpr3|_|) x = match x with - | "true" -> Some true - | "false" -> Some false + | "true" -> Some true + | "false" -> Some false | _ -> None - + [] // Should fail [] -let (|BoolExpr4|_|) x = +let (|BoolExpr4|_|) x = match x with - | "true" -> ValueSome true - | "false" -> ValueSome false + | "true" -> ValueSome true + | "false" -> ValueSome false | _ -> ValueNone [] // Should fail -let rec func12() = 0 +let rec func12() = 0 and [] func13() = [] // Should fail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsField02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsField02.fs index 0cfd840e42b..552041d713b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsField02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsField02.fs @@ -4,7 +4,7 @@ open System open System.Diagnostics [] -type FieldOnlyAttribute() = +type FieldOnlyAttribute() = inherit Attribute() type TestClass() = @@ -15,7 +15,7 @@ type TestClass() = static let rec func2() = "someFunction" []// Should succeed (special exception when function can be lifted to a field) - static let rec func3() = "someFunction" + static let rec func3() = "someFunction" and [] fun4() = "someFunction" // Should succeed (special exception when function can be lifted to a field) [] // Should succeed (special exception when function can be lifted to a field) @@ -49,16 +49,16 @@ type TestClass() = [] // Should succeed (special exception when function can be lifted to a field) let (|BoolExpr3|_|) x = match x with - | "true" -> Some true - | "false" -> Some false + | "true" -> Some true + | "false" -> Some false | _ -> None [] // Should succeed (special exception when function can be lifted to a field) [] let (|BoolExpr4|_|) x = match x with - | "true" -> ValueSome true - | "false" -> ValueSome false + | "true" -> ValueSome true + | "false" -> ValueSome false | _ -> ValueNone [] // Should succeed (special exception when function can be lifted to a field) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsInterface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsInterface.fs index 5f4e2ff5ea0..bdaf895845a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsInterface.fs @@ -14,8 +14,8 @@ type IFoo = interface end [] type IFoo2 = abstract A :int - -[] + +[] [] [] type IFoo3 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsMethod02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsMethod02.fs index 8687a9b1d0c..fdb4043edc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsMethod02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsMethod02.fs @@ -3,38 +3,38 @@ open System [] -type MethodOnlyAttribute() = +type MethodOnlyAttribute() = inherit Attribute() [] // Should fail let val1 = "someValue" [] // Should fail -let i, j, k = (1, 2, 3) +let i, j, k = (1, 2, 3) [] // Should fail let val2 = nameof(MethodOnlyAttribute) [] // Should fail -let rec val3 = nameof(val2) +let rec val3 = nameof(val2) [] // Should fail -let ``val4`` = "someValue" +let ``val4`` = "someValue" [] // Should fail let rec val5 = 0 and [] val6 = [] // Should fail - + [] // Should fail let (a :: _) = [] [] // Should fail -let (d, e) as val7 = 1, 2 +let (d, e) as val7 = 1, 2 [] // Should fail -let 1 = 0 +let 1 = 0 type X = { X: int } [] // Should fail -let { X = _ } = { X = 1 } +let { X = _ } = { X = 1 } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsMethod03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsMethod03.fs index c60ecae32b2..1eab00ced79 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsMethod03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsMethod03.fs @@ -4,42 +4,42 @@ open System open System.Diagnostics [] -type MethodOnlyAttribute() = +type MethodOnlyAttribute() = inherit Attribute() -type TestClass() = +type TestClass() = [] // Should fail - static let val1 = "someValue" + static let val1 = "someValue" [] // Should fail static let rec val2 = "someValue" [] // Should fail - static let rec val3 = "someValue" + static let rec val3 = "someValue" and [] val4 = "someValue" // Should fail [] // Should fail - let val5 = "someValue" + let val5 = "someValue" [] // Should fail let i, j, k = (1, 2, 3) [] // Should fail - let val5 = nameof(MethodOnlyAttribute) + let val5 = nameof(MethodOnlyAttribute) [] // Should fail - let rec val6 = nameof(val5) + let rec val6 = nameof(val5) [] // Should fail - let ``val7`` = "someValue" + let ``val7`` = "someValue" [] // Should fail let rec val8 = 0 and [] val9 = [] // Should fail - + [] // Should fail - let (a :: _) = [] + let (a :: _) = [] [] // Should fail let (d, e) as foo = 1, 2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsStruct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsStruct.fs index 8e3fe0259d3..436b1027f88 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsStruct.fs @@ -33,7 +33,7 @@ type InterfaceTargetAttribute() = [] [] [] -type UnionCase = +type UnionCase = | UnionCase of int | UnionCase2 of string @@ -41,7 +41,7 @@ type UnionCase = [] [] [] -type UnionCase2 = +type UnionCase2 = | UnionCase of a: int * b: int | UnionCase2 of c: string * d: string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets01.fs index 6856fec0e79..dcf40d6af62 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:4673 // Title: AttributeTargets from AttributeUsage are not being checked/honored // Descr: Verify an attribute targeting methods, can't be applied to any other language elements. @@ -14,7 +14,7 @@ open System type MAttribute() = inherit Attribute() type A() = - + [] let someVal = 100 @@ -27,7 +27,7 @@ type A() = [] member this.Index with [] get () = 5 and [] set (x : int) = () - + [] static member (+) (op1 : A, op2 : A) = new A() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets02.fs index 99d25d9a68d..32e7630f0bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:4727 // Title: once we start compiling them as real mutable fields, you should not be able to target both "property" for "val mutable" fields in classes @@ -9,7 +9,7 @@ open System #nowarn "0046" #nowarn "0044" -type B() = +type B() = [] [] val mutable y : int @@ -24,8 +24,8 @@ type C() = [] member x.mf5 = 0 - - member x.Foo + + member x.Foo with [] get() = 1 and set(v) = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_ConditionalAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_ConditionalAttribute.fs index 12710cc5e91..e0ad4fe249d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_ConditionalAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_ConditionalAttribute.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression for FSHARP1.0:6098 // conditionalattribute on a class should fail with a diagnostic @@ -8,6 +8,6 @@ open System.Diagnostics [] type Foo() = - + [] member x.Gar() = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_RequiresExplicitTypeArguments01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_RequiresExplicitTypeArguments01.fs index 17d0b2fa69b..881e402d112 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_RequiresExplicitTypeArguments01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_RequiresExplicitTypeArguments01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression for FSHARP1.0:6163 // [] wasn't working on type members // The generic function 'Foo' must be given explicit type argument\(s\) @@ -10,7 +10,7 @@ type A() = member x.Foo<'a>(y:'a) = printfn "first" member x.Foo<'a>(y:'a, ?z:int) = printfn "second" -let a = new A() +let a = new A() a.Foo(42) // first a.Foo(42) // first a.Foo(42, 0) // second @@ -22,7 +22,7 @@ type B() = [] member x.Foo<'a>(y:'a, ?z:int) = printfn "second" -let b = new B() +let b = new B() b.Foo(42) // first b.Foo(42) // first b.Foo(42, 0) // second diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_RequiresExplicitTypeArguments02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_RequiresExplicitTypeArguments02.fs index 6b1cdc31045..fdf62d8e21d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_RequiresExplicitTypeArguments02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_RequiresExplicitTypeArguments02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression for FSHARP1.0:6163 // [] wasn't working on type members, make sure it's inherited too // The generic function 'Foo' must be given explicit type argument\(s\) @@ -15,9 +15,9 @@ type D() = type E() = inherit D() override x.Foo<'a>(y:'a) = printfn "third" - + let f (x : #D) = x.Foo(42) exit 1 - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_SealedAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_SealedAttribute01.fs index 1a58c154ca4..9de66ff393a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_SealedAttribute01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_SealedAttribute01.fs @@ -1,11 +1,11 @@ [] -type UnnecessarilySealedStruct = +type UnnecessarilySealedStruct = struct member x.P = 1 end [] -type BadSealedInterface = +type BadSealedInterface = interface abstract P : int end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_StructLayout01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_StructLayout01.fs index 0e0130e5a9f..1a3d29605f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_StructLayout01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_StructLayout01.fs @@ -1,10 +1,10 @@ [] -type X1 = +type X1 = abstract M : unit -> 'a [] [] -type X2() = +type X2() = abstract M : unit -> 'a [] @@ -14,4 +14,4 @@ type X4 = R1 | R2 type X5 = R1 = 1 | R2 = 2 [] -type X6 = delegate of int -> int \ No newline at end of file +type X6 = delegate of int -> int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_VolatileField.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_VolatileField.fs index d35abffe475..b121cf2939e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_VolatileField.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_VolatileField.fs @@ -9,7 +9,7 @@ module VolatileFieldSanityChecks = begin [] let x2 = 1 - type C() = + type C() = [] static let sx2 = 1 // expect an error - not mutable @@ -28,4 +28,3 @@ module VolatileFieldSanityChecks = begin member x.P = 1 end - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/MarshalAsAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/MarshalAsAttribute.fs index 529c8361a0d..1a020003615 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/MarshalAsAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/MarshalAsAttribute.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // FSB 4029, [] does not get encoded as 'marshal( fixed sysstring [512]) ' namespace MarshallDemoFS @@ -9,7 +9,7 @@ open System.Runtime.InteropServices type NagInt = int32 // type Integer in nag.h -type public NagErrorCode = // NAG error codes +type public NagErrorCode = // NAG error codes NE_NOERROR = 0 | NE_CODE_NOT_SET = 1 @@ -19,7 +19,7 @@ type public NagErrorHandler = delegate of IntPtr * NagInt * IntPtr -> unit type public NagError = val code: NagErrorCode // Out: Error Code val print: bool // In: print? yes/no - [] + [] val message: string // InOut: Error message (size is NAG_ERROR_BUF_LEN) val handler: NagErrorHandler // In: Error handling function val errnum: NagInt // May hold useful value for some errors @@ -34,8 +34,8 @@ module Program = let err = NagError() let size = Marshal.SizeOf(err) let expectedsize = if System.IntPtr.Size = 4 then 536 else 544 - if (size = expectedsize) then + if (size = expectedsize) then 0 - else - printfn "Error: expected size (%A) <> actual size (%A)" expectedsize size + else + printfn "Error: expected size (%A) <> actual size (%A)" expectedsize size failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/RequiresExplicitTypeArguments01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/RequiresExplicitTypeArguments01.fs index 4014d9a3f9c..3c46fc90ffc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/RequiresExplicitTypeArguments01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/RequiresExplicitTypeArguments01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression for FSHARP1.0:6163 // [] wasn't working on type members @@ -7,7 +7,7 @@ type A() = member x.Foo<'a>(y:'a) = "first" member x.Foo<'a>(y:'a, ?z:int) = "second" -let a = new A() +let a = new A() if a.Foo(42) <> "first" then failwith "Failed: 1" if a.Foo(42, 0) <> "second" then failwith "Failed: 2" if a.Foo(42, 0) <> "second" then failwith "Failed: 3" @@ -18,6 +18,6 @@ type B() = [] member x.Foo<'a>(y:'a, ?z:int) = "second" -let b = new B() +let b = new B() if b.Foo(42) <> "first" then failwith "Failed: 4" if b.Foo(42, 0) <> "second" then failwith "Failed: 5" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/RequiresExplicitTypeArguments02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/RequiresExplicitTypeArguments02.fs index b92ce4d3530..f1b16bcdf4d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/RequiresExplicitTypeArguments02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/RequiresExplicitTypeArguments02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression for FSHARP1.0:6163 // [] wasn't working on type members, make sure it's inherited too @@ -15,8 +15,8 @@ type D() = type E() = inherit D() override x.Foo<'a>(y:'a) = "third" - + let f (x : #D) = x.Foo(42) + x.Foo(42, 1) - + if f (E()) <> "thirdother" then failwith "Failed: 1" else () \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion01.fs index 573c7d5544d..1d1b25394db 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes [] -do +do () let asm = System.Reflection.Assembly.GetExecutingAssembly().GetName() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion02.fs index 6768fc8e004..0e0dff19d5a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion02.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes [] -do +do () let asm = System.Reflection.Assembly.GetExecutingAssembly().GetName() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion01.fs index 0019bc85b26..c7dab59490a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes [] [] -do +do () let asm = System.Reflection.Assembly.GetExecutingAssembly().GetName() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion02.fs index 6f76b962f5d..ca78fa6e25f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion02.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes [] [] -do +do () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ArrayParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ArrayParam.fs index cff714b29f5..ea3d0c7f7f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ArrayParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ArrayParam.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // FSB 1437, Assembly attribute w/array parameter fails to build @@ -23,10 +23,10 @@ do let tyAttributes = t.GetCustomAttributes(false) let attrib = tyAttributes |> Array.find (fun attrib -> match attrib with :? TestAttribute -> true | _ -> false) (attrib :?> TestAttribute) - + let tyFoo = typeof let testAtt = getTestAttribute tyFoo - if testAtt.Value <> [|0|] then + if testAtt.Value <> [|0|] then false else true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/AttribWithEnumFlags01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/AttribWithEnumFlags01.fs index ea73d1aa747..a763b49f8fc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/AttribWithEnumFlags01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/AttribWithEnumFlags01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Attributes +// #Conformance #DeclarationElements #Attributes // FSB 950, Custom attributes with flags enumeration arguments @@ -9,32 +9,32 @@ type EnumType = | C = 4 type EnumTypeInt64 = | E = 1L - + type CustomAttribute(x : EnumType) = inherit System.Attribute() member this.Value = x - -type CustomAttributeInt64(x : EnumTypeInt64) = + +type CustomAttributeInt64(x : EnumTypeInt64) = inherit System.Attribute() member this.Value = x - + [] -type SomeClass() = +type SomeClass() = override this.ToString() = "foo" -[] -type SomeClassInt64 = +[] +type SomeClassInt64 = interface end - -let runTest() = + +let runTest() = let testObj = new SomeClass() let itsAttributes = testObj.GetType().GetCustomAttributes(false) let attrib = itsAttributes |> Array.find (fun attrib -> match attrib with :? CustomAttribute -> true | _ -> false) if (attrib :?> CustomAttribute).Value <> (EnumType.A ||| EnumType.C) then failwith "Failed: 1" - + do - let value = + let value = typeof.GetCustomAttributes(false) |> Seq.tryPick(function | :? CustomAttributeInt64 as ca -> Some(int64 ca.Value) @@ -43,7 +43,7 @@ let runTest() = match value with | Some v when v = 10L -> () | _ -> failwith "Failed: 2" - + true // Actually run our test diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication01.fs index 4bea5828eb9..45b5e5d40a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // FSB 1036, Assembly-level attributes attached to non-do bindings diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication02.fs index 4d8eb3f403f..9878ae35846 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:1475 // F# attributes in prim-types.fs do not specify attribute targets diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication03.fs index bd32c8cc6e7..97751092cb0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes open System @@ -7,7 +7,7 @@ open System type TestType() = - [] + [] member s.ObsoleteMethod = 10 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication04.fs index 2db59fa3dc7..5a10b8744f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes open System @@ -7,7 +7,7 @@ open System type TestType() = - [] + [] member s.ObsoleteMethod = 10 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication05.fs index 2a6fb42413f..5408b1ac023 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication05.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #DeclarationElements #Attributes -// Attribute +// #Regression #Conformance #DeclarationElements #Attributes +// Attribute //This attribute is not valid for use on this language element [] type A() = inherit System.Attribute() -let [] x : int = 1 in x + x +let [] x : int = 1 in x + x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication06.fs index 745e5e8b3fa..04f5e3900ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication06.fs @@ -1,5 +1,5 @@ -// #Regression #Conformance #DeclarationElements #Attributes -// Attribute +// #Regression #Conformance #DeclarationElements #Attributes +// Attribute //Attributes are not permitted on 'let' bindings in expressions$ [] @@ -7,5 +7,5 @@ type A() = inherit System.Attribute() let foo ( [] x ) = 1 in foo 2 + foo 3 -let foo2 ( [] x ) ( [] y ) = 1 in foo2 2 3 + foo2 4 5 +let foo2 ( [] x ) ( [] y ) = 1 in foo2 2 3 + foo2 4 5 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication07.fs index 4db1ae0bfa7..feae10be7c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication07.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSharp1.0:4740 //This attribute cannot be used in this version of F# diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeTargetSpecifications.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeTargetSpecifications.fs index 04db4e80ac9..b4171d46886 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeTargetSpecifications.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeTargetSpecifications.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSharp1.0:1089 - Support "module" and other attribute target specifications in parser diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayout.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayout.fs index 3a3c7a5419a..ac07507307f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayout.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayout.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Tests to ensure that you can't use StructLayout inappropriately // Regression tests for FSHARP1.0:5931 //The type 'SExplicitBroken' has been marked as having an Explicit layout, but the field 'v2' has not been marked with the 'FieldOffset' attribute$ @@ -16,8 +16,8 @@ type SExplicitBroken = [] val v1 : int [] - val v2 : int - + val v2 : int + // Sequential layout with a field offset - will not build [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_AbstractClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_AbstractClass.fs index ad68e248585..28cccdae8d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_AbstractClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_AbstractClass.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 // Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ -module NegativeTests = +module NegativeTests = [] [] - type N2() = + type N2() = abstract M : unit -> 'a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU1.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU1.fs index 76705f7590e..fe300be39d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU1.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU1.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 // Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ -module NegativeTests = - +module NegativeTests = + [] type N3 = R1 | R2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU2.fs index 2b261d1b884..5b2db5e43ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU2.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 // Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ -module NegativeTests = - +module NegativeTests = + [] type N4 = R1 = 1 | R2 = 2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Delegate.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Delegate.fs index 0e18c2cf330..4a728d0f1ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Delegate.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Delegate.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 // Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ -module NegativeTests = - +module NegativeTests = + [] type N5 = delegate of int -> int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Interface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Interface.fs index 3c6e0d79589..e371da3efa7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Interface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Interface.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 // Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ -module NegativeTests = +module NegativeTests = [] - type N1 = + type N1 = abstract M : unit -> 'a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_UseNullAsTrueValue01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_UseNullAsTrueValue01.fs index eb2b13f3e31..22bc2f40050 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_UseNullAsTrueValue01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_UseNullAsTrueValue01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSharp1.0:5611 // Title: Give an error on uses of UseNullAsTrueValue @@ -12,7 +12,7 @@ // expect error [] -type MyUnion = +type MyUnion = | A1 | A | B of string @@ -21,11 +21,11 @@ type MyUnion = [] type MyUnion2 = | A1 - | A + | A // expect error [] -type MyUnion3 = +type MyUnion3 = | A1 // expect error @@ -34,21 +34,21 @@ type MyRecord3 = { x : int } // expect error [] -type MyClass4() = +type MyClass4() = class member x.P = 1 end // expect error [] -type MyInterface5 = - interface +type MyInterface5 = + interface abstract P : int end // expect error [] -type MyStruct6(x : int) = +type MyStruct6(x : int) = struct member __.X = x end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/FreeTypeVariable01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/FreeTypeVariable01.fs index def4c0351cc..8dc48e62b33 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/FreeTypeVariable01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/FreeTypeVariable01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:1708 // internal compiler error for free type variable in attribute //internal error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Function01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Function01.fs index 0b26df65e0c..1e488135f51 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Function01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Function01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:2087 // Function parameter attributes are ignored and do not appear in the resulting assembly // Attribute is placed on a let-binding function definition @@ -14,7 +14,7 @@ type A2() = class inherit System.Attribute() end -[] +[] let foo ([]x) = x // The rest of the code is a mere verification that the compiler thru reflection diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/FunctionArg01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/FunctionArg01.fs index c07d2774234..077f07460fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/FunctionArg01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/FunctionArg01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:2087 // Function parameter attributes are ignored and do not appear in the resulting assembly // Attribute is placed on the argument of a let-binding function definition @@ -14,7 +14,7 @@ type A2() = class inherit System.Attribute() end -[] +[] let foo ([]x) = x // The rest of the code is a mere verification that the compiler thru reflection diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/InExternDecl.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/InExternDecl.fs index 10bc1a73ad1..9c2661002bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/InExternDecl.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/InExternDecl.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:4192 // We should not give any warning when attribute is used on extern declaration diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ParamArrayAttrUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ParamArrayAttrUsage.fs index 38cf0492b83..5c988f82d3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ParamArrayAttrUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ParamArrayAttrUsage.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Attributes +// #Conformance #DeclarationElements #Attributes //Regression test for FSHARP bug 102 Import uses of ParamArray attribute diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType01.fs index 922492d9366..c0abbdeddc1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:1165 // F# supports custom attributes on return type // Note: the syntax is kind of awkward... diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType02.fs index 04c78ba4490..fba7e79d624 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:1165 // F# supports custom attributes on return type. // Multiple attributes on the same return value (two different attributes) @@ -7,19 +7,19 @@ -type CA1 = +type CA1 = class inherit System.Attribute new (tt:string) = { t = tt } val t : string - end + end -type CA2 = +type CA2 = class inherit System.Attribute new (tt:string) = { t = tt } val t : string - end + end // This is a function that has a custom attribute on the return type. let f(x) : [] [] int = x + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType03.fs index 3e34bdfc926..9c123be08e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/ReturnType03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:1165 // F# supports custom attributes on return type. // Multiple attributes on the same return value (same attribute repeated twice) @@ -8,12 +8,12 @@ [] -type CA1 = +type CA1 = class inherit System.Attribute new (tt:string) = { t = tt } val t : string - end + end // This is a function that has a custom attribute on the return type. let f(x) : [] [] int = x + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/SanityCheck01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/SanityCheck01.fs index c540c6d02e6..4474953de1f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/SanityCheck01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/SanityCheck01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // FSB 1622, Cannot use "null" in Attributes diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayout.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayout.fs index 2af95ff1add..4ebaf338440 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayout.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayout.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression tests for FSHARP1.0:5931 module M @@ -12,7 +12,7 @@ type S = val v1 : int [] val v2 : int - + // Explicit layout - will build [] [] @@ -22,8 +22,8 @@ type SExplicit = val v1 : int [] [] - val v2 : int - + val v2 : int + // Sequential layout - will build [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayoutSequentialPos_Exception.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayoutSequentialPos_Exception.fs index ab882a58561..bbe7431b03c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayoutSequentialPos_Exception.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayoutSequentialPos_Exception.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 // Need to tighten up our implementation of StructLayout.Sequential. -module PositiveTests = +module PositiveTests = [] - type P4 = + type P4 = member this.M = 1 new() = {} diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypeofTypedefofInAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypeofTypedefofInAttribute.fs index 3325b361a80..cf403b44509 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypeofTypedefofInAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypeofTypedefofInAttribute.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // FSB 3565, verify typeof<_> and typedefof<_> can be used in @@ -7,18 +7,18 @@ open System - + type CustomAttribute(typeofResult : Type, typedefofResult : Type) = inherit System.Attribute() member this.TypeofResult = typeofResult member this.TypedefofResult = typedefofResult - + [>, typedefof>)>] -type SomeClass() = +type SomeClass() = class end -let runTest() = +let runTest() = let testObj = new SomeClass() let itsAttributes = testObj.GetType().GetCustomAttributes(false) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypesAsAttrArgs01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypesAsAttrArgs01.fs index e16f3821cb1..01647921e66 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypesAsAttrArgs01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypesAsAttrArgs01.fs @@ -1,11 +1,11 @@ -// #Conformance #DeclarationElements #Attributes +// #Conformance #DeclarationElements #Attributes // Verify the ability to specify types as parameters into Attributes type CustomAttribute(x : System.Type) = inherit System.Attribute() - + [)>] type Foo() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_ReturnType03b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_ReturnType03b.fs index b6de23eaa7c..b2d27cb0fb2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_ReturnType03b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_ReturnType03b.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:1165 // F# supports custom attributes on return type. // Multiple attributes on the same return value (same attribute repeated twice) not allowed by default (AllowMultiple is false) // Note: the syntax is kind of awkward... -type CA1 = +type CA1 = class inherit System.Attribute new (tt:string) = { t = tt } val t : string - end + end // This is a function that has a custom attribute on the return type. let f(x) : [] [] int = x + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutExplicit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutExplicit01.fs index c113f274609..7b08e8b415d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutExplicit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutExplicit01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Attributes +// #Regression #Conformance #DeclarationElements #Attributes // FSB 3573: Add unverifiability warning for StructLayout: ICE when you set Explicit struct layout but don't provide offsets for each field @@ -7,10 +7,10 @@ open System.Collections.Generic open System.Diagnostics open System.Runtime.InteropServices; - + [] type A = - new() = A() + new() = A() [] [] static val mutable private x : int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ImportedAttributes/FieldOffset01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ImportedAttributes/FieldOffset01.fs index b6058d24633..cf198bcaf6f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ImportedAttributes/FieldOffset01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/ImportedAttributes/FieldOffset01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Attributes #Import +// #Conformance #DeclarationElements #Attributes #Import // Ignore "Uses of this construct may result in the generation of unverifiable .NET IL code..." #nowarn "9" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs index 2da1dbe9b20..4b8d6ec775a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs @@ -20,7 +20,7 @@ namespace FSharpTest |> withDiagnostics [ (Error 552, Line 3, Col 11, Line 3, Col 19, "Only class types may take value arguments") ] - + [] let ``Delegate definition with primary constructor no argument.`` () = FSharp @@ -57,7 +57,7 @@ a.Invoke()""" |> compileExeAndRun |> shouldSucceed |> verifyOutput "line: 5" - + [] let ``Delegate with struct optional parameter`` () = FSharp """type A = delegate of [] ?a: int -> unit @@ -82,7 +82,7 @@ d.Invoke()""" |> compileExeAndRun |> shouldSucceed |> verifyOutput "line: 9" - + [] let ``Delegate with OptionalArgument and CallerFilePath`` () = FSharp """open System.Runtime.CompilerServices @@ -127,4 +127,4 @@ d.Invoke(Some None) d.Invoke(None)""" |> compileExeAndRun |> shouldSucceed - |> verifyOutputContains [| "value: 42"; "inner none"; "outer none" |] + |> verifyOutputContains [| "value: 42"; "inner none"; "outer none" |] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/CompilingToALibrary01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/CompilingToALibrary01.fs index b05a60bf60c..a38a2dc2262 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/CompilingToALibrary01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/CompilingToALibrary01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:4277 // Compile with -a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/CompilingToAModule01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/CompilingToAModule01.fs index 111d54ca51d..a512b00ee59 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/CompilingToAModule01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/CompilingToAModule01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:4277 // Compile with --target:module diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_InvalidSignature02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_InvalidSignature02.fs index 2c272945e4b..f17284f241c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_InvalidSignature02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_InvalidSignature02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Verify error when signature for the [] doesn't diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_invalidsignature001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_invalidsignature001.fs index bda3e297737..f076c37a475 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_invalidsignature001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_invalidsignature001.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1793 // Explicit program entry point: [] // Function does not have type string [] -> unit @@ -7,7 +7,7 @@ module M = - let func (args : int list) = + let func (args : int list) = if(args.Length=0) then 0 else 1 [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_oninvalidlanguageelement001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_oninvalidlanguageelement001.fs index 988ca3a9309..a03337943b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_oninvalidlanguageelement001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_oninvalidlanguageelement001.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 - FSHARP1.0:3783 // Explicit program entry point: [] // attribute on invalid language element (error) @@ -8,7 +8,7 @@ [] module M = - let func (args : string[]) = + let func (args : string[]) = if(args.Length=0) then 0 else 1 [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoattributesonsamefunction001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoattributesonsamefunction001.fs index fd41f0135fa..55888576917 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoattributesonsamefunction001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoattributesonsamefunction001.fs @@ -1,11 +1,11 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1793 // Explicit program entry point: [] // Two attributes same function (compile with --all-warnings-as-errors to make sure we are totally silent) module M = - let func (args : string[]) = + let func (args : string[]) = if(args.Length=0) then 0 else 1 [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoentrypoints001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoentrypoints001.fs index 3f218a6ee00..f93df1f7d80 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoentrypoints001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoentrypoints001.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // attribute on multiple functions @@ -7,7 +7,7 @@ module M = - let func (args : string[]) = + let func (args : string[]) = if(args.Length=1 && args.[0]="Hello") then 0 else 1 [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002a.fs index fa9d09fac4a..df3f161411a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002a.fs @@ -1,10 +1,10 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // Attribute is last declaration on first file module M -let func (args : string[]) = +let func (args : string[]) = if(args.Length=1 && args.[0]="Hello") then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002b.fs index 3e0a986f4f4..d2517346b0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002b.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // Attribute is last declaration on first file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPointAndAssemblyCulture.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPointAndAssemblyCulture.fs index ca32d37aa5b..abb415a5190 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPointAndAssemblyCulture.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPointAndAssemblyCulture.fs @@ -1,45 +1,45 @@ // #NoMT #EntryPoint #Regression // Regression for 6333 - we used to not allow AssemblyCultureAttribute on anything other than a library and not with an empty value, unlike C# module AssemblyInfo - - open System.Reflection; - open System.Runtime.CompilerServices; - open System.Runtime.InteropServices; - - // General Information about an assembly is controlled through the following - // set of attributes. Change these attribute values to modify the information - // associated with an assembly. - [] - [] - [] - [] - [] - [] - [] - [] - - // Setting ComVisible to false makes the types in this assembly not visible - // to COM components. If you need to access a type in this assembly from - // COM, set the ComVisible attribute to true on that type. - [] - - // The following GUID is for the ID of the typelib if this project is exposed to COM + + open System.Reflection; + open System.Runtime.CompilerServices; + open System.Runtime.InteropServices; + + // General Information about an assembly is controlled through the following + // set of attributes. Change these attribute values to modify the information + // associated with an assembly. + [] + [] + [] + [] + [] + [] + [] + [] + + // Setting ComVisible to false makes the types in this assembly not visible + // to COM components. If you need to access a type in this assembly from + // COM, set the ComVisible attribute to true on that type. + [] + + // The following GUID is for the ID of the typelib if this project is exposed to COM [] - - // Version information for an assembly consists of the following four values: - // - // Major Version - // Minor Version - // Build Number - // Revision - // - // You can specify all the values or you can default the Build and Revision Numbers - // by using the '*' as shown below: - // [assembly: AssemblyVersion("1.0.*")] - [] - [] + + // Version information for an assembly consists of the following four values: + // + // Major Version + // Minor Version + // Build Number + // Revision + // + // You can specify all the values or you can default the Build and Revision Numbers + // by using the '*' as shown below: + // [assembly: AssemblyVersion("1.0.*")] + [] + [] do () - + [] let _main(args : string[]) = exit 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs index aac262b5f23..9dfd59b3685 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs @@ -1,7 +1,7 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe -// when multiple namespaces with multiple modules declared in source file +// when multiple namespaces with multiple modules declared in source file @@ -9,14 +9,14 @@ namespace MyNamespace1 module MyModule1 = let irrelevant = 10 - + module MyModule2 = let irrelevant = 10 - + namespace MyNamespace2 module MyModule3 = let irrelevant = 10 - + module MyModule4 = let irrelevant = 10 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointModuleInNamespace.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointModuleInNamespace.fs index 1cb8e4ca24b..e31e2d269e0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointModuleInNamespace.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointModuleInNamespace.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when single module declared inside namespace diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointMultipleModules.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointMultipleModules.fs index 6a03510419c..bc18cb80255 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointMultipleModules.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointMultipleModules.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when multiple modules declared without declaring namespace diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointTypeInNamespace.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointTypeInNamespace.fs index 279cc740a37..672ec076809 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointTypeInNamespace.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointTypeInNamespace.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when source file declares type inside namespace diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/behavior001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/behavior001.fs index e7debb09f4d..dafcd446d48 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/behavior001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/behavior001.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // Verify that static initializers are invoked before entering the 'main' function @@ -7,8 +7,8 @@ let static_initializer = 10 - + [] -let main (argsz:string []) = +let main (argsz:string []) = exit(if(static_initializer=10) then 0 else 1) - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI.fs index bfb85b9cfdb..8a545aa25b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:2209 - existence of this attribute should not confuse FSI // Explicit program entry point: [] // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointfunctionnotmain001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointfunctionnotmain001.fs index 2cb1d6942e2..7d853c4825e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointfunctionnotmain001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointfunctionnotmain001.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1793 // Explicit program entry point: [] // Entry point function does not have to be called 'main' @@ -7,7 +7,7 @@ module M = - let func (a : string []) = + let func (a : string []) = if(a.Length=0) then 0 else 1 [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/inamodule001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/inamodule001.fs index 418579a9b69..1c3506865ec 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/inamodule001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/inamodule001.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // 'main' function is in a module @@ -7,7 +7,7 @@ module M = - let func (args : string[]) = + let func (args : string[]) = if(args.Length=1 && args.[0]="Hello") then 0 else 1 [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/noarguments001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/noarguments001.fs index 427aa330bf6..423de2b2670 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/noarguments001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/noarguments001.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // 'main' function invoked with no arguments @@ -9,4 +9,4 @@ [] let main args = exit(if(args.Length=0) then 0 else 1) - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/oneargument001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/oneargument001.fs index 4c06e7e9df3..9d83886b942 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/oneargument001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/oneargument001.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // 'main' function invoked with 1 argument diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001a.fs index 9d4226980b4..451547a91a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001a.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // 'main' function invoked with no arguments @@ -7,6 +7,6 @@ module M -let func (args : string[]) = +let func (args : string[]) = if(args.Length=1 && args.[0]="Hello") then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001b.fs index 2b5beb7c616..eaa2870265f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001b.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #EntryPoint +// #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 // Explicit program entry point: [] // 'main' function invoked with no arguments diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/CLIEvent01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/CLIEvent01.fs index 5ae959a6a61..67f9e13d8b8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/CLIEvent01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/CLIEvent01.fs @@ -1,22 +1,22 @@ -// #Regression #Conformance #DeclarationElements #Events +// #Regression #Conformance #DeclarationElements #Events // Regression for 5180, this used to not compile in VS2008 type 'a Wrapper() = let event = Event<_,_>() [] member x.SomethingHappened : IEvent = event.Publish - member x.Packed = + member x.Packed = { new IExistsWrapper with member i.Apply u = u.Use () x } - + and IExistsWrapper = abstract Apply<'t> : IWrapperUser<'t> -> 't and IWrapperUser<'t> = abstract Use<'b> : unit -> ('b Wrapper -> 't) - + and Registry() = static member Register (wrap:IExistsWrapper) = - wrap.Apply - { new IWrapperUser<_> with - member x.Use() = - fun w -> + wrap.Apply + { new IWrapperUser<_> with + member x.Use() = + fun w -> w.SomethingHappened.Add(fun _ -> ()) } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/EventWithGenericTypeAsUnit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/EventWithGenericTypeAsUnit01.fs index c0990ab1dba..232fe8831fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/EventWithGenericTypeAsUnit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/EventWithGenericTypeAsUnit01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Events +// #Regression #Conformance #DeclarationElements #Events // Regression for 5917 // Used to throw an internal compiler error on the type declarations @@ -7,8 +7,8 @@ module M type IParam<'a> = [] abstract ValueChanged : IEvent - -type Param<'a>() = + +type Param<'a>() = interface IParam<'a> with [] member x.ValueChanged = Unchecked.defaultof> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/EventsOnInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/EventsOnInterface01.fs index df3a6373082..cac4e83861b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/EventsOnInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/EventsOnInterface01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Events +// #Conformance #DeclarationElements #Events // Verify ability to implement events on an interface @@ -9,10 +9,10 @@ type IHaveMagicalProperties = abstract member Rub : unit -> unit abstract member DropCoinIn : unit -> unit - + [] abstract member GoodThingHappened : IEvent - + [] abstract member BadThingHappened : IEvent @@ -20,17 +20,17 @@ type MagicLamp = val m_goodResult : Event - new() = { + new() = { m_goodResult = new Event<_,_>() } interface IHaveMagicalProperties with member this.Rub() = this.m_goodResult.Trigger(this, ("A genie appears!", 3)) member this.DropCoinIn() = () - + [] member this.GoodThingHappened = this.m_goodResult.Publish - + // Make the event accessible, but will throw when you try to add or remove a handler [] member this.BadThingHappened = Unchecked.defaultof< IEvent > @@ -38,13 +38,13 @@ type MagicLamp = // Verify it works let mutable setArgs = "", 0 - + let lamp = new MagicLamp() let magicalLamp = lamp :> IHaveMagicalProperties - + let eventHandler = MagicalResult(fun sender msg res -> setArgs <- (msg, res)) magicalLamp.GoodThingHappened.AddHandler eventHandler magicalLamp.Rub() - + if setArgs <> ("A genie appears!", 3) then failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression01.fs index 7aeba46cac0..2f8aca1a93e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Events +// #Conformance #DeclarationElements #Events // FSB 942, mutable variable escapes its scope when used with an event handler @@ -14,11 +14,11 @@ type Action = type SqueakyToy() = let squeakEvent = new Event<_>() let triggerSqueakEvent = squeakEvent.Trigger - + // This event fire whenever the squeaky toy squeaks member this.Squeak with get () = squeakEvent - - member this.ApplyAction act = + + member this.ApplyAction act = match act with | Squeeze -> triggerSqueakEvent(act) | Poke -> triggerSqueakEvent(act) @@ -54,7 +54,7 @@ let test() = pinkSqueakyToy.ApplyAction(Squeeze) if m_eventFlag1 <> Some(Squeeze) then failwith "Failed: 2" if m_eventFlag2 <> Some(Squeeze) then failwith "Failed: 3" - + // Remove one of the event handlers pinkSqueakyToy.Squeak.Publish.RemoveHandler(eventHandler1) m_eventFlag1 <- None diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression02.fs index 1bff0c4bca4..1ca4ea2ec17 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression02.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #DeclarationElements #Events +// #Regression #Conformance #DeclarationElements #Events // Regression test for FSHARP1.0:5192 // The following code should not ICE! -let postEventInContext,sendEventInContext = +let postEventInContext,sendEventInContext = let post (event:Event<'a>) = () let send (event:Event<'a>) = () post,send diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression02b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression02b.fs index 80daf85000e..3a134303f69 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression02b.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #Events +// #Regression #Conformance #DeclarationElements #Events // Regression test for FSHARP1.0:5192 // The following code should not ICE! open System.Threading - -let postEventInContext,sendEventInContext = + +let postEventInContext,sendEventInContext = let callBack (event:Event<'a>) arg = let f _ = event.Trigger(arg) new SendOrPostCallback(f) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck.fs index 354bcd50dd2..54d42e85aa0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Events +// #Conformance #DeclarationElements #Events // Sanity check events. type Action = | Squeeze @@ -9,11 +9,11 @@ type Action = type SqueakyToy() = let squeakEvent = new Event<_>() let triggerSqueakEvent = squeakEvent.Trigger - + // This event fire whenever the squeaky toy squeaks member this.Squeak with get () = squeakEvent - - member this.ApplyAction act = + + member this.ApplyAction act = match act with | Squeeze -> triggerSqueakEvent(act) | Poke -> triggerSqueakEvent(act) @@ -50,7 +50,7 @@ m_eventFlag2 <- None pinkSqueakyToy.ApplyAction(Squeeze) if m_eventFlag1 <> Some(Squeeze) then failwith "Failed: 2" if m_eventFlag2 <> Some(Squeeze) then failwith "Failed: 3" - + // Remove one of the event handlers pinkSqueakyToy.Squeak.Publish.RemoveHandler(eventHandler1) m_eventFlag1 <- None diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck02.fs index 4d20ba981bb..011ad3c402e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck02.fs @@ -1,10 +1,10 @@ -// #Conformance #DeclarationElements #Events #ReqNOMT +// #Conformance #DeclarationElements #Events #ReqNOMT // Sanity check events based on the new library changes type Fruit (shelfLife : int) = - + let mutable m_age = 0 let expireEvent = new Event() @@ -13,7 +13,7 @@ type Fruit (shelfLife : int) = m_age <- m_age + x if m_age > shelfLife then expireEvent.Trigger((m_age, shelfLife)) - + member this.OnExpire = expireEvent.Publish @@ -40,7 +40,7 @@ pear.OnExpire.Add(fun (age, shelfLife) -> x <- age; y <- shelfLife) let mutable a = 0 let mutable b = 0 -pear.OnExpire +pear.OnExpire |> Event.map (fun (age, shelfLife) -> (-age, -shelfLife)) // Invert values |> Event.filter (fun (age, shelfLife) -> age < -80) // Ignore all apples > 100 old |> Event.add (fun (age, shelfLife) -> a <- age; b <- shelfLife) // When triggered set a and bs values. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/AddMessageProperty.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/AddMessageProperty.fs index 37c80e67893..b8eb213a46f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/AddMessageProperty.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/AddMessageProperty.fs @@ -4,7 +4,7 @@ let f() = raise (MyCustomExc(42)) with | MyCustomExc _ as e -> e.Message - + let result = f() printfn "%s" result diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/AddMethsProps01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/AddMethsProps01.fs index dfa51d17c44..4825874c42e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/AddMethsProps01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/AddMethsProps01.fs @@ -1,18 +1,18 @@ -// #Regression #Conformance #TypesAndModules #Exceptions +// #Regression #Conformance #TypesAndModules #Exceptions // FSB 1384, Suggestion: allow explicit exception type definitions to override members - specifically the Message property -type Language = +type Language = | ``MC++`` = 0 | ``C#`` = 1 | ``VB.Net`` = 2 exception NonFSLangException of Language - with + with override this.Message = "Who would want to program in anything other than F#?" end - + let testFunc() = try raise (NonFSLangException(Language.``C#``)) @@ -21,7 +21,7 @@ let testFunc() = | NonFSLangException (langUsed) as ex -> sprintf "Language [%s]. Exception text [%s]" (langUsed.ToString()) (ex.Message) | _ -> "Expected exception not caught." - + let result = testFunc() printfn "%s" result diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/CatchWOTypecheck01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/CatchWOTypecheck01.fs index 76011397c3d..e0d7f44846e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/CatchWOTypecheck01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/CatchWOTypecheck01.fs @@ -1,11 +1,11 @@ -// #Conformance #TypesAndModules #Exceptions +// #Conformance #TypesAndModules #Exceptions // Verify you can catch an F# exceptions can be caught via pattern matching (and not a dynamic type check). exception NumIsOddException of int * string -let half x = +let half x = if x % 2 = 0 then x / 2 else diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_AssertionFailureExn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_AssertionFailureExn.fs index de4c8c08253..31df1de4c4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_AssertionFailureExn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_AssertionFailureExn.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Exceptions +// #Regression #Conformance #TypesAndModules #Exceptions // Regression test for FSharp1.0:3583 - Remove AssertionFailureException diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnConstructorBadFieldName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnConstructorBadFieldName.fs index fc6d75ea9c0..ee6d7049d81 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnConstructorBadFieldName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnConstructorBadFieldName.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Exceptions +// #Conformance #TypesAndModules #Exceptions // Make sure we properly detect bogus named field in constructors diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldNameUsedMulti.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldNameUsedMulti.fs index dff3b979fdf..d3b39d9d1d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldNameUsedMulti.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldNameUsedMulti.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Exceptions +// #Conformance #TypesAndModules #Exceptions // Make sure we properly detect field names specified multiple times diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_InheritException.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_InheritException.fs index 02b9d43e703..927801925b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_InheritException.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_InheritException.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Exceptions +// #Regression #Conformance #TypesAndModules #Exceptions // Verify error when trying to inherit from F# exception types diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_MustStartWithCap01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_MustStartWithCap01.fs index 366f7c83511..a071762d728 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_MustStartWithCap01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_MustStartWithCap01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Exceptions +// #Regression #Conformance #TypesAndModules #Exceptions // Verify error if you try to start an exception definition with a lower case letter // Regression test for FSHARP1.0:2817 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/EqualAndBoxing01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/EqualAndBoxing01.fs index a7d00c093c0..221c670fba5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/EqualAndBoxing01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/EqualAndBoxing01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Exceptions +// #Regression #Conformance #TypesAndModules #Exceptions // Regression test for FSHARP1.0:5535 // Exception type exception E of int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ManualMessagePropertyWinsOverAutomaticOne.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ManualMessagePropertyWinsOverAutomaticOne.fs index 8067c494d78..34ad0d0e6c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ManualMessagePropertyWinsOverAutomaticOne.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ManualMessagePropertyWinsOverAutomaticOne.fs @@ -4,7 +4,7 @@ let f() = raise (MyCustomExc("This should be the message!")) with | MyCustomExc m as e -> e.Message - + let result = f() printfn "%s" result diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/PrivateMessagePropertyIsNotReplacingBuiltinMessage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/PrivateMessagePropertyIsNotReplacingBuiltinMessage.fs index 73c8b01c3ff..7a352941410 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/PrivateMessagePropertyIsNotReplacingBuiltinMessage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/PrivateMessagePropertyIsNotReplacingBuiltinMessage.fs @@ -1,5 +1,5 @@ exception MyCustomExc of int - with + with member private this.Message = "This must remain secret!" end @@ -8,7 +8,7 @@ let f() = raise (MyCustomExc(42)) with | e -> e.Message - + let result = f() printfn "%s" result diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/ExplicitObjectConstructors.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/ExplicitObjectConstructors.fs index e61dacdbc26..1976ee682bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/ExplicitObjectConstructors.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/ExplicitObjectConstructors.fs @@ -18,7 +18,7 @@ module ExplicitObjectConstructors = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/ClassTypes/ExplicitObjectConstructors) - + [] let ``WithAttribute01_fs`` compilation = compilation @@ -31,7 +31,7 @@ module ExplicitObjectConstructors = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/ClassTypes/ExplicitObjectConstructors) - + [] let ``WithAttribute02_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute01.fs index 63f76a63d48..87503da1597 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors +// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors // Regression test for FSHARP1.0:4212 // Attribute is placed on both the explicit and the implicit constructors diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute02.fs index 74542e14b75..51b41048f7b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors +// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors // Regression test for FSHARP1.0:4212 // Attribute is placed on the explicit constructor only diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/new_while_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/new_while_01.fs index c8a601f0124..6cd09c355ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/new_while_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/new_while_01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors +// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors // Regression test for FSHARP1.0:3217 // Use misc constructs in explicit object constructor // construct: while ... do ... done type T = - new () = + new () = while true do () done diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/DefaultValue01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/DefaultValue01.fs index 4fbb7125f5a..7341d14b54a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/DefaultValue01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/DefaultValue01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Fields #MemberDefinitions +// #Conformance #DeclarationElements #Fields #MemberDefinitions // Declare a mutable class field via default value // You can't set the field in an explicit ctor using the record initialization // syntax, so you have to resort to using a 'then' expression afterwards. :( @@ -7,7 +7,7 @@ module DefaultValue01 type Point = [] val mutable public m_x : float - + val mutable public m_y : float new(x, y) as this = { m_y = y } then this.m_x <- x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField01.fs index 67af4cd259a..dd7b9ded0c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Fields #MemberDefinitions +// #Regression #Conformance #DeclarationElements #Fields #MemberDefinitions // Verify that static fields must be marked mutable. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField02a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField02a.fs index 7a2672ae070..298ff61ae29 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField02a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField02a.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Fields #MemberDefinitions +// #Regression #Conformance #DeclarationElements #Fields #MemberDefinitions // Verify we disallow the creation of public, static fields //Static 'val' fields in types must be mutable, private and marked with the '\[\]' attribute\. They are initialized to the 'null' or 'zero' value for their type\. Consider also using a 'static let mutable' binding in a class type\.$ //Static 'val' fields in types must be mutable, private and marked with the '\[\]' attribute\. They are initialized to the 'null' or 'zero' value for their type\. Consider also using a 'static let mutable' binding in a class type\.$ @@ -13,11 +13,11 @@ type ClassType = [] type StructType = [] - static val mutable public FieldPub : string + static val mutable public FieldPub : string [] - static val mutable private FieldPri : string + static val mutable private FieldPri : string - override this.ToString() = "StructType" + override this.ToString() = "StructType" ClassType.FieldPub <- "a class" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/StaticField01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/StaticField01.fs index a24290f7362..fcab55e1420 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/StaticField01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/StaticField01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Fields #MemberDefinitions +// #Conformance #DeclarationElements #Fields #MemberDefinitions // Sanity check static mutable fields on classes. (Should have default value / null) type Foo() = @@ -9,7 +9,7 @@ type Foo() = static member Check1() = Foo.defaultInt <> 0 static member Check2() = Foo.defaultStr <> null - + if Foo.Check1() then failwith "Failed: 1" if Foo.Check2() then failwith "Failed: 2" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/StaticField02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/StaticField02.fs index 7c7b37f6418..78c1f50217d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/StaticField02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/StaticField02.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Fields #MemberDefinitions +// #Conformance #DeclarationElements #Fields #MemberDefinitions // Verify the ability to create public, static fields @@ -13,9 +13,9 @@ type ClassType = [] type StructType = // [] -// static val mutable public FieldPub : string +// static val mutable public FieldPub : string [] - static val mutable private FieldPri : string + static val mutable private FieldPri : string - override this.ToString() = "StructType" + override this.ToString() = "StructType" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/Staticfield03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/Staticfield03.fs index 5f76c01aa77..dd1e204c0c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/Staticfield03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/Staticfield03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Fields #MemberDefinitions +// #Regression #Conformance #DeclarationElements #Fields #MemberDefinitions // Regression for Dev10:840199 // More extensive tests in fsharp\devdiv\src\tests\fsharp\core\members\basics\test-hw.ml @@ -11,7 +11,7 @@ type Bar<'a,'b>() = static member Instance = theInstance // Equi-recursive type defs -type Rec1<'a>() = +type Rec1<'a>() = static let rec2Instance = new Rec2<'a>() static let rec1Instance = new Rec1<'a>() static member Rec2Instance = rec2Instance @@ -24,7 +24,7 @@ and Rec2<'a>() = static member Rec2Instance = rec2Instance // recursive type defs - multi tyargs -type Rec1AB<'a,'b>() = +type Rec1AB<'a,'b>() = static let rec2Instance = new Rec2B<'a>() static let rec1Instance = new Rec1AB<'a,'b>() static member Rec2Instance = rec2Instance @@ -32,4 +32,4 @@ type Rec1AB<'a,'b>() = and Rec2B<'a>() = static let rec2Instance = new Rec2B<'a>() - static member Rec2Instance = rec2Instance + static member Rec2Instance = rec2Instance diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/ImplicitObjectConstructors.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/ImplicitObjectConstructors.fs index 3e4eebe7de1..c52601a6bfa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/ImplicitObjectConstructors.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/ImplicitObjectConstructors.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module ImplicitObjectConstructors = // This test was automatically generated (moved from FSharpQA suite - Conformance/ClassTypes/ImplicitObjectConstructors) - + [] let ``WithAttribute_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/WithAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/WithAttribute.fs index 6cf6470bc46..beb4c598bc9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/WithAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/WithAttribute.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors +// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors // Regression test for FSHARP1.0:4212 module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenTwice.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenTwice.fs index 40db7e3d6b2..baaacae9a32 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenTwice.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenTwice.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Import +// #Regression #Conformance #DeclarationElements #Import // Verify you can open a module or namespace twice and not get a warning/error //This declaration opens the module 'Microsoft\.FSharp\.Collections\.List', which is marked as 'RequireQualifiedAccess'\. Adjust your code to use qualified references to the elements of the module instead, e\.g\. 'List\.map' instead of 'map'\. This change will ensure that your code is robust as new constructs are added to libraries\.$ //This declaration opens the module 'Microsoft\.FSharp\.Collections\.List', which is marked as 'RequireQualifiedAccess'\. Adjust your code to use qualified references to the elements of the module instead, e\.g\. 'List\.map' instead of 'map'\. This change will ensure that your code is robust as new constructs are added to libraries\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenUnknownNS.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenUnknownNS.fs index f57ee9be828..2a54550961b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenUnknownNS.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenUnknownNS.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Import +// #Regression #Conformance #DeclarationElements #Import // Verify error when opening an unknown module or namespace diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openEnum.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openEnum.fs index 82523b63acd..02503c7da8e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openEnum.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openEnum.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Import +// #Regression #Conformance #DeclarationElements #Import //The value or constructor 'A' is not defined //The value or constructor 'B' is not defined @@ -6,7 +6,7 @@ module TestModule1 = - + type Enum = | A = 0 | B = 1 @@ -18,16 +18,16 @@ open TestModule1 let mutable successes = 0 let a = A -(*let _ = - match a with +(*let _ = + match a with | A _ -> successes <- successes + 1 () | _ -> failwith "error"*) let b = B -(*let _ = +(*let _ = match b with - | B -> successes <- successes + 1 + | B -> successes <- successes + 1 () | _ -> failwith "error"*) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openInTypeDecl.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openInTypeDecl.fs index 85a71f628f5..78fbaa4e678 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openInTypeDecl.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openInTypeDecl.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #DeclarationElements #Import +// #Regression #Conformance #DeclarationElements #Import //Unexpected keyword 'open' in member definition$ type Foo() = let x = 42 - + open System let timeConstructed = DateTime.Now.Ticks diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openModInFun.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openModInFun.fs index bf3f835744a..e11d47704e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openModInFun.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_openModInFun.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Import +// #Regression #Conformance #DeclarationElements #Import //Unexpected keyword 'open' in binding\. Expected incomplete structured construct at or before this point or other token\.$ //Unexpected keyword 'open' in binding$ //Unexpected keyword 'open' in expression$ @@ -8,7 +8,7 @@ let f x y = Console.WriteLine(result.ToString()) open System Console.WriteLine(result.ToString()) - + let top x y = let r1 = x + y @@ -17,7 +17,7 @@ let top x y = open System Console.WriteLine(result.ToString()) nested r1 r2 - + type Foo() = member public this.PrintHello() = open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/OpenNestedModule01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/OpenNestedModule01.fs index c6ade788d6b..f32139e0bf6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/OpenNestedModule01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/OpenNestedModule01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Import +// #Conformance #DeclarationElements #Import module ABC = @@ -6,13 +6,13 @@ module ABC = type Foo1 = | A | B - + module ABC = - + type Foo2 = | A | B - + open ABC open ABC.ABC diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/W_OpenUnqualifiedNamespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/W_OpenUnqualifiedNamespace01.fs index af215b3d668..5250c9b0454 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/W_OpenUnqualifiedNamespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/W_OpenUnqualifiedNamespace01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Import +// #Regression #Conformance #DeclarationElements #Import // Verify warning when opening a non-fully qualified namespace diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/openDU.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/openDU.fs index ff64de18934..14b4aabe82b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/openDU.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/openDU.fs @@ -1,8 +1,8 @@ -// #Conformance #DeclarationElements #Import +// #Conformance #DeclarationElements #Import module TestModule1 = - + type DiscUnion = | A of int | B of string @@ -14,16 +14,16 @@ open TestModule1 let mutable successes = 0 let a = A 1 -let _ = - match a with +let _ = + match a with | A _ -> successes <- successes + 1 () | _ -> failwith "error" let b = B "foo" -let _ = +let _ = match b with - | B _ -> successes <- successes + 1 + | B _ -> successes <- successes + 1 () | _ -> failwith "error" @@ -37,5 +37,5 @@ let _ = // Everything worked out ok if successes = 3 then () -else +else failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/openSystem01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/openSystem01.fs index c7ffa8bc857..63e2de28aa2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/openSystem01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/openSystem01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Import +// #Conformance #DeclarationElements #Import // Open a namespace in System.dll diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/ConcreteUnitOnInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/ConcreteUnitOnInterface01.fs index c00fc552beb..da815ffbaef 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/ConcreteUnitOnInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/ConcreteUnitOnInterface01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #InterfacesAndImplementations +// #Regression #Conformance #DeclarationElements #InterfacesAndImplementations // FS1 2504, Generic interface instantiated with unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/GenericMethodsOnInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/GenericMethodsOnInterface01.fs index 2f086e7ede5..00a6079eea8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/GenericMethodsOnInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/GenericMethodsOnInterface01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #InterfacesAndImplementations +// #Conformance #DeclarationElements #InterfacesAndImplementations // FS1 997, Unable to implement interfaces with generic methods diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/GenericMethodsOnInterface02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/GenericMethodsOnInterface02.fs index 458595fcad7..520d827f363 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/GenericMethodsOnInterface02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/GenericMethodsOnInterface02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #InterfacesAndImplementations +// #Regression #Conformance #DeclarationElements #InterfacesAndImplementations // FSB 1147, implementing interfaces with generic members gives internal error - undefined type variable @@ -8,7 +8,7 @@ type IFoo = interface end type Derived() = class - interface IFoo with + interface IFoo with member x.Ignore<'b> (y:'b) = () end end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/SanityCheck.fs index dd5856fcf8e..c6b34d7c05f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/SanityCheck.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings #ActivePatterns +// #Conformance #DeclarationElements #LetBindings #ActivePatterns let (|A|B|) x = if x < 0 then A else B @@ -12,7 +12,7 @@ let _ = match 10 with | A -> failwith "Failed: 2" | B -> printfn "Great!" - + let (|DT|) (x:System.DateTime) = (x.Date, x.TimeOfDay) @@ -20,6 +20,6 @@ let (|DT|) (x:System.DateTime) = (x.Date, x.TimeOfDay) let maxit a b = match a, b with | DT (ar, ai), DT (br, bi) -> max ar br - + let result = maxit System.DateTime.Now System.DateTime.Now if result.Date <> System.DateTime.Now.Date then failwith "Failed: 3" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/parameterizedActivePattern.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/parameterizedActivePattern.fs index ec888a7cf16..0cd5865fca9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/parameterizedActivePattern.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/parameterizedActivePattern.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings #ActivePatterns +// #Conformance #DeclarationElements #LetBindings #ActivePatterns let (|MulN|_|) (n:int) (inp:int) = if inp % 3 = 0 then Some(inp/n) else None diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/partialActivePattern.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/partialActivePattern.fs index 7e2433da6e7..08ee3239878 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/partialActivePattern.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/partialActivePattern.fs @@ -1,9 +1,9 @@ -// #Conformance #DeclarationElements #LetBindings #ActivePatterns +// #Conformance #DeclarationElements #LetBindings #ActivePatterns let (|MulThree|_|) inp = if inp % 3 = 0 then Some (inp / 3) else None in -let result = +let result = match 27 with | MulThree remainder -> remainder | _ -> failwith "Failed: 1" in - + if result <> 9 then failwith "Failed: 2" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/AsPat01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/AsPat01.fs index 60f277f4deb..af6d050e181 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/AsPat01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/AsPat01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings +// #Conformance #DeclarationElements #LetBindings // Verify let bindings can function as patterns diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/AsPat02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/AsPat02.fs index 152fe29b1ee..3fabe220fb4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/AsPat02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/AsPat02.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings +// #Conformance #DeclarationElements #LetBindings // Verify using patter matching inside let bindings diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AsPat01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AsPat01.fs index 79385956e60..438dc06b162 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AsPat01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AsPat01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Verify errors associated with using let bindings + pattern matching //Type mismatch\. Expecting a+ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AttributesOnLet01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AttributesOnLet01.fs index eb84823f489..5599a3839a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AttributesOnLet01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AttributesOnLet01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Regression test for FSharp1.0:3744 - Unable to apply attributes on individual patterns in a tupled pattern match let binding - Implementation doesn't match spec @@ -11,5 +11,5 @@ open System -let ([] venus, earth, [] mars) = +let ([] venus, earth, [] mars) = ("too hot","just right", "too cold") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsForInlineValue.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsForInlineValue.fs index 40274d71ab5..b3a6a237320 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsForInlineValue.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsForInlineValue.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Regression test for FSharp1.0:4165 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsforIncompleteTryWith.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsforIncompleteTryWith.fs index 4fb4adfa311..6a009d99d30 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsforIncompleteTryWith.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsforIncompleteTryWith.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Regression test for FSharp1.0:4488 // fsc throws ICE on source code error [was TABs caused ICE] //Possible incorrect indentation: this token is offside of context started at position \(8:1\)\. Try indenting this token further or using standard formatting conventions\.$ //Unexpected start of structured construct in expression$ //Unmatched '\('$ //Unexpected symbol '\)' in implementation file$ -let x = +let x = ( try 123 with e -> 1234 ) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_GenericTypeAnnotations01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_GenericTypeAnnotations01.fs index 941e5e1cbd9..68f31dbed92 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_GenericTypeAnnotations01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_GenericTypeAnnotations01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Regression test for FSharp1.0:1943 - Better error message when unknown unicode characters are used - in particular the � character diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_InvalidInnerRecursiveBinding.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_InvalidInnerRecursiveBinding.fs index 5616a0f37c2..650c31d39cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_InvalidInnerRecursiveBinding.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_InvalidInnerRecursiveBinding.fs @@ -3,9 +3,9 @@ // Regression test for bug 6372 type C () = override self.ToString() = - let rec x y = + let rec x y = foo "hello" y - and foo (x:string) = printfn "string" + and foo (x:string) = printfn "string" and foo (x:obj) = printfn "obj" x "Hi" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_InvalidInnerRecursiveBinding2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_InvalidInnerRecursiveBinding2.fs index 6c2986a1248..d9dcb15874a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_InvalidInnerRecursiveBinding2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_InvalidInnerRecursiveBinding2.fs @@ -1,8 +1,8 @@ // #Conformance #DeclarationElements #LetBindings #Regression //Duplicate definition of value 'foo' // Regression test for bug 6372 -let rec x y = +let rec x y = foo "hello" y -and foo (x:string) = printfn "string" +and foo (x:string) = printfn "string" and foo (x:obj) = printfn "obj" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals02.fs index d5bf760d3ea..7c67a7962b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals02.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // FSB 1981, Signature must contain the literal value -// The literal value must be given in the signature as well: -// we must be able to type check against a signature alone, +// The literal value must be given in the signature as well: +// we must be able to type check against a signature alone, // and literal values are relevant to things like redundant pattern match detection (you can use literals in patterns) module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals02.fsi b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals02.fsi index 7e04ac9de15..95a110f8d0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals02.fsi +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals02.fsi @@ -1,12 +1,12 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings //A declaration may only be the \[\] attribute if a constant value is also given, e\.g\. 'val x: int = 1'$ //A declaration may only be the \[\] attribute if a constant value is also given, e\.g\. 'val x: int = 1'$ // FSB 1981, Signature must contain the literal value -// The literal value must be given in the signature as well: -// we must be able to type check against a signature alone, +// The literal value must be given in the signature as well: +// we must be able to type check against a signature alone, // and literal values are relevant to things like redundant pattern match detection (you can use literals in patterns) module M [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals03.fs index e6e576308d4..07ae49fd841 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // verify error when literal value specified in the signature file does not match actual literal value module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals03.fsi b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals03.fsi index ec193e73949..1e46b0a21a3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals03.fsi +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals03.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals04.fs index c253d840657..6a6b05ca608 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Literals04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings //This is not a valid constant expression or custom attribute value$ //This is not a valid constant expression$ //This is not a valid constant expression or custom attribute value$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological01.fs index d52bad34237..07ac1e8f9f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd. It used to parse, but not it is an error. See FSHARP1.0:4980, test since updated for triple quoted string support diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological03.fs index 42555f70332..6f19d4c033d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd. It used to parse, but not it is an error. See FSHARP1.0:4980, test since updated for triple quoted string support diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological05.fs index 7b796ab9b79..fbc81ef593b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd. It used to parse, but not it is an error. See FSHARP1.0:4980, since updated for triple quoted string support diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological06.fs index 24252b70ba2..f91370d47c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological06.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd. It used to parse, but not it is an error. See FSHARP1.0:4980, since updated for triple quote strings diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Literals01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Literals01.fs index 56b8f4b81ef..6642ae79dbb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Literals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Literals01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // FSB 1124, Implement constant literals -// Test the ability to define literals, which we can validate by using attributes +// Test the ability to define literals, which we can validate by using attributes // since only const literals are allowable on attribute constructors. type EnumType = @@ -12,8 +12,8 @@ type EnumType = type CustomAttrib(a:int, b:string, c:float, d:EnumType) = inherit System.Attribute() - -[] + +[] let lit01 = 42 [] @@ -50,7 +50,7 @@ let lit11 = lit10 [] type SomeClass() = override this.ToString() = "SomeClass" - + [] let foo1 x = () @@ -78,7 +78,7 @@ type EnumInt64 = E = 1L [] let valueOfEnumInt64 : EnumInt64 = LanguagePrimitives.EnumOfValue 1L -(* why doesn't this work? +(* why doesn't this work? match "ab" with | ("a" + "b") -> () | _ -> failwith "Bad pattern match" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Pathological02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Pathological02.fs index 1f3590543dd..1b1c574dc9e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Pathological02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Pathological02.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings +// #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd, but parses and typechecks fine! :) // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Pathological04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Pathological04.fs index 27015737d9a..b462d5fac9a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Pathological04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Pathological04.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings +// #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd, but parses and typechecks fine! :) // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/RecursiveBindingGroup.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/RecursiveBindingGroup.fs index b53c5baca96..21afcbf94dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/RecursiveBindingGroup.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/RecursiveBindingGroup.fs @@ -1,22 +1,22 @@ // #Conformance #DeclarationElements #LetBindings #Regression // Regression test for bug 6372 -let foo() = +let foo() = let rec a() = 1 let b() = 2 let b() = 3 b() -let bar() = +let bar() = let rec a() = 1 let b() = 2 let b() = 3 b() -let rec x y = +let rec x y = baz "hello" y -and baz (x:string) = - let baz(x:obj) = +and baz (x:string) = + let baz(x:obj) = printfn "string" baz("hey") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/SanityCheck.fs index 359183d5ef3..345b9f67f93 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/SanityCheck.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings +// #Conformance #DeclarationElements #LetBindings let f x y = x * y diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs index ed886913440..99dfe1c8ca1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings +// #Regression #Conformance #DeclarationElements #LetBindings // Verify warning when 'do-bindings' do not return unit. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/nestedLetBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/nestedLetBindings.fs index 13d438fd85e..bc1b77c287c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/nestedLetBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/nestedLetBindings.fs @@ -1,24 +1,24 @@ -// #Conformance #DeclarationElements #LetBindings +// #Conformance #DeclarationElements #LetBindings type Foo() = let mutable m_x = 0 member this.DoStuff x = - let nestedDoStuff x = + let nestedDoStuff x = let doubleNestedDoStuff x y = x * y let curriedDoStuff = doubleNestedDoStuff x (curriedDoStuff x) nestedDoStuff x - + let rec recursiveFunctionA x = - if x < 0 then + if x < 0 then 0 - else + else recursiveFunctionB (x - 2) and recursiveFunctionB x = // This doesn't do anything meaningful... let zero = - let someArbitraryFunction (x,y:int) = + let someArbitraryFunction (x,y:int) = let listMaker (x:'t) : 't list = [] (listMaker x) @ (listMaker y) List.length (someArbitraryFunction (1, 2)) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/SanityCheck.fs index 1b204c18a4a..2195e281c16 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/SanityCheck.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings #TypeAnnotations #TypeInference #TypeConstraints +// #Conformance #DeclarationElements #LetBindings #TypeAnnotations #TypeInference #TypeConstraints let f (x:int) (y:string) = System.String.Concat ((x.ToString()), y) @@ -12,7 +12,7 @@ if res2 <> 100 then failwith "Failed: 2" type Foo() = member this.DoStuff ((x : int), (y: string)) = printfn "%A %A" x y member this.DoStuff2 ((x, y) : int * string) = printfn "%A %A" x y - + let x = new Foo() x.DoStuff(42, "something") x.DoStuff2((42, "something")) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/SanityCheck2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/SanityCheck2.fs index 15fef952b41..0eaea7a3eee 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/SanityCheck2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/SanityCheck2.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #LetBindings #TypeAnnotations #TypeInference #TypeConstraints +// #Conformance #DeclarationElements #LetBindings #TypeAnnotations #TypeInference #TypeConstraints let empty<'a when 'a : comparison> : ('a list * 'a Set) = ([], Set.empty) let empties = empty // optional list of lists of lists of optional units printfn "Empties = %A" empties diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/W_TypeParamsWhenNotNeeded.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/W_TypeParamsWhenNotNeeded.fs index 7f5d7476b76..2645b0708d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/W_TypeParamsWhenNotNeeded.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/W_TypeParamsWhenNotNeeded.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeAnnotations #TypeInference #TypeConstraints +// #Regression #Conformance #DeclarationElements #LetBindings #TypeAnnotations #TypeInference #TypeConstraints // Verify warning when providing explicit type parameters when // the function is defined without them. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_NoTypeFuncsInTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_NoTypeFuncsInTypes.fs index 240c0df186d..eb754142d33 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_NoTypeFuncsInTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_NoTypeFuncsInTypes.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Verify error associated with putting type functions inside types diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_measure_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_measure_01.fs index c692c97430b..5928ec1d654 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_measure_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_measure_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:2320 // A is a measure diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_undefined_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_undefined_01.fs index 14b1108a18a..d0127f627f1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_undefined_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_undefined_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:2320 // A is an not defined diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/SizeOf01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/SizeOf01.fs index 6047714c2f2..a9553e8d339 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/SizeOf01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/SizeOf01.fs @@ -1,10 +1,10 @@ -// #Conformance #DeclarationElements #LetBindings #TypeTests +// #Conformance #DeclarationElements #LetBindings #TypeTests // Tests for sizeof<'a> type function // This is a little complicated, but trust me it works out. -type T<'a>() = +type T<'a>() = static member P<'b>() = sizeof<'b> member x.M = T.P<'a>() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/TypeFunctions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/TypeFunctions.fs index 3754e59055c..8f2cdc4d15d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/TypeFunctions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/TypeFunctions.fs @@ -36,7 +36,7 @@ module LetBindings_TypeFunctions = |> verifyCompileAndRun |> shouldSucceed - + [] let ``E_typeof_measure_01_fs`` compilation = compilation @@ -59,7 +59,7 @@ module LetBindings_TypeFunctions = (Error 671, Line 7, Col 27, Line 7, Col 33, "A property cannot have explicit type parameters. Consider using a method instead.") ] - + [] let ``E_typeof_undefined_01_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofAsArgument.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofAsArgument.fs index d9bc5845c05..36dfb51fd57 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofAsArgument.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofAsArgument.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSharp1.0:3654 - design change: allow foo to be used as an argument without parentheses diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofBasic001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofBasic001.fs index 13bfecbf237..a04e757c5ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofBasic001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofBasic001.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:1490 // Basic usage of typeof // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofInCustomAttributes001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofInCustomAttributes001.fs index c315468d874..e411aaf8b9b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofInCustomAttributes001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeofInCustomAttributes001.fs @@ -1,15 +1,15 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:1490 // can't use typeof in attributes // [)>] -type TestTypeOnType() = +type TestTypeOnType() = class member x.P = 1 end - -and TestTypeOnTypeView() = + +and TestTypeOnTypeView() = class member x.P = 1 end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_anonymous_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_anonymous_01.fs index 17a10052463..0e00de5183d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_anonymous_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_anonymous_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:2320 // Type passed to typeof<> is _ // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_class_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_class_01.fs index e4fcd94b0d2..5b948655b0e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_class_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_class_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:2320 // A is a class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_interface_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_interface_01.fs index 53682e5fc04..bd735fadfcc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_interface_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_interface_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:2320 // A is an interface diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_struct_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_struct_01.fs index 24d90993d52..49131390b24 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_struct_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/typeof_struct_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests +// #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:2320 // A is a struct diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/ImplementingDispatchSlots/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/ImplementingDispatchSlots/SanityCheck.fs index b316b836820..f6e964aecf0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/ImplementingDispatchSlots/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/ImplementingDispatchSlots/SanityCheck.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions +// #Conformance #DeclarationElements #MemberDefinitions type Shape = @@ -10,17 +10,17 @@ type CShape() = abstract GetKind : unit -> Shape default this.GetKind() = Shape.Shape member this.Name() = "shape" - + type COval() = inherit CShape() override this.GetKind() = Shape.Oval member this.Name() = "shape.oval" - + type CCircle() = inherit COval() override this.GetKind() = Shape.Circle member this.Name() = "shape.oval.circle" - + let shape = new CShape() let oval = new COval() let circle = new CCircle() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AbstractProperties01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AbstractProperties01.fs index e17d94f3dae..b11f0e9eacf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AbstractProperties01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AbstractProperties01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify ability to override / inherit properties diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AutoPropsWithModifierBeforeGetSet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AutoPropsWithModifierBeforeGetSet.fs index 97749d24068..4586e683aae 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AutoPropsWithModifierBeforeGetSet.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AutoPropsWithModifierBeforeGetSet.fs @@ -40,7 +40,7 @@ let ``Instance Properties Test`` () = member val internal B14: int = 0 with get, set member val internal B15: int = 0 with get // should fail - member val internal B16: int = 0 with set""" + member val internal B16: int = 0 with set""" |> withLangVersionPreview |> typecheck |> shouldFail @@ -76,7 +76,7 @@ let ``Static Properties Test`` () = static member val internal B14: int = 0 with get, set static member val internal B15: int = 0 with get // should fail - static member val internal B16: int = 0 with set""" + static member val internal B16: int = 0 with set""" |> withLangVersionPreview |> typecheck |> shouldFail @@ -105,7 +105,7 @@ let ``Abstract Properties Test: access modifiers are not allowed`` () = // should fail abstract member B7: int with internal get // should fail - abstract member B8: int with internal set""" + abstract member B8: int with internal set""" |> withLangVersionPreview |> typecheck |> shouldFail @@ -128,7 +128,7 @@ type A = member internal C: int with get, set member D: int with internal get, private set abstract E: int with get, set - abstract F: int with get, private set""" + abstract F: int with get, private set""" |> withLangVersionPreview |> verifyCompile |> shouldFail @@ -153,7 +153,7 @@ type A = member internal B: int member internal C: int with get, set member D: int with internal get, private set - member E: int with get, set""" + member E: int with get, set""" |> withAdditionalSourceFile encodeFs |> withLangVersionPreview |> compile @@ -186,7 +186,7 @@ type A = new: unit -> A member B: int with internal get member C: int with internal set - member D: int with internal get, private set""" + member D: int with internal get, private set""" |> withAdditionalSourceFile encodeFs |> withLangVersion80 |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcreteProp.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcreteProp.fs index 7f6711b3230..f4911ce10b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcreteProp.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcreteProp.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify error when you have a property with both an abstract and concrete component // Regression from FSB 4496 [] -type X() = +type X() = let mutable state = 0 member x.State with get() = state abstract State : int with set diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties02.fs index becb917dbdf..91da0c3cc80 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:4160 // ICE when trying to compile code with abstract properties // See also FSHARP1.0:3661 and 4981 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties03.fs index 71821325974..cc450709372 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties03.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:4265 - Disallow an abstract setter with concrete getter // See also FSHARP1.0:3661 and 4981 [] -type X() = +type X() = let mutable state = 0 member x.State with get() = state abstract State : int with set diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember01.fs index 6ecd74a0536..ef7a54a8619 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression for FSHARP1.0:6168 // Active patterns should not be allowed as members - they don't work , but currently can be defined //This is not a valid name for an active pattern @@ -6,7 +6,7 @@ module M -type FaaBor() = +type FaaBor() = static member (|Foo|Bar|) (x, y) = match x = y with | true -> Foo diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember02.fs index c5f8ec11fec..aa695ccf1b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember02.fs @@ -1,15 +1,15 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression for FSHARP1.0:6168 // Active patterns should not be allowed as members - they don't work , but currently can be defined //This is not a valid name for an active pattern -type FooBar2() = +type FooBar2() = member x.(|Foo|Bar|) y = match x = y with | true -> Foo | false -> Bar - // compiler error on "Foo" + // compiler error on "Foo" member x.doSomething y = let r = x.``|Foo|Bar|`` y // compiles! match r with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember03.fs index 2a61a9bf3ef..d5674e43d26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember03.fs @@ -5,7 +5,7 @@ let (|A|B|) x = if x = "Foo" then A else B let (|A|B|_|) = None type APUsageInClass() = - + let (|A|) = 7 let (|A|B|) x = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DeclarePropertyTwice01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DeclarePropertyTwice01.fs index e2683069887..7ffcf6c5e95 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DeclarePropertyTwice01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DeclarePropertyTwice01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify error if you declare a setter twice -type Vector3 = +type Vector3 = | Vector3 of float * float * float member this.Decompose() = match this with Vector3(x, y, z) -> x, y, z diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DuplicateProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DuplicateProperty01.fs index 1c5fb053dcc..f4d4f1e528d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DuplicateProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DuplicateProperty01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:2435 (ICE on duplicate property definitions.) // See also bug FSHARP1.0:4925 (this test will have to be updated once that bug is resolved) -module NM = - type ClassMembers () = +module NM = + type ClassMembers () = let mutable adjustableInstanceValue = "3" member this.Property001 with get() = adjustableInstanceValue diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch01.fs index fc9b29c1f83..90119936e0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:1407 (Poor error message when arguments do not match signature of overloaded operator. Also incorrect span.) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch02.fs index 6c23f7f2e7a..59c8bf58b6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:1407 (Poor error message when arguments do not match signature of overloaded operator. Also incorrect span.) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerIndeterminateType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerIndeterminateType01.fs index 65c093d5e2b..1975c670973 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerIndeterminateType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerIndeterminateType01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for TFS#903376 //The operator 'expr\.\[idx\]' has been used on an object of indeterminate type based on information prior to this program point\. Consider adding further type constraints$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerNotSpecified01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerNotSpecified01.fs index 021244c17dd..44f52f5f5f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerNotSpecified01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerNotSpecified01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify error if the type doesn't support an indexer diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_OutscopeThisPtr01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_OutscopeThisPtr01.fs index a403071930a..a8ba663b3b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_OutscopeThisPtr01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_OutscopeThisPtr01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:579 // Verify the ability to outscope the this pointer: it's an error! diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties02.fs index fec44ef0402..77c63e7d2c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Setter declared using curried syntax // Expected: invalid declaration syntax @@ -6,7 +6,7 @@ let mutable globalPt : obj = null type Pt = { X : float; Y : float } - member this.Move with set x, y = + member this.Move with set x, y = globalPt <- { X = this.X + x; Y = this.Y + y} () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties06.fs index 754458273c2..18dcb65eaea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties06.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:4163 // Setter with no arguments (curried or uncurried?) // Used to crash the compiler! @@ -6,10 +6,10 @@ //See FSHARP1.0:5456 -type Transform (rotation : (float * float * float), position : (float * float *float)) = +type Transform (rotation : (float * float * float), position : (float * float *float)) = let foo = 1 member v.init - with set() = + with set() = let bar = foo in () bar diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit01.fs index 463c10e84a7..47955265cba 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit01.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify property setters must have type unit -type immut = +type immut = { - immutStr: string ; + immutStr: string ; } -with +with member x.Str with get() = x.immutStr and set(v:string) = {immutStr = v} let oldtInstance = {immutStr = "Old"} -let newInstance = oldtInstance.Str <- "New" //this doesn't work +let newInstance = oldtInstance.Str <- "New" //this doesn't work diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit02.fs index 109e40167bd..0ae919320a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit02.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify error message when property setter doesn't return unit. -type Foo() = +type Foo() = let mutable m_value = 0 - - member this.Property with get() = m_value + + member this.Property with get() = m_value and set x = m_value <- x; "Returns a string" - + let foo = new Foo() let result = (foo.Property <- 40) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable.fs index 7d3d66e6af5..569768405b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties //This instance member needs a parameter to represent the object being invoked\. Make the member static or use the notation 'member x\.Member\(args\) = \.\.\.'\.$ type Foo() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable02.fs index ab651a9cb18..635c0fe6560 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // FSB 1007, internal error tripped by property member without this diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_useInstMethodThroughStatic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_useInstMethodThroughStatic.fs index 2819e8ca38a..ed7d90d5fa1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_useInstMethodThroughStatic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_useInstMethodThroughStatic.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties //Method or object constructor 'DoStuff' is not static$ type Foo() = let m_val = 0 member this.DoStuff() = m_val static member StaticMethod() = 42 - + let x = new Foo() let result = Foo.DoStuff() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_useStaticMethodThroughInstance.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_useStaticMethodThroughInstance.fs index fc8f9e9e77d..60c4bf3cdaa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_useStaticMethodThroughInstance.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_useStaticMethodThroughInstance.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties //StaticMethod is not an instance method$ type Foo() = let m_val = 0 member this.DoStuff() = m_val static member StaticMethod() = 42 - + let x = new Foo() let result = x.StaticMethod() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/GetAndSetKeywords01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/GetAndSetKeywords01.fs index dcb746fa61e..ea6dd34e627 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/GetAndSetKeywords01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/GetAndSetKeywords01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify you can define properties with the get and set keyword let mutable lastUsed = ("", 0) @@ -9,14 +9,14 @@ type Foo = static member WriteOnly with set x = lastUsed <- ("WriteOnly", x) - static member ReadWrite1 + static member ReadWrite1 with get () = lastUsed <- ("ReadWrite1", 0); 3 and set x = lastUsed <- ("ReadWrite1", x) - static member ReadWrite2 + static member ReadWrite2 with set x = lastUsed <- ("ReadWrite2", x) and get () = lastUsed <- ("ReadWrite2", 0); 4 - + if Foo.ReadOnly1 <> 1 then failwith "Failed: 1" if lastUsed <> ("ReadOnly1", 0) then failwith "Failed: 2" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/GetterSetterDiff01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/GetterSetterDiff01.fs index f064c110035..3dc26c079da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/GetterSetterDiff01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/GetterSetterDiff01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify if parameters to getter and setter are different @@ -7,10 +7,10 @@ let mutable a, b, c = 0, false, "" type Foo() = - member this.Item with get (x : int, y : bool) = + member this.Item with get (x : int, y : bool) = a <- x; b <- y; 42 - and set (z : string, y : bool, x : int) (arg : float) = - a <- x; b <- y; c <- z; + and set (z : string, y : bool, x : int) (arg : float) = + a <- x; b <- y; c <- z; if arg <> 12.34 then failwith "Failed: 1" if (a, b, c) <> (0, false, "") then failwith "Failed: 2" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/IndexedPropertiesSameType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/IndexedPropertiesSameType.fs index 7869e2b4218..cd5daf9ab37 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/IndexedPropertiesSameType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/IndexedPropertiesSameType.fs @@ -4,7 +4,7 @@ type MyIndexerClass() = member x.Indexer1 with get (index: int): string = "" and set (index: int) (value: float) = () - + member x.Indexer2 with get (index) = 1 and set (index) (value: float) = () @@ -29,9 +29,9 @@ type GenericIndexer<'indexerArgs,'indexerOutput,'indexerInput>() = member this.LastArgs = m_lastArgs member this.LastInput = m_lastInput - member this.Item with get (args : 'indexerArgs) = + member this.Item with get (args : 'indexerArgs) = m_lastArgs <- args; Unchecked.defaultof<'indexerOutput> - and set (args : 'indexerArgs) (input : 'indexerInput) = + and set (args : 'indexerArgs) (input : 'indexerInput) = m_lastArgs <- args m_lastInput <- input \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer01.fs index b285db70c72..f893d79c40b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer01.fs @@ -1,9 +1,9 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify creating a property named Item creates an indexer -type Foo() = +type Foo() = member this.Item (x : decimal) = 42 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer02.fs index 320712aa0e3..85951f69f0c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer02.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties module M type GenericIndexer<'indexerArgs,'indexerOutput,'indexerInput>() = @@ -8,10 +8,10 @@ type GenericIndexer<'indexerArgs,'indexerOutput,'indexerInput>() = member this.LastArgs = m_lastArgs member this.LastInput = m_lastInput - member this.Item with get (args : 'indexerArgs) = + member this.Item with get (args : 'indexerArgs) = m_lastArgs <- args; Unchecked.defaultof<'indexerOutput> - and set (args : 'indexerArgs) (input : 'indexerInput) = + and set (args : 'indexerArgs) (input : 'indexerInput) = m_lastArgs <- args m_lastInput <- input diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer03.fs index 55e64aab7b7..9531a89c429 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer03.fs @@ -1,20 +1,20 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:5062 // Make sure we don't ICE on this code! // module TestModule -type TestType1 ( x : int , y : int ) = +type TestType1 ( x : int , y : int ) = let mutable x = x let mutable y = y - + [] // Static field static val mutable private instArray : int array - + do TestType1.instArray <- [|1 .. 10|] - /// Static indexer with tupled getter and setter + /// Static indexer with tupled getter and setter static member Item with get (i : int * string) = TestType1.instArray.[0] and set (i : string) (j : int) = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs index 659ea3b2a52..ffabcbdfdce 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs @@ -16,7 +16,7 @@ module MemberDefinitions_MethodsAndProperties = let verifyCompileAndRun = verifyCompile >> run - // SOURCE=PartiallyOverriddenProperty.fs + // SOURCE=PartiallyOverriddenProperty.fs [] let ``Partially Overridden Property`` compilation = compilation @@ -31,7 +31,7 @@ module MemberDefinitions_MethodsAndProperties = |> withCheckNulls |> verifyCompileAndRun |> shouldSucceed - + // SOURCE=E_AbstractAndConcreteProp.fs SCFLAGS="--test:ErrorRanges" # E_AbstractAndConcreteProp.fs [] let ``E_AbstractAndConcreteProp_fs`` compilation = @@ -86,7 +86,7 @@ module MemberDefinitions_MethodsAndProperties = (Error 3868, Line 17, Col 11, Line 17, Col 14, "This active pattern expects 1 expression argument(s) and a pattern argument, e.g., 'Bar e1 pat'."); (Warning 25, Line 15, Col 15, Line 15, Col 16, "Incomplete pattern matches on this expression.") ] - + // SOURCE=E_ActivePatternMember03.fs SCFLAGS="--test:ErrorRanges" # E_ActivePatternMember03.fs [] @@ -458,7 +458,7 @@ type I = (Error 3550, Line 11, Col 5, Line 11, Col 54, "Duplicate parameter. The parameter 'i' has been used more that once in this method.") (Error 3550, Line 11, Col 5, Line 11, Col 54, "Duplicate parameter. The parameter 'j' has been used more that once in this method.") ] - + [] let ``Error in signature file with no implementation file with abstract methods when reusing parameters`` () = let encodeFsi = @@ -594,14 +594,14 @@ type I = (Error 3550, Line 7, Col 5, Line 7, Col 54, "Duplicate parameter. The parameter 'i' has been used more that once in this method.") (Error 3550, Line 7, Col 5, Line 7, Col 54, "Duplicate parameter. The parameter 'j' has been used more that once in this method.") ] - + [] let ``IndexedPropertiesSameType_fs`` compilation = compilation |> withLangVersion80 |> verifyCompileAndRun |> shouldSucceed - + [] let ``Indexed1PropertiesSameType preview``() = Fsx """ @@ -613,7 +613,7 @@ type MyIndexerClass() = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer1' has getter of type 'string' but setter of type 'float'.") - + [] let ``Indexed2PropertiesSameType_fs preview``() = Fsx """ @@ -625,7 +625,7 @@ type MyIndexerClass() = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer2' has getter of type 'int' but setter of type 'float'.") - + [] let ``Indexed3PropertiesSameType_fs preview``() = Fsx """ @@ -638,7 +638,7 @@ type MyIndexerClass() = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer3' has getter of type 'int' but setter of type 'float'.") - + [] let ``Indexed4PropertiesSameType_fs preview``() = Fsx """ @@ -650,7 +650,7 @@ type MyIndexerClass() = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer4' has getter of type 'float' but setter of type 'string'.") - + [] let ``Indexed5PropertiesSameType_fs preview``() = Fsx """ @@ -662,7 +662,7 @@ type MyIndexerClass() = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer5' has getter of type 'float' but setter of type 'obj'.") - + [] let ``GenericIndexerPropertiesSameType_fs preview``() = Fsx """ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverriddenProperty.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverriddenProperty.fs index 472ee4ea8ec..d706eaddc1d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverriddenProperty.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverriddenProperty.fs @@ -2,8 +2,8 @@ module MyLib type BaseType() = abstract Msg : string with get,set - default this.Msg - with get() = "" + default this.Msg + with get() = "" and set x = printfn "%s" x type DerivedType() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties01.fs index efd35e436ac..0806729fba1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify readonly properties diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties02.fs index 3cc8d19c1ec..e13a15e36f3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties02.fs @@ -5,10 +5,10 @@ let mutable globalPt : obj = null type Pt = { X : float; Y : float } - member this.Move with set x y = + member this.Move with set x y = globalPt <- { X = this.X + x; Y = this.Y + y} () - member this.Move2 with set ((x, y)) = + member this.Move2 with set ((x, y)) = globalPt <- { X = this.X + x; Y = this.Y + y} () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties03.fs index 47ab89889d0..f1882c2c64c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties03.fs @@ -1,15 +1,15 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify property with both getter and setter -type Vector3 = +type Vector3 = | Vector3 of float * float * float member this.Decompose() = match this with Vector3(x, y, z) -> x, y, z type Vector = { mutable Vector3 : Vector3 } - member this.Length with get () = + member this.Length with get () = let x,y,z = this.Vector3.Decompose() sqrt <| x * x + y * y + z * z and set newLen = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties04.fs index 54036dafefe..2361660284d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties04.fs @@ -1,9 +1,9 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify property with both getter and setter with the setter declared first -type Vector3 = +type Vector3 = | Vector3 of float * float * float member this.Decompose() = match this with Vector3(x, y, z) -> x, y, z @@ -11,7 +11,7 @@ type Vector = { mutable Vector3 : Vector3 } member this.Length with set newLen = this.Vector3 <- Vector3(newLen, newLen, newLen) - and get () = + and get () = let x,y,z = this.Vector3.Decompose() sqrt <| x * x + y * y + z * z diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties05.fs index 720457a39f2..1ace24aa67a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Properties05.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify you can declare an indexer from an interface @@ -33,12 +33,12 @@ if (t :> IAmReadOnly).ROValue <> 42 then failwith "Failed: 2" if ROCalled <> true then failwith "Failed: 3" if WOCalled <> false then failwith "Failed: 4" -(t :> IAmWriteOnly).WOValue <- 4 +(t :> IAmWriteOnly).WOValue <- 4 if WOCalled <> true then failwith "Failed: 5" if RWRCalled <> false then failwith "Failed: 6" if RWWCalled <> false then failwith "Failed: 7" if (t :> IAmReadWrite).RWValue <> 42 then failwith "Failed: 8" -(t :> IAmReadWrite).RWValue <- 4 +(t :> IAmReadWrite).RWValue <- 4 if RWRCalled <> true then failwith "Failed: 9" if RWWCalled <> true then failwith "Failed: 10" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/RecursiveLetValues.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/RecursiveLetValues.fs index 41b52662059..ffb2b561071 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/RecursiveLetValues.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/RecursiveLetValues.fs @@ -1,20 +1,20 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:4150 - Bug in List.partition (Was : Recursive functions declared in implicit class constructors taking exactly two parameters yield error "Invalid Value.") open System -type Foo() = +type Foo() = let rec recFunc1 (x, y) = () let rec recFunc2 (x, y, _) = (y, x) |> ignore override this.ToString() = "Stuff" - -module Bar = + +module Bar = let rec recFunc1 (x, y) = () let rec recFunc2 (x, y, _) = (y, x) |> ignore let rec recFunc3 (_) = (1) |> ignore let Func4 (y, x) = () - + let f = Foo() let c = Bar.Func4(1,1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/StaticGenericField01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/StaticGenericField01.fs index 3f8a12f1e64..d8c6f525c71 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/StaticGenericField01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/StaticGenericField01.fs @@ -1,12 +1,12 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify we can handle static generic fields -type Counter1<'a> = +type Counter1<'a> = static member P = sizeof<'a> -type Counter2<'a>() = +type Counter2<'a>() = static let x = sizeof<'a> static member P = x member this.P2 = Counter2<'a>.P diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/TupledIndexer.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/TupledIndexer.fs index 67233b94ee6..1fe4b104a5b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/TupledIndexer.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/TupledIndexer.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify tupled parameters to properties work as expected // Regression for FSB 5273, ICE: Indexed properties not mixing well with tupled parameters diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/genericGenericClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/genericGenericClass.fs index a9868cbdd14..470ca97f317 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/genericGenericClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/genericGenericClass.fs @@ -1,14 +1,14 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties -type Foo<'a>() = +type Foo<'a>() = let mutable m_val : 'a list = [] - + member this.Add x = m_val <- m_val @ [x] member this.Length = List.length m_val - + let f1 = new Foo() -f1.Add 1; f1.Add 2; f1.Add 3; +f1.Add 1; f1.Add 2; f1.Add 3; if f1.Length <> 3 then failwith "Failed: 1" let f2 = new Foo() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-DU.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-DU.fs index 82207a3a359..e45b06444dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-DU.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-DU.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Testing instance methods on discriminated unions diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-Records.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-Records.fs index 00081069dca..d06a06e5146 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-Records.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-Records.fs @@ -1,11 +1,11 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Testing instance methods on record types -type Person = +type Person = { - Name : string; - DateOfBirth : System.DateTime; + Name : string; + DateOfBirth : System.DateTime; } member this.DoStuff param1 param2 = param1 + param2 + 42 override this.ToString() = this.Name + "+DOB" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-class.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-class.fs index 0aad3dfcfde..663df976948 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-class.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/instMembers-class.fs @@ -1,11 +1,11 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Testing instance methods on regular classes type VanillaClass(x) = let mutable m_value = x member this.InstanceProperty with get() = m_value and set x = m_value <- x - + let vt1 = new VanillaClass(42) vt1.InstanceProperty <- vt1.InstanceProperty * -1 let vt2 = new VanillaClass(-42) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/multiParamIndexer.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/multiParamIndexer.fs index 61dd0156ec6..eba699c0408 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/multiParamIndexer.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/multiParamIndexer.fs @@ -1,16 +1,16 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties open System.Text -type TypeWithIndexer() = +type TypeWithIndexer() = let m_val = new StringBuilder("one\ntwo\nthree\nfour") member x.Item with get (x', y) = let lines = m_val.ToString().Split([|"\n"|], System.StringSplitOptions.RemoveEmptyEntries) lines.[x'].[y] and set (x') (newChar) = m_val.Chars x' <- newChar - + member x.Value = m_val.ToString() @@ -20,13 +20,13 @@ let foo = new TypeWithIndexer() if foo.Item(1, 1) <> "w".ToCharArray().[0] then failwith "Failed: 1" // Use setter -foo.Item 0 <- ("!".ToCharArray().[0]) +foo.Item 0 <- ("!".ToCharArray().[0]) if foo.Value <> "!ne\ntwo\nthree\nfour" then failwith "Failed: 2" // Use getter using getter syntax if foo.[3,0] <> "f".ToCharArray().[0] then failwith "Failed: 3" // Use setter -foo.[1] <- ("!".ToCharArray().[0]) +foo.[1] <- ("!".ToCharArray().[0]) if foo.Value <> "!!e\ntwo\nthree\nfour" then failwith "Failed: 4" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-DU.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-DU.fs index ecfa29d2941..32e2bef32db 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-DU.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-DU.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties let resultString = "Butter and Cheese" @@ -7,8 +7,8 @@ type VanillaDU = | A of int | B of string | C - static member GetValue (param1, param2, param3) = - let add x y : float = x + y + static member GetValue (param1, param2, param3) = + let add x y : float = x + y add 1.0 (42 |> float) |> ignore resultString diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-Records.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-Records.fs index 0c905490d2d..a25824bdaac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-Records.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-Records.fs @@ -1,11 +1,11 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Testing instance methods on record types -type Person = +type Person = { - Name : string; - DateOfBirth : System.DateTime; + Name : string; + DateOfBirth : System.DateTime; } static member SomeStaticMethod (param1, param2) = "PersonRecordType" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-class.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-class.fs index 6ffd09df685..4778dafa23f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-class.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-class.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties type MusicFormat = CD | Record | MP3 @@ -8,7 +8,7 @@ type MusicPlayer() = type CDPlayer() = inherit MusicPlayer() with - + static member GetFormat() = CD if CDPlayer.GetFormat() <> CD then failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-instance.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-instance.fs index d4f16b7248f..6cdad1abe35 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-instance.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/staticMembers-instance.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression for DEV10:841423 // Previously it was an error to have a static and instance member share the same name @@ -7,7 +7,7 @@ module M let s1 = "member method" let s2 = "static method" -type T() = +type T() = member v.a() = "member method" static member a() = "static method" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupesAndFuncsAsArgs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupesAndFuncsAsArgs.fs index d079acb337f..220d67c6f66 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupesAndFuncsAsArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupesAndFuncsAsArgs.fs @@ -1,10 +1,10 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties type Foo() = static member ExecuteFunction (func : (int * string) -> bool) (args : (int * string)) = func args - + // Type inferred tuples member this.AddTupes (a : (int*int*int)) (b : (int*int*int*int)) c = let a1, a2, a3 = a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupledValueProperties01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupledValueProperties01.fs index 9563c546477..0f1f70b9d1b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupledValueProperties01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupledValueProperties01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:966 // Verify that we can have properties that takes tuples for arguments // Note: the non-curried syntax ((x:decimal, y:decimal)) is expected @@ -7,16 +7,16 @@ type x ()= class let mutable verificationX = false let mutable verificationY = false - + member this.X with set ((x:decimal,y:decimal)) = verificationX <- (x = 1M && y= -2M) - + member this.Y with set (x : decimal*decimal) = verificationY <- (-(fst x) = 1M) && ( -(snd x) = -2M) - + member this.Verify = if verificationX && verificationY then 0 else 1 end - + let v = new x() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/typeMethodsCurrable.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/typeMethodsCurrable.fs index a81bfa84c4b..3b46382068c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/typeMethodsCurrable.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/typeMethodsCurrable.fs @@ -1,7 +1,7 @@ -// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties +// #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties -type Record = +type Record = { A : int; B : int; C : int; D : int } member this.AddTo a b c d = (this.A + a, this.B + b, this.C + c, this.D + d) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MisspeltParam01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MisspeltParam01.fs index d98346d3608..f91016f97aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MisspeltParam01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MisspeltParam01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // Verify error when you misspell named parameters diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MustBePrefix.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MustBePrefix.fs index eb801ce5e80..8b078c7c8c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MustBePrefix.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MustBePrefix.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // Verify warning when named arguments do not form _prefix_ of unnamed arguments. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NonNamedAfterNamed.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NonNamedAfterNamed.fs index 99762a9e228..d25adc104e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NonNamedAfterNamed.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NonNamedAfterNamed.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NumParamMismatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NumParamMismatch01.fs index aaf831ae650..621968cae9d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NumParamMismatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NumParamMismatch01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // FSB 1433, Count of supplied parameters incorrect in error message if named parameters are used. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_ReusedParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_ReusedParam.fs index 6b04da4fc31..1a531dab86b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_ReusedParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_ReusedParam.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments //The named argument 'param1' has been assigned more than one value -type Foo = +type Foo = static member DoStuff (param1:int, param2:int) = param1 + param2 - + Foo.DoStuff(param1=1, param1=2, param2=3) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_SyntaxErrors01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_SyntaxErrors01.fs index 816881967bc..d35e537205f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_SyntaxErrors01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_SyntaxErrors01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // FSB 1430, Compiler spits out duplicate errors when given bogus syntax for named arguments diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01.fs index f326c12c618..98b0bf24606 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // FSB 1368, named arguments implicitly using property setters for generic class do not typecheck correctly @@ -17,12 +17,12 @@ module GenericClass = let x1 = S(1,"1") if x1.x <> 1 then failwith "Failed: 1" if x1.y <> "1" then failwith "Failed: 2" - + // Named-argument constructor let x2 = S(b="2",a=2) if x2.x <> 2 then failwith "Failed: 3" if x2.y <> "2" then failwith "Failed: 4" - + // Constructor with property setters afterwards let x3 = S(3,"3",X= -3, Y= "-3") if x3.x <> -3 then failwith "Failed: 5" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExt.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExt.fs index f6dc68abdea..c0d72cf700b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExt.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExt.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // FSB 1368, named arguments implicitly using property setters for generic class do not typecheck correctly diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExtInherit.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExtInherit.fs index ef51f1f751f..4ff55ff4b65 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExtInherit.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExtInherit.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments module GenericInheritedClass2 = @@ -9,7 +9,7 @@ module GenericInheritedClass2 = new() = { w = new System.Collections.Generic.List()} end - type S = + type S = class inherit R val mutable x : int @@ -23,7 +23,7 @@ module GenericInheritedClassExt2 = member x.A with set v = x.X <- v + 1 member x.B with set v = x.Y <- v + "1" type GenericInheritedClass2.R with - member x.C with set v = v |> Seq.iter x.w.Add + member x.C with set v = v |> Seq.iter x.w.Add // Standard construction let x1 = GenericInheritedClass2.S(1,"1", A = 2, B = "2",C = [ 3] ) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExtOpt.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExtOpt.fs index f5887cc7f41..fcdafadd3e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExtOpt.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn01NamedExtOpt.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments @@ -15,7 +15,7 @@ module GenericClass = member x.XProxyIntrinsic with set (v:'a) = x.X <- v member x.YProxyIntrinsic with set (v:'b) = x.Y <- v module GenericClassExt = - + module Extensions = open GenericClass type S<'a,'b> with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn02.fs index 8a2716be63a..6d461f5bb9b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn02.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments open System @@ -15,7 +15,7 @@ module NonGenericStruct = let x1 : S = S() if x1.x <> 0 then failwith "Failed: 1" if x1.y <> 0 then failwith "Failed: 2" - + let x2 : S = S(X=1, Y=2) if x2.x <> 1 then failwith "Failed: 3" if x2.y <> 2 then failwith "Failed: 4" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn02NamedExt.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn02NamedExt.fs index cd0a0df0a1e..cf8343ada96 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn02NamedExt.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/PropSetAfterConstrn02NamedExt.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // FSB 1368, named arguments implicitly using property setters for generic class do not typecheck correctly @@ -19,20 +19,20 @@ module GenericClass = type S<'a,'b> with member x.XProxyOptional with set (v:'a) = x.X <- v member x.YProxyOptional with set (v:'b) = x.Y <- v - + open Extensions - + // Standard construction let x1 = S(1,"1", XProxyIntrinsic = 42, YProxyIntrinsic = "42") if x1.x <> 42 then failwith "Failed: 1" if x1.y <> "42" then failwith "Failed: 2" - + let x2 = S<_,_>(1,"1") x2.XProxyOptional <- 43 x2.YProxyOptional <- "43" if x2.x <> 43 then failwith "Failed: 3" if x2.y <> "43" then failwith "Failed: 4" - + let x3 = S<_,_>(1,"1", XProxyOptional = 44, YProxyOptional = "44") if x3.x <> 44 then failwith "Failed: 5" if x3.y <> "44" then failwith "Failed: 6" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/SanityCheck.fs index d4cfb429b75..2a99f80c437 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/SanityCheck.fs @@ -1,13 +1,13 @@ -// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments type EType = A = 1 | B = 2 type Foo() = - member this.MethWithNamedParams (param1:int, param2:EType, param3:string) = + member this.MethWithNamedParams (param1:int, param2:EType, param3:string) = (param1 + (int param2) + param3.Length) - - + + let x = new Foo() let result = x.MethWithNamedParams(param3="stuff", param2=EType.A, param1 = 10) if result <> 16 then failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/genericNamedParams.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/genericNamedParams.fs index 45644cae2da..aba51845f1f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/genericNamedParams.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/genericNamedParams.fs @@ -1,10 +1,10 @@ -// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments type Foo() = static member DoStuff (a, b, c, d:string) = a + b + c + d.Length static member DoStuff2 (a:'a) : 'a list = [] - + let r = Foo.DoStuff(a=1, b=2, c=3, d="foo") if r <> 9 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/mixNamedNonNamed.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/mixNamedNonNamed.fs index e8d6189beee..c3dc6ae2277 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/mixNamedNonNamed.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/mixNamedNonNamed.fs @@ -1,11 +1,11 @@ -// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments type Foo() = - static member MethodWithNamedArgs (one:int, two:int, three:float, four:float) = + static member MethodWithNamedArgs (one:int, two:int, three:float, four:float) = let onetwo = (one |> float) + (two * two |> float) onetwo + three ** 3.0 + four ** 4.0 - + let r1 = Foo.MethodWithNamedArgs(1, 2, 3.0, 4.0) let r2 = Foo.MethodWithNamedArgs(1, 2, 3.0, four=4.0) let r3 = Foo.MethodWithNamedArgs(1, 2, three=3.0, four=4.0) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/refLibsHaveNamedParams.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/refLibsHaveNamedParams.fs index 3522ae219ff..21ceca53b4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/refLibsHaveNamedParams.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/refLibsHaveNamedParams.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments +// #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // Test that all types exposed in the base class library have 'named params' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck.fs index 284b3a63a2a..e776430b03c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Regression for FSHARP1.0: 6040 module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck02.fs index 6106f83070b..d39f36137be 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Regression for FSHARP1.0: 6040 module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/NullOptArgsFromCS.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/NullOptArgsFromCS.fs index 52a5aeaa878..da7b2d5192f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/NullOptArgsFromCS.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/NullOptArgsFromCS.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Dev10: 811195. Internal parse error when calling C#/VB methods with optional args whose default value is null // Should be no errors here module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/OptionalArgOnAbstract01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/OptionalArgOnAbstract01.fs index ec69a1266fd..5fc7f5b5c43 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/OptionalArgOnAbstract01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/OptionalArgOnAbstract01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Regression for 6385 type Optional() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/OptionalArguments.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/OptionalArguments.fs index 0af170a336a..e0de47c61b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/OptionalArguments.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/OptionalArguments.fs @@ -560,7 +560,7 @@ let main _ = |> run |> shouldSucceed |> withOutputContainsAllInOrder ["VSome ValueSome 1"; "VSome ValueNone"; "VSome 1"; "VNone"] - + [] let ``Optional Arguments in constructor can't be a ValueOption+StructAttribute attribute with langversion=90`` () = let source = @@ -634,7 +634,7 @@ let main _args = |> ILVerifierModule.verifyPEFileWithSystemDlls |> run |> verifyOutputContains [|"main;18;hello;42;"|] - + // Regression test for https://github.com/dotnet/fsharp/issues/19711 // `?name = expr` (explicit caller-side question-mark syntax) must accept a // ValueOption when the declared parameter is `[] ?name`. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck.fs index 7d17b441feb..17193655802 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck.fs @@ -1,13 +1,13 @@ -// #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments type Ballad() = static member MethWithOptParams (?param1:int, ?param2:string list, ?param3:int list option) = - let actualParam1 = + let actualParam1 = match param1 with | Some x -> x | None -> 0 - let actualParam2 = + let actualParam2 = match param2 with | Some(slist) -> List.length slist | None -> 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck02.fs index 1070659cf60..4859bbd49ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck02.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Test optional parameters with prim types, obj types, disc unions, option types, ref types, mutable types, etc. @@ -18,18 +18,18 @@ type Foo() = member this.Obj = m_objType member this.DU = m_duType member this.ILO = m_ilo - + member this.MegaOptParams (?prim:float, ?obj:string, ?du:People, ?ilo:int list option, ?x:int) = let getArg (x:'a option) def:'a = - match x with + match x with | Some(value) -> value | None -> def - + m_primType <- getArg prim 100.0 m_objType <- getArg obj "" m_duType <- getArg du (Jane(Joe(0))) m_ilo <- getArg ilo (Some([1..10])) - + let test = new Foo() // Verify initial values for properties diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck03.fs index bc16fc37416..46dafbcf5af 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Regression for FSHARP1.0: 6040 module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityOptArgsFromCS.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityOptArgsFromCS.fs index bd759dff99c..e767f037f11 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityOptArgsFromCS.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityOptArgsFromCS.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Should be no errors here module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/optionalOfOptOptA.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/optionalOfOptOptA.fs index 9a36741b5fb..8d0105cb4ec 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/optionalOfOptOptA.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/optionalOfOptOptA.fs @@ -1,11 +1,11 @@ -// #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments +// #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Test an optional parameter of type 'option option option a' type Foo<'a>() = member this.Test (?param1:'a option option option) = match param1 with - | Some(a) -> + | Some(a) -> match a with | Some(b) -> match b with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/CallMethods.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/CallMethods.fs index 0dcaa19f50d..48d3ce764f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/CallMethods.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/CallMethods.fs @@ -6,7 +6,7 @@ open System let checkMethod (f:'a->'a) value (defaultFun:unit->'a) defaultValue = let result = f value if result <> value then printfn "normal case failed for type %s. Expected %A <> %A" typeof<'a>.Name value result; exit 1 - let result = defaultFun() + let result = defaultFun() if defaultFun() <> defaultValue then printf "default case failed for type %s. Expected %A <> %A" typeof<'a>.Name defaultValue result; exit 1 do checkMethod (fun v -> Class.Method1 (v)) 1y (fun () -> Class.Method1 ()) 42y diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/InterfaceMethod.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/InterfaceMethod.fs index 5fbf202bd95..c35ebd4888e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/InterfaceMethod.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/InterfaceMethod.fs @@ -1,10 +1,10 @@ -// #Conformance #DeclarationElements #MemberDefinitions #OptionalDefaultParameterValueArguments +// #Conformance #DeclarationElements #MemberDefinitions #OptionalDefaultParameterValueArguments open System.Runtime.InteropServices open System // test that only default parameters at interfaces have effect. -type MyFace = +type MyFace = abstract Test : [] i:int-> int type Impl() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Library.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Library.fs index d945639ff85..cd13e07563b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Library.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Library.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #OptionalDefaultParameterValueArguments +// #Conformance #DeclarationElements #MemberDefinitions #OptionalDefaultParameterValueArguments namespace ConsumeFromCS @@ -25,7 +25,7 @@ type Class() = // Check a value type - only default ctor possible. static member Method15 ([]i:DateTime) = i - // Check nullables. + // Check nullables. static member MethodNullable1 ([())>]i:Nullable) = i static member MethodNullable2 ([())>]i:Nullable) = i static member MethodNullable3 ([())>]i:Nullable) = i @@ -34,7 +34,7 @@ type Class() = static member Mix1(a:int, b:string, []c:int) = c // can omit optional in the middle of the arg list; this works in C# too. static member Mix2(a:int, b:string, []c:int, d: int) = c - static member Mix3(a:int, []b:string, + static member Mix3(a:int, []b:string, []c:int, []d: int) = (b,c,d) // compiler should be able to figure out default to pass to Optional parameters without DefaultParameterValue. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/OptionalDefaultParamArgs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/OptionalDefaultParamArgs.fs index 3c41d7d6534..0364d472360 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/OptionalDefaultParamArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/OptionalDefaultParamArgs.fs @@ -75,7 +75,7 @@ module MemberDefinitions_OptionalDefaultParamArgs = compilation |> verifyCompile |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Warning 3211, Line 10, Col 62, Line 10, Col 63, "The default value does not have the same type as the argument. The DefaultParameterValue attribute and any Optional attribute will be ignored. Note: 'null' needs to be annotated with the correct type, e.g. 'DefaultParameterValue(null:obj)'." Error 1, Line 13, Col 25, Line 13, Col 27, "This expression was expected to have type 'string' @@ -87,7 +87,7 @@ module MemberDefinitions_OptionalDefaultParamArgs = compilation |> verifyCompile |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Warning 3211, Line 10, Col 62, Line 10, Col 67, "The default value does not have the same type as the argument. The DefaultParameterValue attribute and any Optional attribute will be ignored. Note: 'null' needs to be annotated with the correct type, e.g. 'DefaultParameterValue(null:obj)'." Warning 3397, Line 12, Col 19, Line 12, Col 21, """This expression uses 'unit' for an 'obj'-typed argument. This will lead to passing 'null' at runtime. This warning may be disabled using '#nowarn "3397"."""] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Sanity.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Sanity.fs index 5e9d98b61d3..81c0b3ab361 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Sanity.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Sanity.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #OptionalDefaultParameterValueArguments +// #Conformance #DeclarationElements #MemberDefinitions #OptionalDefaultParameterValueArguments open System.Runtime.InteropServices open System @@ -32,7 +32,7 @@ type Class() = static member Mix1(a:int, b:string, []c:int) = c // can omit optional in the middle of the arg list; this works in C# too. static member Mix2(a:int, b:string, []c:int, d: int) = c - static member Mix3(a:int, []b:string, + static member Mix3(a:int, []b:string, []c:int, []d: int) = (b,c,d) // compiler should be able to figure out default to pass to Optional parameters without DefaultParameterValue. @@ -48,7 +48,7 @@ type Class() = let checkMethod (f:'a->'a) value (defaultFun:unit->'a) defaultValue = let result = f value if result <> value then printfn "normal case failed for type %s. Expected %A <> %A" typeof<'a>.Name value result; failwith "Failed: 1" - let result = defaultFun() + let result = defaultFun() if defaultFun() <> defaultValue then printf "default case failed for type %s. Expected %A <> %A" typeof<'a>.Name defaultValue result; failwith "Failed: 2" do checkMethod (fun v -> Class.Method1 (v)) 1y (fun () -> Class.Method1 ()) 42y diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/ArityFilteringTest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/ArityFilteringTest.fs index fa8dfcb8d76..700bfa53027 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/ArityFilteringTest.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/ArityFilteringTest.fs @@ -7,17 +7,17 @@ type OverloadTest() = member this.Method(x: int) = "one-int" member this.Method(x: int, y: int) = "two-ints" member this.Method(x: int, y: int, z: int) = "three-ints" - + static member StaticMethod() = "static-no-args" static member StaticMethod(x: int) = "static-one-int" static member StaticMethod(x: int, y: int) = "static-two-ints" - - member this.OptMethod(x: int, ?y: int) = + + member this.OptMethod(x: int, ?y: int) = match y with | Some v -> sprintf "opt-%d-%d" x v | None -> sprintf "opt-%d-none" x - - member this.ParamArrayMethod([] args: int[]) = + + member this.ParamArrayMethod([] args: int[]) = sprintf "params-%d" args.Length // Simulate Assert.Equal-like pattern with many overloads at different arities @@ -26,15 +26,15 @@ type MockAssert = static member Equal(expected: string, actual: string) = "string-string" static member Equal(expected: float, actual: float) = "float-float" static member Equal(expected: obj, actual: obj) = "obj-obj" - + static member Equal(expected: float, actual: float, precision: int) = "float-float-precision" static member Equal(expected: int, actual: int, comparer: System.Collections.Generic.IEqualityComparer) = "int-int-comparer" static member Equal(expected: string, actual: string, comparer: System.Collections.Generic.IEqualityComparer) = "string-string-comparer" - + static member Single(x: int) = "single-int" - + static member Quad(a: int, b: int, c: int, d: int) = "quad" - + static member WithCallerInfo(x: int, [] ?callerName: string) = match callerName with | Some n -> sprintf "caller-%s" n diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/ConsumeOverloadGenericMethods.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/ConsumeOverloadGenericMethods.fs index e0d94f4c96c..8dbd1735ff9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/ConsumeOverloadGenericMethods.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/ConsumeOverloadGenericMethods.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading #NoMono #ReqNOMT +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading #NoMono #ReqNOMT // Regression test for 4075 overload resolution confused by C<> and C when C.GenericMethod is given explicit instantiation let reproB1 : int = MyClass.M(box 12) // typechecks ok diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_InferredTypeNotUnique01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_InferredTypeNotUnique01.fs index 5485583a4ad..eae89e365d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_InferredTypeNotUnique01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_InferredTypeNotUnique01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSharp1.0:3762 - Using FastFunc explicitly is not differentiate from function types, thus causing compiler to create bad method tables, maybe other problems //Duplicate method\. The method 'Foo' has the same name and signature as another method in type 'SomeClass'\. // Note: as of Beta2, FastFunc became FSharpFunc @@ -6,7 +6,7 @@ type SomeClass() = member this.Foo (x:int->int) = printfn "method 1" - + // Overloaded method signature is the same as previous, error expected - member this.Foo (x:FSharpFunc) = + member this.Foo (x:FSharpFunc) = printfn "method 2" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OperatorOverloading01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OperatorOverloading01.fs index 0f9bba4e9a1..5ecfc6dfec4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OperatorOverloading01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OperatorOverloading01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSHARP1.0:4964 // Compiler should not ICE on inappropriate operator overloading //Method or object constructor 'op_Addition' not found @@ -6,13 +6,13 @@ type MyPoint = struct val mutable private m_X : float val mutable private m_Y : float - + new (x, y) = { m_X = x; m_Y = y } - + member this.X with get () = this.m_X and set x = this.m_X <- x member this.Y with get () = this.m_Y and set y = this.m_Y <- y member this.Len = sqrt ( this.X * this.X + this.Y * this.Y ) - + // (* Correct *) static member (+) (p1 : MyPoint, p2 : MyPoint) = MyPoint(p1.X + p2.X, p1.Y + p2.Y) (* Incorrect *) static member (+) (p1 : MyPoint) (p2 : MyPoint) = MyPoint(p1.X + p2.X, p1.Y + p2.Y) end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadCurriedFunc.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadCurriedFunc.fs index 2a4f637f2ab..6986ffbad98 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadCurriedFunc.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadCurriedFunc.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Verify error when overloading a curried function @@ -11,7 +11,7 @@ type C = static member DoStuff (x : obj) (y : obj) = () [] static member DoStuff (x : obj) (y : string) = () - + let emptySet1 : Set = Set.empty let emptySet2 : Set = Set.empty diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_ReturnGenericUnit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_ReturnGenericUnit01.fs index 789bb742ece..936a049e6f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_ReturnGenericUnit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_ReturnGenericUnit01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Verify error message when returning a 'a which is of type unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_UnsolvableConstraints01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_UnsolvableConstraints01.fs index f1c1529da1c..7fa7163c2a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_UnsolvableConstraints01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_UnsolvableConstraints01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression for FSHARP1.0:6164 type 'a D = static member inline (+)(_:^b D, _:^b) : ^b when ^b : (static member (+) : ^b * ^b -> ^b) = failwith "Not implemented" static member inline (+)(_:^b, _:^b D) : ^b when ^b : (static member (+) : ^b * ^b -> ^b) = failwith "Not implemented" - + let f (x:int D) = x + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/InferenceForLambdaArgs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/InferenceForLambdaArgs.fs index a1b9328ccae..01e59fef72d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/InferenceForLambdaArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/InferenceForLambdaArgs.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Conformance #DeclarationElements #MemberDefinitions #Overloading // inference failed for Linq .ToDictionary(fun,fun) - #3170 open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/MethodOverloadUnambiguous.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/MethodOverloadUnambiguous.fs index 5f3217c3387..77d10ebbe25 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/MethodOverloadUnambiguous.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/MethodOverloadUnambiguous.fs @@ -1,6 +1,6 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading -// Regression test for FSHARP1.0:1494 -// New tiebreaker rules for method overloading? +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// Regression test for FSHARP1.0:1494 +// New tiebreaker rules for method overloading? open System.Reflection @@ -8,7 +8,7 @@ open System.Linq.Expressions let asExpr x = (x :> Expression) -let expressionTreeForMethod (mi:MethodInfo) = +let expressionTreeForMethod (mi:MethodInfo) = let parameters = mi.GetParameters() let paramExprs : Expression[] = parameters |> Array.map (fun pi -> Expression.Parameter(pi.ParameterType, pi.Name) |> asExpr) Expression.Call(null , mi, paramExprs) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NativePtrOverloads03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NativePtrOverloads03.fs index c0c43f4c4d9..ed5d41b459c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NativePtrOverloads03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NativePtrOverloads03.fs @@ -1,7 +1,7 @@ module NativePtrOverloads03 open Microsoft.FSharp.NativeInterop #nowarn "9" -// Regression test for issue #7428 +// Regression test for issue #7428 type R = static member F(p: nativeptr) = 0us diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoOverloadIDSpecified.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoOverloadIDSpecified.fs index 1e86f57a8d2..f797616b1c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoOverloadIDSpecified.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoOverloadIDSpecified.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Conformance #DeclarationElements #MemberDefinitions #Overloading // As of Beta2, we don't need OverloadIDs anymore! // type Foo() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoWarningWhenDoingDispatchSlotInference01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoWarningWhenDoingDispatchSlotInference01.fs index 43f01b4ce62..4ee82972473 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoWarningWhenDoingDispatchSlotInference01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoWarningWhenDoingDispatchSlotInference01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSHARP1.0:1894 // This code should compile without warnings! diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoWarningWhenOverloadingInSubClass01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoWarningWhenOverloadingInSubClass01.fs index b1938afe531..62e0b531d08 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoWarningWhenOverloadingInSubClass01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/NoWarningWhenOverloadingInSubClass01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // FSharp1.0:4748 - override outscope warning does not seem to be overload sensitive // This code should compile without warnings! diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OnAllOverloads01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OnAllOverloads01.fs index 94706a9b508..4d9ad134da0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OnAllOverloads01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OnAllOverloads01.fs @@ -1,11 +1,11 @@ -// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Conformance #DeclarationElements #MemberDefinitions #Overloading // Verify OverloadIDAttribute should is not required on all overloads -type Test1() = +type Test1() = member x.ChangeText(s: string) = () member x. ChangeText(i: int) = () //case 2: -type Test2() = +type Test2() = member x.ChangeText(s: string) = () member x.ChangeText(i: int) = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading01.fs index 06a20af75a7..d0b2053d3ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading01.fs @@ -1,15 +1,15 @@ -// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Conformance #DeclarationElements #MemberDefinitions #Overloading // Sanity check operator overloading type OverloadOp1(x : int) = - + member this.Value = x - + static member (+) (lhs : OverloadOp1, rhs : int) = new OverloadOp1(lhs.Value + rhs) static member (+) (lhs : OverloadOp1, rhs : OverloadOp1) = new OverloadOp1(lhs.Value + rhs.Value) - + let test1() = let x = new OverloadOp1(0) let y = x + 2 @@ -20,5 +20,5 @@ let test1() = if z.Value <> 4 then failwith "Failed: 3" () -// Run the test -test1() +// Run the test +test1() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading02.fs index 06efe00bdc9..4795936aab6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSHARP1.0:4730 - Overly restrictive - functions not allowed as operator overloads @@ -15,7 +15,7 @@ type public TestType() = static member public (+++) (a : TestType, b : int -> int) = (b 17) + a.Value static member public (+++) (a : int -> int, b : TestType) = (a 17) + b.Value - + static member public (+++) (a : obj * string -> int, b : TestType) = (a (box 17, "17")) + b.Value let inline (+++) (a : ^a) (b : ^b) = ((^a or ^b): (static member (+++): ^a * ^b -> ^c) (a,b) ) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading03.fs index c9ffb9298b8..58ceecb6c55 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression for FSHARP1.0:5803 // Compiler was tripping up on this before diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading04.fs index c22a091520e..d624e43a30f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OperatorOverloading04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression for Dev10 bug #860557 // Overloading (+) does not work properly when first argument is a string module M @@ -7,13 +7,13 @@ type Step = Step of string with static member (+)(s, Step t) = s + t static member (+)(Step s, t) = s + t let str1 = "a" + (Step "b") // should be no error -let str2 = (Step "a") + "b" +let str2 = (Step "a") + "b" + - type Step2 = Step2 of int with static member (+)(s, Step2 t) = s + t -let int3 = 1 + Step2 2 +let int3 = 1 + Step2 2 if str1 <> "ab" then failwith "Failed: 1" if str2 <> "ab" then failwith "Failed: 2" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingAndExtensionMethodsForGenericTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingAndExtensionMethodsForGenericTypes.fs index 4f647a74df9..f44641b5d12 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingAndExtensionMethodsForGenericTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingAndExtensionMethodsForGenericTypes.fs @@ -1,8 +1,8 @@ -// #Regression +// #Regression // Regression for 353661 [FSharp] The code below shows an error when editing, but no error when compiled. open System.Linq -type T = +type T = abstract Count : int -> bool default this.Count(_ : int) = true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingMembers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingMembers.fs index e98999930b6..f359db00fd9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingMembers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingMembers.fs @@ -272,7 +272,7 @@ module MemberDefinitions_OverloadingMembers = |> shouldFail |> withDiagnostics [ (Error 438, Line 7, Col 19, Line 7, Col 20, "Duplicate method. The method 'M' has the same name and signature as another method in type 'Q'.") - (Error 438, Line 6, Col 19, Line 6, Col 20, "Duplicate method. The method 'M' has the same name and signature as another method in type 'Q'.") + (Error 438, Line 6, Col 19, Line 6, Col 20, "Duplicate method. The method 'M' has the same name and signature as another method in type 'Q'.") ] // NativePtrOverloads03.fs - regression test, previously failing overloads should now compile @@ -292,7 +292,7 @@ module MemberDefinitions_OverloadingMembers = |> withOptions ["--nowarn:9"] |> compile |> shouldFail - |> withDiagnostics [ + |> withDiagnostics [ (Error 438, Line 9, Col 19, Line 9, Col 20, "Duplicate method. The method 'H' has the same name and signature as another method in type 'S' once tuples, functions, units of measure and/or provided types are erased.") (Error 438, Line 8, Col 19, Line 8, Col 20, "Duplicate method. The method 'H' has the same name and signature as another method in type 'S' once tuples, functions, units of measure and/or provided types are erased.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/SanityCheck.fs index 8a379d6a797..879d87f160d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/SanityCheck.fs @@ -1,9 +1,9 @@ -// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Conformance #DeclarationElements #MemberDefinitions #Overloading type Foo() = member this.DoStuff (x:int) = "doStuff-1" member this.DoStuff (x:string) = "doStuff-2" member this.DoStuff (x:int, y:string) = "doStuff-3" - + let test = new Foo() if test.DoStuff(0) <> "doStuff-1" then failwith "Failed: 1" if test.DoStuff("") <> "doStuff-2" then failwith "Failed: 2" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule01a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule01a.fs index 7b6e1978352..be139b8fe63 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule01a.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSHARP1.0:1600 // New tiebreaker for method overloading // Rule #1: non-generic methods are preferred over generic methods @@ -8,9 +8,9 @@ module M1 = static member F (x : int) = 1.1 end - + let c = C.F('a') = 1 // ok; c is 1 let d = C.F(1) = 1.1 // ok; d is 1.1 if c && d then () else failwith "Failed: 1" - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule01b.fs index 4e5ea5a1dac..9b3aee668a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule01b.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSHARP1.0:1600 // New tiebreaker for method overloading // Rule #1: non-generic methods are preferred over generic methods - -module M2 = - type C() = +module M2 = + + type C() = static member F<'a>(x : 'a ,y : 'a) = 'a' static member F(x : obj, y : obj) = 'b' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule02.fs index c8009e80481..3ac80d29fe4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule02.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSHARP1.0:1600 // New tiebreaker for method overloading // Rule #2: ParamArray: normal form vs expanded form -module M3 = +module M3 = type C() = class static member F ([] x : obj) = 1 static member F (x : obj array) = 1.1 end - + let r = C.F([|1|]) if r = 1 then () else if r = 1 then () else failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule03.fs index 2bee9a79600..079b3bcf722 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TieBreakerRule03.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSHARP1.0:1600 // New tiebreaker for method overloading // Rule #3: methods have same # of args and each arg type subsumes the other -module M4 = +module M4 = type A() = class end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TooGeneric.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TooGeneric.fs index e856bc586dd..60cda1a3e0a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TooGeneric.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TooGeneric.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression test for FSHARP1.0:3388 // overloaded operators which are more generic than their enclosing class // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TypeCompatibilityFilterTest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TypeCompatibilityFilterTest.fs index 22df91b8e90..fc0c82e44a3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TypeCompatibilityFilterTest.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/TypeCompatibilityFilterTest.fs @@ -9,28 +9,28 @@ type TypeCompatTest() = static member Process(x: float) = "float" static member Process(x: bool) = "bool" static member Process(x: byte) = "byte" - + static member Generic<'T>(x: 'T) = sprintf "generic-%s" (typeof<'T>.Name) - + static member WithInterface(x: IComparable) = "IComparable" static member WithInterface(x: IEnumerable) = "IEnumerable" - + static member WithObject(x: obj) = "obj" - + static member WithTuple(x: int * int) = "tuple2" static member WithTuple(x: int * int * int) = "tuple3" - + static member WithArray(x: int[]) = "array1d" static member WithArray(x: int[,]) = "array2d" - + static member Multi(x: int, y: int) = "int-int" static member Multi(x: string, y: string) = "string-string" static member Multi(x: int, y: string) = "int-string" static member Multi(x: string, y: int) = "string-int" - + static member WithNullable(x: Nullable) = "nullable-int" static member WithNullable(x: Nullable) = "nullable-float" - + static member NumericConversions(x: int64) = "int64" static member NumericConversions(x: nativeint) = "nativeint" @@ -70,7 +70,7 @@ type ParamArrayTypeTest() = static member Process([] args: int[]) = sprintf "ints-%d" args.Length static member Process([] args: string[]) = sprintf "strings-%d" args.Length static member Process([] args: obj[]) = sprintf "objs-%d" args.Length - + static member Mixed(prefix: string, [] values: int[]) = sprintf "%s-%d" prefix values.Length static member Mixed(prefix: string, [] values: string[]) = sprintf "%s-strs-%d" prefix values.Length diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/diffNumArguments.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/diffNumArguments.fs index 7a4afb12d0d..6928bd24774 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/diffNumArguments.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/diffNumArguments.fs @@ -1,9 +1,9 @@ -// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Conformance #DeclarationElements #MemberDefinitions #Overloading type Foo() = member this.DoStuff (x:int) = "doStuff-1" member this.DoStuff (x:string) = "doStuff-2" member this.DoStuff (x:int, y:string) = "doStuff-3" - + let test = new Foo() if test.DoStuff(0) <> "doStuff-1" then failwith "Failed: 1" if test.DoStuff("") <> "doStuff-2" then failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/reuseOverloadIDs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/reuseOverloadIDs.fs index 16092854453..789490fe6c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/reuseOverloadIDs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/reuseOverloadIDs.fs @@ -1,10 +1,10 @@ -// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// #Conformance #DeclarationElements #MemberDefinitions #Overloading // This test used to be about the [], which is now gone // Reuse the same overload IDs, but with different method sets type Foo() = member this.DoStuff1 (x:int) = "doStuff1-1" member this.DoStuff1 (x:string) = "doStuff1-2" - + member this.DoStuff2 (x:int) = "doStuff2-1" member this.DoStuff2 (x:string) = "doStuff2-2" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs index 29f58ce0db6..cfeaa3c05c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs @@ -2,7 +2,7 @@ module OutOptionalTests open System.Runtime.InteropServices type Thing = - static member Do(o: outref, []i: int) = + static member Do(o: outref, []i: int) = o <- i i = 7 let (_:bool), (_:int) = Thing.Do(i = 42) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/StaticMethodResolution.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/StaticMethodResolution.fs index c6602a0f1be..2adf43a4b9b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/StaticMethodResolution.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/StaticMethodResolution.fs @@ -6,7 +6,7 @@ open FSharp.Test.Compiler open Xunit module StaticMethodResolution = - + // Regression test for https://github.com/dotnet/fsharp/issues/19664 // // When a static extension method is defined in a *different* [] module than diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_AbbreviationOnNamespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_AbbreviationOnNamespace01.fs index 330cb151922..b0a34937aed 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_AbbreviationOnNamespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_AbbreviationOnNamespace01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Modules +// #Regression #Conformance #DeclarationElements #Modules // This used to be a positive test. Now it is not. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName01.fs index fd84a3f4e24..9cb1528e8f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Modules +// #Regression #Conformance #DeclarationElements #Modules // Verify error when abbreviating a module to an invalid name //Unexpected symbol '\$' in definition\. Expected incomplete structured construct at or before this point or other token\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName02.fs index 31d6688f320..266822f4533 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Modules +// #Regression #Conformance #DeclarationElements #Modules // Verify error when using a dot in the name diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_NameConflict01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_NameConflict01.fs index 6167d7efd0f..315d921f443 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_NameConflict01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_NameConflict01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #Modules +// #Regression #Conformance #DeclarationElements #Modules diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_UseInsideFunc.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_UseInsideFunc.fs index 06da0fea8eb..f947190dbfb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_UseInsideFunc.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_UseInsideFunc.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DeclarationElements #Modules +// #Regression #Conformance #DeclarationElements #Modules // Verify error if trying to use a module abbreviation inside of a function //Incomplete structured construct at or before this point in binding$ let someFunc x y = module ListMod = Microsoft.FSharp.Collections.List - + ListMod.sum [0; x; y] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/SanityCheck.fs index 3ad023c1d93..96d373af8e5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/SanityCheck.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Modules +// #Conformance #DeclarationElements #Modules // @@ -6,14 +6,14 @@ module A = module B = module C = type X = | Red = 1 - | Blue = 2 - - + | Blue = 2 + + module Abbreviated_A = A module Abbreviated_A_B = A.B module Abbreviated_A_B_C = A.B.C - + let blue = int Abbreviated_A_B_C.X.Blue let red = int Abbreviated_A_B.C.X.Red diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/SanityCheck02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/SanityCheck02.fs index a4e0aea118a..ac1b0243b21 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/SanityCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/SanityCheck02.fs @@ -1,9 +1,9 @@ -// #Conformance #DeclarationElements #Modules +// #Conformance #DeclarationElements #Modules module ``Some Crazy Identifier !@#`` = Microsoft.FSharp.Collections.List - + let result = ``Some Crazy Identifier !@#``.sum [1; 2; 3] if result <> 6 then failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideModuleDef.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideModuleDef.fs index cfe719f4f18..c15dea2751a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideModuleDef.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideModuleDef.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Modules +// #Conformance #DeclarationElements #Modules // Use module abbreviation inside a module // @@ -7,15 +7,15 @@ module A = module B = module C = type X = | Red = 1 - | Blue = 2 - let DirectorySeparatorChar = System.IO.Path.DirectorySeparatorChar - -module TestModule1 = - + | Blue = 2 + let DirectorySeparatorChar = System.IO.Path.DirectorySeparatorChar + +module TestModule1 = + let f x y = x + y - + module ABC = A.B.C - + let dsc = ABC.DirectorySeparatorChar printfn "Current directory separator char is %c" dsc diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDef.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDef.fs index 3596265c855..709de10deff 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDef.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDef.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Modules +// #Conformance #DeclarationElements #Modules // Use module abbreviation inside a namespace // @@ -8,8 +8,8 @@ namespace Faa.Bor module B = module C = type X = | Red = 1 - | Blue = 2 - let DirectorySeparatorChar = System.IO.Path.DirectorySeparatorChar + | Blue = 2 + let DirectorySeparatorChar = System.IO.Path.DirectorySeparatorChar module IO = A.B.C diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDefExternal.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDefExternal.fs index b4827cfb579..5c311a881e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDefExternal.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDefExternal.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #Modules #ReqNOMT +// #Conformance #DeclarationElements #Modules #ReqNOMT // Use module abbreviation inside a namespace // Module is defined in an external assembly // @@ -11,4 +11,4 @@ namespace Faa.Bor type Faabor<'a>() = let dsc = IO.DirectorySeparatorChar member this.PrintDSC () = printfn "%A" dsc - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDefExternal_DLL.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDefExternal_DLL.fs index b1c1e6ae0c1..3384ffc69d2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDefExternal_DLL.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideNamespaceDefExternal_DLL.fs @@ -1,9 +1,9 @@ -// #Conformance #DeclarationElements #Modules #ReqNOMT +// #Conformance #DeclarationElements #Modules #ReqNOMT module A module B = module C = type X = | Red = 1 - | Blue = 2 - let DirectorySeparatorChar = System.IO.Path.DirectorySeparatorChar + | Blue = 2 + let DirectorySeparatorChar = System.IO.Path.DirectorySeparatorChar diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen01.fs index 98af5e18f32..99acc11e4cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Modules +// #Conformance #TypesAndModules #Modules // Sanity check AutoOpen diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen02.fs index 121bd16a7fc..cb930330d79 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen02.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #TypesAndModules #Modules +// #Regression #Conformance #TypesAndModules #Modules module A = [] - module B = + module B = let x = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen03.fs index 086b5cb526e..c76aa3b6695 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen03.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Modules +// #Conformance #TypesAndModules #Modules module A @@ -6,12 +6,12 @@ module A module B = [] - module C = + module C = [] - module D = + module D = let x = 0 - -// This should cause a cascade... + +// This should cause a cascade... open B // ... bringing x into scope diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/DefineModule01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/DefineModule01.fs index 50cbc12998f..43496f04a7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/DefineModule01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/DefineModule01.fs @@ -1,15 +1,15 @@ -// #Conformance #TypesAndModules #Modules +// #Conformance #TypesAndModules #Modules // Define a simple module and access its values -module MyModule = +module MyModule = let x = 1 type Foo = A | B - module MyNestedModule = + module MyNestedModule = let f y = y + 1 type Bar = C | D diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_CannotAccessPrivateMembersOfAnotherType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_CannotAccessPrivateMembersOfAnotherType.fs index 1fcf31c020c..746ec36852d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_CannotAccessPrivateMembersOfAnotherType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_CannotAccessPrivateMembersOfAnotherType.fs @@ -1,22 +1,22 @@ -// #AccessibilityModifiers #FSharpQA #Conformance #TypesAndModules #Modules +// #AccessibilityModifiers #FSharpQA #Conformance #TypesAndModules #Modules //The member or object constructor 'Impl' is not accessible\. Private members may only be accessed from within the declaring type\. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions\.$ -namespace Tim +namespace Tim -module Correlation = +module Correlation = - type SpecMulti() = + type SpecMulti() = - member private t.Impl _ _ = () + member private t.Impl _ _ = () - type SpecSet = { + type SpecSet = { - Inner : SpecMulti + Inner : SpecMulti - } with + } with - member t.Generate arg = + member t.Generate arg = - let fn _ = () + let fn _ = () - t.Inner.Impl f arg \ No newline at end of file + t.Inner.Impl f arg \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithExpression02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithExpression02.fs index d5913b91a80..a4df3b79e26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithExpression02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithExpression02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Modules +// #Regression #Conformance #TypesAndModules #Modules // Regression test for FSHARP1.0:2644 (a module may start with an expression) // This is unfortunate, but this is the current behavior for this release. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ObsoleteAttribOnModules01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ObsoleteAttribOnModules01.fs index 7d89830d9ad..d2b59e5911c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ObsoleteAttribOnModules01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ObsoleteAttribOnModules01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Modules +// #Regression #Conformance #TypesAndModules #Modules // Regression test for: FSharp1.0:2030 - We should honor System.Obsolete on modules @@ -6,22 +6,22 @@ [] -module ObsoleteModule = +module ObsoleteModule = module NestedModule = let Level = 1 let Level = 0 - -module Module = + +module Module = [] - module NestedObsoleteModule = + module NestedObsoleteModule = let Level = 1 let Level = 0 - -module Program = + +module Program = open ObsoleteModule let mutable level = ObsoleteModule.Level level <- ObsoleteModule.NestedModule.Level - + open Module level <- Module.NestedObsoleteModule.Level level <- Module.Level diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/FullyQualify01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/FullyQualify01.fs index be773038fdf..133aefb4818 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/FullyQualify01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/FullyQualify01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Modules +// #Conformance #TypesAndModules #Modules // Verify ability to fully qualify module identifiers @@ -6,7 +6,7 @@ module Test = module A = - module B = + module B = module C = module D = let counter = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/LibFoo1.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/LibFoo1.fs index 46b192ecc90..a07667c023a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/LibFoo1.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/LibFoo1.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Modules +// #Conformance #TypesAndModules #Modules namespace n1 module Module1 = let foo = 100 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/LibFoo2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/LibFoo2.fs index ca5831415ca..f61f19a3df6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/LibFoo2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/LibFoo2.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Modules +// #Conformance #TypesAndModules #Modules namespace n1 module Module1 = let foo = 200 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleAbbreviationWithModule01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleAbbreviationWithModule01.fs index 657181d0ed2..4e253d3d85d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleAbbreviationWithModule01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleAbbreviationWithModule01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Modules +// #Regression #Conformance #TypesAndModules #Modules // Regression test for FSHARP1.0:2644 (a module may start with an expression) // Module abbreviation: // Trying to abbreviate a module is ok @@ -6,6 +6,6 @@ // Module abbreviations -module AbbreviateModule = +module AbbreviateModule = Microsoft.FSharp.Collections.List - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleDefinitions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleDefinitions.fs index 06c22537e7b..9b35fe5ac92 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleDefinitions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleDefinitions.fs @@ -103,7 +103,7 @@ module ModuleDefinitions = (Error 37, Line 9, Col 1, Line 9, Col 18, "Duplicate definition of type, exception or module 'module'") ] - // SOURCE="E_ModuleWithSameNameInNamespace02a.fsx E_ModuleWithSameNameInNamespace02b.fsx" SCFLAGS="--test:ErrorRanges" # E_ModuleWithSameNameInNamespace02 + // SOURCE="E_ModuleWithSameNameInNamespace02a.fsx E_ModuleWithSameNameInNamespace02b.fsx" SCFLAGS="--test:ErrorRanges" # E_ModuleWithSameNameInNamespace02 [] let ``E_ModuleWithSameNameInNamespace02a_fsx`` compilation = compilation @@ -256,7 +256,7 @@ module ModuleDefinitions = (Error 965, Line 8, Col 1, Line 9, Col 26, "The path 'Microsoft.FSharp.Core' is a namespace. A module abbreviation may not abbreviate a namespace.") ] - // + // // #These 2 are not actual testcases, just test libraries for the next 2 // SOURCE=LibFoo1.fs SCFLAGS="-a" // SOURCE=LibFOo2.fs SCFLAGS="-a" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleWithExpression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleWithExpression01.fs index 3162632d1a1..6b51bbde5a4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleWithExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleWithExpression01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypesAndModules #Modules +// #Regression #Conformance #TypesAndModules #Modules // Regression test for FSHARP1.0:2644 (a module may start with an expression) // Verify that we can compile a module with an expression in it // -module M = +module M = printfn "hello" let x = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleWithExpression02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleWithExpression02.fs index 7c49d8ebf60..da553909db1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleWithExpression02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleWithExpression02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Modules +// #Regression #Conformance #TypesAndModules #Modules // Regression test for FSHARP1.0:2644 (a module may start with an expression) // This is unfortunate, but this is the current behavior for this release. // So, the workaround is to use begin... end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/Module_internalConsumer01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/Module_internalConsumer01.fs index 9d03fc63873..ddb88b9b42b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/Module_internalConsumer01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/Module_internalConsumer01.fs @@ -1,5 +1,5 @@ // #Regression #AccessorModifiers #Module -// Regression test for DevDiv:175204 +// Regression test for DevDiv:175204 // It should be possible to access internal modules // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/SameTypeInTwoReferences01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/SameTypeInTwoReferences01.fs index 94d404d071a..f15bf6461de 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/SameTypeInTwoReferences01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/SameTypeInTwoReferences01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Modules +// #Conformance #TypesAndModules #Modules module T open n1.Module1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/SameTypeInTwoReferences02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/SameTypeInTwoReferences02.fs index 47f828b4b56..105eae17ee0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/SameTypeInTwoReferences02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/SameTypeInTwoReferences02.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Modules +// #Conformance #TypesAndModules #Modules module T open n1.Module1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_ModuleAbbreviationWithNamespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_ModuleAbbreviationWithNamespace01.fs index cacd7409943..9942d29a9dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_ModuleAbbreviationWithNamespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_ModuleAbbreviationWithNamespace01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #TypesAndModules #Modules +// #Regression #Conformance #TypesAndModules #Modules // Regression test for FSHARP1.0:2644 (a module may start with an expression) // Module abbreviation: Trying to abbreviate a namespace is deprecated // See also FSHARP1.0:2848 // Module abbreviations -module M2 = +module M2 = Microsoft.FSharp.Core exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/E_BeginWithNamespace01a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/E_BeginWithNamespace01a.fs index e072d1fbe64..31869a2b818 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/E_BeginWithNamespace01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/E_BeginWithNamespace01a.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Namespaces +// #Regression #Conformance #TypesAndModules #Namespaces // Regression test for FSHARP1.0:5354 // Namespace fragment warning should not underlines the entire file in blue //Files in libraries or multiple-file applications must begin with a namespace or module declaration, e\.g\. 'namespace SomeNamespace\.SubNamespace' or 'module SomeNamespace\.SomeModule'\. Only the last source file of an application may omit such a declaration\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/E_BeginWithNamespace01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/E_BeginWithNamespace01b.fs index 7f21028115a..70f5ad5849e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/E_BeginWithNamespace01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/E_BeginWithNamespace01b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Namespaces +// #Regression #Conformance #TypesAndModules #Namespaces // Regression test for FSHARP1.0:5354 // Namespace fragment warning should not underlines the entire file in blue diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/FooGlobal.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/FooGlobal.fs index 336244de98b..aed374c5bc3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/FooGlobal.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/FooGlobal.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Namespaces +// #Regression #Conformance #TypesAndModules #Namespaces // Regression for Dev10: 837511 // "namespace global" causes strange error in dependent code in different assembly // This will be a library for other test files to consume diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/NamespaceDeclGroups.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/NamespaceDeclGroups.fs index 994aa9f1b79..2e81e288c97 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/NamespaceDeclGroups.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/NamespaceDeclGroups.fs @@ -66,4 +66,3 @@ module NamespaceDeclGroups = |> shouldSucceed - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/NoWarnOnJustNamespace.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/NoWarnOnJustNamespace.fs index 82f35e7dcc4..d1a1a66ed55 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/NoWarnOnJustNamespace.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/NoWarnOnJustNamespace.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Namespaces +// #Conformance #TypesAndModules #Namespaces // Regression test for FSharp1.0: // Title: files with just "namespace foo" should not warn diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/TypeInGlobalNamespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/TypeInGlobalNamespace01.fs index f991a3b406a..9353cb0d17c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/TypeInGlobalNamespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/TypeInGlobalNamespace01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Namespaces +// #Regression #Conformance #TypesAndModules #Namespaces // Regression for Dev10: 837511 // "namespace global" causes strange error in dependent code in different assembly diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/TypeInGlobalNamespace02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/TypeInGlobalNamespace02.fs index cb502e4f822..e1006b37a26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/TypeInGlobalNamespace02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NamespaceDeclGroups/TypeInGlobalNamespace02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Namespaces +// #Regression #Conformance #TypesAndModules #Namespaces // See FSHARP1.0:6251 // "namespace global" causes strange error in dependent code in different assembly // Can't use fully qualified name diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NullRepresentations/E_NullInvalidForFSTypes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NullRepresentations/E_NullInvalidForFSTypes01.fs index 055a28c7e81..7e86cf9b4bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NullRepresentations/E_NullInvalidForFSTypes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NullRepresentations/E_NullInvalidForFSTypes01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules +// #Regression #Conformance #TypesAndModules // Verify that 'null' is not a valid value for F# types diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/AstrSymbOper01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/AstrSymbOper01.fs index 39569f788ae..c9147379f3d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/AstrSymbOper01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/AstrSymbOper01.fs @@ -1,4 +1,4 @@ -// #Conformance #BasicGrammarElements #Operators +// #Conformance #BasicGrammarElements #Operators // Verify you can create a function named '*' without diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/BasicOperatorNames.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/BasicOperatorNames.fs index fa340382024..f1c5500ee22 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/BasicOperatorNames.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/BasicOperatorNames.fs @@ -1,4 +1,4 @@ -// #Conformance #BasicGrammarElements #Operators +// #Conformance #BasicGrammarElements #Operators // Test basic operator names @@ -12,7 +12,7 @@ let (!) x = if !10 <> 3628800 then failwith "Failed: : 1" // Binary -let (<<<) x y = x - x * y +let (<<<) x y = x - x * y if 10 <<< 3 <> -20 then failwith "Failed: : 2" let (>:) x y = x + x * y diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/E_BasicOperatorNames01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/E_BasicOperatorNames01.fs index ab23c121a29..e6788df67d0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/E_BasicOperatorNames01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/E_BasicOperatorNames01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/EqualOperatorsOverloading.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/EqualOperatorsOverloading.fs index 81488edd01a..a27bef1815f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/EqualOperatorsOverloading.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/EqualOperatorsOverloading.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators // FSB 3993, Operator overloading of == and != is inconsistent @@ -10,5 +10,5 @@ type Test(x: int) = let a, b = Test(1), Test(2) -let _ = ( a == b ) +let _ = ( a == b ) let _ = ( a != b ) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/RefAssignment01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/RefAssignment01.fs index e7af61c87f8..a256eb44666 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/RefAssignment01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/RefAssignment01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators // Regression for FSHARP1.0:5809 // Lexfilter doesn't respect := operator module T let tup = (1, 2, 3) -let x = +let x = let (b, _, _) = tup b diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/DotNotationAfterGenericMethod01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/DotNotationAfterGenericMethod01.fs index 1f53b80e3ff..51d1fdcce2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/DotNotationAfterGenericMethod01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/DotNotationAfterGenericMethod01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators // FSharp1.0:4760 - A method(with,arguments) cannot appear mid-way down a path-lookup type Variable<'a>() = static member New<'T>() = new Variable<'T>() - static member NewDouble() = new Variable() + static member NewDouble() = new Variable() member this.Named(x:string) = this let v2 = Variable.New().Named("v") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_ExclamationMark01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_ExclamationMark01.fs index 71d48009eb7..241ec7fa8cb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_ExclamationMark01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_ExclamationMark01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators // Regression test for FSHARP1.0:2541 // Prefix only operators: !OP, ?OP, ~OP // Try to use !OP as an infix-op is an error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_Negation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_Negation01.fs index 8ce84e606ff..2108562ae46 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_Negation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_Negation01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators module M // Verify errors when trying to negate unsigned values diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_QuestionMark01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_QuestionMark01.fs index 01d4a71de04..bef0c65be7d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_QuestionMark01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_QuestionMark01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators // Regression test for FSHARP1.0:2541 // Prefix only operators: !OP, ?OP, ~OP // Try to use !OP as an infix-op is an error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_QuestionMark02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_QuestionMark02.fs index 395ea8165dc..9fb23055aa1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_QuestionMark02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_QuestionMark02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators // Regression test for FSHARP1.0:2541 // Prefix only operators: !OP, ?OP, ~OP // Try to use !OP as an infix-op is an error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_Tilde01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_Tilde01.fs index e7011eda01c..a67eb167fe8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_Tilde01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_Tilde01.fs @@ -3,7 +3,7 @@ // Prefix only operators: !OP, ?OP, ~OP // Try to use !OP as an infix-op is an error // ?OP ~OP -// Note: as of 11/1, the usage of ~ is restricted to very specific cases. +// Note: as of 11/1, the usage of ~ is restricted to very specific cases. //Invalid operator definition\. Prefix operator definitions must use a valid prefix operator name\.$ //Invalid operator definition\. Prefix operator definitions must use a valid prefix operator name\.$ //Invalid prefix operator$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/ExclamationMark02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/ExclamationMark02.fs index d8f02ae101a..98922779cd9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/ExclamationMark02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/ExclamationMark02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators // Regression test for FSHARP1.0:2541 // Prefix only operators: !OP, ?OP, ~OP // Try to use !OP as an infix-op is an error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/Negation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/Negation01.fs index 04eb45b905b..38df19a304d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/Negation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/Negation01.fs @@ -1,4 +1,4 @@ -// #Conformance #BasicGrammarElements #Operators +// #Conformance #BasicGrammarElements #Operators // Verify you can negate any numeric value diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/VerticalbarOptionalinDU.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/VerticalbarOptionalinDU.fs index f4ac477bdba..c727cfbc3e9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/VerticalbarOptionalinDU.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/VerticalbarOptionalinDU.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #BasicGrammarElements #Operators +// #Regression #Conformance #BasicGrammarElements #Operators // FSB 3209: Vertical bar in single case Enum should be optional -type Monochrome = +type Monochrome = Black = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/checkedOperatorsNoOverflow.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/checkedOperatorsNoOverflow.fs index 3eb8c174d29..ba1e39c29d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/checkedOperatorsNoOverflow.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/checkedOperatorsNoOverflow.fs @@ -1,12 +1,12 @@ -// #Conformance #BasicGrammarElements #Operators +// #Conformance #BasicGrammarElements #Operators // Test issue FSHARP1.0:902 open System open Operators.Checked -let testNoOverflow op overflowArg = - try - let r = op overflowArg +let testNoOverflow op overflowArg = + try + let r = op overflowArg () with | :? OverflowException -> failwith "Failed: 1" @@ -38,7 +38,7 @@ testNoOverflow uint16 65535 testNoOverflow uint32 4294967295L testNoOverflow uint64 8446744073709551615.0f testNoOverflow unativeint 4294967295L - + testNoOverflow int -2147483647L testNoOverflow int16 -32767 testNoOverflow int32 -2147483647L diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/checkedOperatorsOverflow.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/checkedOperatorsOverflow.fs index cf969b1af5b..c289af53cfc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/checkedOperatorsOverflow.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/checkedOperatorsOverflow.fs @@ -1,21 +1,21 @@ open System open Operators.Checked -let testOverflow op overflowArg = - try - let r = op overflowArg +let testOverflow op overflowArg = + try + let r = op overflowArg printfn "%A" overflowArg failwith "Failed: 1" with | :? OverflowException -> () // Because there's no way to overflow nativeint/unativeint on 64bit since they won't accept bigint -let testOverflow2 op overflowArg = +let testOverflow2 op overflowArg = if System.IntPtr.Size = 8 then // we cannot use System.Environment.Is64BitProcess because this could be targeting 2.0 - () + () else - try - let r = op overflowArg + try + let r = op overflowArg printfn "%A" overflowArg failwith "Failed: 2" with @@ -61,7 +61,7 @@ testOverflow uint32 -4294967296L testOverflow uint64 -18446744073709551616.0f testOverflow2 unativeint -4294967296L -// nativeint/unativeint don't support strings, char will throw FormatException if str.length > 1 so no overflow +// nativeint/unativeint don't support strings, char will throw FormatException if str.length > 1 so no overflow testOverflow byte "256" testOverflow int "2147483649" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PropertyResolution/StaticPropertyResolution.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PropertyResolution/StaticPropertyResolution.fs index 33fe8740def..b8f1f3d2cca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PropertyResolution/StaticPropertyResolution.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PropertyResolution/StaticPropertyResolution.fs @@ -10,12 +10,12 @@ module StaticPropertyResolution = // Regression test for static property accessors (getter/setter) resolution. // Related to https://github.com/dotnet/fsharp/issues/19797 // - // When a static extension 'set' or 'get' accessor is defined in a *different* module - // than the generic type it extends, and the corresponding property has the other intrinsic - // static accessor + // When a static extension 'set' or 'get' accessor is defined in a *different* module + // than the generic type it extends, and the corresponding property has the other intrinsic + // static accessor // (i.e. the intrinsic property has a 'get' and the extension has a 'set', or vice versa) // - // For instance, resolving the assignment via explicit-type-argument syntax, + // For instance, resolving the assignment via explicit-type-argument syntax, // where the 'set' accessor is an extension and the 'get' accessor is intrinsic, // Type.Property <- value previously failed with FS0810. // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/ActivePatternForUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/ActivePatternForUnion.fs index 11a3f9323d2..4767deb8e79 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/ActivePatternForUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/ActivePatternForUnion.fs @@ -1,6 +1,6 @@ module Test -type AB = +type AB = | A | B of int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/CreateUnionCases.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/CreateUnionCases.fs index aedd420b581..e7f42cf3e59 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/CreateUnionCases.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/CreateUnionCases.fs @@ -1,7 +1,7 @@ module Test -type MyDu = - | A +type MyDu = + | A | Other static let ofString s = match s with | "A" -> A | _ -> Other diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/PlainEnum.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/PlainEnum.fs index 4662d040123..62523ba96ec 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/PlainEnum.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/PlainEnum.fs @@ -9,5 +9,5 @@ type MyPlainEnum = let methods = typeof.GetMethods(System.Reflection.BindingFlags.Static) - + printfn "%i" (methods.Length) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/QuotationsForStaticLetRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/QuotationsForStaticLetRecords.fs index bee4bcb9653..a98fa9afa76 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/QuotationsForStaticLetRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/QuotationsForStaticLetRecords.fs @@ -5,7 +5,7 @@ type R = F1: int F2: int } - + static let createRecord v1 r = { F1 = v1; F2 = v1 } static member Q = <@ createRecord 42 @> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/QuotationsForStaticLetUnions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/QuotationsForStaticLetUnions.fs index fa6257770f5..e0279df8824 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/QuotationsForStaticLetUnions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/QuotationsForStaticLetUnions.fs @@ -1,7 +1,7 @@ module Test -type MyDu = - | A +type MyDu = + | A | Other static let ofString s = match s with | "A" -> A | _ -> Other diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecordOrderOfExecution.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecordOrderOfExecution.fs index 132514142b1..9409b9f2ab2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecordOrderOfExecution.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecordOrderOfExecution.fs @@ -7,15 +7,15 @@ type R = } static do printfn "init R 1" - static let r1 = + static let r1 = do printfn "side effect in let binding R1" { F1 = 1; F2 = 1 } - static member R1 = + static member R1 = do printfn "side effect in member R1" r1 -module InnerModule = +module InnerModule = let print() = printfn "calling print %i" R.R1.F2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecursiveDUs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecursiveDUs.fs index 556f331d5e0..7a495a73ac3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecursiveDUs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecursiveDUs.fs @@ -2,13 +2,13 @@ module rec Test [] -type DuA = +type DuA = | A1 | B of DuB | C of DuC static do printfn "DuA init" - static let allVals = + static let allVals = printfn "DuA allVals access" seq {yield DuA.A1.ToString();yield! DuB.AllValues; yield! DuC.AllValues} static member AllValues = allVals @@ -20,7 +20,7 @@ type DuB = | C of DuC static do printfn "DuB init" - static let allVals = + static let allVals = printfn "DuB allVals access" seq {yield DuB.B1.ToString();yield! DuA.AllValues; yield! DuC.AllValues} static member AllValues = allVals @@ -32,7 +32,7 @@ type DuC = | B of DuB static do printfn "DuC init" - static let allVals = + static let allVals = printfn "DuC allVals access" seq {yield DuC.C1.ToString();yield! DuA.AllValues; yield! DuB.AllValues} static member AllValues = allVals diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecursiveRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecursiveRecords.fs index b58e7b6d6ed..8f81fb93735 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecursiveRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/RecursiveRecords.fs @@ -1,19 +1,19 @@ module rec Test -type Chicken = +type Chicken = {Eggs : Egg list} static do printfn "Chicken init" - static let firstEggEver = + static let firstEggEver = printfn "creating firstEggEver" {Mother = {Eggs = []}} static member FirstEgg = firstEggEver -type Egg = +type Egg = {Mother : Chicken} static do printfn "Egg init" -type Omelette = +type Omelette = {Egg : Egg} static do printfn "Omelette init" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleEmptyGenericType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleEmptyGenericType.fs index 00e36ff836f..690d64b4bec 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleEmptyGenericType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleEmptyGenericType.fs @@ -1,14 +1,14 @@ module Test type EmptyT<'T> = - static let cachedName = + static let cachedName = let name = typeof<'T>.Name printfn "Accessing name for %s" name name static member Name = cachedName -for i=0 to 10 do +for i=0 to 10 do EmptyT.Name |> ignore EmptyT.Name |> ignore EmptyT.Name |> ignore \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleEmptyType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleEmptyType.fs index 5ea94f81299..c348606e729 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleEmptyType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleEmptyType.fs @@ -4,7 +4,7 @@ type EmptyT = static let x = 5 static do printfn "init" static let mutable counter = 0 - static member Incr() = + static member Incr() = counter <- counter + 1 counter static member PrintIt() = printfn "%i" x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleRecord.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleRecord.fs index 31c42801dc8..1ba8356afb1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleRecord.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleRecord.fs @@ -11,14 +11,14 @@ type R = static let mutable mutableVal = 0 static let incrementor() = mutableVal <- mutableVal + 1 - static member IncrementAndReturn() = + static member IncrementAndReturn() = do incrementor() let freshVal = factoryFunc mutableVal freshVal.F1 + cachedval.F1 let mutable lastVal = 0 -for i=0 to 5 do +for i=0 to 5 do lastVal <- R.IncrementAndReturn() printfn "%i" lastVal \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleUnion.fs index 9f56fa63146..40c5888bbdc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/SimpleUnion.fs @@ -1,26 +1,26 @@ module Test -type MyDu = - | A of int - | B of string +type MyDu = + | A of int + | B of string | C static let factoryFunc x = A x static let mutable mutableVal = factoryFunc 11 - static let circularIncrement() = - mutableVal <- + static let circularIncrement() = + mutableVal <- match mutableVal with | A i -> B (string i) | B _ -> C | C -> A 42 - static member IncrementAndReturn() = + static member IncrementAndReturn() = do circularIncrement() mutableVal let mutable lastVal = C -for i=0 to 5 do +for i=0 to 5 do lastVal <- MyDu.IncrementAndReturn() printfn "%A" lastVal \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecords.fs index 4facec5630e..3c028696927 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecords.fs @@ -1,6 +1,6 @@ module Test -type MyRecord<'T> = +type MyRecord<'T> = { X: 'T Y: int @@ -12,7 +12,7 @@ type MyRecord<'T> = { X = Unchecked.defaultof<'T> ; Y = 15} static let mutable perTyparInstMutableCounter = 0 - static member IncBySize() = + static member IncBySize() = perTyparInstMutableCounter <- perTyparInstMutableCounter + sizeOfT static member GetCounter() = perTyparInstMutableCounter diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecordsILtest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecordsILtest.fs index ef2414db2ed..715894bde9c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecordsILtest.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecordsILtest.fs @@ -4,9 +4,9 @@ open System [] [] -type MyRecord<'T> = +type MyRecord<'T> = { - X: 'T + X: 'T } // Init per typar static let cachedVal = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericUnion.fs index d05297cc25c..54d4ebd7af6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericUnion.fs @@ -1,19 +1,19 @@ module Test [] -type MyUnion<'A,'B> = +type MyUnion<'A,'B> = | A of aval:'A | B of bval:'B | C - static let sizeOfTCached = + static let sizeOfTCached = printfn "Creating cached val for %s * %s" (typeof<'A>.Name) (typeof<'B>.Name) sizeof> - + static let mutable perTyparInstMutableCounter = 0 - static member IncBySize() = + static member IncBySize() = perTyparInstMutableCounter <- perTyparInstMutableCounter + sizeOfTCached static member GetCounter() = perTyparInstMutableCounter diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs index d75accd96f8..4a2592d3e81 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs @@ -7,7 +7,7 @@ open FSharp.Test.Compiler [] [] [] -let ``Regression in Member val - not allowed without primary constructor`` (langVersion:string) = +let ``Regression in Member val - not allowed without primary constructor`` (langVersion:string) = Fs """module Test type Bad3 = member val X = 1 + 1 """ @@ -86,7 +86,7 @@ let ``Static let - lowercase DU`` compilation = compilation |> withLangVersion80 |> typecheck - |> shouldSucceed + |> shouldSucceed [] let ``Static let in empty type`` compilation = @@ -124,7 +124,7 @@ let ``Static let in simple union`` compilation = let ``Support in plain enums - typecheck should fail`` compilation = compilation |> withLangVersion80 - |> typecheck + |> typecheck |> shouldFail |> withDiagnosticMessage "Enumerations cannot have members" @@ -156,7 +156,7 @@ let ``Static let in struct record`` compilation = |> verifyCompileAndRun |> shouldSucceed |> withStdOutContains "7" - + [] let ``Static let creating DU cases`` compilation = compilation @@ -164,7 +164,7 @@ let ``Static let creating DU cases`` compilation = |> shouldSucceed |> withStdOutContains "..." - + [] let ``Static let union - order of execution`` compilation = compilation @@ -177,7 +177,7 @@ side effect in member Singleton calling print Case2 42 side effect in member Singleton calling print Case2 42""" - + [] let ``Static let record - order of execution`` compilation = compilation @@ -191,7 +191,7 @@ calling print 1 side effect in member R1 calling print 1""" - + [] let ``Static let - recursive DU definitions calling each other`` compilation = compilation @@ -231,7 +231,7 @@ let ``Static let extension to builtin type`` compilation = |> typecheck |> shouldFail |> withDiagnostics [Error 3573, Line 4, Col 5, Line 4, Col 51, "Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead."] - + [] let ``Static let - quotations support for records`` compilation = compilation @@ -371,10 +371,10 @@ creating MyTypes.U.u1 now MyTypes module 'do' no. 2 InnerModuleNotAccess 'do' Case2 1""" - + [] -let ``Static let IL init single file test withRealInternalSignatureOff`` () = +let ``Static let IL init single file test withRealInternalSignatureOff`` () = FSharp """ module Test open System @@ -440,7 +440,7 @@ do Console.WriteLine("module after type") }"""] [] -let ``Static let IL init single file test withRealInternalSignatureOn`` () = +let ``Static let IL init single file test withRealInternalSignatureOn`` () = FSharp """ module Test open System @@ -839,7 +839,7 @@ b.ToString() |> ignore |> asExe |> ignoreWarnings |> compileAndRun - |> shouldSucceed + |> shouldSucceed [] @@ -872,4 +872,4 @@ module ActualProgram = |> asExe |> ignoreWarnings |> compileAndRun - |> shouldSucceed \ No newline at end of file + |> shouldSucceed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StructRecord.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StructRecord.fs index f9308d5e73d..638495de81d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StructRecord.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StructRecord.fs @@ -12,14 +12,14 @@ type R = static let mutable mutableVal = 0 static let incrementor() = mutableVal <- mutableVal + 1 - static member IncrementAndReturn() = + static member IncrementAndReturn() = do incrementor() let freshVal = factoryFunc mutableVal freshVal.F1 + cachedval.F1 let mutable lastVal = 0 -for i=0 to 5 do +for i=0 to 5 do lastVal <- R.IncrementAndReturn() printfn "%i" lastVal \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StructUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StructUnion.fs index 26466c8e67e..50a5be90ec5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StructUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StructUnion.fs @@ -1,27 +1,27 @@ module Test [] -type MyDu = - | A of intVal:int - | B of stringVal:string +type MyDu = + | A of intVal:int + | B of stringVal:string | C static let factoryFunc x = A x static let mutable mutableVal = factoryFunc 11 - static let circularIncrement() = - mutableVal <- + static let circularIncrement() = + mutableVal <- match mutableVal with | A i -> B (string i) | B _ -> C | C -> A 42 - static member IncrementAndReturn() = + static member IncrementAndReturn() = do circularIncrement() mutableVal let mutable lastVal = C -for i=0 to 5 do +for i=0 to 5 do lastVal <- MyDu.IncrementAndReturn() printfn "%A" lastVal \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/UnionOrderOfExecution.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/UnionOrderOfExecution.fs index d627dbd1a99..bd9969e2bc9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/UnionOrderOfExecution.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/UnionOrderOfExecution.fs @@ -5,15 +5,15 @@ type U = | Case2 of int static do printfn "init type U" - static let case2cachedVal = + static let case2cachedVal = do printfn "side effect in let binding case2cachedVal" Case2 42 - static member GetSingleton = + static member GetSingleton = do printfn "side effect in member Singleton" case2cachedVal -module InnerModule = +module InnerModule = let print() = printfn "calling print %A" (U.GetSingleton) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/UnionShowCase.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/UnionShowCase.fs index 7b6cb870ff2..06a48f989a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/UnionShowCase.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/UnionShowCase.fs @@ -11,7 +11,7 @@ type U = static do printfn "init U 2" static let u2 = Case2 2 static member val U2 = u2 - + static do printfn "init end" printfn "%A" U.U1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsi b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsi index d8f91e0aaf7..5bae8de8e82 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules +// #Regression #Conformance #TypesAndModules // Type abbreviation - flexible type in signature // Regression test for FSHARP1.0:3742 @@ -11,5 +11,5 @@ type C = class type D = class inherit C end - + type BadType = #C // <- flexible type (aka anonymous type with constraint) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation02.fs index fefed6de6a7..8573f8c8601 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules +// #Regression #Conformance #TypesAndModules // Verify error if creating a type abbreviation which results in an infinite type expression. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbbrev.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbbrev.fs index 6a5fdb842de..c620582b6a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbbrev.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbbrev.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypesAndModules +// #Regression #Conformance #TypesAndModules // Verify error when trying to inherit from type abbreviations. type Type1 = A | B type Type2 = Type1 * int -type Type3 = +type Type3 = class inherit Type2 end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_PrivateTypeAbbreviation02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_PrivateTypeAbbreviation02.fs index 73b1ac81118..060374e0f19 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_PrivateTypeAbbreviation02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_PrivateTypeAbbreviation02.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypesAndModules +// #Regression #Conformance #TypesAndModules // Regression test for FSharp1.0:5229 // Title: Allow private type abbreviations -module M = +module M = type private X = int * int let f (x:X) = x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_UnexpectedCharInTypeName01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_UnexpectedCharInTypeName01.fs index d5b609d17f3..53a83b988b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_UnexpectedCharInTypeName01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_UnexpectedCharInTypeName01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules +// #Regression #Conformance #TypesAndModules // Regression test for FSHARP1.0:2431 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/PrivateTypeAbbreviation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/PrivateTypeAbbreviation01.fs index 8816a13ef31..e1afc637ed7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/PrivateTypeAbbreviation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/PrivateTypeAbbreviation01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules +// #Regression #Conformance #TypesAndModules // Regression test for FSharp1.0:5229 // Title: Allow private type abbreviations -module M = +module M = type private X = int * int let f (x:X) = x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/TypeAbbreviationAfterForwardRef.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/TypeAbbreviationAfterForwardRef.fs index fdd43a9cfdc..063abf8330d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/TypeAbbreviationAfterForwardRef.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/TypeAbbreviationAfterForwardRef.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #TypesAndModules +// #Regression #Conformance #TypesAndModules // Regression test for FSHARP1.0:4949 // unusual interaction with type abbreviations, inference, and forward references -type IWibble = +type IWibble = abstract member wibble : int -> int -let g (y : double) (x : IWibble) : IWibble = x - -let f = g 2.0 -type mywibble = IWibble +let g (y : double) (x : IWibble) : IWibble = x + +let f = g 2.0 +type mywibble = IWibble try let (m : mywibble) = failwith "foo" printf "foo=%A\n" (f m) -with +with | ex -> () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang01.fs index 4b6335c3789..20420919c82 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang01.fs @@ -5,17 +5,17 @@ open System type Disposable(id: int) = static let mutable disposedIds = Set.empty static let mutable constructedIds = Set.empty - + do constructedIds <- constructedIds.Add(id) - + member _.Id = id - + static member GetDisposed() = disposedIds static member GetConstructed() = constructedIds static member Reset() = disposedIds <- Set.empty constructedIds <- Set.empty - + interface IDisposable with member this.Dispose() = disposedIds <- disposedIds.Add(this.Id) @@ -25,7 +25,7 @@ type DisposableBuilder() = use res = resource return! f res } - + member _.Bind(disposable: Disposable, f) = async.Bind(async.Return(disposable), f) member _.Return(x) = async.Return x member _.ReturnFrom(x) = x @@ -35,20 +35,20 @@ let counterDisposable = DisposableBuilder() let testBindingPatterns() = Disposable.Reset() - + counterDisposable { - use! res = new Disposable(1) + use! res = new Disposable(1) use! __ = new Disposable(2) use! (res1) = new Disposable(3) use! _ = new Disposable(4) use! (_) = new Disposable(5) return () } |> Async.RunSynchronously - + let constructed = Disposable.GetConstructed() let disposed = Disposable.GetDisposed() let undisposed = constructed - disposed - + if not undisposed.IsEmpty then printfn $"Undisposed instances: %A{undisposed}" failwithf "Not all disposables were properly disposed" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang02.fs index d57f0b8c14d..9a4503955c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang02.fs @@ -5,17 +5,17 @@ open System type Disposable(id: int) = static let mutable disposedIds = Set.empty static let mutable constructedIds = Set.empty - + do constructedIds <- constructedIds.Add(id) - + member _.Id = id - + static member GetDisposed() = disposedIds static member GetConstructed() = constructedIds static member Reset() = disposedIds <- Set.empty constructedIds <- Set.empty - + interface IDisposable with member this.Dispose() = disposedIds <- disposedIds.Add(this.Id) @@ -25,7 +25,7 @@ type DisposableBuilder() = use res = resource return! f res } - + member _.Bind(disposable: Disposable, f) = async.Bind(async.Return(disposable), f) member _.Return(x) = async.Return x member _.ReturnFrom(x) = x @@ -35,7 +35,7 @@ let counterDisposable = DisposableBuilder() let testBindingPatterns() = Disposable.Reset() - + counterDisposable { use! _ = new Disposable(1) use! _ = new Disposable(2) @@ -43,11 +43,11 @@ let testBindingPatterns() = use! (_) = new Disposable(4) return () } |> Async.RunSynchronously - + let constructed = Disposable.GetConstructed() let disposed = Disposable.GetDisposed() let undisposed = constructed - disposed - + if not undisposed.IsEmpty then printfn $"Undisposed instances: %A{undisposed}" failwithf "Not all disposables were properly disposed" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang03.fs index 57c814c561a..e57506febc8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang03.fs @@ -3,20 +3,20 @@ type Disposable(id: int) = static let mutable disposedIds = Map.empty static let mutable constructedIds = Set.empty - + do constructedIds <- constructedIds.Add(id) - + member _.Id = id - + static member GetDisposed() = disposedIds static member GetConstructed() = constructedIds static member Reset() = disposedIds <- Map.empty constructedIds <- Set.empty - + interface IDisposable with - member this.Dispose() = - let currentCount = + member this.Dispose() = + let currentCount = match Map.tryFind this.Id disposedIds with | Some count -> count | None -> 0 @@ -28,7 +28,7 @@ type DisposableBuilder() = use res = resource return! f res } - + member _.Bind(disposable: Disposable, f) = async.Bind(async.Return(disposable), f) member _.Return(x) = async.Return x member _.ReturnFrom(x) = x @@ -38,34 +38,34 @@ let counterDisposable = DisposableBuilder() let testBindingPatterns() = Disposable.Reset() - + counterDisposable { - use! res = new Disposable(1) + use! res = new Disposable(1) use! __ = new Disposable(2) use! (res1) = new Disposable(3) use! _ = new Disposable(4) use! (_) = new Disposable(5) return () } |> Async.RunSynchronously - + let constructed = Disposable.GetConstructed() let disposed = Disposable.GetDisposed() - + let disposedSet = Set.ofSeq (Map.keys disposed) let undisposed = constructed - disposedSet - + if not undisposed.IsEmpty then printfn $"Undisposed instances: %A{undisposed}" failwithf "Not all disposables were properly disposed" - - let multipleDisposed = + + let multipleDisposed = disposed |> Map.filter (fun _ count -> count > 1) - + if not multipleDisposed.IsEmpty then printfn $"Objects disposed multiple times: %A{multipleDisposed}" failwithf "Some disposables were disposed multiple times" - + printfn $"Success! All %d{constructed.Count} disposables were properly disposed exactly once" testBindingPatterns() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang04.fs index 3c32e29bc46..d9e23c70bf9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang04.fs @@ -3,20 +3,20 @@ type Disposable(id: int) = static let mutable disposedIds = Map.empty static let mutable constructedIds = Set.empty - + do constructedIds <- constructedIds.Add(id) - + member _.Id = id - + static member GetDisposed() = disposedIds static member GetConstructed() = constructedIds static member Reset() = disposedIds <- Map.empty constructedIds <- Set.empty - + interface IDisposable with - member this.Dispose() = - let currentCount = + member this.Dispose() = + let currentCount = match Map.tryFind this.Id disposedIds with | Some count -> count | None -> 0 @@ -28,7 +28,7 @@ type DisposableBuilder() = use res = resource return! f res } - + member _.Bind(disposable: Disposable, f) = async.Bind(async.Return(disposable), f) member _.Return(x) = async.Return x member _.ReturnFrom(x) = x @@ -38,54 +38,54 @@ let counterDisposable = DisposableBuilder() let testBindingPatterns() = Disposable.Reset() - + counterDisposable { - use! res = new Disposable(1) + use! res = new Disposable(1) use! __ = new Disposable(2) use! (res1) = new Disposable(3) - + use! _ = new Disposable(4) use! _ = new Disposable(5) - + use! x = new Disposable(6) use! x = new Disposable(7) use! (_) = new Disposable(8) use! (_) = new Disposable(9) - + return () } |> Async.RunSynchronously - + let constructed = Disposable.GetConstructed() let disposed = Disposable.GetDisposed() - + let disposedSet = Set.ofSeq (Map.keys disposed) let undisposed = constructed - disposedSet - + if not undisposed.IsEmpty then printfn $"Undisposed instances: %A{undisposed}" failwithf "Not all disposables were properly disposed" - + // Verify each object was disposed exactly once - let incorrectlyDisposed = + let incorrectlyDisposed = disposed |> Map.partition (fun _ count -> count = 1) |> snd - + if not incorrectlyDisposed.IsEmpty then printfn $"Objects with incorrect disposal count: %A{incorrectlyDisposed}" failwithf "Some disposables were not disposed exactly once" - + let idChecks = - [1..9] |> List.map (fun id -> + [1..9] |> List.map (fun id -> match Map.tryFind id disposed with | Some 1 -> true | _ -> false ) - + if not ((List.forall id) idChecks) then failwithf "Not all disposable IDs were properly handled" - + printfn $"Success! All %d{constructed.Count} disposables were properly disposed exactly once, including repeated patterns" testBindingPatterns() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang05.fs index d71b7290d19..dae64d9fa67 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang05.fs @@ -5,17 +5,17 @@ open System type Disposable(id: int) = static let mutable disposedIds = Set.empty static let mutable constructedIds = Set.empty - + do constructedIds <- constructedIds.Add(id) - + member _.Id = id - + static member GetDisposed() = disposedIds static member GetConstructed() = constructedIds static member Reset() = disposedIds <- Set.empty constructedIds <- Set.empty - + interface IDisposable with member this.Dispose() = disposedIds <- disposedIds.Add(this.Id) @@ -25,7 +25,7 @@ type DisposableBuilder() = use res = resource return! f res } - + member _.Bind(disposable: Disposable, f) = async.Bind(async.Return(disposable), f) member _.Return(x) = async.Return x member _.ReturnFrom(x) = x @@ -35,20 +35,20 @@ let counterDisposable = DisposableBuilder() let testBindingPatterns() = Disposable.Reset() - + counterDisposable { - use! res:Disposable = new Disposable(1) + use! res:Disposable = new Disposable(1) use! __:Disposable = new Disposable(2) use! (res1: Disposable) = new Disposable(3) use! _: Disposable = new Disposable(4) use! (_: Disposable) = new Disposable(5) return () } |> Async.RunSynchronously - + let constructed = Disposable.GetConstructed() let disposed = Disposable.GetDisposed() let undisposed = constructed - disposed - + if not undisposed.IsEmpty then printfn $"Undisposed instances: %A{undisposed}" failwithf "Not all disposables were properly disposed" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs index 94ce5a3c03c..9604b360dd9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs @@ -17,7 +17,7 @@ module UseBangBindingsVersion9 = |> withDiagnostics [ (Error 1228, Line 43, Col 14, Line 43, Col 15, "'use!' bindings must be of the form 'use! = '") ] - + [] let ``UseBangBindings - UseBang02_fs - Current LangVersion`` compilation = compilation @@ -28,7 +28,7 @@ module UseBangBindingsVersion9 = |> withDiagnostics [ (Error 1228, Line 40, Col 14, Line 40, Col 15, "'use!' bindings must be of the form 'use! = '") ] - + [] let ``UseBangBindings - UseBang03_fs - Current LangVersion`` compilation = compilation @@ -39,7 +39,7 @@ module UseBangBindingsVersion9 = |> withDiagnostics [ (Error 1228, Line 46, Col 14, Line 46, Col 15, "'use!' bindings must be of the form 'use! = '") ] - + [] let ``UseBangBindings - UseBang04_fs - Current LangVersion`` compilation = compilation @@ -50,7 +50,7 @@ module UseBangBindingsVersion9 = |> withDiagnostics [ (Error 1228, Line 47, Col 14, Line 47, Col 15, "'use!' bindings must be of the form 'use! = '") ] - + [] let ``UseBangBindings - UseBang05_fs - Current LangVersion`` compilation = compilation @@ -88,7 +88,7 @@ module UseBangBindingsPreview = |> withLangVersion10 |> compileAndRun |> shouldSucceed - + [] let ``UseBangBindings - UseBang04_fs - Preview LangVersion`` compilation = compilation @@ -96,7 +96,7 @@ module UseBangBindingsPreview = |> withLangVersion10 |> compileAndRun |> shouldSucceed - + [] let ``UseBangBindings - UseBang05_fs - Preview LangVersion`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding01.fs index 4fbe7575b3a..d9416aa997c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding01.fs @@ -1,4 +1,4 @@ -// #DeclarationElements #LetBindings +// #DeclarationElements #LetBindings // open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindingDiscard01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindingDiscard01.fs index 28a6d38806f..a2579261047 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindingDiscard01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindingDiscard01.fs @@ -1,4 +1,4 @@ -// #DeclarationElements #LetBindings +// #DeclarationElements #LetBindings // let answer = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs index 7ccea723a8f..79f97bedaf4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs @@ -24,14 +24,14 @@ module UseBindings = |> withLangVersion80 |> compileAndRun |> shouldSucceed - + [] let ``UseBindings - UseBindingDiscard03_fs - Current LangVersion`` compilation = compilation |> asExe |> compileAndRun |> shouldSucceed - + [] let ``UseBindings - UseBinding01_fs - Current LangVersion`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs index 8340ac9be7f..c2015b8b8d6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs @@ -9,7 +9,7 @@ open FSharp.Test module Unmanaged = [] - let ``voidptr is unmanaged`` () = + let ``voidptr is unmanaged`` () = Fsx """ [] type Test<'T when 'T: unmanaged> = @@ -24,10 +24,10 @@ let _ = Test() |> withNoWarn 9 |> typecheck |> shouldSucceed - + [] - let ``nativeptr of voidptr works`` () = + let ``nativeptr of voidptr works`` () = Fsx """ let myVal : nativeptr = Unchecked.defaultof<_> """ @@ -35,7 +35,7 @@ let myVal : nativeptr = Unchecked.defaultof<_> |> shouldSucceed [] - let ``Struct with private field can be unmanaged`` () = + let ``Struct with private field can be unmanaged`` () = Fsx """ [] type Test<'T when 'T: unmanaged> = @@ -52,7 +52,7 @@ let _ = Test>>() |> shouldSucceed [] - let ``Struct with private managed field cannot be unmanaged`` () = + let ``Struct with private managed field cannot be unmanaged`` () = Fsx """ [] type Test<'T when 'T: unmanaged> = @@ -70,9 +70,9 @@ let _ = Test>>() |> withDiagnostics [ Error 1, Line 10, Col 9, Line 10, Col 33, "A generic construct requires that the type 'DoubleType' is an unmanaged type" Error 1, Line 11, Col 9, Line 11, Col 49, "A generic construct requires that the type 'DoubleType>' is an unmanaged type" ] - + [] - let ``voption considered unmanaged when inner type is unmanaged`` () = + let ``voption considered unmanaged when inner type is unmanaged`` () = Fsx """ let test (x: 'T when 'T : unmanaged) = () test (ValueSome 15) @@ -83,7 +83,7 @@ test (ValueSome (struct {|Field = 42|})) |> shouldSucceed [] - let ``voption not considered unmanaged when inner type is reference type`` () = + let ``voption not considered unmanaged when inner type is reference type`` () = Fsx """ let test (x: 'T when 'T : unmanaged) = () test (ValueSome "xxx") @@ -98,7 +98,7 @@ test (ValueSome (struct {|Field = Some 42|})) Error 1, Line 5, Col 35, Line 5, Col 42, "A generic construct requires that the type ''a option' is an unmanaged type" ] [] - let ``Option not considered unmanaged`` () = + let ``Option not considered unmanaged`` () = Fsx """ let test (x: 'T when 'T : unmanaged) = () test (None) @@ -408,7 +408,7 @@ let _ = Test>>() [] - let ``Consume C#-defined unmanaged constraint incorrectly in F# - report error`` () = + let ``Consume C#-defined unmanaged constraint incorrectly in F# - report error`` () = let csLib = CSharp "namespace CsLib{ public record struct CsharpStruct(T item) where T:unmanaged;}" |> withCSharpLanguageVersion CSharpLanguageVersion.Preview @@ -426,7 +426,7 @@ let y = new CsharpStruct(struct(1,"this is string")) |> withDiagnostics [(Error 1, Line 3, Col 13, Line 3, Col 45, "A generic construct requires that the type 'string' is an unmanaged type")] [] - let ``F# can consume C#-defined unmanaged constraint and call method with modreq`` () = + let ``F# can consume C#-defined unmanaged constraint and call method with modreq`` () = let csLib = CSharp """ namespace CsLib @@ -456,7 +456,7 @@ printf "%s" (CsharpStruct.Hi()) |> verifyOutput "MultiCaseUnion" [] - let ``FSharp generates modreq for CSharp to consume in preview`` () = + let ``FSharp generates modreq for CSharp to consume in preview`` () = Fsx "let testMyFunction (x: 'TUnmanaged when 'TUnmanaged : unmanaged) = ()" |> withLangVersionPreview |> compile @@ -472,7 +472,7 @@ printf "%s" (CsharpStruct.Hi()) } """] [] - let ``FSharp generates modreq for CSharp to consume in v9`` () = + let ``FSharp generates modreq for CSharp to consume in v9`` () = Fsx "let testMyFunction (x: 'TUnmanaged when 'TUnmanaged : unmanaged) = ()" |> withLangVersion10 |> compile @@ -489,7 +489,7 @@ printf "%s" (CsharpStruct.Hi()) [] - let ``Unmanaged constraint in lambda reproduces issue 17509`` () = + let ``Unmanaged constraint in lambda reproduces issue 17509`` () = // This test reproduces the issue https://github.com/dotnet/fsharp/issues/17509 // When UnmanagedConstraintCsharpInterop is enabled, it generates invalid IL // causing a TypeLoadException at runtime @@ -513,7 +513,7 @@ Main() |> verifyOutput "Hello: System.IntPtr is unmanagedseq [0n; 0n; 0n]" [] - let ``Unmanaged constraint in lambda generates invalid IL for Specialize method with preview version`` () = + let ``Unmanaged constraint in lambda generates invalid IL for Specialize method with preview version`` () = Fsx """ let Main() = let func (x:int) : 'T when 'T : unmanaged = Unchecked.defaultof<'T> @@ -541,7 +541,7 @@ Main() [] let ``C# can consume F#-defined struct with unmanaged constraint - valid`` () = - let fsharpLib = + let fsharpLib = Fs """namespace MyFsLib [] type FsharpStructWrapper<'TInner when 'TInner: unmanaged> = @@ -550,7 +550,7 @@ type FsharpStructWrapper<'TInner when 'TInner: unmanaged> = |> asLibrary |> withName "fsLib" - let app = + let app = CSharp """ using System; using MyFsLib; @@ -574,7 +574,7 @@ type FsharpStructWrapper<'TInner when 'TInner: unmanaged> = [] let ``C# can consume F#-defined struct with unmanaged constraint - and report error when invalid`` () = - let fsharpLib = + let fsharpLib = Fs """namespace MyFsLib [] type FsharpStructWrapper<'T when 'T: unmanaged> = @@ -596,7 +596,7 @@ module FsharpPreparedData = |> withLangVersionPreview |> withName "fsLib" - let app = + let app = CSharp """ using System; using MyFsLib; diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/ObjectConstructors.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/ObjectConstructors.fs index 483dde4c140..ed128805c8b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/ObjectConstructors.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/ObjectConstructors.fs @@ -131,7 +131,7 @@ module ObjectConstructors = |> ignore // SOURCE=ImplicitCtorsCallingBaseclassPassingSelf.fs - // This test intentionally throws exceptions to test exception handling + // This test intentionally throws exceptions to test exception handling // and can crash the test host on some platforms [] let ``ImplicitCtorsCallingBaseclassPassingSelf_fs`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_false.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_false.fs index fdedbead8b4..4b7d90c3db1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_false.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_false.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ApplicationExpressions +// #Regression #Conformance #ApplicationExpressions // Before check-in 11472, assert(false) had a special treatment (used to throw an AssertionFailure exception) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_false_DEBUG.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_false_DEBUG.fs index 82b664ca275..99cf86604f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_false_DEBUG.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_false_DEBUG.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ApplicationExpressions +// #Regression #Conformance #ApplicationExpressions // Before check-in 11472, assert(false) had a special treatment (used to throw an AssertionFailure exception) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_true.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_true.fs index 1503f18d6a6..033a8f3020f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_true.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/Assertion/Assert_true.fs @@ -1,4 +1,4 @@ -// #Conformance #ApplicationExpressions +// #Conformance #ApplicationExpressions // Assert expressions // Special cases: // - assert(true) ==> should not throw diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/E_PostfixType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/E_PostfixType01.fs index 3fe7bda3e32..5b97e65e783 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/E_PostfixType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/E_PostfixType01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ApplicationExpressions +// #Regression #Conformance #ApplicationExpressions // Regression test for FSHARP1.0:5525 // Deprecate postfix type application in "new" and "inherit" constructs //Unexpected identifier in expression$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/E_PostfixType03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/E_PostfixType03.fs index aedb265593a..f61a7b654a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/E_PostfixType03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/E_PostfixType03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ApplicationExpressions +// #Regression #Conformance #ApplicationExpressions // Regression test for FSHARP1.0:5525 // Deprecate postfix type application in "new" and "inherit" constructs //Unexpected identifier in member definition$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/PostfixType02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/PostfixType02.fs index e76e7348ce3..45bf16f6213 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/PostfixType02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/PostfixType02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ApplicationExpressions +// #Regression #Conformance #ApplicationExpressions // Regression test for FSHARP1.0:5525 // Deprecate postfix type application in "new" and "inherit" constructs // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/ObjectConstruction/E_ObjectConstruction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/ObjectConstruction/E_ObjectConstruction01.fs index 3f10b356341..000c6031999 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/ObjectConstruction/E_ObjectConstruction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/ObjectConstruction/E_ObjectConstruction01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ApplicationExpressions #ObjectConstructors +// #Regression #Conformance #ApplicationExpressions #ObjectConstructors // Verify error for inaccessible constructor //The type 'BitArray' does not define a field, constructor, or member named 'BitArrayEnumeratorSimple' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/ObjectConstruction/ObjectConstruction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/ObjectConstruction/ObjectConstruction01.fs index 60eb9f78043..aec8704aa9e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/ObjectConstruction/ObjectConstruction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/ObjectConstruction/ObjectConstruction01.fs @@ -1,10 +1,10 @@ -// #Conformance #ApplicationExpressions #ObjectConstructors +// #Conformance #ApplicationExpressions #ObjectConstructors // Sanity check Object Construction via constructors // type Foo = val m_value : int - member this.Value = this.m_value + member this.Value = this.m_value public new() = { m_value = -1 } public new(x) = { m_value = x } public new(x:string,y:string) = { m_value = -2 } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/AmbigLetBinding.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/AmbigLetBinding.fs index d089cecc7be..a5bf4debd6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/AmbigLetBinding.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/AmbigLetBinding.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Binding +// #Regression #Conformance #Binding // Regression test for FSHARP1.0:1917 // Verify that when given an ambiguous let binding we treat it as a function binding, rather than a pattern match. @@ -20,7 +20,7 @@ let id x = x let Ident h = 42 // Now call that function -if (Ident ("tuple", 1)) <> 42 then +if (Ident ("tuple", 1)) <> 42 then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs index f5324a634f6..035d18e3445 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs @@ -157,7 +157,7 @@ module BindingExpressions = |> withDiagnostics [ (Warning 64, Line 10, Col 32, Line 10, Col 33, "This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'.") ] - + [] let ``UpperBindingPattern_fs v9`` compilation = compilation @@ -190,12 +190,12 @@ module BindingExpressions = (Warning 49, Line 117, Col 37, Line 117, Col 40, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.") (Warning 49, Line 122, Col 12, Line 122, Col 15, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.") ] - + [] let ``UpperBindingPattern_fs`` compilation = compilation |> getCompilation - |> asExe + |> asExe |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/MutableLocals01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/MutableLocals01.fs index 9a4805bdddf..e5beb6d29b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/MutableLocals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/MutableLocals01.fs @@ -28,7 +28,7 @@ module ExecTests = let test1() = let mutable exec_test_1 = 1 - (fun () -> exec_test_1 <- exec_test_1 + 1), (fun () -> exec_test_1 <- exec_test_1 + 2), (fun () -> exec_test_1) + (fun () -> exec_test_1 <- exec_test_1 + 1), (fun () -> exec_test_1 <- exec_test_1 + 2), (fun () -> exec_test_1) let incr, incr2, get = test1() @@ -48,8 +48,8 @@ module ExecTests = let result () = (v1,v2,v3,v4,v5) = exp - let check() = - if result() then true + let check() = + if result() then true else eprintfn "FAIL: (v1,v2,v3,v4,v5) = %A, expected %A" (v1,v2,v3,v4,v5) exp false @@ -98,7 +98,7 @@ module IntTests = let test1d() = let mutable ix1d = 1 - let f () = + let f () = printfn "don't inline me" printfn "don't inline me" printfn "don't inline me" @@ -118,7 +118,7 @@ module IntTests = let test1f() = let mutable ix1f_NOT_IF_OPT = 1 - let f () = + let f () = printfn "don't inline me" printfn "don't inline me" printfn "don't inline me" @@ -129,21 +129,21 @@ module IntTests = (* [] - type S = + type S = val mutable x : int member this_NO.M() = [ (fun () -> this_NO.x <- this_NO.x + 1) ] *) let test2() = let mutable ix2 = 1 - [ (fun () -> + [ (fun () -> let xaddr = &ix2 xaddr )] let test3() = let mutable ix3 = 1 - [ (fun () -> + [ (fun () -> let xaddr = &ix3 xaddr <- 2 )] @@ -183,14 +183,14 @@ module StringTests = let test2() = let mutable sx2 = "1" - [ (fun () -> + [ (fun () -> let xaddr = &sx2 xaddr )] let test3() = let mutable sx3 = "1" - [ (fun () -> + [ (fun () -> let xaddr = &sx3 xaddr <- "2" )] @@ -204,7 +204,7 @@ module NestedLambdas = let test2() = - [ (fun () -> + [ (fun () -> let mutable nlx2 = 1 [(fun () -> nlx2 <- nlx2 + 1)]) ] @@ -232,10 +232,10 @@ module SeqExpr = let test2() = seq { for x in [1..10] do let mutable nlx1 = 1 - let f() = - nlx1 <- nlx1 + 1; + let f() = + nlx1 <- nlx1 + 1; nlx1 - let g() = nlx1 + let g() = nlx1 yield f yield g } @@ -251,7 +251,7 @@ module AsyncExpr = nlx1 <- 3 do! Async.Sleep 10 printfn "nlx1 = %d" nlx1 - nlx1 <- nlx1 + 1 + nlx1 <- nlx1 + 1 printfn "nlx1 = %d" nlx1 do! Async.Sleep 10 printfn "nlx1 = %d" nlx1 @@ -262,45 +262,45 @@ module AsyncExpr = module TryWith = - let foo o s = + let foo o s = let mutable x_NO = 1 - try + try o s x_NO with exn -> x_NO <- 5 - let foo2 o s = + let foo2 o s = let mutable x_NO = 1 - try + try o s x_NO x_NO <- 5 with exn -> () - let bar o s = + let bar o s = let mutable x = 1 try o () - with exn -> + with exn -> s := (fun () -> x <- x + 1) module TryFinally = - let foo o s = + let foo o s = let mutable x_NO = 1 - try + try o s x_NO finally x_NO <- 5 - let foo2 o s = + let foo2 o s = let mutable x_NO = 1 - try + try o s x_NO x_NO <- 5 finally s () - let bar o s = + let bar o s = let mutable x = 1 try o () @@ -309,23 +309,23 @@ module TryFinally = module ForLoop = - let foo o s = + let foo o s = let mutable x_NO = 1 for i in o do x_NO <- x_NO + 1 - let bar o s = + let bar o s = let mutable x = 1 for i in o do s := (fun () -> x <- x + 1) module WhileLoop = - let foo o s = + let foo o s = let mutable x_NO = 1 - while (s x_NO) do + while (s x_NO) do x_NO <- x_NO + 1 - let bar o s = + let bar o s = let mutable x = 1 while o x do s := (fun () -> x <- x + 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/W_TypeInferforGenericType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/W_TypeInferforGenericType.fs index 6d64e5dbac0..30989a3ec31 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/W_TypeInferforGenericType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/W_TypeInferforGenericType.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #Binding +// #Regression #Conformance #Binding namespace One module One = // Regression test for bug 4083: Extend "inferred type is less generic than the given type annotations" warning to cover cases where a user-authored 'b is constrained to be an 'a - + let f2 (x : 'a) (y : 'b) = x : 'b diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in03.fs index 5b9547f51c6..c96771e8226 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in03.fs @@ -7,6 +7,6 @@ //The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ // module C - let a = 3 + let a = 3 a + 1 |> ignore a > 4 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in05.fs index 0c386d1676d..101a57bbe92 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in05.fs @@ -6,7 +6,7 @@ //The type 'int' does not match the type 'unit'$ //The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ -module E = +module E = let a = 3 in a + 1 |> ignore a + 1 |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/ComputationExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/ComputationExpressions.fs index 7607e632493..b79bcb94fbc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/ComputationExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/ComputationExpressions.fs @@ -316,9 +316,9 @@ module LetUseBangTests = |> asExe |> compile |> withDiagnostics [ - (Error 750, Line 3, Col 13, Line 3, Col 17, + (Error 750, Line 3, Col 13, Line 3, Col 17, "This construct may only be used within computation expressions"); - (Error 748, Line 4, Col 13, Line 4, Col 20, + (Error 748, Line 4, Col 13, Line 4, Col 20, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bigint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bigint.fs index f66aeb7c56e..36a01627c0e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bigint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bigint.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bigint02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bigint02.fs index 1b2b4df8dea..eb707040540 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bigint02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bigint02.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bool.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bool.fs index dec80621450..64a2971e0cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bool.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/bool.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/byte.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/byte.fs index 24d218beac4..52b8890e7b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/byte.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/byte.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 32uy // byte let check(x:byte) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/byteArr.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/byteArr.fs index f1bb74cc8a9..8b1e7fbabfa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/byteArr.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/byteArr.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/char.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/char.fs index 15ee6146c6e..7287912ee2f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/char.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/char.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/double.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/double.fs index 3450a4259bc..36dc8ef9d69 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/double.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/double.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/float.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/float.fs index 646ef89eecf..e1c9a729bbf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/float.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/float.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/float32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/float32.fs index 8e5c399abcb..ed876647534 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/float32.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/float32.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -6,9 +6,9 @@ // - the type we get is what we meant it to be -let v1 = 1.0f // float32/single +let v1 = 1.0f // float32/single let v2 = 1.01f // float32/single -let v3 = 1.01e10f // float32/single +let v3 = 1.01e10f // float32/single let check(x:float32) = true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int.fs index ad90d0ac20e..63a3872c77d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 86 // int let check(x:int) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int16.fs index 1bc4e1aca21..de1f5d107c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int16.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 17s // int16 let check(x:int16) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int32.fs index 41221816d33..964553c82e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int32.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int32.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 86 // int32 let check(x:int32) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int64.fs index 38d2a1621ec..753daca53d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int64.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/int64.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 99999999L // int64 let check(x:int64) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/nativenint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/nativenint.fs index e98cd07d860..8644bb5bd00 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/nativenint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/nativenint.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/sbyte.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/sbyte.fs index a93ae4c5b1f..22da2cf0bde 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/sbyte.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/sbyte.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 3y // sbyte let check(x:sbyte) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/single.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/single.fs index e0f1672c304..4a7ba5a5069 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/single.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/single.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -6,9 +6,9 @@ // - the type we get is what we meant it to be -let v1 = 1.0f // float32/single +let v1 = 1.0f // float32/single let v2 = 1.01f // float32/single -let v3 = 1.01e10f // float32/single +let v3 = 1.01e10f // float32/single let check(x:single) = true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/string.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/string.fs index 3bcae1f2066..63bfbd39847 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/string.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/string.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint16.fs index 77d64882d12..d259cab2006 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint16.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 18us // uint16 let check(x:uint16) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint32.fs index 06c39837491..9b6013783b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint32.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint32.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 99u // uint32 let check(x:uint32) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint64.fs index 546361ae7eb..1efcf24ee32 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint64.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/uint64.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 10328273UL // uint64 let check(x:uint64) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/unativenint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/unativenint.fs index 7870ea57750..ccdd271964b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/unativenint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/unativenint.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/unit.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/unit.fs index 36305613290..2ac707c95de 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/unit.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ConstantExpressions/unit.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants +// #Conformance #Constants // Constant expressions // This is the example quoted from the specs // Verification: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/LiteralNull01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/LiteralNull01.fs index 8f85e2f4449..b99cf794522 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/LiteralNull01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/LiteralNull01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow +// #Regression #Conformance #ControlFlow // Regression test for FSHARP1.0:2323 (Compiler ICE when matching on literal Null) // @@ -11,6 +11,6 @@ let mutable res = 0 match box x with | Null -> res <- 1 - | _ -> res <- 0 + | _ -> res <- 0 exit res diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs index 2f88587276e..8b36fa8250c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module PatternMatching = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - + [] let ``W_PatternMatchingCounterExample01_fs`` compilation = compilation @@ -23,7 +23,7 @@ module PatternMatching = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - + [] let ``W_PatternMatchingCounterExample02_fs`` compilation = compilation @@ -37,7 +37,7 @@ module PatternMatching = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - + [] let ``W_PatternMatchingCounterExample03_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_Function01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_Function01.fs index 8bca73e1183..9b34cf3315f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_Function01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_Function01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow +// #Regression #Conformance #ControlFlow // Regression test for FSharp1.0:1713 // FS0025: Incomplete pattern matches on this expression... - wording could be improved a bit //'0.0' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample01.fs index 31cf83a697c..ff4c8be8832 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow +// #Regression #Conformance #ControlFlow // Regression test for FSHARP1.0:1986 (conter example in complex pattern matching) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample02.fs index ba0414c7062..f98ea33aa0a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow +// #Regression #Conformance #ControlFlow // Regression test for FSHARP1.0:1986 (conter example in complex pattern matching) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample03.fs index 24a5f6a125d..45e35d8b352 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow +// #Regression #Conformance #ControlFlow // Regression test for FSHARP1.0:1986 (counter example in complex pattern matching) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/E_BadIEnumerable01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/E_BadIEnumerable01.fs index d03c7cd6a3a..489d48a1c0a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/E_BadIEnumerable01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/E_BadIEnumerable01.fs @@ -3,18 +3,18 @@ //The type 'En' is not a valid enumerator type , i\.e\. does not have a 'MoveNext\(\)' method returning a bool, and a 'Current' property$ //The type 'En<'a>' is not a valid enumerator type , i\.e\. does not have a 'MoveNext\(\)' method returning a bool, and a 'Current' property$ -[] +[] type Struct = val x:int val y:int - + type En<'a>(mvNext:'a) = member x.Current = 1 member x.MoveNext() = mvNext - + type T<'a>(mvNext:'a) = member x.GetEnumerator() = En mvNext - + let s = seq { for i in T true -> i } let t = seq { for i in T "test" -> i } let u = seq { for i in T (Struct()) -> i } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/IEnumerableIteration01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/IEnumerableIteration01.fs index 89f54be4456..f7a4c0b0f50 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/IEnumerableIteration01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/IEnumerableIteration01.fs @@ -7,21 +7,21 @@ open System.Collections type IOther = abstract member Test : int -> int -type Arr(a : int[]) = +type Arr(a : int[]) = interface IOther with member this.Test x = x + 1 - interface IEnumerable with - member this.GetEnumerator() = + interface IEnumerable with + member this.GetEnumerator() = let i = ref -1 - { new IEnumerator with - member this.Reset() = failwith "not supported" - member this.MoveNext() = incr i; !i < a.Length - member this.Current = box (a.[!i]) + { new IEnumerator with + member this.Reset() = failwith "not supported" + member this.MoveNext() = incr i; !i < a.Length + member this.Current = box (a.[!i]) } -let a = Arr([|1;2;3;4;5|]) +let a = Arr([|1;2;3;4;5|]) let mutable x = 0 -for i in a do +for i in a do x <- x + unbox i exit <| (if x = 15 then 0 else 1) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs index cef9f9b4abb..63ea684bb6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module SequenceIteration = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/SequenceIteration) - + [] let ``W_IncompleteMatchFor01_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration01.fs index 83179a8f80c..42526a21993 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration01.fs @@ -1,4 +1,4 @@ -// #Conformance #ControlFlow #Sequences +// #Conformance #ControlFlow #Sequences // Test Sequence iteration expressions (for loops). diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/W_IncompleteMatchFor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/W_IncompleteMatchFor01.fs index 341002098fc..485001b2827 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/W_IncompleteMatchFor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/W_IncompleteMatchFor01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow #Sequences +// #Regression #Conformance #ControlFlow #Sequences // Regression for FSHARP1.0:5733 // For expressions should warn when elements will be skipped just like computation expressions do @@ -19,11 +19,11 @@ for 1 in [1;2;3] do // These warned prior to the fix and throw runtime exceptions async { - for Some(nm) in [ Some("James"); None; Some("John") ] do - printfn "%d" nm.Length -} |> Async.RunSynchronously - - + for Some(nm) in [ Some("James"); None; Some("John") ] do + printfn "%d" nm.Length +} |> Async.RunSynchronously + + let s2 = seq { for Some(nm) in [ Some("James"); None; Some("John") ] do yield nm.Length } s2 |> Seq.iter (printfn "%A") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/Downto01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/Downto01.fs index dfb86e8a5da..d0e99c547f3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/Downto01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/Downto01.fs @@ -1,4 +1,4 @@ -// #Conformance #ControlFlow +// #Conformance #ControlFlow // Sanity check the 'downto' keyword diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/E_ForRequiresInt01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/E_ForRequiresInt01.fs index c8d4e378cb9..ac0e5e2956f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/E_ForRequiresInt01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/E_ForRequiresInt01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow +// #Regression #Conformance #ControlFlow // Verify for loops require integer values for bounds //This expression was expected to have type. 'int' .but here has type. 'float' //This expression was expected to have type. 'int' .but here has type. 'float' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/ForWithUppercaseIdentifier01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/ForWithUppercaseIdentifier01.fs index d89cd8f1316..81af8c9ecda 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/ForWithUppercaseIdentifier01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SimpleFor/ForWithUppercaseIdentifier01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow +// #Regression #Conformance #ControlFlow // Regression for Dev10:850869 // Previously, using an uppercase identifier in the loop variable caused an error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryFinally/TryFinallyInSequence01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryFinally/TryFinallyInSequence01.fs index 94a0c98211b..4b7f3e424ee 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryFinally/TryFinallyInSequence01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryFinally/TryFinallyInSequence01.fs @@ -1,4 +1,4 @@ -// #Regression #Sequences #Conformance #ControlFlow #Exceptions +// #Regression #Sequences #Conformance #ControlFlow #Exceptions // Test issue 4234. The behavior here differs from the equivalent C# but that's ok. Just make sure if it changes we notice. let mutable result = "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryFinally/W-TryFinallyNotUnit.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryFinally/W-TryFinallyNotUnit.fs index 71de5549bca..2ea4a8c6886 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryFinally/W-TryFinallyNotUnit.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryFinally/W-TryFinallyNotUnit.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow #Exceptions +// #Regression #Conformance #ControlFlow #Exceptions // Verify warning if a finally block does not return 'unit' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/E_RethrowOutsideWith01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/E_RethrowOutsideWith01.fs index 2ac2e867992..4d297c51935 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/E_RethrowOutsideWith01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/E_RethrowOutsideWith01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ControlFlow #Exceptions +// #Regression #Conformance #ControlFlow #Exceptions //Calls to 'reraise' may only occur directly in a handler of a try-with$ reraise() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith01.fs index c8fb801bdf8..afda9ee5a74 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith01.fs @@ -1,4 +1,4 @@ -// #Conformance #ControlFlow #Exceptions +// #Conformance #ControlFlow #Exceptions // Verify simple try with blogs work diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith02.fs index e47204e291f..fd85c66cb7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith02.fs @@ -1,4 +1,4 @@ -// #Conformance #ControlFlow #Exceptions +// #Conformance #ControlFlow #Exceptions // Verify simple try finally blogs work diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith03.fs index 3d235c60d43..52a69827812 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/TryWith/TryWith03.fs @@ -1,7 +1,7 @@ type MyRec = { A : int; B : string } [] -type NullType(i:int) = +type NullType(i:int) = member __.X = i let updateRecd x = @@ -9,7 +9,7 @@ let updateRecd x = { x with A = 42 } with e -> { A = 0; B = "success" } - + if (updateRecd Unchecked.defaultof).B <> "success" then exit 1 let touchType (x : NullType) = @@ -17,10 +17,10 @@ let touchType (x : NullType) = x.X with e -> -1 - + if (touchType null) <> -1 then exit 1 exit 0 - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_RigidTypeAnnotation03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_RigidTypeAnnotation03.fs index 7d53af4f9aa..8dab893f5b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_RigidTypeAnnotation03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_RigidTypeAnnotation03.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations +// #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations // Regression test for FSharp1.0:3644 - Type annotation ignored for lookup of union case //This expression was expected to have type. 'int' .but here has type. 'string' type Data<'a> = ConsData of 'a * Data<'a> | EmptyData -let d = (Data.ConsData("A", Data.EmptyData)) +let d = (Data.ConsData("A", Data.EmptyData)) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02.fs index 0c557791d3f..87e52da052e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations +// #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations // Regression test for FSHARP1.0:2346 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02b.fs index ce96329a6e1..5a364a2fcab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations +// #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations // Regression test for FSHARP1.0:2346 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/rigidtypeannotation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/rigidtypeannotation01.fs index 8f257a4bb41..10bd069b277 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/rigidtypeannotation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/rigidtypeannotation01.fs @@ -1,6 +1,6 @@ -// #Conformance #TypeRelatedExpressions #TypeAnnotations +// #Conformance #TypeRelatedExpressions #TypeAnnotations let p = (1 : int) -let f x = (x : string) +let f x = (x : string) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/staticcoercion01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/staticcoercion01.fs index 4ebb17f8435..a4e942d1823 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/staticcoercion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/staticcoercion01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeRelatedExpressions #TypeAnnotations +// #Conformance #TypeRelatedExpressions #TypeAnnotations (1 :> obj) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/staticcoercion01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/staticcoercion01b.fs index 57c54348644..f7ec0133e8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/staticcoercion01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/staticcoercion01b.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeRelatedExpressions #TypeAnnotations +// #Conformance #TypeRelatedExpressions #TypeAnnotations [] type s diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/AddressOf/E_byrefvaluesnotpermitted001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/AddressOf/E_byrefvaluesnotpermitted001.fs index 9b8e4df31aa..265b02a0a73 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/AddressOf/E_byrefvaluesnotpermitted001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/AddressOf/E_byrefvaluesnotpermitted001.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions +// #Regression #Conformance #DataExpressions // AddressOf Operator (errors) // Verify we can the compiler always issue warnings about using & and && operators //A byref typed value would be stored here\. Top-level let-bound byref values are not permitted diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/BuilderViaExtMethods.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/BuilderViaExtMethods.fs index d6901a32e2f..9c2131ca38c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/BuilderViaExtMethods.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/BuilderViaExtMethods.fs @@ -1,24 +1,24 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Verify you can create a workflow builder via extension methods // Regression test for FSHARP1.0:5040 type System.String with - + member this.Bind(result : string -> string, rest : string -> 'b) = rest <| result this - + member this.Bind(result : unit -> 'a, rest : 'a -> 'b) = rest <| result() - + member this.Return(x) = x + this - - + + let result = "foo" { let! x = (fun (str : string) -> str + "." + str) let! y = (fun () -> "!") return x + y } - + if result <> "foo.foo!foo" then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/Capacity01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/Capacity01.fs index 85b3084c1ee..cc06d29897e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/Capacity01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/Capacity01.fs @@ -1,5 +1,5 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions #ReqRetail -// Capacity. Verify creating a computation expression with many let! bindings. +// #Regression #Conformance #DataExpressions #ComputationExpressions #ReqRetail +// Capacity. Verify creating a computation expression with many let! bindings. // Notice: this test will fail on non Retail builds (by design, as per FSHARP1.0:5082) // Sequence expression. Note that 'let!' in sequence expressions isn't permitted. // Nesting for loops instead... @@ -38,7 +38,7 @@ let test1 = if Seq.length test1 <> 1 then exit 1 // Async workflow -let test2 = +let test2 = async { let! a = async { return 1 } in let! b = async { return 1 } in let! c = async { return 1 } in let! d = async { return 1 } in let! e = async { return 1 } in let! f = async { return 1 } in @@ -49,7 +49,7 @@ let test2 = let! s = async { return 1 } in let! t = async { return 1 } in let! u = async { return 1 } in let! v = async { return 1 } in let! w = async { return 1 } in let! x = async { return 1 } in let! y = async { return 1 } in let! z = async { return 1 } - + let! a2= async { return 1 } in let! b2= async { return 1 } in let! c2= async { return 1 } in let! d2= async { return 1 } in let! e2= async { return 1 } in let! f2= async { return 1 } in let! g2= async { return 1 } in let! h2= async { return 1 } in let! i2= async { return 1 } in @@ -59,7 +59,7 @@ let test2 = let! s2= async { return 1 } in let! t2= async { return 1 } in let! u2= async { return 1 } in let! v2= async { return 1 } in let! w2= async { return 1 } in let! x2= async { return 1 } in let! y2= async { return 1 } in let! z2= async { return 1 } - + let! a3= async { return 1 } in let! b3= async { return 1 } in let! c3= async { return 1 } in let! d3= async { return 1 } in let! e3= async { return 1 } in let! f3= async { return 1 } in let! g3= async { return 1 } in let! h3= async { return 1 } in let! i3= async { return 1 } in @@ -72,7 +72,7 @@ let test2 = return (a, b2, c3, d, e2, f3, g, j2, i3, j, k2, l3, m, n2, o3, p, q2, r3, s, t2, u3, v, w2, x3, y, z2) } |> Async.RunSynchronously - + if test2 <> (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods01.fs index 6dd4eb48675..fb31d36985a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods01.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #ComputationExpressions +// #Conformance #DataExpressions #ComputationExpressions // Verify the ability to define computation expression methods and // that they get called as part of a custom workflow builder. @@ -11,12 +11,12 @@ type BindBuilder() = member this.BindResults = List.toArray (!m_bindResults) member this.Bind(result : string, restOfComputation : string -> int) = - + m_bindResults := result :: !m_bindResults - + // Execute the rest restOfComputation result - + member this.Return(x : int) = x let test = new BindBuilder() @@ -25,16 +25,16 @@ let testResult = test { let! x = "foo" let! y = "bar" - + if x = "won't match..." then return -1 else return x.Length + y.Length } - -if testResult <> 6 then + +if testResult <> 6 then exit 1 - + if test.BindResults <> [| "bar"; "foo" |] then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods02.fs index 20430b495c9..807af475ddb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods02.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #ComputationExpressions +// #Conformance #DataExpressions #ComputationExpressions // Verify the ability to define computation expression methods and // that they get called as part of a custom workflow builder. @@ -15,20 +15,20 @@ type WorkflowBuilder() = member this.CombineCalledWith = Seq.toArray m_combineCalledWith member this.For(elements : seq<'item>, loopBody : 'item -> unit) = - + elements |> Seq.iter (fun item -> printfn "%d: %A" m_loopedElements.Count item m_loopedElements.Add(sprintf "%A" item) let _ = loopBody item ()) - + member this.Combine(firstPart : unit, secondPart : 'a) = m_combineCalledWith.Add(sprintf "%A" secondPart) secondPart - + member this.Delay (f : unit -> 'a) = f() - + member this.Zero() = () let workflow = new WorkflowBuilder() @@ -51,19 +51,19 @@ if result <> () then printfn "failed"; exit 1 if workflow.CombineCalledWith <> [| "()"; "()" |] then printfn "failed"; exit 1 -if workflow.LoopedElements <> +if workflow.LoopedElements <> [| - "1"; - "\"world\""; "\"universe\""; - "Int 1"; - "Char 'a'"; "Char 'b'"; + "1"; + "\"world\""; "\"universe\""; + "Int 1"; + "Char 'a'"; "Char 'b'"; "Int 2"; - "Char 'a'"; "Char 'b'"; - "2"; - "\"world\""; "\"universe\""; - "Int 1"; - "Char 'a'"; "Char 'b'"; - "Int 2"; + "Char 'a'"; "Char 'b'"; + "2"; + "\"world\""; "\"universe\""; + "Int 1"; + "Char 'a'"; "Char 'b'"; + "Int 2"; "Char 'a'"; "Char 'b'" |] then printfn "failed"; exit 1 printfn "Succeeded" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods03.fs index 47d8e84cda7..4eee002c597 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods03.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #ComputationExpressions +// #Conformance #DataExpressions #ComputationExpressions // Verify the ability to define computation expression methods and // that they get called as part of a custom workflow builder. @@ -10,21 +10,21 @@ type NoExnWorkflow() = member this.TryFinally<'a> (body : unit -> 'a, finallyBlock : unit -> unit) = // Don't execute finally block - this is how we verify it executes - // _our_ try/finally. + // _our_ try/finally. try body() with e -> Unchecked.defaultof<'a> - + member this.TryWith<'a> (body : unit -> 'a, catchBlock : exn -> 'a) = - + // Don't execute with block - this is how we verify it executes // _our_ try/with try body() with e -> Unchecked.defaultof<'a> - + member this.Delay<'a> (f : unit -> 'a) = f member this.Combine(firstPart, secondPart) = secondPart member this.Zero () = () @@ -41,7 +41,7 @@ let testFinally = finally failwith "TEST FAILURE: Finally block shouldn't be executed!" } - + if testFinally() <> 5 then exit 1 ////////////////////////////////////////////////// diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods04.fs index 88cbfd276b6..8617aaa86a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/CompExprMethods04.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #ComputationExpressions +// #Conformance #DataExpressions #ComputationExpressions // Verify the ability to define computation expression methods and // that they get called as part of a custom workflow builder. @@ -12,7 +12,7 @@ type WorkflowBuilder() = member this.Items = yieldedItems |> Array.ofSeq member this.Yield(item) = yieldedItems.Add(item) - member this.YieldFrom(items : seq) = + member this.YieldFrom(items : seq) = items |> Seq.iter (fun item -> yieldedItems.Add(item.ToUpper())) () @@ -31,7 +31,7 @@ let result = yield "foo" yield "bar" yield! [| "a"; "b"; "c" |] - + return () } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/DifferentGenericBuilders.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/DifferentGenericBuilders.fs index 9fc112b551c..2a92ef3bd86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/DifferentGenericBuilders.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/DifferentGenericBuilders.fs @@ -1,11 +1,11 @@ -// #Conformance #DataExpressions #ComputationExpressions +// #Conformance #DataExpressions #ComputationExpressions // Verify you can customize the behavior of a workflow builder // through the use of generics type WorkflowBuilder<'a>() = member this.Return(x) = x + typeof<'a>.Name - - + + let wf1 = new WorkflowBuilder() let result1 = wf1 { return "test1:" } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingCombine.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingCombine.fs index b06d74f93e9..09742a92d82 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingCombine.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingCombine.fs @@ -1,19 +1,19 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'Combine' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s member x.Zero() = S("l") member x.For(s : seq, rest: (int -> unit)) = S("") let t = new T() -let t' = t { +let t' = t { let a = 10 for x in [1] do () 0 |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingFor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingFor.fs index 3beeff93e94..19d7fc42f20 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingFor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingFor.fs @@ -1,18 +1,18 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'For' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s member x.Return() = S("l") let t = new T() -let t' = t { +let t' = t { let! x = S("1") for i in [S("A")] do () } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturn.fs index 5010e70386b..4bae0bb2335 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturn.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'Return' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s let t = new T() -let t' = t { +let t' = t { let! x = S("1") return S("2") } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturnFrom.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturnFrom.fs index f8185a9b7fa..b78c7a09766 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturnFrom.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturnFrom.fs @@ -1,18 +1,18 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'ReturnFrom' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s member x.Zero() = S("0") let t = new T() -let t' = t { +let t' = t { let! x = S("1") return! S("2") } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingTryFinally.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingTryFinally.fs index 9991c25ce2a..4d773bb8808 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingTryFinally.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingTryFinally.fs @@ -1,22 +1,22 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'TryFinally' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s member x.Return() = S("l") member x.Zero() = S("l") let t = new T() -let t' = t { +let t' = t { let! x = S("1") - try + try () - finally + finally () } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingTryWith.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingTryWith.fs index 3807980a106..4eccdbc1902 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingTryWith.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingTryWith.fs @@ -1,22 +1,22 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'TryWith' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s member x.Return() = S("l") member x.Zero() = S("l") let t = new T() -let t' = t { +let t' = t { let! x = S("1") - try + try () - with + with | _ -> () } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingUsing.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingUsing.fs index e83604cfdf9..3fafa7337af 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingUsing.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingUsing.fs @@ -1,18 +1,18 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'Using' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s member x.Return() = S("l") let t = new T() -let t' = t { +let t' = t { let! x = S("1") use w = new T() return w diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingWhile.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingWhile.fs index cc6818008c7..edf29ad6034 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingWhile.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingWhile.fs @@ -1,18 +1,18 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'While' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s member x.Return() = S("l") let t = new T() -let t' = t { +let t' = t { let! x = S("1") while true do () } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYield.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYield.fs index 7251faf3978..cdb856ad9dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYield.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYield.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'Yield' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s let t = new T() -let t' = t { +let t' = t { let! x = S("1") yield S("2") } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYieldFrom.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYieldFrom.fs index 3777c375f2b..82b4b0d740a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYieldFrom.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYieldFrom.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'YieldFrom' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s let t = new T() -let t' = t { +let t' = t { let! x = S("1") yield! S("2") } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingZero.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingZero.fs index 1442f1077e7..977aff336e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingZero.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingZero.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:6149 //This control construct may only be used if the computation expression builder defines a 'Zero' method$ -type R = S of string - -type T() = - member x.Bind(p: R, rest: (string -> R)) = - match p with - | S(s) -> rest s +type R = S of string + +type T() = + member x.Bind(p: R, rest: (string -> R)) = + match p with + | S(s) -> rest s let t = new T() -let t' = t { +let t' = t { let! x = S("1") S("2") } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_TypeAlias01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_TypeAlias01.fs index f37607979e3..3a3e06a0f90 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_TypeAlias01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/E_TypeAlias01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions #ReqRetail +// #Regression #Conformance #DataExpressions #ComputationExpressions #ReqRetail // Dev11:207112 //This expression was expected to have type. ''a -> 'b' .but here has type. 'AsyncBuilder' //Invalid record, sequence or computation expression\. Sequence expressions should be of the form 'seq { \.\.\. }' @@ -7,6 +7,6 @@ let g x = x let x = f "test" { return 1 } // ok let y = f async { return 1 } // also ok, same result -let z = g async { return 1 } +let z = g async { return 1 } let a = (g async) { return 1 } // ok diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MinMaxValuesInLoop01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MinMaxValuesInLoop01.fs index 51fe93bf94f..a3243f37012 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MinMaxValuesInLoop01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MinMaxValuesInLoop01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:4370 // for loops involving System.Int32.MaxValue as the upper limit does not work correctly @@ -20,7 +20,7 @@ i <- System.Int32.MinValue + 2 while i > System.Int32.MinValue do acc <- acc - 1 i <- i - 1 - + if acc <> 0 then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MinMaxValuesInLoop02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MinMaxValuesInLoop02.fs index 22e03d2cfd2..55ea59bea3c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MinMaxValuesInLoop02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MinMaxValuesInLoop02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ComputationExpressions +// #Regression #Conformance #DataExpressions #ComputationExpressions // Regression test for FSHARP1.0:4370 // for loops involving System.Int32.MinValue diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MutateBuilders.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MutateBuilders.fs index b3bdd110121..fcd3e0ecf2a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MutateBuilders.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/MutateBuilders.fs @@ -1,32 +1,32 @@ -// #Conformance #DataExpressions #ComputationExpressions +// #Conformance #DataExpressions #ComputationExpressions // Verify you can mutate the computation expression builder // Verify you can use a builder returned from a function type SimpleWorkflow(logMsg : string) = member this.Bind(result : string, restOfComputation : string -> 'a) = - + restOfComputation (result + "!" + logMsg + "!" + result) - + member this.Return x = x - - + + let getBuilder logMsg = new SimpleWorkflow(logMsg) // Get builder from function -let result = +let result = getBuilder "Message for you sir" { let! x = "foo" let! y = "bar" return (x + "~" + y) } - -if result <> "foo!Message for you sir!foo~bar!Message for you sir!bar" then + +if result <> "foo!Message for you sir!foo~bar!Message for you sir!bar" then exit 1 - + // Mutate the builder let mutable builder = getBuilder "*" -let test1 = builder { +let test1 = builder { let! x = "1" return x } @@ -34,7 +34,7 @@ if test1 <> "1!*!1" then exit 1 builder <- getBuilder "#" -let test2 = builder { +let test2 = builder { let! x = "2" return x } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/NonClassWorkflow01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/NonClassWorkflow01.fs index 91da9deca69..b216ab1c961 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/NonClassWorkflow01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/NonClassWorkflow01.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #ComputationExpressions +// #Conformance #DataExpressions #ComputationExpressions // Verify you can have a non-class based computation expression workflow builder type make = string @@ -8,19 +8,19 @@ type Transport = | Car of make * model | Bike | Walking - + member this.Bind(result : unit -> 'a, rest : 'a -> 'b) = rest <| result() - + member this.Return(x) = x + match this with | Car(_) -> 100 | Bike -> 10 | Walking -> 1 - + let mySweetRide = Car("1981", "Tercel") let result = - mySweetRide { + mySweetRide { let! x = fun () -> 42 return x } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/RunAndDelay01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/RunAndDelay01.fs index d2ce23b0e50..1ee54f838b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/RunAndDelay01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ComputationExpressions/RunAndDelay01.fs @@ -1,53 +1,53 @@ -// #Conformance #DataExpressions #ComputationExpressions +// #Conformance #DataExpressions #ComputationExpressions // Verify the startup semantics of Run and Delay based on whether or not they // are present. type RunDelayWorkflow() = member this.Run(x) = "RUN-" + x + "-RUN" - - member this.Delay(f) = + + member this.Delay(f) = "DELAY-" + f() + "-DELAY" - + member this.Return(x) = "RET-" + x + "-RET" - + let test1 = (new RunDelayWorkflow()) { return "1" } if test1 <> "RUN-DELAY-RET-1-RET-DELAY-RUN" then exit 1 //////////////////////////////////////////////////// type DelayWorkflow() = - - member this.Delay(f) = + + member this.Delay(f) = "DELAY-" + f() + "-DELAY" - + member this.Return(x) = "RET-" + x + "-RET" - + let test2 = (new DelayWorkflow()) { return "2" } if test2 <> "DELAY-RET-2-RET-DELAY" then exit 1 //////////////////////////////////////////////////// type RunWorkflow() = - - member this.Run(x) = + + member this.Run(x) = "RUN-" + x + "-RUN" - + member this.Return(x) = "RET-" + x + "-RET" - + let test3 = (new RunWorkflow()) { return "3" } if test3 <> "RUN-RET-3-RET-RUN" then exit 1 //////////////////////////////////////////////////// type NeitherWorkflow() = - + member this.Return(x) = "RET-" + x + "-RET" - + let test4 = (new NeitherWorkflow()) { return "4" } if test4 <> "RET-4-RET" then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_InvalidSelfReferentialStructConstructor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_InvalidSelfReferentialStructConstructor.fs index 1d9bc7038ef..7203e501c36 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_InvalidSelfReferentialStructConstructor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_InvalidSelfReferentialStructConstructor.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // FSB 6350, Compiler crash on invalid code: Crash by invalid type definition //Structs may only bind a 'this' parameter at member declarations$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_MembersMustBeVirtual01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_MembersMustBeVirtual01.fs index 23564654982..938f25d6747 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_MembersMustBeVirtual01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_MembersMustBeVirtual01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // FSB 1683, dispatch slot checking in object expression manages to match non-virtual member //The type Foo contains the member 'MyX' but it is not a virtual or abstract method that is available to override or implement. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithDuplOverride01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithDuplOverride01.fs index d928644ec9d..3dedfb01596 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithDuplOverride01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithDuplOverride01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // Regression test for FSharp1.0:4593 - Internal compiler error on typechecking object expressions with duplicate overrides //More than one override implements 'Next: StrongToWeakEntry<'a> array -> int when 'a: not struct' @@ -9,7 +9,7 @@ type BaseHashtable<'Entry, 'Key>(initialCapacity) = abstract member Next : entries : 'Entry array -> int -[] +[] type StrongToWeakEntry<'Value when 'Value : not struct> = val mutable public next : int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithOverride01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithOverride01.fs index 06de99f15f8..f3939794ce5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithOverride01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithOverride01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // FSharp1.0:6424 - Object expressions fail to check override of final method (from method impl) //The method 'Class1\.CompareTo\(other: string\) : int' is sealed and cannot be overridden -let z = +let z = { new Class1() with override this.CompareTo(other : string) = 12 } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericObjectExpression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericObjectExpression01.fs index 9eb013066e1..6202e06c57a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericObjectExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericObjectExpression01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // FSB 1112, Bug in definition of generic interface diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericObjectExpression02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericObjectExpression02.fs index fd11974726d..9529d6e9d88 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericObjectExpression02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericObjectExpression02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // Regression test for FSHARP1.0:5141 // Title: spurious warning with slot inference? // Desc: Not expecting to get a 'less generic than indicated by the annotation' message at the point pointed by marked @@ -7,7 +7,7 @@ type IParameterUser<'t> = abstract Use<'b> : list<'b> -> 't - + let getName5 () = { new IParameterUser<'t> with member x.Use<'b> (p:list<'b> (*HERE*)) : 't = failwith "" } exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericTypeAnnotations01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericTypeAnnotations01.fs index e850297cf0d..08fb94157dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericTypeAnnotations01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/GenericTypeAnnotations01.fs @@ -1,13 +1,13 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // Regression test for FSHARP1.0:3857 // Incorrect FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''a'. // -type X = +type X = abstract M : unit -> 'a -let v = - { new X with +let v = + { new X with member this.M() : 'a = failwith "" } - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/InterfaceObjectExpression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/InterfaceObjectExpression01.fs index e04f778ec46..74a516651da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/InterfaceObjectExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/InterfaceObjectExpression01.fs @@ -1,20 +1,20 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // Regression for FSHARP1.0:6510 -// -type I = +// +type I = abstract ToString: unit -> string -type J = +type J = abstract ToString: unit -> string -let x = - { new I with +let x = + { new I with member __.ToString () = "AAA" - interface J with + interface J with member __.ToString () = "BBB" } if (x :> obj).ToString () = "AAA" then exit 1 // used to print "AAA" instead of something like "FSI_0003+x@8" -if x.ToString() <> "AAA" then exit 1 -if (x :> obj :?> I).ToString() <> "AAA" then exit 1 -if (x :> obj :?> J).ToString() <> "BBB" then exit 1 +if x.ToString() <> "AAA" then exit 1 +if (x :> obj :?> I).ToString() <> "AAA" then exit 1 +if (x :> obj :?> J).ToString() <> "BBB" then exit 1 exit 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/MultipleInterfacesInObjExpr.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/MultipleInterfacesInObjExpr.fs index 7974ad6b6a4..59c3dc569f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/MultipleInterfacesInObjExpr.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/MultipleInterfacesInObjExpr.fs @@ -1,17 +1,17 @@ type I1 = abstract Foo : unit -> bool - + type I2 = abstract Foo : unit -> bool -let failIfFalse cond fmt = - Printf.kprintf (fun s -> +let failIfFalse cond fmt = + Printf.kprintf (fun s -> if not cond then printfn "%s" s exit 1 ) fmt -let verifyInterfaceImplementation<'T> o = +let verifyInterfaceImplementation<'T> o = let ty = o.GetType() let map = try ty.GetInterfaceMap(typeof<'T>) with e -> failIfFalse false "%A" e; Unchecked.defaultof<_> for (ifcMethod, targetMethod) in Seq.zip map.InterfaceMethods map.TargetMethods do @@ -20,7 +20,7 @@ let verifyInterfaceImplementation<'T> o = failIfFalse targetMethod.IsPrivate "Method %s should be private" targetMethod.Name -let o1 = +let o1 = { new I1 with member this.Foo() = false @@ -33,7 +33,7 @@ let o2 = override this.ToString() = "123" interface I1 with member this.Foo() = false - + interface I2 with member this.Foo() = false } @@ -46,7 +46,7 @@ verifyInterfaceImplementation o2 verifyInterfaceImplementation o2 let o2Ty = o2.GetType() -let toString = o2Ty.GetMethod("ToString") +let toString = o2Ty.GetMethod("ToString") failIfFalse (toString.DeclaringType = o2Ty) "ToString should be overridden" failIfFalse toString.IsPublic "ToString should be public" failIfFalse toString.IsVirtual "ToString should be virtual" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ObjExprWithOverloadedMethod01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ObjExprWithOverloadedMethod01.fs index 93388703333..9f9b95a975c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ObjExprWithOverloadedMethod01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ObjExprWithOverloadedMethod01.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #ObjectConstructors +// #Conformance #DataExpressions #ObjectConstructors // Verify Dispatch Slot Checking when the interface has an overloaded method. open System @@ -10,10 +10,10 @@ type IHaveOverload = type SomeClass<'a> (arg : 'a) = member this.Value = arg -let test = { +let test = { new SomeClass<_>("ConstructorArgument") with override this.ToString() = "SomeClass" - + interface IHaveOverload with override this.DoStuff (x : int) = x override this.DoStuff (x : string) = Int32.Parse(x) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ObjExprWithOverride01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ObjExprWithOverride01.fs index f549aafee0d..899b2b51095 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ObjExprWithOverride01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ObjExprWithOverride01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // FSharp1.0:6424 - Object expressions fail to check override of final method (from method impl) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/StaticType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/StaticType01.fs index ad7fff8d161..54f01f65f7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/StaticType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/StaticType01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // Verify the static type of object expressions @@ -9,24 +9,24 @@ // See also FSHARP1.0:2954 (corresponding spec bug) let oe1 = - { + { new System.Collections.Generic.IComparer with - member x.Compare(a,b) = compare (a % 7) (b % 7) + member x.Compare(a,b) = compare (a % 7) (b % 7) } let _ = oe1 : System.Collections.Generic.IComparer - + // Verify static type is of type System.Object let oe2 = - { + { new System.Object() with - member x.ToString () = "Hello, base.ToString() = " + base.ToString() + member x.ToString () = "Hello, base.ToString() = " + base.ToString() } let _ = oe2 : System.Object // Verify static type is of type System.Object let oe3 = - { + { new System.Object() with member x.Finalize() = printfn "Finalize" interface System.IDisposable with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ValidStructConstructor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ValidStructConstructor.fs index 4c995be1928..78cd19e1b7f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ValidStructConstructor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/ValidStructConstructor.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // good - bug 6350 module mod6350 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/W_Deprecated01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/W_Deprecated01.fs index 4df4b369971..80f6f05b31d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/W_Deprecated01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/ObjectExpressions/W_Deprecated01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #DataExpressions #ObjectConstructors +// #Regression #Conformance #DataExpressions #ObjectConstructors // Regression test for FSharp1.0:3389 - Deprecate older object expression syntax //This construct is deprecated: This form of object expression is not used in F#\. Use 'member this\.MemberName \.\.\. = \.\.\.' to define member implementations in object expressions\. -type X = +type X = abstract M : unit -> 'a - -let v = + +let v = { new X with M() = failwith "" } exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions.fs index 5eb7c3a622c..729a960284b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions.fs @@ -25,16 +25,16 @@ open FSharp.Test.Compiler open System.IO module QueryExpressions = - + let private basePath = Path.Combine(__SOURCE_DIRECTORY__, "QueryExpressions") - + /// Create Utils.fs as a library CompilationUnit let private getUtilsLib () = let source = File.ReadAllText(Path.Combine(basePath, "Utils.fs")) FSharp source |> withName "Utils" |> asLibrary - + /// Compile a test that depends on Utils.dll (compile-only, no run) let private compileWithUtils (fileName: string) = let source = File.ReadAllText(Path.Combine(basePath, fileName)) @@ -56,7 +56,7 @@ module QueryExpressions = |> shouldSucceed |> ignore - /// Compile a standalone test as library (compile-only, no run) + /// Compile a standalone test as library (compile-only, no run) let private compileAsLibrary (fileName: string) = let source = File.ReadAllText(Path.Combine(basePath, fileName)) FSharp source diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_BadGroupValBy01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_BadGroupValBy01.fs index 9e338f91218..a8e6e17be02 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_BadGroupValBy01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_BadGroupValBy01.fs @@ -3,16 +3,16 @@ //'groupValBy' is used with an incorrect number of arguments\. This is a custom operation in this query or computation expression\. Expected 2 argument\(s\), but given 0\.$ //'groupValBy' is used with an incorrect number of arguments\. This is a custom operation in this query or computation expression\. Expected 2 argument\(s\), but given 1\.$ -let q1 = +let q1 = query { for c in [1..10] do - groupValBy + groupValBy } let q2 = query { for c in [1..10] do - groupValBy c + groupValBy c } let q3 = // no error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches01.fs index 7066abe0da6..6d4864acd0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches01.fs @@ -3,9 +3,9 @@ //'match' expressions may not be used in queries$ let x = - query { - for i in [1..10] do - match i with + query { + for i in [1..10] do + match i with | 1 -> for j in [1..10] do if i = 0 then yield i else yield i + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches02.fs index bc4e2a0280a..db861005c0c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_MismatchedConditionalBranches02.fs @@ -2,11 +2,11 @@ //'match' expressions may not be used in queries$ let q10 = - query { for i in [1..10] do - match i with - | 8 -> - for j in [1..10] do - if i = j then + query { for i in [1..10] do + match i with + | 8 -> + for j in [1..10] do + if i = j then yield i | _ -> () } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_Sequential01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_Sequential01.fs index 5a1ff55bb75..3853997d90e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_Sequential01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_Sequential01.fs @@ -9,14 +9,14 @@ let q1 ds = for c in ds do printfn "%A" c select c - } + } let q1' ds = query { for c in ds do printfn "%A" c yield c - } + } let q2 ds = query { diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors01.fs index efc3d64dbba..ca8a374e04d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors01.fs @@ -9,7 +9,7 @@ let q1 = // no errors select d } -let q2 = +let q2 = query { for d in [1..10] do where (d > 3) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors02.fs index 07141dfab42..66017cd80ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors02.fs @@ -9,7 +9,7 @@ let q3 = // no errors select d } -let q4 = +let q4 = query { for d in [1..10] do where (d > 3) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors03.fs index 21105f1f384..9312a1e86ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/E_WhitespaceErrors03.fs @@ -3,8 +3,8 @@ //'join' must come after a 'for' selection clause and be followed by the rest of the query\. Syntax: \.\.\. join var in collection on \(outerKey = innerKey\)\. Note that parentheses are required after 'on' \.\.\.$ //'join' must come after a 'for' selection clause and be followed by the rest of the query\. Syntax: \.\.\. join var in collection on \(outerKey = innerKey\)\. Note that parentheses are required after 'on' \.\.\.$ let q5 = // no errors - query { - for d in [1..10] do + query { + for d in [1..10] do where (d > 3) select d } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/ForWhereJoin01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/ForWhereJoin01.fs index a9886a30cb4..c1e46878984 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/ForWhereJoin01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/ForWhereJoin01.fs @@ -3,7 +3,7 @@ // Note: as of 10/26/2011, it is ok to have where before join/groupJoin! // -let q1 = +let q1 = query { for i in [1..10] do where (i > 2) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/JoinsWithInterveningExpressions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/JoinsWithInterveningExpressions01.fs index a379ebbe134..c4886320532 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/JoinsWithInterveningExpressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/JoinsWithInterveningExpressions01.fs @@ -19,7 +19,7 @@ let f2 db db2 = for i in db do let x = i,i for j in db do - let y = + let y = match (x,j) with | _,_ -> x,j join k in db2 on (i=k) @@ -71,9 +71,9 @@ type Customer(name) = member this.Name = name override this.Equals(obj) = match obj with | :? Customer as c1 -> this.Name = c1.Name | _ -> false interface System.IComparable with - override this.CompareTo(obj) = - match obj with - | :? Customer as c1 -> if this.Name = c1.Name then 0 else 1 + override this.CompareTo(obj) = + match obj with + | :? Customer as c1 -> if this.Name = c1.Name then 0 else 1 | _ -> -1 let cdb1 = [Customer("Jeff"); Customer("Annie"); Customer("Britta"); Customer("Troy"); Customer("Abed"); Customer("Pierce")].AsQueryable() let cdb2 = [Customer("Jeff"); Customer("Annie"); Customer("Britta"); Customer("Troy"); Customer("Abed")].AsQueryable() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Aggregates01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Aggregates01.fs index 1509a7199c7..c32a7a54903 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Aggregates01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Aggregates01.fs @@ -7,7 +7,7 @@ open System.Linq // Count - Simple let factorsOf300 = [2;2;3;5;5] -let uniqueFactors = +let uniqueFactors = query { for n in factorsOf300 do distinct @@ -17,7 +17,7 @@ if uniqueFactors <> 3 then printfn "uniqueFactors failed"; exit 1 // Sum - Simple let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] -let numSum = +let numSum = query { for n in numbers do sumBy n @@ -27,7 +27,7 @@ if numSum <> 45 then printfn "numSum failed"; exit 1 // Sum - Projection let words = ["cherry"; "apple"; "blueberry"] -let totalChars = +let totalChars = query { for w in words do sumBy (w.Length) @@ -115,9 +115,9 @@ let averageNum = query { for n in numbers2 do averageBy n } if averageNum <> 4.5 then printfn "averageNum failed"; exit 1 // Average - Projection -let averageLength = - query { - for w in words do +let averageLength = + query { + for w in words do let wl = w.Length |> float averageBy wl } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101ElementOperators01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101ElementOperators01.fs index 528b8148842..1dad4679cc2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101ElementOperators01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101ElementOperators01.fs @@ -18,7 +18,7 @@ if products12.ProductName <> "Queso Manchego La Pastora" then printfn "products1 // First - Condition let strings = [ "zero"; "one"; "two"; "three"; "four"; "five"; "six"; "seven"; "eight"; "nine" ] -let startsWithO = +let startsWithO = query { for s in strings do where (s.[0] = 'o') @@ -38,7 +38,7 @@ if firstNumOrDefault <> 0 then printfn "firstNumOrDefault failed"; exit 1 // ElementAt let numbers2 = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] -let fourthLowNum = +let fourthLowNum = query { for n in numbers2 do where (n > 5) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Grouping01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Grouping01.fs index 15af071e9c6..a00a8f96d5a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Grouping01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Grouping01.fs @@ -10,7 +10,7 @@ let digits = [ "zero"; "one"; "two"; "three"; "four"; "five"; "six"; "seven"; "e let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] let numberGroups = - query { + query { for n in numbers do groupValBy n (n % 5) into g select (g.Key, g.ToArray()) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Ordering01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Ordering01.fs index 3f7ffce4073..bace183d01d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Ordering01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Ordering01.fs @@ -16,7 +16,7 @@ if sortedWords <> ["apple"; "blueberry"; "cherry"] then printfn "sortedWords fai // OrderBy - Simple 2 let sortedWords2 = query { - for w in words do + for w in words do sortBy (w.Length) } |> Seq.toList if sortedWords2 <> ["apple"; "cherry"; "blueberry"] then printfn "sortedWords2 failed"; exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Partitioning01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Partitioning01.fs index bd05f4e1967..524522fceeb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Partitioning01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Partitioning01.fs @@ -12,7 +12,7 @@ let first3Numbers = for n in numbers do take 3 } |> Seq.toList -if first3Numbers <> [5;4;1] then printfn "first3Numbers failed"; exit 1 +if first3Numbers <> [5;4;1] then printfn "first3Numbers failed"; exit 1 // Take - nested let customers = getCustomerList() @@ -26,7 +26,7 @@ let WAOrders = if WAOrders |> Seq.take 3 |> Seq.toArray <> WAOrders.[0..2] then printfn "first3WAOrders failed"; exit 1 // Skip - simple -let allButFirst4Numbers = +let allButFirst4Numbers = query { for n in numbers do skip 4 @@ -52,7 +52,7 @@ let firstNumbersLessThan6 = if firstNumbersLessThan6 <> [5;4;1;3] then printfn "firstNumbersLessThan6 failed"; exit 1 // SkipWhile - simple -let allButFirst3Numbers = +let allButFirst3Numbers = query { for n in numbers do skipWhile (n % 3 <> 0) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Select01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Select01.fs index 4ec69055a3e..4e2d99a484b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Select01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Select01.fs @@ -6,7 +6,7 @@ open System.Linq let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] -// Select - Simple 1 +// Select - Simple 1 let numsPlusOne = query { for n in numbers do @@ -62,7 +62,7 @@ if productInfos.[0] <> ("Chai", "Beverages", 18.0000M) then printfn "productInfo // Select - Filtered let digits = strings -let lowNums = +let lowNums = query { for n in numbers do where (n < 5) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101SetOperators01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101SetOperators01.fs index bd304fd4905..b4edca70ff7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101SetOperators01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101SetOperators01.fs @@ -8,7 +8,7 @@ open System.Linq // Distinct - 1 let factorsOf300 = [2;2;3;5;5] -let uniqueFactors = +let uniqueFactors = query { for n in factorsOf300 do distinct @@ -29,7 +29,7 @@ if categoryNames <> ["Beverages"; "Condiments"; "Produce"; "Meat/Poultry"; "Seaf // Union - 2 let customers = getCustomerList() -let productFirstChars = +let productFirstChars = query { for p in products do select p.ProductName.[0] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Where01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Where01.fs index 3bb4d2770f7..dfc39f22957 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Where01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Linq101Where01.fs @@ -7,7 +7,7 @@ open System.Linq let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] - + // Where - Simple 1 let lowNums = query { @@ -58,7 +58,7 @@ let shortDigits = query { for d in digits do select d - } - |> Seq.mapi (fun i d -> if d.Length < i then Some(d) else None) + } + |> Seq.mapi (fun i d -> if d.Length < i then Some(d) else None) |> Seq.choose id if shortDigits.Count() <> 5 then printfn "shortDigits failed"; exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/MatchInQuery01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/MatchInQuery01.fs index 676e369aacd..f64c7824631 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/MatchInQuery01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/MatchInQuery01.fs @@ -9,7 +9,7 @@ let iq = System.Linq.Queryable.AsQueryable([1;2;3;4;5]) let q4 (ds : seq) = query { for i in ds do - let x = + let x = match (i % 2) with | 0 -> i | _ -> i * i diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/MatchInQuery02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/MatchInQuery02.fs index fdd9dbb254c..a497e430031 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/MatchInQuery02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/MatchInQuery02.fs @@ -9,7 +9,7 @@ let iq = System.Linq.Queryable.AsQueryable([1;2;3;4;5]) let q5 (ds : seq) = query { for i in ds do - let x = + let x = function | 0 -> i | _ -> i * i @@ -21,10 +21,10 @@ if q5 iq <> [1;4;9;16;25] then printfn "q5 failed"; exit 1 let q5' (ds : seq) = query { for i in ds do - select + select ((function | 0 -> i - | _ -> i * i) i) + | _ -> i * i) i) } |> Seq.toList if q5' ie <> [1;4;9;16;25] then printfn "q5' failed"; exit 1 if q5' iq <> [1;4;9;16;25] then printfn "q5' failed"; exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverClass01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverClass01.fs index 130e1b86d0e..cd2ef69a6e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverClass01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverClass01.fs @@ -15,7 +15,7 @@ let CustomerClass4 = CustomerClass1.AsParallel() let queries (dataSource : seq) = // For/Yield - let q1 = + let q1 = query { for c in dataSource do yield c @@ -116,8 +116,8 @@ let queries (dataSource : seq) = for d in dataSource do where (d.Age > 26) select d - } - yield (c,q) + } + yield (c,q) } if (q12 |> Seq.length) <> 6 then printfn "Failed on nested query"; exit 1 @@ -130,37 +130,37 @@ let queries (dataSource : seq) = for d in dataSource do where (d.Age > 26) select d - } - yield! q + } + yield! q } if (q13 |> Seq.length) <> 12 then printfn "Failed on yield!"; exit 1 // distinct - let q14 = + let q14 = query { for c in dataSource do let q = query { for d in [1;1;2;2;3;3;3] do distinct - } + } select (c,q) } let c,q = (q14 |> Seq.head) if (q |> Seq.length <> 3) then printfn "Failed on distinct"; exit 1 // groupBy - let q15 = + let q15 = query { for c in dataSource do groupBy c } - + if (q15 |> Seq.head).Key.Name <> "Jeff" then printfn "Failed on groupBy"; exit 1 if q15 |> Seq.length <> 6 then exit 1 // last - let q16 = + let q16 = query { for c in dataSource do last @@ -169,7 +169,7 @@ let queries (dataSource : seq) = if q16.Name <> "Britta" then printfn "Failed on last"; exit 1 // lastOrDefault - let q17 = + let q17 = query { for c in ([] : int list) do lastOrDefault @@ -178,7 +178,7 @@ let queries (dataSource : seq) = if q17 <> 0 then printfn "Failed on lastOrDefault"; exit 1 // head - let q18 = + let q18 = query { for c in dataSource do head @@ -187,7 +187,7 @@ let queries (dataSource : seq) = if q18.Name <> "Jeff" then printfn "Failed on head"; exit 1 // headOrDefault - let q19 = + let q19 = query { for c in ([] : int list) do headOrDefault @@ -196,16 +196,16 @@ let queries (dataSource : seq) = if q19 <> 0 then printfn "Failed on headOfDefault"; exit 1 // exactlyOne - let q20 = + let q20 = query { for c in [(dataSource |> Seq.head)] do exactlyOne } if q20.Name <> "Jeff" then printfn "Failed on exactlyOne"; exit 1 - + try - let q21 = + let q21 = query { for c in dataSource do exactlyOne @@ -213,10 +213,10 @@ let queries (dataSource : seq) = printfn "Failed on exactlyOne" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () try - let q22 = + let q22 = query { for c in ([] : int list) do exactlyOne @@ -224,11 +224,11 @@ let queries (dataSource : seq) = printfn "Failed on exactlyOne" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () // exactlyOneOrDefault try - let q23 = + let q23 = query { for c in dataSource do exactlyOneOrDefault @@ -236,10 +236,10 @@ let queries (dataSource : seq) = printfn "Failed on exactlyOneOrDefault" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () - let q24 = + let q24 = query { for c in ([] : int list) do exactlyOneOrDefault @@ -247,7 +247,7 @@ let queries (dataSource : seq) = if q24 <> 0 then printfn "Failed on exactlyOneOrDefault"; exit 1 - let q25 = + let q25 = query { for c in [(dataSource |> Seq.head)] do exactlyOneOrDefault @@ -256,7 +256,7 @@ let queries (dataSource : seq) = if q25.Name <> "Jeff" then printfn "Failed on exactlyOneOrDefault"; exit 1 // count - let q26 = + let q26 = query { for c in dataSource do count @@ -265,7 +265,7 @@ let queries (dataSource : seq) = if q26 <> 6 then printfn "Failed on count"; exit 1 // nth - let q27 = + let q27 = query { for c in dataSource do nth 3 @@ -274,7 +274,7 @@ let queries (dataSource : seq) = if q27.Name <> "Troy" then printfn "Failed on nth"; exit 1 // skip - let q28 = + let q28 = query { for c in dataSource do skip 2 @@ -283,16 +283,16 @@ let queries (dataSource : seq) = if q28 |> Seq.length <> 4 then printfn "Failed on skip"; exit 1 // skipWhile - let q29 = + let q29 = query { for c in dataSource do skipWhile (c.Age > 26) } - + if q29 |> Seq.length <> 5 then printfn "Failed on skipWhile"; exit 1 // take - let q30 = + let q30 = query { for c in dataSource do take 2 @@ -301,7 +301,7 @@ let queries (dataSource : seq) = if q30 |> Seq.length <> 2 then printfn "Failed on take"; exit 1 // takeWhile - let q31 = + let q31 = query { for c in dataSource do takeWhile (c.Age > 20) @@ -310,7 +310,7 @@ let queries (dataSource : seq) = if q31 |> Seq.length <> 1 then printfn "Failed on takeWhile"; exit 1 // find - let q33 = + let q33 = query { for c in dataSource do find (c.Age < 26 && c.Age > 20) @@ -319,7 +319,7 @@ let queries (dataSource : seq) = if q33.Name <> "Abed" then printfn "Failed on find"; exit 1 // minBy - let q34 = + let q34 = query { for c in dataSource do minBy c.Age @@ -328,7 +328,7 @@ let queries (dataSource : seq) = if q34 <> 19 then printfn "Failed on minBy"; exit 1 // maxBy - let q35 = + let q35 = query { for c in dataSource do maxBy c.Age @@ -337,7 +337,7 @@ let queries (dataSource : seq) = if q35 <> 62 then printfn "Failed on maxBy"; exit 1 // groupValBy - let q35 = + let q35 = query { for c in dataSource do groupValBy c c.Age diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverRecords01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverRecords01.fs index 64ebc712657..d3e08f85d23 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverRecords01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverRecords01.fs @@ -18,7 +18,7 @@ let CustomerRecords4 = CustomerRecords3.AsParallel() let queries (dataSource : seq) = // For/Yield - let q1 = + let q1 = query { for c in dataSource do yield c @@ -119,8 +119,8 @@ let queries (dataSource : seq) = for d in dataSource do where (d.Age > 26) select d - } - yield (c,q) + } + yield (c,q) } if (q12 |> Seq.length) <> 6 then printfn "Failed on nested query"; exit 1 @@ -133,37 +133,37 @@ let queries (dataSource : seq) = for d in dataSource do where (d.Age > 26) select d - } - yield! q + } + yield! q } if (q13 |> Seq.length) <> 12 then printfn "Failed on yield!"; exit 1 // distinct - let q14 = + let q14 = query { for c in dataSource do let q = query { for d in [1;1;2;2;3;3;3] do distinct - } + } select (c,q) } let c,q = (q14 |> Seq.head) if (q |> Seq.length <> 3) then printfn "Failed on distinct"; exit 1 // groupBy - let q15 = + let q15 = query { for c in dataSource do groupBy c } - + if (q15 |> Seq.head).Key.Name <> "Jeff" then printfn "Failed on groupBy"; exit 1 if q15 |> Seq.length <> 6 then exit 1 // last - let q16 = + let q16 = query { for c in dataSource do last @@ -172,7 +172,7 @@ let queries (dataSource : seq) = if q16.Name <> "Britta" then printfn "Failed on last"; exit 1 // lastOrDefault - let q17 = + let q17 = query { for c in ([] : int list) do lastOrDefault @@ -181,7 +181,7 @@ let queries (dataSource : seq) = if q17 <> 0 then printfn "Failed on lastOrDefault"; exit 1 // head - let q18 = + let q18 = query { for c in dataSource do head @@ -190,7 +190,7 @@ let queries (dataSource : seq) = if q18.Name <> "Jeff" then printfn "Failed on head"; exit 1 // headOrDefault - let q19 = + let q19 = query { for c in ([] : int list) do headOrDefault @@ -199,16 +199,16 @@ let queries (dataSource : seq) = if q19 <> 0 then printfn "Failed on headOfDefault"; exit 1 // exactlyOne - let q20 = + let q20 = query { for c in [(dataSource |> Seq.head)] do exactlyOne } if q20.Name <> "Jeff" then printfn "Failed on exactlyOne"; exit 1 - + try - let q21 = + let q21 = query { for c in dataSource do exactlyOne @@ -216,10 +216,10 @@ let queries (dataSource : seq) = printfn "Failed on exactlyOne" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () try - let q22 = + let q22 = query { for c in ([] : int list) do exactlyOne @@ -227,11 +227,11 @@ let queries (dataSource : seq) = printfn "Failed on exactlyOne" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () // exactlyOneOrDefault try - let q23 = + let q23 = query { for c in dataSource do exactlyOneOrDefault @@ -239,10 +239,10 @@ let queries (dataSource : seq) = printfn "Failed on exactlyOneOrDefault" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () - let q24 = + let q24 = query { for c in ([] : int list) do exactlyOneOrDefault @@ -250,7 +250,7 @@ let queries (dataSource : seq) = if q24 <> 0 then printfn "Failed on exactlyOneOrDefault"; exit 1 - let q25 = + let q25 = query { for c in [(dataSource |> Seq.head)] do exactlyOneOrDefault @@ -259,7 +259,7 @@ let queries (dataSource : seq) = if q25.Name <> "Jeff" then printfn "Failed on exactlyOneOrDefault"; exit 1 // count - let q26 = + let q26 = query { for c in dataSource do count @@ -268,7 +268,7 @@ let queries (dataSource : seq) = if q26 <> 6 then printfn "Failed on count"; exit 1 // nth - let q27 = + let q27 = query { for c in dataSource do nth 3 @@ -277,7 +277,7 @@ let queries (dataSource : seq) = if q27.Name <> "Troy" then printfn "Failed on nth"; exit 1 // skip - let q28 = + let q28 = query { for c in dataSource do skip 2 @@ -286,16 +286,16 @@ let queries (dataSource : seq) = if q28 |> Seq.length <> 4 then printfn "Failed on skip"; exit 1 // skipWhile - let q29 = + let q29 = query { for c in dataSource do skipWhile (c.Age > 26) } - + if q29 |> Seq.length <> 5 then printfn "Failed on skipWhile"; exit 1 // take - let q30 = + let q30 = query { for c in dataSource do take 2 @@ -304,7 +304,7 @@ let queries (dataSource : seq) = if q30 |> Seq.length <> 2 then printfn "Failed on take"; exit 1 // takeWhile - let q31 = + let q31 = query { for c in dataSource do takeWhile (c.Age > 20) @@ -313,7 +313,7 @@ let queries (dataSource : seq) = if q31 |> Seq.length <> 1 then printfn "Failed on takeWhile"; exit 1 // find - let q33 = + let q33 = query { for c in dataSource do find (c.Age < 26 && c.Age > 20) @@ -322,7 +322,7 @@ let queries (dataSource : seq) = if q33.Name <> "Abed" then printfn "Failed on find"; exit 1 // minBy - let q34 = + let q34 = query { for c in dataSource do minBy c.Age @@ -331,7 +331,7 @@ let queries (dataSource : seq) = if q34 <> 19 then printfn "Failed on minBy"; exit 1 // maxBy - let q35 = + let q35 = query { for c in dataSource do maxBy c.Age @@ -340,7 +340,7 @@ let queries (dataSource : seq) = if q35 <> 62 then printfn "Failed on maxBy"; exit 1 // groupValBy - let q35 = + let q35 = query { for c in dataSource do groupValBy c c.Age diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverTuples01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverTuples01.fs index 23f2f9cc00c..7ac7cb02107 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverTuples01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/OperatorsOverTuples01.fs @@ -6,7 +6,7 @@ open System.Linq let CustomersTuples1 = [ ("Jeff", 34) - ("Annie", 19) + ("Annie", 19) ("Abed", 25) ("Troy", 25) ("Pierce", 62) @@ -17,7 +17,7 @@ let CustomersTuples4 = CustomersTuples3.AsParallel() let queries (dataSource : seq<_>) = // For/Yield - let q1 = + let q1 = query { for c in dataSource do yield c @@ -119,8 +119,8 @@ let queries (dataSource : seq<_>) = for (n1,a1) in dataSource do where (a1 > 26) select n1 - } - yield (n,q) + } + yield (n,q) } if (q12 |> Seq.length) <> 6 then printfn "Failed on nested query"; exit 1 @@ -133,37 +133,37 @@ let queries (dataSource : seq<_>) = for (n1,a1) in dataSource do where (a1 > 26) select n1 - } - yield! q + } + yield! q } if (q13 |> Seq.length) <> 12 then printfn "Failed on yield!"; exit 1 // distinct - let q14 = + let q14 = query { for (n,a) in dataSource do let q = query { for d in [1;1;2;2;3;3;3] do distinct - } + } select (n,q) } let c,q = (q14 |> Seq.head) if (q |> Seq.length <> 3) then printfn "Failed on distinct"; exit 1 // groupBy - let q15 = + let q15 = query { for c in dataSource do groupBy c } - + if (q15 |> Seq.head).Key <> ("Jeff",34) then printfn "Failed on groupBy"; exit 1 if q15 |> Seq.length <> 6 then exit 1 // last - let q16 = + let q16 = query { for c in dataSource do last @@ -172,7 +172,7 @@ let queries (dataSource : seq<_>) = if q16 <> ("Britta",26) then printfn "Failed on last"; exit 1 // lastOrDefault - let q17 = + let q17 = query { for c in ([] : int list) do lastOrDefault @@ -181,7 +181,7 @@ let queries (dataSource : seq<_>) = if q17 <> 0 then printfn "Failed on lastOrDefault"; exit 1 // head - let q18 = + let q18 = query { for c in dataSource do head @@ -190,7 +190,7 @@ let queries (dataSource : seq<_>) = if q18 <> ("Jeff", 34) then printfn "Failed on head"; exit 1 // headOrDefault - let q19 = + let q19 = query { for c in ([] : int list) do headOrDefault @@ -199,16 +199,16 @@ let queries (dataSource : seq<_>) = if q19 <> 0 then printfn "Failed on headOfDefault"; exit 1 // exactlyOne - let q20 = + let q20 = query { for c in [(dataSource |> Seq.head)] do exactlyOne } if q20 <> ("Jeff", 34) then printfn "Failed on exactlyOne"; exit 1 - + try - let q21 = + let q21 = query { for c in dataSource do exactlyOne @@ -216,10 +216,10 @@ let queries (dataSource : seq<_>) = printfn "Failed on exactlyOne" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () try - let q22 = + let q22 = query { for c in ([] : int list) do exactlyOne @@ -227,11 +227,11 @@ let queries (dataSource : seq<_>) = printfn "Failed on exactlyOne" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () // exactlyOneOrDefault try - let q23 = + let q23 = query { for c in dataSource do exactlyOneOrDefault @@ -239,10 +239,10 @@ let queries (dataSource : seq<_>) = printfn "Failed on exactlyOneOrDefault" exit 1 with - :? InvalidOperationException -> () + :? InvalidOperationException -> () - let q24 = + let q24 = query { for c in ([] : int list) do exactlyOneOrDefault @@ -250,7 +250,7 @@ let queries (dataSource : seq<_>) = if q24 <> 0 then printfn "Failed on exactlyOneOrDefault"; exit 1 - let q25 = + let q25 = query { for c in [(dataSource |> Seq.head)] do exactlyOneOrDefault @@ -259,7 +259,7 @@ let queries (dataSource : seq<_>) = if q25 <> ("Jeff", 34) then printfn "Failed on exactlyOneOrDefault"; exit 1 // count - let q26 = + let q26 = query { for c in dataSource do count @@ -268,7 +268,7 @@ let queries (dataSource : seq<_>) = if q26 <> 6 then printfn "Failed on count"; exit 1 // nth - let q27 = + let q27 = query { for c in dataSource do nth 3 @@ -277,7 +277,7 @@ let queries (dataSource : seq<_>) = if q27 <> ("Troy", 25) then printfn "Failed on nth"; exit 1 // skip - let q28 = + let q28 = query { for c in dataSource do skip 2 @@ -286,16 +286,16 @@ let queries (dataSource : seq<_>) = if q28 |> Seq.length <> 4 then printfn "Failed on skip"; exit 1 // skipWhile - let q29 = + let q29 = query { for (n,a) in dataSource do skipWhile (a > 26) } - + if q29 |> Seq.length <> 5 then printfn "Failed on skipWhile"; exit 1 // take - let q30 = + let q30 = query { for c in dataSource do take 2 @@ -304,7 +304,7 @@ let queries (dataSource : seq<_>) = if q30 |> Seq.length <> 2 then printfn "Failed on take"; exit 1 // takeWhile - let q31 = + let q31 = query { for (n,a) in dataSource do takeWhile (a > 20) @@ -313,7 +313,7 @@ let queries (dataSource : seq<_>) = if q31 |> Seq.length <> 1 then printfn "Failed on takeWhile"; exit 1 // find - let q33 = + let q33 = query { for (n,a) in dataSource do find (a < 26 && a > 20) @@ -322,7 +322,7 @@ let queries (dataSource : seq<_>) = if q33 <> ("Abed", 25) then printfn "Failed on find"; exit 1 // minBy - let q34 = + let q34 = query { for (n,a) in dataSource do minBy a @@ -331,7 +331,7 @@ let queries (dataSource : seq<_>) = if q34 <> 19 then printfn "Failed on minBy"; exit 1 // maxBy - let q35 = + let q35 = query { for (n,a) in dataSource do maxBy a @@ -340,7 +340,7 @@ let queries (dataSource : seq<_>) = if q35 <> 62 then printfn "Failed on maxBy"; exit 1 // groupValBy - let q35 = + let q35 = query { for c in dataSource do let n,a = c diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Utils.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Utils.fs index b8fba331561..f7998c0372c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Utils.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/Utils.fs @@ -24,7 +24,7 @@ type Product() = let getProductList() = [ Product(ProductID = 1, ProductName = "Chai", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 39 ); - Product(ProductID = 2, ProductName = "Chang", Category = "Beverages", UnitPrice = 19.0000M, UnitsInStock = 17 ); + Product(ProductID = 2, ProductName = "Chang", Category = "Beverages", UnitPrice = 19.0000M, UnitsInStock = 17 ); Product(ProductID = 3, ProductName = "Aniseed Syrup", Category = "Condiments", UnitPrice = 10.0000M, UnitsInStock = 13 ); Product(ProductID = 4, ProductName = "Chef Anton's Cajun Seasoning", Category = "Condiments", UnitPrice = 22.0000M, UnitsInStock = 53 ); Product(ProductID = 5, ProductName = "Chef Anton's Gumbo Mix", Category = "Condiments", UnitPrice = 21.3500M, UnitsInStock = 0 ); @@ -34,77 +34,77 @@ let getProductList() = Product(ProductID = 9, ProductName = "Mishi Kobe Niku", Category = "Meat/Poultry", UnitPrice = 97.0000M, UnitsInStock = 29 ); Product(ProductID = 10, ProductName = "Ikura", Category = "Seafood", UnitPrice = 31.0000M, UnitsInStock = 31 ); Product(ProductID = 11, ProductName = "Queso Cabrales", Category = "Dairy Products", UnitPrice = 21.0000M, UnitsInStock = 22 ); - Product(ProductID = 12, ProductName = "Queso Manchego La Pastora", Category = "Dairy Products", UnitPrice = 38.0000M, UnitsInStock = 86 ); - Product(ProductID = 13, ProductName = "Konbu", Category = "Seafood", UnitPrice = 6.0000M, UnitsInStock = 24 ); - Product(ProductID = 14, ProductName = "Tofu", Category = "Produce", UnitPrice = 23.2500M, UnitsInStock = 35 ); - Product(ProductID = 15, ProductName = "Genen Shouyu", Category = "Condiments", UnitPrice = 15.5000M, UnitsInStock = 39 ); - Product(ProductID = 16, ProductName = "Pavlova", Category = "Confections", UnitPrice = 17.4500M, UnitsInStock = 29 ); - Product(ProductID = 17, ProductName = "Alice Mutton", Category = "Meat/Poultry", UnitPrice = 39.0000M, UnitsInStock = 0 ); - Product(ProductID = 18, ProductName = "Carnarvon Tigers", Category = "Seafood", UnitPrice = 62.5000M, UnitsInStock = 42 ); - Product(ProductID = 19, ProductName = "Teatime Chocolate Biscuits", Category = "Confections", UnitPrice = 9.2000M, UnitsInStock = 25 ); - Product(ProductID = 20, ProductName = "Sir Rodney's Marmalade", Category = "Confections", UnitPrice = 81.0000M, UnitsInStock = 40 ); - Product(ProductID = 21, ProductName = "Sir Rodney's Scones", Category = "Confections", UnitPrice = 10.0000M, UnitsInStock = 3 ); - Product(ProductID = 22, ProductName = "Gustaf's Knäckebröd", Category = "Grains/Cereals", UnitPrice = 21.0000M, UnitsInStock = 104 ); - Product(ProductID = 23, ProductName = "Tunnbröd", Category = "Grains/Cereals", UnitPrice = 9.0000M, UnitsInStock = 61 ); - Product(ProductID = 24, ProductName = "Guaraná Fantástica", Category = "Beverages", UnitPrice = 4.5000M, UnitsInStock = 20 ); - Product(ProductID = 25, ProductName = "NuNuCa Nuß-Nougat-Creme", Category = "Confections", UnitPrice = 14.0000M, UnitsInStock = 76 ); - Product(ProductID = 26, ProductName = "Gumbär Gummibärchen", Category = "Confections", UnitPrice = 31.2300M, UnitsInStock = 15 ); - Product(ProductID = 27, ProductName = "Schoggi Schokolade", Category = "Confections", UnitPrice = 43.9000M, UnitsInStock = 49 ); - Product(ProductID = 28, ProductName = "Rössle Sauerkraut", Category = "Produce", UnitPrice = 45.6000M, UnitsInStock = 26 ); - Product(ProductID = 29, ProductName = "Thüringer Rostbratwurst", Category = "Meat/Poultry", UnitPrice = 123.7900M, UnitsInStock = 0 ); - Product(ProductID = 30, ProductName = "Nord-Ost Matjeshering", Category = "Seafood", UnitPrice = 25.8900M, UnitsInStock = 10 ); - Product(ProductID = 31, ProductName = "Gorgonzola Telino", Category = "Dairy Products", UnitPrice = 12.5000M, UnitsInStock = 0 ); - Product(ProductID = 32, ProductName = "Mascarpone Fabioli", Category = "Dairy Products", UnitPrice = 32.0000M, UnitsInStock = 9 ); - Product(ProductID = 33, ProductName = "Geitost", Category = "Dairy Products", UnitPrice = 2.5000M, UnitsInStock = 112 ); - Product(ProductID = 34, ProductName = "Sasquatch Ale", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 111 ); - Product(ProductID = 35, ProductName = "Steeleye Stout", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 20 ); - Product(ProductID = 36, ProductName = "Inlagd Sill", Category = "Seafood", UnitPrice = 19.0000M, UnitsInStock = 112 ); - Product(ProductID = 37, ProductName = "Gravad lax", Category = "Seafood", UnitPrice = 26.0000M, UnitsInStock = 11 ); - Product(ProductID = 38, ProductName = "Côte de Blaye", Category = "Beverages", UnitPrice = 263.5000M, UnitsInStock = 17 ); - Product(ProductID = 39, ProductName = "Chartreuse verte", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 69 ); - Product(ProductID = 40, ProductName = "Boston Crab Meat", Category = "Seafood", UnitPrice = 18.4000M, UnitsInStock = 123 ); - Product(ProductID = 41, ProductName = "Jack's New England Clam Chowder", Category = "Seafood", UnitPrice = 9.6500M, UnitsInStock = 85 ); - Product(ProductID = 42, ProductName = "Singaporean Hokkien Fried Mee", Category = "Grains/Cereals", UnitPrice = 14.0000M, UnitsInStock = 26 ); - Product(ProductID = 43, ProductName = "Ipoh Coffee", Category = "Beverages", UnitPrice = 46.0000M, UnitsInStock = 17 ); - Product(ProductID = 44, ProductName = "Gula Malacca", Category = "Condiments", UnitPrice = 19.4500M, UnitsInStock = 27 ); - Product(ProductID = 45, ProductName = "Rogede sild", Category = "Seafood", UnitPrice = 9.5000M, UnitsInStock = 5 ); - Product(ProductID = 46, ProductName = "Spegesild", Category = "Seafood", UnitPrice = 12.0000M, UnitsInStock = 95 ); - Product(ProductID = 47, ProductName = "Zaanse koeken", Category = "Confections", UnitPrice = 9.5000M, UnitsInStock = 36 ); - Product(ProductID = 48, ProductName = "Chocolade", Category = "Confections", UnitPrice = 12.7500M, UnitsInStock = 15 ); - Product(ProductID = 49, ProductName = "Maxilaku", Category = "Confections", UnitPrice = 20.0000M, UnitsInStock = 10 ); - Product(ProductID = 50, ProductName = "Valkoinen suklaa", Category = "Confections", UnitPrice = 16.2500M, UnitsInStock = 65 ); - Product(ProductID = 51, ProductName = "Manjimup Dried Apples", Category = "Produce", UnitPrice = 53.0000M, UnitsInStock = 20 ); - Product(ProductID = 52, ProductName = "Filo Mix", Category = "Grains/Cereals", UnitPrice = 7.0000M, UnitsInStock = 38 ); - Product(ProductID = 53, ProductName = "Perth Pasties", Category = "Meat/Poultry", UnitPrice = 32.8000M, UnitsInStock = 0 ); - Product(ProductID = 54, ProductName = "Tourtière", Category = "Meat/Poultry", UnitPrice = 7.4500M, UnitsInStock = 21 ); - Product(ProductID = 55, ProductName = "Pâté chinois", Category = "Meat/Poultry", UnitPrice = 24.0000M, UnitsInStock = 115 ); - Product(ProductID = 56, ProductName = "Gnocchi di nonna Alice", Category = "Grains/Cereals", UnitPrice = 38.0000M, UnitsInStock = 21 ); - Product(ProductID = 57, ProductName = "Ravioli Angelo", Category = "Grains/Cereals", UnitPrice = 19.5000M, UnitsInStock = 36 ); - Product(ProductID = 58, ProductName = "Escargots de Bourgogne", Category = "Seafood", UnitPrice = 13.2500M, UnitsInStock = 62 ); - Product(ProductID = 59, ProductName = "Raclette Courdavault", Category = "Dairy Products", UnitPrice = 55.0000M, UnitsInStock = 79 ); - Product(ProductID = 60, ProductName = "Camembert Pierrot", Category = "Dairy Products", UnitPrice = 34.0000M, UnitsInStock = 19 ); - Product(ProductID = 61, ProductName = "Sirop d'érable", Category = "Condiments", UnitPrice = 28.5000M, UnitsInStock = 113 ); - Product(ProductID = 62, ProductName = "Tarte au sucre", Category = "Confections", UnitPrice = 49.3000M, UnitsInStock = 17 ); - Product(ProductID = 63, ProductName = "Vegie-spread", Category = "Condiments", UnitPrice = 43.9000M, UnitsInStock = 24 ); - Product(ProductID = 64, ProductName = "Wimmers gute Semmelknödel", Category = "Grains/Cereals", UnitPrice = 33.2500M, UnitsInStock = 22 ); - Product(ProductID = 65, ProductName = "Louisiana Fiery Hot Pepper Sauce", Category = "Condiments", UnitPrice = 21.0500M, UnitsInStock = 76 ); - Product(ProductID = 66, ProductName = "Louisiana Hot Spiced Okra", Category = "Condiments", UnitPrice = 17.0000M, UnitsInStock = 4 ); - Product(ProductID = 67, ProductName = "Laughing Lumberjack Lager", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 52 ); - Product(ProductID = 68, ProductName = "Scottish Longbreads", Category = "Confections", UnitPrice = 12.5000M, UnitsInStock = 6 ); - Product(ProductID = 69, ProductName = "Gudbrandsdalsost", Category = "Dairy Products", UnitPrice = 36.0000M, UnitsInStock = 26 ); - Product(ProductID = 70, ProductName = "Outback Lager", Category = "Beverages", UnitPrice = 15.0000M, UnitsInStock = 15 ); - Product(ProductID = 71, ProductName = "Flotemysost", Category = "Dairy Products", UnitPrice = 21.5000M, UnitsInStock = 26 ); - Product(ProductID = 72, ProductName = "Mozzarella di Giovanni", Category = "Dairy Products", UnitPrice = 34.8000M, UnitsInStock = 14 ); - Product(ProductID = 73, ProductName = "Röd Kaviar", Category = "Seafood", UnitPrice = 15.0000M, UnitsInStock = 101 ); - Product(ProductID = 74, ProductName = "Longlife Tofu", Category = "Produce", UnitPrice = 10.0000M, UnitsInStock = 4 ); - Product(ProductID = 75, ProductName = "Rhönbräu Klosterbier", Category = "Beverages", UnitPrice = 7.7500M, UnitsInStock = 125 ); - Product(ProductID = 76, ProductName = "Lakkalikööri", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 57 ); + Product(ProductID = 12, ProductName = "Queso Manchego La Pastora", Category = "Dairy Products", UnitPrice = 38.0000M, UnitsInStock = 86 ); + Product(ProductID = 13, ProductName = "Konbu", Category = "Seafood", UnitPrice = 6.0000M, UnitsInStock = 24 ); + Product(ProductID = 14, ProductName = "Tofu", Category = "Produce", UnitPrice = 23.2500M, UnitsInStock = 35 ); + Product(ProductID = 15, ProductName = "Genen Shouyu", Category = "Condiments", UnitPrice = 15.5000M, UnitsInStock = 39 ); + Product(ProductID = 16, ProductName = "Pavlova", Category = "Confections", UnitPrice = 17.4500M, UnitsInStock = 29 ); + Product(ProductID = 17, ProductName = "Alice Mutton", Category = "Meat/Poultry", UnitPrice = 39.0000M, UnitsInStock = 0 ); + Product(ProductID = 18, ProductName = "Carnarvon Tigers", Category = "Seafood", UnitPrice = 62.5000M, UnitsInStock = 42 ); + Product(ProductID = 19, ProductName = "Teatime Chocolate Biscuits", Category = "Confections", UnitPrice = 9.2000M, UnitsInStock = 25 ); + Product(ProductID = 20, ProductName = "Sir Rodney's Marmalade", Category = "Confections", UnitPrice = 81.0000M, UnitsInStock = 40 ); + Product(ProductID = 21, ProductName = "Sir Rodney's Scones", Category = "Confections", UnitPrice = 10.0000M, UnitsInStock = 3 ); + Product(ProductID = 22, ProductName = "Gustaf's Knäckebröd", Category = "Grains/Cereals", UnitPrice = 21.0000M, UnitsInStock = 104 ); + Product(ProductID = 23, ProductName = "Tunnbröd", Category = "Grains/Cereals", UnitPrice = 9.0000M, UnitsInStock = 61 ); + Product(ProductID = 24, ProductName = "Guaraná Fantástica", Category = "Beverages", UnitPrice = 4.5000M, UnitsInStock = 20 ); + Product(ProductID = 25, ProductName = "NuNuCa Nuß-Nougat-Creme", Category = "Confections", UnitPrice = 14.0000M, UnitsInStock = 76 ); + Product(ProductID = 26, ProductName = "Gumbär Gummibärchen", Category = "Confections", UnitPrice = 31.2300M, UnitsInStock = 15 ); + Product(ProductID = 27, ProductName = "Schoggi Schokolade", Category = "Confections", UnitPrice = 43.9000M, UnitsInStock = 49 ); + Product(ProductID = 28, ProductName = "Rössle Sauerkraut", Category = "Produce", UnitPrice = 45.6000M, UnitsInStock = 26 ); + Product(ProductID = 29, ProductName = "Thüringer Rostbratwurst", Category = "Meat/Poultry", UnitPrice = 123.7900M, UnitsInStock = 0 ); + Product(ProductID = 30, ProductName = "Nord-Ost Matjeshering", Category = "Seafood", UnitPrice = 25.8900M, UnitsInStock = 10 ); + Product(ProductID = 31, ProductName = "Gorgonzola Telino", Category = "Dairy Products", UnitPrice = 12.5000M, UnitsInStock = 0 ); + Product(ProductID = 32, ProductName = "Mascarpone Fabioli", Category = "Dairy Products", UnitPrice = 32.0000M, UnitsInStock = 9 ); + Product(ProductID = 33, ProductName = "Geitost", Category = "Dairy Products", UnitPrice = 2.5000M, UnitsInStock = 112 ); + Product(ProductID = 34, ProductName = "Sasquatch Ale", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 111 ); + Product(ProductID = 35, ProductName = "Steeleye Stout", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 20 ); + Product(ProductID = 36, ProductName = "Inlagd Sill", Category = "Seafood", UnitPrice = 19.0000M, UnitsInStock = 112 ); + Product(ProductID = 37, ProductName = "Gravad lax", Category = "Seafood", UnitPrice = 26.0000M, UnitsInStock = 11 ); + Product(ProductID = 38, ProductName = "Côte de Blaye", Category = "Beverages", UnitPrice = 263.5000M, UnitsInStock = 17 ); + Product(ProductID = 39, ProductName = "Chartreuse verte", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 69 ); + Product(ProductID = 40, ProductName = "Boston Crab Meat", Category = "Seafood", UnitPrice = 18.4000M, UnitsInStock = 123 ); + Product(ProductID = 41, ProductName = "Jack's New England Clam Chowder", Category = "Seafood", UnitPrice = 9.6500M, UnitsInStock = 85 ); + Product(ProductID = 42, ProductName = "Singaporean Hokkien Fried Mee", Category = "Grains/Cereals", UnitPrice = 14.0000M, UnitsInStock = 26 ); + Product(ProductID = 43, ProductName = "Ipoh Coffee", Category = "Beverages", UnitPrice = 46.0000M, UnitsInStock = 17 ); + Product(ProductID = 44, ProductName = "Gula Malacca", Category = "Condiments", UnitPrice = 19.4500M, UnitsInStock = 27 ); + Product(ProductID = 45, ProductName = "Rogede sild", Category = "Seafood", UnitPrice = 9.5000M, UnitsInStock = 5 ); + Product(ProductID = 46, ProductName = "Spegesild", Category = "Seafood", UnitPrice = 12.0000M, UnitsInStock = 95 ); + Product(ProductID = 47, ProductName = "Zaanse koeken", Category = "Confections", UnitPrice = 9.5000M, UnitsInStock = 36 ); + Product(ProductID = 48, ProductName = "Chocolade", Category = "Confections", UnitPrice = 12.7500M, UnitsInStock = 15 ); + Product(ProductID = 49, ProductName = "Maxilaku", Category = "Confections", UnitPrice = 20.0000M, UnitsInStock = 10 ); + Product(ProductID = 50, ProductName = "Valkoinen suklaa", Category = "Confections", UnitPrice = 16.2500M, UnitsInStock = 65 ); + Product(ProductID = 51, ProductName = "Manjimup Dried Apples", Category = "Produce", UnitPrice = 53.0000M, UnitsInStock = 20 ); + Product(ProductID = 52, ProductName = "Filo Mix", Category = "Grains/Cereals", UnitPrice = 7.0000M, UnitsInStock = 38 ); + Product(ProductID = 53, ProductName = "Perth Pasties", Category = "Meat/Poultry", UnitPrice = 32.8000M, UnitsInStock = 0 ); + Product(ProductID = 54, ProductName = "Tourtière", Category = "Meat/Poultry", UnitPrice = 7.4500M, UnitsInStock = 21 ); + Product(ProductID = 55, ProductName = "Pâté chinois", Category = "Meat/Poultry", UnitPrice = 24.0000M, UnitsInStock = 115 ); + Product(ProductID = 56, ProductName = "Gnocchi di nonna Alice", Category = "Grains/Cereals", UnitPrice = 38.0000M, UnitsInStock = 21 ); + Product(ProductID = 57, ProductName = "Ravioli Angelo", Category = "Grains/Cereals", UnitPrice = 19.5000M, UnitsInStock = 36 ); + Product(ProductID = 58, ProductName = "Escargots de Bourgogne", Category = "Seafood", UnitPrice = 13.2500M, UnitsInStock = 62 ); + Product(ProductID = 59, ProductName = "Raclette Courdavault", Category = "Dairy Products", UnitPrice = 55.0000M, UnitsInStock = 79 ); + Product(ProductID = 60, ProductName = "Camembert Pierrot", Category = "Dairy Products", UnitPrice = 34.0000M, UnitsInStock = 19 ); + Product(ProductID = 61, ProductName = "Sirop d'érable", Category = "Condiments", UnitPrice = 28.5000M, UnitsInStock = 113 ); + Product(ProductID = 62, ProductName = "Tarte au sucre", Category = "Confections", UnitPrice = 49.3000M, UnitsInStock = 17 ); + Product(ProductID = 63, ProductName = "Vegie-spread", Category = "Condiments", UnitPrice = 43.9000M, UnitsInStock = 24 ); + Product(ProductID = 64, ProductName = "Wimmers gute Semmelknödel", Category = "Grains/Cereals", UnitPrice = 33.2500M, UnitsInStock = 22 ); + Product(ProductID = 65, ProductName = "Louisiana Fiery Hot Pepper Sauce", Category = "Condiments", UnitPrice = 21.0500M, UnitsInStock = 76 ); + Product(ProductID = 66, ProductName = "Louisiana Hot Spiced Okra", Category = "Condiments", UnitPrice = 17.0000M, UnitsInStock = 4 ); + Product(ProductID = 67, ProductName = "Laughing Lumberjack Lager", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 52 ); + Product(ProductID = 68, ProductName = "Scottish Longbreads", Category = "Confections", UnitPrice = 12.5000M, UnitsInStock = 6 ); + Product(ProductID = 69, ProductName = "Gudbrandsdalsost", Category = "Dairy Products", UnitPrice = 36.0000M, UnitsInStock = 26 ); + Product(ProductID = 70, ProductName = "Outback Lager", Category = "Beverages", UnitPrice = 15.0000M, UnitsInStock = 15 ); + Product(ProductID = 71, ProductName = "Flotemysost", Category = "Dairy Products", UnitPrice = 21.5000M, UnitsInStock = 26 ); + Product(ProductID = 72, ProductName = "Mozzarella di Giovanni", Category = "Dairy Products", UnitPrice = 34.8000M, UnitsInStock = 14 ); + Product(ProductID = 73, ProductName = "Röd Kaviar", Category = "Seafood", UnitPrice = 15.0000M, UnitsInStock = 101 ); + Product(ProductID = 74, ProductName = "Longlife Tofu", Category = "Produce", UnitPrice = 10.0000M, UnitsInStock = 4 ); + Product(ProductID = 75, ProductName = "Rhönbräu Klosterbier", Category = "Beverages", UnitPrice = 7.7500M, UnitsInStock = 125 ); + Product(ProductID = 76, ProductName = "Lakkalikööri", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 57 ); Product(ProductID = 77, ProductName = "Original Frankfurter grüne Soße", Category = "Condiments", UnitPrice = 13.0000M, UnitsInStock = 32 ) ] let getProductListAsRecords() = [{ ProductID = 1; ProductName = "Chai"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 39 }; - { ProductID = 2; ProductName = "Chang"; Category = "Beverages"; UnitPrice = 19.0000M; UnitsInStock = 17 }; + { ProductID = 2; ProductName = "Chang"; Category = "Beverages"; UnitPrice = 19.0000M; UnitsInStock = 17 }; { ProductID = 3; ProductName = "Aniseed Syrup"; Category = "Condiments"; UnitPrice = 10.0000M; UnitsInStock = 13 }; { ProductID = 4; ProductName = "Chef Anton's Cajun Seasoning"; Category = "Condiments"; UnitPrice = 22.0000M; UnitsInStock = 53 }; { ProductID = 5; ProductName = "Chef Anton's Gumbo Mix"; Category = "Condiments"; UnitPrice = 21.3500M; UnitsInStock = 0 }; @@ -114,71 +114,71 @@ let getProductListAsRecords() = { ProductID = 9; ProductName = "Mishi Kobe Niku"; Category = "Meat/Poultry"; UnitPrice = 97.0000M; UnitsInStock = 29 }; { ProductID = 10; ProductName = "Ikura"; Category = "Seafood"; UnitPrice = 31.0000M; UnitsInStock = 31 }; { ProductID = 11; ProductName = "Queso Cabrales"; Category = "Dairy Products"; UnitPrice = 21.0000M; UnitsInStock = 22 }; - { ProductID = 12; ProductName = "Queso Manchego La Pastora"; Category = "Dairy Products"; UnitPrice = 38.0000M; UnitsInStock = 86 }; - { ProductID = 13; ProductName = "Konbu"; Category = "Seafood"; UnitPrice = 6.0000M; UnitsInStock = 24 }; - { ProductID = 14; ProductName = "Tofu"; Category = "Produce"; UnitPrice = 23.2500M; UnitsInStock = 35 }; - { ProductID = 15; ProductName = "Genen Shouyu"; Category = "Condiments"; UnitPrice = 15.5000M; UnitsInStock = 39 }; - { ProductID = 16; ProductName = "Pavlova"; Category = "Confections"; UnitPrice = 17.4500M; UnitsInStock = 29 }; - { ProductID = 17; ProductName = "Alice Mutton"; Category = "Meat/Poultry"; UnitPrice = 39.0000M; UnitsInStock = 0 }; - { ProductID = 18; ProductName = "Carnarvon Tigers"; Category = "Seafood"; UnitPrice = 62.5000M; UnitsInStock = 42 }; - { ProductID = 19; ProductName = "Teatime Chocolate Biscuits"; Category = "Confections"; UnitPrice = 9.2000M; UnitsInStock = 25 }; - { ProductID = 20; ProductName = "Sir Rodney's Marmalade"; Category = "Confections"; UnitPrice = 81.0000M; UnitsInStock = 40 }; - { ProductID = 21; ProductName = "Sir Rodney's Scones"; Category = "Confections"; UnitPrice = 10.0000M; UnitsInStock = 3 }; - { ProductID = 22; ProductName = "Gustaf's Knäckebröd"; Category = "Grains/Cereals"; UnitPrice = 21.0000M; UnitsInStock = 104 }; - { ProductID = 23; ProductName = "Tunnbröd"; Category = "Grains/Cereals"; UnitPrice = 9.0000M; UnitsInStock = 61 }; - { ProductID = 24; ProductName = "Guaraná Fantástica"; Category = "Beverages"; UnitPrice = 4.5000M; UnitsInStock = 20 }; - { ProductID = 25; ProductName = "NuNuCa Nuß-Nougat-Creme"; Category = "Confections"; UnitPrice = 14.0000M; UnitsInStock = 76 }; - { ProductID = 26; ProductName = "Gumbär Gummibärchen"; Category = "Confections"; UnitPrice = 31.2300M; UnitsInStock = 15 }; - { ProductID = 27; ProductName = "Schoggi Schokolade"; Category = "Confections"; UnitPrice = 43.9000M; UnitsInStock = 49 }; - { ProductID = 28; ProductName = "Rössle Sauerkraut"; Category = "Produce"; UnitPrice = 45.6000M; UnitsInStock = 26 }; - { ProductID = 29; ProductName = "Thüringer Rostbratwurst"; Category = "Meat/Poultry"; UnitPrice = 123.7900M; UnitsInStock = 0 }; - { ProductID = 30; ProductName = "Nord-Ost Matjeshering"; Category = "Seafood"; UnitPrice = 25.8900M; UnitsInStock = 10 }; - { ProductID = 31; ProductName = "Gorgonzola Telino"; Category = "Dairy Products"; UnitPrice = 12.5000M; UnitsInStock = 0 }; - { ProductID = 32; ProductName = "Mascarpone Fabioli"; Category = "Dairy Products"; UnitPrice = 32.0000M; UnitsInStock = 9 }; - { ProductID = 33; ProductName = "Geitost"; Category = "Dairy Products"; UnitPrice = 2.5000M; UnitsInStock = 112 }; - { ProductID = 34; ProductName = "Sasquatch Ale"; Category = "Beverages"; UnitPrice = 14.0000M; UnitsInStock = 111 }; - { ProductID = 35; ProductName = "Steeleye Stout"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 20 }; - { ProductID = 36; ProductName = "Inlagd Sill"; Category = "Seafood"; UnitPrice = 19.0000M; UnitsInStock = 112 }; - { ProductID = 37; ProductName = "Gravad lax"; Category = "Seafood"; UnitPrice = 26.0000M; UnitsInStock = 11 }; - { ProductID = 38; ProductName = "Côte de Blaye"; Category = "Beverages"; UnitPrice = 263.5000M; UnitsInStock = 17 }; - { ProductID = 39; ProductName = "Chartreuse verte"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 69 }; - { ProductID = 40; ProductName = "Boston Crab Meat"; Category = "Seafood"; UnitPrice = 18.4000M; UnitsInStock = 123 }; - { ProductID = 41; ProductName = "Jack's New England Clam Chowder"; Category = "Seafood"; UnitPrice = 9.6500M; UnitsInStock = 85 }; - { ProductID = 42; ProductName = "Singaporean Hokkien Fried Mee"; Category = "Grains/Cereals"; UnitPrice = 14.0000M; UnitsInStock = 26 }; - { ProductID = 43; ProductName = "Ipoh Coffee"; Category = "Beverages"; UnitPrice = 46.0000M; UnitsInStock = 17 }; - { ProductID = 44; ProductName = "Gula Malacca"; Category = "Condiments"; UnitPrice = 19.4500M; UnitsInStock = 27 }; - { ProductID = 45; ProductName = "Rogede sild"; Category = "Seafood"; UnitPrice = 9.5000M; UnitsInStock = 5 }; - { ProductID = 46; ProductName = "Spegesild"; Category = "Seafood"; UnitPrice = 12.0000M; UnitsInStock = 95 }; - { ProductID = 47; ProductName = "Zaanse koeken"; Category = "Confections"; UnitPrice = 9.5000M; UnitsInStock = 36 }; - { ProductID = 48; ProductName = "Chocolade"; Category = "Confections"; UnitPrice = 12.7500M; UnitsInStock = 15 }; - { ProductID = 49; ProductName = "Maxilaku"; Category = "Confections"; UnitPrice = 20.0000M; UnitsInStock = 10 }; - { ProductID = 50; ProductName = "Valkoinen suklaa"; Category = "Confections"; UnitPrice = 16.2500M; UnitsInStock = 65 }; - { ProductID = 51; ProductName = "Manjimup Dried Apples"; Category = "Produce"; UnitPrice = 53.0000M; UnitsInStock = 20 }; - { ProductID = 52; ProductName = "Filo Mix"; Category = "Grains/Cereals"; UnitPrice = 7.0000M; UnitsInStock = 38 }; - { ProductID = 53; ProductName = "Perth Pasties"; Category = "Meat/Poultry"; UnitPrice = 32.8000M; UnitsInStock = 0 }; - { ProductID = 54; ProductName = "Tourtière"; Category = "Meat/Poultry"; UnitPrice = 7.4500M; UnitsInStock = 21 }; - { ProductID = 55; ProductName = "Pâté chinois"; Category = "Meat/Poultry"; UnitPrice = 24.0000M; UnitsInStock = 115 }; - { ProductID = 56; ProductName = "Gnocchi di nonna Alice"; Category = "Grains/Cereals"; UnitPrice = 38.0000M; UnitsInStock = 21 }; - { ProductID = 57; ProductName = "Ravioli Angelo"; Category = "Grains/Cereals"; UnitPrice = 19.5000M; UnitsInStock = 36 }; - { ProductID = 58; ProductName = "Escargots de Bourgogne"; Category = "Seafood"; UnitPrice = 13.2500M; UnitsInStock = 62 }; - { ProductID = 59; ProductName = "Raclette Courdavault"; Category = "Dairy Products"; UnitPrice = 55.0000M; UnitsInStock = 79 }; - { ProductID = 60; ProductName = "Camembert Pierrot"; Category = "Dairy Products"; UnitPrice = 34.0000M; UnitsInStock = 19 }; - { ProductID = 61; ProductName = "Sirop d'érable"; Category = "Condiments"; UnitPrice = 28.5000M; UnitsInStock = 113 }; - { ProductID = 62; ProductName = "Tarte au sucre"; Category = "Confections"; UnitPrice = 49.3000M; UnitsInStock = 17 }; - { ProductID = 63; ProductName = "Vegie-spread"; Category = "Condiments"; UnitPrice = 43.9000M; UnitsInStock = 24 }; - { ProductID = 64; ProductName = "Wimmers gute Semmelknödel"; Category = "Grains/Cereals"; UnitPrice = 33.2500M; UnitsInStock = 22 }; - { ProductID = 65; ProductName = "Louisiana Fiery Hot Pepper Sauce"; Category = "Condiments"; UnitPrice = 21.0500M; UnitsInStock = 76 }; - { ProductID = 66; ProductName = "Louisiana Hot Spiced Okra"; Category = "Condiments"; UnitPrice = 17.0000M; UnitsInStock = 4 }; - { ProductID = 67; ProductName = "Laughing Lumberjack Lager"; Category = "Beverages"; UnitPrice = 14.0000M; UnitsInStock = 52 }; - { ProductID = 68; ProductName = "Scottish Longbreads"; Category = "Confections"; UnitPrice = 12.5000M; UnitsInStock = 6 }; - { ProductID = 69; ProductName = "Gudbrandsdalsost"; Category = "Dairy Products"; UnitPrice = 36.0000M; UnitsInStock = 26 }; - { ProductID = 70; ProductName = "Outback Lager"; Category = "Beverages"; UnitPrice = 15.0000M; UnitsInStock = 15 }; - { ProductID = 71; ProductName = "Flotemysost"; Category = "Dairy Products"; UnitPrice = 21.5000M; UnitsInStock = 26 }; - { ProductID = 72; ProductName = "Mozzarella di Giovanni"; Category = "Dairy Products"; UnitPrice = 34.8000M; UnitsInStock = 14 }; - { ProductID = 73; ProductName = "Röd Kaviar"; Category = "Seafood"; UnitPrice = 15.0000M; UnitsInStock = 101 }; - { ProductID = 74; ProductName = "Longlife Tofu"; Category = "Produce"; UnitPrice = 10.0000M; UnitsInStock = 4 }; - { ProductID = 75; ProductName = "Rhönbräu Klosterbier"; Category = "Beverages"; UnitPrice = 7.7500M; UnitsInStock = 125 }; - { ProductID = 76; ProductName = "Lakkalikööri"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 57 }; + { ProductID = 12; ProductName = "Queso Manchego La Pastora"; Category = "Dairy Products"; UnitPrice = 38.0000M; UnitsInStock = 86 }; + { ProductID = 13; ProductName = "Konbu"; Category = "Seafood"; UnitPrice = 6.0000M; UnitsInStock = 24 }; + { ProductID = 14; ProductName = "Tofu"; Category = "Produce"; UnitPrice = 23.2500M; UnitsInStock = 35 }; + { ProductID = 15; ProductName = "Genen Shouyu"; Category = "Condiments"; UnitPrice = 15.5000M; UnitsInStock = 39 }; + { ProductID = 16; ProductName = "Pavlova"; Category = "Confections"; UnitPrice = 17.4500M; UnitsInStock = 29 }; + { ProductID = 17; ProductName = "Alice Mutton"; Category = "Meat/Poultry"; UnitPrice = 39.0000M; UnitsInStock = 0 }; + { ProductID = 18; ProductName = "Carnarvon Tigers"; Category = "Seafood"; UnitPrice = 62.5000M; UnitsInStock = 42 }; + { ProductID = 19; ProductName = "Teatime Chocolate Biscuits"; Category = "Confections"; UnitPrice = 9.2000M; UnitsInStock = 25 }; + { ProductID = 20; ProductName = "Sir Rodney's Marmalade"; Category = "Confections"; UnitPrice = 81.0000M; UnitsInStock = 40 }; + { ProductID = 21; ProductName = "Sir Rodney's Scones"; Category = "Confections"; UnitPrice = 10.0000M; UnitsInStock = 3 }; + { ProductID = 22; ProductName = "Gustaf's Knäckebröd"; Category = "Grains/Cereals"; UnitPrice = 21.0000M; UnitsInStock = 104 }; + { ProductID = 23; ProductName = "Tunnbröd"; Category = "Grains/Cereals"; UnitPrice = 9.0000M; UnitsInStock = 61 }; + { ProductID = 24; ProductName = "Guaraná Fantástica"; Category = "Beverages"; UnitPrice = 4.5000M; UnitsInStock = 20 }; + { ProductID = 25; ProductName = "NuNuCa Nuß-Nougat-Creme"; Category = "Confections"; UnitPrice = 14.0000M; UnitsInStock = 76 }; + { ProductID = 26; ProductName = "Gumbär Gummibärchen"; Category = "Confections"; UnitPrice = 31.2300M; UnitsInStock = 15 }; + { ProductID = 27; ProductName = "Schoggi Schokolade"; Category = "Confections"; UnitPrice = 43.9000M; UnitsInStock = 49 }; + { ProductID = 28; ProductName = "Rössle Sauerkraut"; Category = "Produce"; UnitPrice = 45.6000M; UnitsInStock = 26 }; + { ProductID = 29; ProductName = "Thüringer Rostbratwurst"; Category = "Meat/Poultry"; UnitPrice = 123.7900M; UnitsInStock = 0 }; + { ProductID = 30; ProductName = "Nord-Ost Matjeshering"; Category = "Seafood"; UnitPrice = 25.8900M; UnitsInStock = 10 }; + { ProductID = 31; ProductName = "Gorgonzola Telino"; Category = "Dairy Products"; UnitPrice = 12.5000M; UnitsInStock = 0 }; + { ProductID = 32; ProductName = "Mascarpone Fabioli"; Category = "Dairy Products"; UnitPrice = 32.0000M; UnitsInStock = 9 }; + { ProductID = 33; ProductName = "Geitost"; Category = "Dairy Products"; UnitPrice = 2.5000M; UnitsInStock = 112 }; + { ProductID = 34; ProductName = "Sasquatch Ale"; Category = "Beverages"; UnitPrice = 14.0000M; UnitsInStock = 111 }; + { ProductID = 35; ProductName = "Steeleye Stout"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 20 }; + { ProductID = 36; ProductName = "Inlagd Sill"; Category = "Seafood"; UnitPrice = 19.0000M; UnitsInStock = 112 }; + { ProductID = 37; ProductName = "Gravad lax"; Category = "Seafood"; UnitPrice = 26.0000M; UnitsInStock = 11 }; + { ProductID = 38; ProductName = "Côte de Blaye"; Category = "Beverages"; UnitPrice = 263.5000M; UnitsInStock = 17 }; + { ProductID = 39; ProductName = "Chartreuse verte"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 69 }; + { ProductID = 40; ProductName = "Boston Crab Meat"; Category = "Seafood"; UnitPrice = 18.4000M; UnitsInStock = 123 }; + { ProductID = 41; ProductName = "Jack's New England Clam Chowder"; Category = "Seafood"; UnitPrice = 9.6500M; UnitsInStock = 85 }; + { ProductID = 42; ProductName = "Singaporean Hokkien Fried Mee"; Category = "Grains/Cereals"; UnitPrice = 14.0000M; UnitsInStock = 26 }; + { ProductID = 43; ProductName = "Ipoh Coffee"; Category = "Beverages"; UnitPrice = 46.0000M; UnitsInStock = 17 }; + { ProductID = 44; ProductName = "Gula Malacca"; Category = "Condiments"; UnitPrice = 19.4500M; UnitsInStock = 27 }; + { ProductID = 45; ProductName = "Rogede sild"; Category = "Seafood"; UnitPrice = 9.5000M; UnitsInStock = 5 }; + { ProductID = 46; ProductName = "Spegesild"; Category = "Seafood"; UnitPrice = 12.0000M; UnitsInStock = 95 }; + { ProductID = 47; ProductName = "Zaanse koeken"; Category = "Confections"; UnitPrice = 9.5000M; UnitsInStock = 36 }; + { ProductID = 48; ProductName = "Chocolade"; Category = "Confections"; UnitPrice = 12.7500M; UnitsInStock = 15 }; + { ProductID = 49; ProductName = "Maxilaku"; Category = "Confections"; UnitPrice = 20.0000M; UnitsInStock = 10 }; + { ProductID = 50; ProductName = "Valkoinen suklaa"; Category = "Confections"; UnitPrice = 16.2500M; UnitsInStock = 65 }; + { ProductID = 51; ProductName = "Manjimup Dried Apples"; Category = "Produce"; UnitPrice = 53.0000M; UnitsInStock = 20 }; + { ProductID = 52; ProductName = "Filo Mix"; Category = "Grains/Cereals"; UnitPrice = 7.0000M; UnitsInStock = 38 }; + { ProductID = 53; ProductName = "Perth Pasties"; Category = "Meat/Poultry"; UnitPrice = 32.8000M; UnitsInStock = 0 }; + { ProductID = 54; ProductName = "Tourtière"; Category = "Meat/Poultry"; UnitPrice = 7.4500M; UnitsInStock = 21 }; + { ProductID = 55; ProductName = "Pâté chinois"; Category = "Meat/Poultry"; UnitPrice = 24.0000M; UnitsInStock = 115 }; + { ProductID = 56; ProductName = "Gnocchi di nonna Alice"; Category = "Grains/Cereals"; UnitPrice = 38.0000M; UnitsInStock = 21 }; + { ProductID = 57; ProductName = "Ravioli Angelo"; Category = "Grains/Cereals"; UnitPrice = 19.5000M; UnitsInStock = 36 }; + { ProductID = 58; ProductName = "Escargots de Bourgogne"; Category = "Seafood"; UnitPrice = 13.2500M; UnitsInStock = 62 }; + { ProductID = 59; ProductName = "Raclette Courdavault"; Category = "Dairy Products"; UnitPrice = 55.0000M; UnitsInStock = 79 }; + { ProductID = 60; ProductName = "Camembert Pierrot"; Category = "Dairy Products"; UnitPrice = 34.0000M; UnitsInStock = 19 }; + { ProductID = 61; ProductName = "Sirop d'érable"; Category = "Condiments"; UnitPrice = 28.5000M; UnitsInStock = 113 }; + { ProductID = 62; ProductName = "Tarte au sucre"; Category = "Confections"; UnitPrice = 49.3000M; UnitsInStock = 17 }; + { ProductID = 63; ProductName = "Vegie-spread"; Category = "Condiments"; UnitPrice = 43.9000M; UnitsInStock = 24 }; + { ProductID = 64; ProductName = "Wimmers gute Semmelknödel"; Category = "Grains/Cereals"; UnitPrice = 33.2500M; UnitsInStock = 22 }; + { ProductID = 65; ProductName = "Louisiana Fiery Hot Pepper Sauce"; Category = "Condiments"; UnitPrice = 21.0500M; UnitsInStock = 76 }; + { ProductID = 66; ProductName = "Louisiana Hot Spiced Okra"; Category = "Condiments"; UnitPrice = 17.0000M; UnitsInStock = 4 }; + { ProductID = 67; ProductName = "Laughing Lumberjack Lager"; Category = "Beverages"; UnitPrice = 14.0000M; UnitsInStock = 52 }; + { ProductID = 68; ProductName = "Scottish Longbreads"; Category = "Confections"; UnitPrice = 12.5000M; UnitsInStock = 6 }; + { ProductID = 69; ProductName = "Gudbrandsdalsost"; Category = "Dairy Products"; UnitPrice = 36.0000M; UnitsInStock = 26 }; + { ProductID = 70; ProductName = "Outback Lager"; Category = "Beverages"; UnitPrice = 15.0000M; UnitsInStock = 15 }; + { ProductID = 71; ProductName = "Flotemysost"; Category = "Dairy Products"; UnitPrice = 21.5000M; UnitsInStock = 26 }; + { ProductID = 72; ProductName = "Mozzarella di Giovanni"; Category = "Dairy Products"; UnitPrice = 34.8000M; UnitsInStock = 14 }; + { ProductID = 73; ProductName = "Röd Kaviar"; Category = "Seafood"; UnitPrice = 15.0000M; UnitsInStock = 101 }; + { ProductID = 74; ProductName = "Longlife Tofu"; Category = "Produce"; UnitPrice = 10.0000M; UnitsInStock = 4 }; + { ProductID = 75; ProductName = "Rhönbräu Klosterbier"; Category = "Beverages"; UnitPrice = 7.7500M; UnitsInStock = 125 }; + { ProductID = 76; ProductName = "Lakkalikööri"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 57 }; { ProductID = 77; ProductName = "Original Frankfurter grüne Soße"; Category = "Condiments"; UnitPrice = 13.0000M; UnitsInStock = 32 }] @@ -201,18 +201,18 @@ type Customer(customerID, companyName, address, city, region, postalCode, countr let getCustomerList() = let doc = XmlReader.Create(Environment.CurrentDirectory + "\\customers.xml") - + let xname s = XName.Get(s) - let ge (x : XElement) (s : string) = - try - let r = x.Element(XName.Get(s)).ToString() - Regex.Match(r, ">(.*)<").Groups.[1].Value - with + let ge (x : XElement) (s : string) = + try + let r = x.Element(XName.Get(s)).ToString() + Regex.Match(r, ">(.*)<").Groups.[1].Value + with | :? NullReferenceException -> "" query { for e in XDocument.Load(doc).Root.Elements(xname "customer") do let get = ge e - let orders = + let orders = query { for o in e.Elements(xname "orders").Elements(xname "order") do let date = ge o "orderdate" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/WhereRequiresParens01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/WhereRequiresParens01.fs index 1f1caa2480f..233237a4445 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/WhereRequiresParens01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/QueryExpressions/WhereRequiresParens01.fs @@ -9,5 +9,5 @@ let query = select i } -let r = "seq [10; 8; 6; 4; ...]" = sprintf "%A" query +let r = "seq [10; 8; 6; 4; ...]" = sprintf "%A" query if not r then exit 1 else exit 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/CustomType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/CustomType01.fs index 71e463cee17..0eada3bc8c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/CustomType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/CustomType01.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions +// #Conformance #DataExpressions // Verify the ability to use custom types in range expressions // All it needs is a One property and a member (+) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/CustomType02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/CustomType02.fs index abcb63e4ea8..0ed50520f54 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/CustomType02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/CustomType02.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions +// #Conformance #DataExpressions // Verify the ability to use custom types in range expressions // All it needs is a Zero property and a member (+) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/FloatingPointRangeExp01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/FloatingPointRangeExp01.fs index 08bdc3f65ea..96caba21244 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/FloatingPointRangeExp01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/FloatingPointRangeExp01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions +// #Regression #Conformance #DataExpressions // FSB 1005, float comprehensions of form "x0 .. dx .. x1" suffer rounding errors @@ -6,7 +6,7 @@ //Floating point ranges are experimental and may be deprecated in a future release let floatingPointRange = [0.0 .. 0.01 .. 2.0] -let lastNum, sndToLast = floatingPointRange +let lastNum, sndToLast = floatingPointRange |> List.rev |> function fst :: snd :: rest -> (fst, snd) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/W-FloatingPointRangeExp01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/W-FloatingPointRangeExp01.fs index f1d796fd242..fc52c324d43 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/W-FloatingPointRangeExp01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/RangeExpressions/W-FloatingPointRangeExp01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #DataExpressions +// #Regression #Conformance #DataExpressions // FSB 1005, float comprehensions of form "x0 .. dx .. x1" suffer rounding errors //Floating point ranges are experimental and may be deprecated in a future release let floatingPointRange = [0.0 .. 0.01 .. 2.0] -let lastNum, sndToLast = floatingPointRange +let lastNum, sndToLast = floatingPointRange |> List.rev |> function fst :: snd :: rest -> (fst, snd) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/CodeDisposalInMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/CodeDisposalInMatch01.fs index 18c751f8192..d2f91f456a3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/CodeDisposalInMatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/CodeDisposalInMatch01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:4365 // Mistake in generation of code for disposal in "match" sequence expressions // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/E_final_yield_dash_gt_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/E_final_yield_dash_gt_01.fs index da21aa9fd63..ccfb9bd85bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/E_final_yield_dash_gt_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/E_final_yield_dash_gt_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:3135 // See also FSHARP1.0:4207 // Usage of "->" in a sequence expression is deprecated, unless diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse04.fs index 2ac4289fdef..f01bd426d3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:4527 // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse05.fs index 145442d6f8d..2b203ddf6ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:4527 // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse06.fs index fcf5e4a2a14..58b995b697d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse06.fs @@ -1,6 +1,6 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:4527 // -let y = +let y = [ if true then yield! [1;2] else () ] (if y = [1;2] then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse07.fs index 55a248688fc..f1e47987af5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/IfThenElse07.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:4527 // -let x = +let x = [ if true then yield! [1] - if true then + if true then yield 2 ] (if x = [1;2] then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/ReallyLongArray01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/ReallyLongArray01.fs index 0a92b9205a4..4c2e9696cd6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/ReallyLongArray01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/ReallyLongArray01.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #Sequences +// #Conformance #DataExpressions #Sequences // Verify arrays can be really, really long @@ -1158,7 +1158,7 @@ let names = [| "Kerrie"; "Kerry"; |] - + if Array.length names <> 1153 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01_v47.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01_v47.fs index c2b85aece6a..b0cb6cdc1b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01_v47.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01_v47.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Note, implicit yield is enabled because no 'yield' is used diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02_v47.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02_v47.fs index cabe197b92d..380687a4f0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02_v47.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02_v47.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Note, implicit yield is enabled because no 'yield' is used diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03_v47.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03_v47.fs index 286fecdce6a..3bda51773b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03_v47.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03_v47.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Note, implicit yield is enabled because no 'yield' is used diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/YieldInsideFlowControl.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/YieldInsideFlowControl.fs index b90636f2da0..af6457d2e71 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/YieldInsideFlowControl.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/YieldInsideFlowControl.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSharp1.0:3930 - "Invalid sequence expression" error when using yield combined with if-then expressions in seq. @@ -9,8 +9,8 @@ let evens n = yield 0 yield! [2..2..n] |> Seq.ofList } - -let odds n = + +let odds n = seq { if false then yield! [] @@ -18,7 +18,7 @@ let odds n = yield 1 yield! [3..2..n] } - + if ((evens 100) |> Seq.append (odds 100) |> Seq.sum ) <> ( 100 * 101 / 2 ) then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_bang_keyword_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_bang_keyword_01.fs index 677ae056d5e..19991dc2b0c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_bang_keyword_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_bang_keyword_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:3135 // Usage of "->>" in a sequence expression is deprecated // Use "do yield! ..." instead diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_dash_gt_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_dash_gt_01.fs index 2925bfe0d61..6a63bdadcb4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_dash_gt_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_dash_gt_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:3135 // Usage of "->" in a sequence expression is deprecated, unless // in [ for pat in expr -> expr ] and other compact seq expr diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_keyword_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_keyword_01.fs index 6f8dfd0f9d8..de190507f6f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_keyword_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/final_yield_keyword_01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:3135 // Usage of "->" in a sequence expression is deprecated, unless // in [ for pat in expr -> expr ] and other compact seq expr diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/tailcalls01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/tailcalls01.fs index b78d552c847..2e27eb4f6d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/tailcalls01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/tailcalls01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:4135 // We want to make sure that this call succeeds (typically if tail calls are not enabled, // this would yield an out of memory) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/tailcalls02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/tailcalls02.fs index abd93f641c1..8606b0c910f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/tailcalls02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/SequenceExpressions/tailcalls02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Sequences +// #Regression #Conformance #DataExpressions #Sequences // Regression test for FSHARP1.0:4135 // We want to make sure that this call succeeds (typically if tail calls are not enabled, // this would yield an out of memory) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/Simple/ListSubsumption01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/Simple/ListSubsumption01.fs index f37089678c4..bcb1e7d8ac2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/Simple/ListSubsumption01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/Simple/ListSubsumption01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions +// #Regression #Conformance #DataExpressions // Verify list literals have their type based on the first element of the list. // (Regression for FSB 1180) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/EqualityDifferentRuntimeType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/EqualityDifferentRuntimeType01.fs index 789496bee78..949b4f52e89 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/EqualityDifferentRuntimeType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/EqualityDifferentRuntimeType01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DataExpressions #Tuples +// #Regression #Conformance #DataExpressions #Tuples // Regression test for FSHARP1.0:5514 // This was actually a BCL bug (TFS#660592) // Comparing tuples of different types should not throw at runtime diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/Tuples01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/Tuples01.fs index 76d5217b695..a1bdf836e80 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/Tuples01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/Tuples01.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #Tuples +// #Conformance #DataExpressions #Tuples let tuple1 = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/Tuples02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/Tuples02.fs index 405d3ab7d69..e3027070deb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/Tuples02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/DataExpressions/TupleExpressions/Tuples02.fs @@ -1,4 +1,4 @@ -// #Conformance #DataExpressions #Tuples +// #Conformance #DataExpressions #Tuples // Verify tuples work right when crossing the '6' boundary @@ -19,7 +19,7 @@ let tuple19 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 let monsterTuple = 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' -let test26 beastOfATuple = +let test26 beastOfATuple = match beastOfATuple with | a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z -> if a <> 'a' then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/EvaluationOfElaboratedForms/letbinding_precomutation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/EvaluationOfElaboratedForms/letbinding_precomutation01.fs index 64b07e034d1..7557a5e2d78 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/EvaluationOfElaboratedForms/letbinding_precomutation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/EvaluationOfElaboratedForms/letbinding_precomutation01.fs @@ -1,6 +1,6 @@ -// #Regression #Conformance +// #Regression #Conformance // Regression test for FSHARP1.0:3330 -// +// @@ -9,49 +9,49 @@ let mutable times_y_was_computed = 0 let mutable times_c_was_computed = 0 //Simple class to store a single variable -type AClass ( initialValue:int) = +type AClass ( initialValue:int) = let variable = initialValue - + member x.Variable = variable //function which returns a function which returns a function -let f a = +let f a = //pre-computation of x let x = times_x_was_computed <- times_x_was_computed + 1 a * a - + //function which returns a function fun (b:AClass) -> //pre-computation of y - this should be done only once! let y = times_y_was_computed <- times_y_was_computed + 1 b.Variable + x - + fun c -> times_c_was_computed <- times_c_was_computed + 1 c + y - + do let g = f 1 let innerFunction = g (AClass(2)) - + {1 .. 5} |> Seq.iter (fun i -> innerFunction i |> ignore ) -if times_x_was_computed <> 1 then - printfn "value x computed %d time(s); expected 1 time" times_x_was_computed +if times_x_was_computed <> 1 then + printfn "value x computed %d time(s); expected 1 time" times_x_was_computed exit 1 -if times_y_was_computed <> 1 then - printfn "value y computed %d time(s); expected 1 time" times_y_was_computed +if times_y_was_computed <> 1 then + printfn "value y computed %d time(s); expected 1 time" times_y_was_computed exit 1 -if times_c_was_computed <> 5 then - printfn "value c computed %d time(s); expected 5 times" times_c_was_computed +if times_c_was_computed <> 5 then + printfn "value c computed %d time(s); expected 5 times" times_c_was_computed exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines.fs index a9a7cb9d1d1..3f477f8b9b7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines.fs @@ -18,9 +18,9 @@ open FSharp.Test.Compiler open System.IO module Baselines = - + let private basePath = Path.Combine(__SOURCE_DIRECTORY__, "Baselines") - + /// Create QuoteUtils.fs as a library CompilationUnit let private getQuoteUtilsLib () = let source = File.ReadAllText(Path.Combine(basePath, "QuoteUtils.fs")) @@ -61,7 +61,7 @@ module Baselines = |> ignore // ======================================== - // Tests requiring QuoteUtils.dll + // Tests requiring QuoteUtils.dll // ======================================== [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AddressOf.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AddressOf.fs index 34b41beae0c..cb846bf872b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AddressOf.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AddressOf.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5612 open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns @@ -9,7 +9,7 @@ type S(z : int) = [] val mutable x : int //let q = <@ let mutable y = S(1).x -// y <- 2 @> +// y <- 2 @> let q' = Expr.AddressOf(Expr.Var(Var("someVar", typeof))) //let r1 = verify q (|AddressOf|_|) "Let (y, diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AddressSet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AddressSet.fs index 6a098f39b8d..3b7a64f4ee8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AddressSet.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AddressSet.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5612 open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns @@ -9,7 +9,7 @@ type S(z : int) = [] val mutable x : int //let q = <@ let mutable y = S(1).x -// y <- 2 @> +// y <- 2 @> let q' = Expr.AddressSet(Expr.AddressOf(Expr.Var(Var("someVar", typeof))), Expr.Value(1)) //let r1 = verify q (|AddressSet|_|) "Let (y, diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AndAlso.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AndAlso.fs index f559e7f4b6e..e2e552698ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AndAlso.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/AndAlso.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Application.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Application.fs index 6cecb754989..f1f1cd8c9b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Application.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Application.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils @@ -13,7 +13,7 @@ let q' = Expr.Application( ), Expr.Value("arg1") ) - + let r1 = verify q (|Application|_|) "Let (f, Lambda (g, Lambda (x, diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Applications.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Applications.fs index eadda73f48f..3b5d094c9f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Applications.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Applications.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Bool.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Bool.fs index 3572f99caae..dffb58b47f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Bool.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Bool.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Byte.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Byte.fs index 6414873b9c7..3e8d574d430 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Byte.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Byte.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Call.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Call.fs index 7d44167af4f..566d02349e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Call.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Call.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Cast.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Cast.fs index 26659ac59f8..bf6d4bb5b0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Cast.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Cast.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations // Verify bad casts throw at runtime and valid ones succeed open System open Microsoft.FSharp.Quotations @@ -18,7 +18,7 @@ let r2 = 1 with | :? ArgumentException -> 0 - + let r3 = try let uq = <@@ let x = 1 in x @@> @@ -26,5 +26,5 @@ let r3 = 0 with | :? ArgumentException -> 1 - + exit <| if r1 = 0 && r2 = 0 && r3 = 0 then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Char.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Char.fs index 06d88653df9..30e09e5570c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Char.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Char.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Coerce.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Coerce.fs index 47c9767e433..95e04f364f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Coerce.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Coerce.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open Microsoft.FSharp.Quotations.Patterns @@ -6,12 +6,12 @@ open QuoteUtils type A() = member this.X = 1 - + type B() = inherit A() member this.Y = 2 - - + + let q = <@ B() :> A @> let q' = Expr.Coerce(Expr.Value(B()), typeof) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/DefaultValue.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/DefaultValue.fs index 59bdb9688f3..40ada13f18b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/DefaultValue.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/DefaultValue.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5751 open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns @@ -8,7 +8,7 @@ open QuoteUtils type T = [] val data : int - + let q = <@ T() @> let q' = Expr.Let(Var("x", typeof), Expr.DefaultValue(typeof), Expr.Value(0)) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Double.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Double.fs index 1bbf5ff1b05..4bc749b05a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Double.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Double.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/E_Cast.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/E_Cast.fs index bd3772bf30c..5958e66849d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/E_Cast.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/E_Cast.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Verify type annotation is required for casting quotes //Value restriction: The value 'tq' has an inferred generic type val tq: Expr<'_a>However, values cannot have generic type variables like '_a in "let x: '_a"\. You can do one of the following:- Define it as a simple data term like an integer literal, a string literal or a union case like "let x = 1"- Add an explicit type annotation like "let x : int"- Use the value as a non-generic type in later code for type inference like "do x"or if you still want type-dependent results, you can define 'tq' as a function instead by doing either:- Add a unit parameter like "let x\(\)"- Write explicit type parameters like "let x<'a>".This error is because a let binding without parameters defines a value, not a function\. Values cannot be generic because reading a value is assumed to result in the same everywhere but generic type parameters may invalidate this assumption by enabling type-dependent results\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/E_StructQuote.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/E_StructQuote.fs index 44c92d1c458..d7a1b4be733 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/E_StructQuote.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/E_StructQuote.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations #Regression +// #Conformance #Quotations #Regression // Regression for bug 6420 //ReflectedDefinitionAttribute may not be applied to an instance member on a struct type, because the instance member takes an implicit 'this' byref parameter //ReflectedDefinitionAttribute may not be applied to an instance member on a struct type, because the instance member takes an implicit 'this' byref parameter diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ExtMethodWithReflectedDefinition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ExtMethodWithReflectedDefinition.fs index 956f9a297f3..10fa36cde81 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ExtMethodWithReflectedDefinition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ExtMethodWithReflectedDefinition.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open Microsoft.FSharp.Quotations.DerivedPatterns @@ -22,24 +22,24 @@ let hasMethodWithReflectedDefinition quote = // ensure the quotation matches and that the rebuilt quotation retained the ReflectedDefinition attribute, and check the quote's shape let doubleCheckReflectedDefinition (quote : Expr) (shapeString : string) = let qr, f = hasMethodWithReflectedDefinition quote - let res = + let res = match !f with | true -> let qr2, f2 = hasMethodWithReflectedDefinition qr if !f2 then 0 else 1 | false -> -1 - + let shapeResult = checkQuote quote shapeString let shapeResult2 = checkQuote qr shapeString - + res + shapeResult + shapeResult2 - + // test type with extension members with reflected definitions type System.String with member this.Foo = 1 - - [] + + [] member this.Bar = 2 - + [] member this.Ram x = this.Bar * x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/FieldGet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/FieldGet.fs index 07a56b64fcd..7494bd767f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/FieldGet.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/FieldGet.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5612 open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns @@ -9,7 +9,7 @@ type S(z : int) = [] val mutable x : int let q = <@ S(1).x @> -let q' = Expr.FieldGet(Expr.NewObject(typeof.GetConstructor([|typeof|]), [Expr.Value(1)]), typeof.GetField("x")) +let q' = Expr.FieldGet(Expr.NewObject(typeof.GetConstructor([|typeof|]), [Expr.Value(1)]), typeof.GetField("x")) let r1 = verify q (|FieldGet|_|) "Let (copyOfStruct, NewObject (S, Value (1)), FieldGet (Some (copyOfStruct), x))" let r2 = verify q' (|FieldGet|_|) "FieldGet (Some (NewObject (S, Value (1))), x)" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/FieldSet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/FieldSet.fs index acc6fa67fd6..5316858fae4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/FieldSet.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/FieldSet.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils @@ -7,7 +7,7 @@ type S(z : int) = [] val mutable x : int let q = <@ S(1).x <- 1 @> -let q' = Expr.FieldSet(Expr.NewObject(typeof.GetConstructor([|typeof|]), [Expr.Value(1)]), typeof.GetField("x"), Expr.Value(1)) +let q' = Expr.FieldSet(Expr.NewObject(typeof.GetConstructor([|typeof|]), [Expr.Value(1)]), typeof.GetField("x"), Expr.Value(1)) let r1 = verify q (|FieldSet|_|) "FieldSet (Some (NewObject (S, Value (1))), x, Value (1))" let r2 = verify q' (|FieldSet|_|) "FieldSet (Some (NewObject (S, Value (1))), x, Value (1))" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ForIntegerRangeLoop.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ForIntegerRangeLoop.fs index fe0ae8eff19..06b9cf09b2d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ForIntegerRangeLoop.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ForIntegerRangeLoop.fs @@ -1,9 +1,9 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils -let q = <@ for i in 1..10 do () @> +let q = <@ for i in 1..10 do () @> let q' = Expr.ForIntegerRangeLoop(Var("i", typeof), Expr.Value(-2), Expr.Value(-3), Expr.Value(null)) let r1 = verify q (|ForIntegerRangeLoop|_|) "ForIntegerRangeLoop (i, Value (1), Value (10), Value ())" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/IfThenElse.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/IfThenElse.fs index bc019a2edf5..106b2677749 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/IfThenElse.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/IfThenElse.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int16.fs index 12e08170349..059ee7de179 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int16.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int32.fs index 4a38376f7ab..356da329c80 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int32.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int32.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int64.fs index 90a601f5bee..e44fd0db801 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int64.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Int64.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Lambda.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Lambda.fs index 9a79d64589b..c1d4b0c0328 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Lambda.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Lambda.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Lambdas.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Lambdas.fs index 232ac7b21d9..ec5ecc85866 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Lambdas.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Lambdas.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Let.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Let.fs index 45cc5f0d8ad..563abb01d64 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Let.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Let.fs @@ -1,10 +1,10 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils let q = <@ let x, y = (1,2) in x @> -let q' = Expr.Let(Var("x", typeof int>), Expr.Lambda(Var("x", typeof), Expr.Value(0)), Expr.Value(1)) +let q' = Expr.Let(Var("x", typeof int>), Expr.Lambda(Var("x", typeof), Expr.Value(0)), Expr.Value(1)) let r1 = verify q (|Let|_|) "Let (patternInput, NewTuple (Value (1), Value (2)), Let (y, TupleGet (patternInput, 1), Let (x, TupleGet (patternInput, 0), x)))" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/LetRec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/LetRec.fs index 4c052cd055c..2ddc0a89798 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/LetRec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/LetRec.fs @@ -1,9 +1,9 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils -let q = <@ let rec f x = if x = 0 then 0 else f (x-1) +let q = <@ let rec f x = if x = 0 then 0 else f (x-1) f 0 @> let q' = Expr.LetRecursive([(Var("f", typeofint>), Expr.Lambda(Var("x", typeof), Expr.Value(1)))], Expr.Value(0)) let r1 = verify q (|LetRecursive|_|) "LetRecursive ([(f,Lambda (x, diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/MethodWithReflectedDefinition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/MethodWithReflectedDefinition.fs index 98a103ebf81..d045e2c5d0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/MethodWithReflectedDefinition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/MethodWithReflectedDefinition.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open Microsoft.FSharp.Quotations.DerivedPatterns diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewArray.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewArray.fs index 7c0dca69739..5f7348f7af5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewArray.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewArray.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewDelegate.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewDelegate.fs index dd7ab6d2210..e8b9bf9f66c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewDelegate.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewDelegate.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open Microsoft.FSharp.Quotations.Patterns diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewObject.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewObject.fs index 52e0a2fabe8..ef2a65ab744 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewObject.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewObject.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open System.Collections.Generic open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns @@ -7,6 +7,6 @@ open QuoteUtils let q = <@ let x = new List() in x @> let q' = Expr.NewObject(typeof>.GetConstructor([|typeof|]), [Expr.Value(0)]) -let r1 = verify q (|NewObject|_|) "Let (x, NewObject (List`1), x)" +let r1 = verify q (|NewObject|_|) "Let (x, NewObject (List`1), x)" let r2 = verify q' (|NewObject|_|) "NewObject (List`1, Value (0))" exit <| if r1 = 0 && r2 = 0 then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewRecord.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewRecord.fs index 8bbd8567969..4e7790a9708 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewRecord.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewRecord.fs @@ -1,9 +1,9 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils -type t = { Name : string; Age : int } +type t = { Name : string; Age : int } let q = <@ let x = { Name = "Bob"; Age = 10; } in x @> let q' = Expr.NewRecord(typeof, [Expr.Value("Bob"); Expr.Value(10)]) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewStructRecord.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewStructRecord.fs index 0571277fca2..f023598de89 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewStructRecord.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewStructRecord.fs @@ -1,9 +1,9 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils -[] type t = { Name : string; Age : int } +[] type t = { Name : string; Age : int } let q = <@ let x = { Name = "Bob"; Age = 10; } in x @> let q' = Expr.NewRecord(typeof, [Expr.Value("Bob"); Expr.Value(10)]) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewTuple.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewTuple.fs index 5687265d6b6..3bb4f009b65 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewTuple.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewTuple.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewUnionCase.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewUnionCase.fs index e0599e78dc8..9dc22aff09e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewUnionCase.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/NewUnionCase.fs @@ -1,11 +1,11 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils type t = | A of int | B of string let q = <@ let x, y = (A(1), B("1")) in x @> - + let uci = Microsoft.FSharp.Reflection.FSharpType.GetUnionCases(typeof) let q' = Expr.NewUnionCase(uci.[0], [Expr.Value(1)]) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/OrElse.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/OrElse.fs index 12c30e933ad..8ad8eb88886 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/OrElse.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/OrElse.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropGet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropGet.fs index e1f937aa766..2a9e1054b98 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropGet.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropGet.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropSet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropSet.fs index 6b0b66194bd..2d697b3bad0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropSet.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropSet.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open System.Collections.Generic open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropertyGetterWithReflectedDefinition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropertyGetterWithReflectedDefinition.fs index 7fd4632684e..a903c007010 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropertyGetterWithReflectedDefinition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropertyGetterWithReflectedDefinition.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open Microsoft.FSharp.Quotations.DerivedPatterns diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropertySetterWithReflectedDefinition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropertySetterWithReflectedDefinition.fs index 76830e8462e..0d452d13813 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropertySetterWithReflectedDefinition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/PropertySetterWithReflectedDefinition.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.ExprShape open Microsoft.FSharp.Quotations.DerivedPatterns @@ -32,7 +32,7 @@ let hasReflectedDefinitionPropertySetter quote = | ShapeLambda (v,expr) -> Expr.Lambda (v, traverse expr) | ShapeCombination (o, exprs) -> RebuildShapeCombination(o, List.map traverse exprs) (traverse quote, found) - + // ensure the quotation matches and that the rebuilt quotation retained the ReflectedDefinition attribute let q1, f1 = hasReflectedDefinitionPropertySetter q let r1 = match !f1 with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Quote.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Quote.fs index c7679bcf97e..9eb529e2b7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Quote.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Quote.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/QuoteUtils.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/QuoteUtils.fs index cd48c1013e4..f7284cee194 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/QuoteUtils.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/QuoteUtils.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations module QuoteUtils open System @@ -8,11 +8,11 @@ open Microsoft.FSharp.Quotations.DerivedPatterns open Microsoft.FSharp.Quotations.ExprShape open System.Collections.Generic -/// Match a quotation with an active pattern. Use of ExprShape means q should represent valid F# code. +/// Match a quotation with an active pattern. Use of ExprShape means q should represent valid F# code. let matchQuote q (|Pat|_|) = - let mutable result = false + let mutable result = false let mutable matchedFragment = None - let rec checkForShape quote (|Pat|_|) = + let rec checkForShape quote (|Pat|_|) = let m = match quote with | Pat v -> result <- true matchedFragment <- Some(quote) @@ -25,12 +25,12 @@ let matchQuote q (|Pat|_|) = RebuildShapeCombination(o, newExprs) checkForShape q (|Pat|_|) |> ignore if result then matchedFragment else None - + /// Compare a quotation to a string representation of its expected shape let checkQuote (q : Expr) (expectedShape : string) = let x = sprintf "%A" q - if (x.Replace("\r\n", "\n") = expectedShape.Replace("\r\n", "\n")) then - 0 + if (x.Replace("\r\n", "\n") = expectedShape.Replace("\r\n", "\n")) then + 0 else printfn "Expected:" printfn "=========" @@ -38,8 +38,8 @@ let checkQuote (q : Expr) (expectedShape : string) = printfn "Actual:" printfn "=========" printfn "%s" x - 1 - + 1 + /// Verify a quotation matches the given pattern and its string representation is shaped correctly let verify q (|Pat|_|) expectedShape = let qm = matchQuote q (|Pat|_|) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ReferenceToImplicitField.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ReferenceToImplicitField.fs index 5dfab426ab8..b533e277918 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ReferenceToImplicitField.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/ReferenceToImplicitField.fs @@ -1,5 +1,5 @@ // #Conformance #Quotations #Regression -// Bug 6423:Implicit field accesses in implicit method definitions are quoted incorrectly +// Bug 6423:Implicit field accesses in implicit method definitions are quoted incorrectly open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns type Foo() = @@ -15,9 +15,9 @@ type Foo() = let foo = Foo() -let success = +let success = match foo.Bar with - | FieldGet(Some (Value (v,t)), _) -> + | FieldGet(Some (Value (v,t)), _) -> printfn "%A" v obj.ReferenceEquals(v, foo) && t = typeof | _ -> false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/SByte.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/SByte.fs index 319a8f6f76a..c146b75b6c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/SByte.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/SByte.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Sequential.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Sequential.fs index 4aa6f1720fe..f53d027117e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Sequential.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Sequential.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils @@ -7,9 +7,9 @@ let f x = () let g x = () let q = <@ f 1; g 2 @> let q' = Expr.Sequential( - Expr.Let(Var("x", typeof), Expr.Value("A"), Expr.Value(1)), + Expr.Let(Var("x", typeof), Expr.Value("A"), Expr.Value(1)), Expr.Call(Expr.Value("D"), typeof.GetMethod("Contains"), [Expr.Value("C")])) - + let r1 = verify q (|Sequential|_|) "Sequential (Call (None, f, [Value (1)]), Call (None, g, [Value (2)]))" let r2 = verify q' (|Sequential|_|) "Sequential (Let (x, Value (\"A\"), Value (1)), Call (Some (Value (\"D\")), Contains, [Value (\"C\")]))" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Single.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Single.fs index 14b2f516e75..bcca4088d26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Single.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Single.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/SpecificCall.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/SpecificCall.fs index b5ef73a6d8a..c9c0e756c16 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/SpecificCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/SpecificCall.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/String.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/String.fs index b2ca07de213..3f163370a9d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/String.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/String.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryFinally.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryFinally.fs index d129331e675..66096483f97 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryFinally.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryFinally.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryGetReflectedDefinition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryGetReflectedDefinition.fs index 94db2d7e8c4..ba08c273c3a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryGetReflectedDefinition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryGetReflectedDefinition.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open Microsoft.FSharp.Quotations.Patterns @@ -15,15 +15,15 @@ let mi = match q with let rd = Expr.TryGetReflectedDefinition(mi.Value) // Get nested call which doesn't have a reflected definition let mi2 = match rd.Value with - | Lambda (_, body) -> + | Lambda (_, body) -> match body with - | Call (None, m, args) -> + | Call (None, m, args) -> match args.Head with | Call (None, mi, _) -> Some(mi) | _ -> None | _ -> None | _ -> None - + let rd2 = Expr.TryGetReflectedDefinition(mi2.Value) exit <| match rd, rd2 with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryWith.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryWith.fs index fc6a9008b88..6094fe06437 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryWith.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryWith.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:5644 open System @@ -10,10 +10,10 @@ exception E of int let q = <@ try let x = 1 in raise (E 3) with | :? ArgumentException as e when e.InnerException <> null -> -1 | E x -> x @> let q' = Expr.TryWith( - Expr.Value(0), - Var("f", typeof), Expr.Value(1), + Expr.Value(0), + Var("f", typeof), Expr.Value(1), Var("c", typeof), Expr.Call(typeof.GetMethod("Exit"), [Expr.Value(1)])) - + let r1 = verify q (|TryWith|_|) "TryWith (Let (x, Value (1), Call (None, Raise, [Coerce (NewObject (E, Value (3)), Exception)])), matchValue, diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryWith01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryWith01.fs index b500d892930..4c77f35e5a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryWith01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TryWith01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:5649 // Title: Reflected 'try..with' has inverted conditional branches @@ -12,7 +12,7 @@ exception E0 exception E1 let q = <@ - try 0 with + try 0 with | E0 -> 1 | E1 -> 2 @> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TupleGet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TupleGet.fs index 78e8cfb7066..30ae65019d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TupleGet.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TupleGet.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TypeTest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TypeTest.fs index 6854f3f9db6..93a01eb88f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TypeTest.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/TypeTest.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open System open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt16.fs index a314be0ebf9..20e5f031324 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt16.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt32.fs index 6a81bd47cc4..5362330004a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt32.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt32.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt64.fs index b170b349ef1..aef538deb82 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt64.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UInt64.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UnionCaseTest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UnionCaseTest.fs index 5737bbfe2dd..e0320c95f93 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UnionCaseTest.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/UnionCaseTest.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils @@ -6,7 +6,7 @@ open QuoteUtils type t = | A of int | B of string let q = <@ let m = match A(1) with | A x -> 0 | B x -> 1 in () @> let uci = Microsoft.FSharp.Reflection.FSharpType.GetUnionCases(typeof) -let q' = Expr.UnionCaseTest(Expr.NewUnionCase(uci.[0], [Expr.Value(1)]), uci.[0]) +let q' = Expr.UnionCaseTest(Expr.NewUnionCase(uci.[0], [Expr.Value(1)]), uci.[0]) let r1 = verify q (|UnionCaseTest|_|) "Let (m, Let (matchValue, NewUnionCase (A, Value (1)), IfThenElse (UnionCaseTest (matchValue, B), @@ -14,6 +14,6 @@ let r1 = verify q (|UnionCaseTest|_|) "Let (m, Value (1)), Let (x, PropertyGet (Some (matchValue), Item, []), Value (0)))), Value ())" - + let r2 = verify q' (|UnionCaseTest|_|) "UnionCaseTest (NewUnionCase (A, Value (1)), A)" exit <| if r1 = 0 && r2 = 0 then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Unit.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Unit.fs index 0ca2d9ee817..5624b7de033 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Unit.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Unit.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Value.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Value.fs index 82860ff93cd..0ea592b06ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Value.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Value.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.DerivedPatterns open Microsoft.FSharp.Quotations.Patterns @@ -7,6 +7,6 @@ open QuoteUtils let q = <@ 0 @> let q' = Expr.Value(null) -let r1 = verify q (|Value|_|) "Value (0)" +let r1 = verify q (|Value|_|) "Value (0)" let r2 = verify q' (|Value|_|) "Value ()" exit <| if r1 = 0 && r2 = 0 then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Var.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Var.fs index 2273c4f3b2e..a89997b1f86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Var.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/Var.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/VarSet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/VarSet.fs index 51bbf1373b5..56af9ff699e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/VarSet.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/VarSet.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5752 open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/WhileLoop.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/WhileLoop.fs index d9c1edde619..80c37c98ecb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/WhileLoop.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Baselines/WhileLoop.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open QuoteUtils diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions.fs index c80190c85dd..465b0f318a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions.fs @@ -13,7 +13,7 @@ open FSharp.Test.Compiler open System.IO module Regressions = - + let private basePath = Path.Combine(__SOURCE_DIRECTORY__, "Regressions") /// Compile a C# file to a library diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ActivePatternDecomposeList01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ActivePatternDecomposeList01.fs index 2461916697f..f81342542f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ActivePatternDecomposeList01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ActivePatternDecomposeList01.fs @@ -1,29 +1,29 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:4918 // Ensure we can decompose a list returned from an active pattern inside a quotation -let (|RefCell|) x = !x -let q = - <@@ let xs = ref [1.;2.] - match xs with - | RefCell [v1_b; v2_b] -> v1_b + v2_b - | _ -> failwith "?" - @@> +let (|RefCell|) x = !x +let q = + <@@ let xs = ref [1.;2.] + match xs with + | RefCell [v1_b; v2_b] -> v1_b + v2_b + | _ -> failwith "?" + @@> -let xs = ref [1.0; 2.0] +let xs = ref [1.0; 2.0] let ys = (|RefCell|) xs let result = - if (match ys with _::_ -> true | _ -> false) then - if (match ys.Tail with _::_ -> true | _ -> false) then - if (match (ys.Tail).Tail with [] -> true | _ -> false) then - (fun v2_b v1_b -> v2_b + v1_b) ((ys.Tail).Head) (ys.Head) - else - -1.0 - else + if (match ys with _::_ -> true | _ -> false) then + if (match ys.Tail with _::_ -> true | _ -> false) then + if (match (ys.Tail).Tail with [] -> true | _ -> false) then + (fun v2_b v1_b -> v2_b + v1_b) ((ys.Tail).Head) (ys.Head) + else + -1.0 + else -1.0 - else + else -1.0 - + exit <| match result with | 3.0 -> 0 | _ -> 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_DecomposeArray01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_DecomposeArray01.fs index f989e7baff8..b358eaf7e66 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_DecomposeArray01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_DecomposeArray01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5695 // Quotations don't allow pattern matching on arrays inside quotations //Quotations cannot contain inline assembly code or pattern matching on arrays$ //Quotations cannot contain inline assembly code or pattern matching on arrays$ -let q = +let q = <@ let x = [|1;2;3;4|] let y = match x with | [|x1;x2;x3|] -> Some(x3) @@ -15,7 +15,7 @@ let q = let (|AP|) (x : 'a array) = x.[0..2] -let q2 = +let q2 = <@ let x = [|1;2;3;4|] let y = match x with | AP [|x1;x2;x3|] -> Some(x3) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_GenericQuotation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_GenericQuotation01.fs index 77308132ed4..ab85a89d5ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_GenericQuotation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_GenericQuotation01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Verify error for generalized quotations //Inner generic functions are not permitted in quoted expressions\. Consider adding some type constraints until this function is no longer generic let _ = <@ let x = [] - x @> + x @> exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral01.fs index 98d1f8fdcd5..7e61af1bdb5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Verify restrictions for what can be written in a quotation //Incomplete structured construct at or before this point in quotation literal //Unmatched '<@ @>' @@ -7,6 +7,6 @@ //Unexpected end of quotation in expression. Expected incomplete structured construct at or before this point or other token. let _ = <@ type Foo(x : int) = - member this.Length = x @> + member this.Length = x @> exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral02.fs index 5b8b2410e16..4a6e0ba6b50 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Verify restrictions for what can be written in a quotation @@ -6,4 +6,4 @@ let _ = <@ let mutable x = 0 let y = &x - y @> + y @> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral03.fs index 9882bced595..637102f30aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_InvalidQuotationLiteral03.fs @@ -1,6 +1,6 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Verify quotations cannot contain object expressions //Quotations cannot contain object expressions$ - + let _ = <@ { new System.IDisposable with member this.Dispose() = () } @> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationHoles01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationHoles01.fs index 801df1962d6..f7ad302fcc2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationHoles01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationHoles01.fs @@ -11,9 +11,9 @@ try let r = q2 (Expr.Value("hi")) exit 1 with - | :? System.ArgumentException as e -> + | :? System.ArgumentException as e -> let expected = "Type mismatch when splicing expression into quotation literal. The type of the expression tree being inserted doesn't match the type expected by the splicing operation. Expected 'System.String', but received type 'System.Object'. Consider type-annotating with the expected expression type, e.g., (%% x : System.String) or (%x : System.String)." - if not (e.Message.Contains(expected)) then + if not (e.Message.Contains(expected)) then printfn "%A" (e.Message) exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators01.fs index 3a09e01c2c5..57f99813905 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for 6073 (quotation operators) //Unexpected infix operator in binding\. Expected '\)' or other token\. //Unmatched '\(' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators02.fs index 1fcc278b7d0..814cef1706f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for 6073 (quotation operators) //Unexpected infix operator in binding module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators03.fs index 46582089a8e..270b6be6d05 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for 6073 (quotation operators) //Unexpected infix operator in binding module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators04.fs index e0a85b47915..201627752f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuotationOperators04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for 6073 (quotation operators) //Unexpected infix operator in binding\. Expected '\)' or other token\. //Unmatched '\(' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuoteAddressOf01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuoteAddressOf01.fs index ee4b681779a..a5c85af2e8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuoteAddressOf01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuoteAddressOf01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Quotes do not allow addressof of a mutable // Quotations cannot contain this kind of type // Quotations cannot contain this kind of type @@ -11,9 +11,9 @@ let x = <@ let mutable x = 1 [] type S(z : int) = [] val mutable x : int - + let x2 = <@ let mutable x = S(0) let y = &x y @> - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuoteDynamic01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuoteDynamic01.fs index d4b91de4f26..52938b6ca94 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuoteDynamic01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/E_QuoteDynamic01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations //Regression for FSHARP1.0:6030 //Quoting a class member ? results in error about 'trait members' but quoting it as op_Dynamic is ok //Quotations cannot contain expressions that make member constraint calls, or uses of operators that implicitly resolve to a member constraint call diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/EnumFromCSQuote01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/EnumFromCSQuote01.fs index 868d365098d..ecc74c2f438 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/EnumFromCSQuote01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/EnumFromCSQuote01.fs @@ -1,5 +1,5 @@ -// #Regression #Conformance #Quotations -// Regression for FSHARP1.0:6007 +// #Regression #Conformance #Quotations +// Regression for FSHARP1.0:6007 // Enums were causing ArgumentExceptions when quoted // Use an enum from C# (int based and non-int based) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/EnumQuote01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/EnumQuote01.fs index cc1fa1bd5df..15a72aa6f6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/EnumQuote01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/EnumQuote01.fs @@ -1,5 +1,5 @@ -// #Regression #Conformance #Quotations -// Regression for FSHARP1.0:6007 +// #Regression #Conformance #Quotations +// Regression for FSHARP1.0:6007 // Enums were causing ArgumentExceptions when quoted module T diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/LiteralArrays01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/LiteralArrays01.fs index 53f81301059..4b9a36fce53 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/LiteralArrays01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/LiteralArrays01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // DevDiv:188523 -let a = <@ [| 2;3;4 |] @> -let b = <@ [| 2u;3u;4u |] @> -let c = <@ [| 2s;3s;4s |] @> -let d = <@ [| 2UL;3UL;4UL |] @> +let a = <@ [| 2;3;4 |] @> +let b = <@ [| 2u;3u;4u |] @> +let c = <@ [| 2s;3s;4s |] @> +let d = <@ [| 2UL;3UL;4UL |] @> let e = <@ [| 2us;3us;4us |] @> // previously threw internal error: unexpected expression shape if e.ToString() <> "NewArray (UInt16, Value (2us), Value (3us), Value (4us))" then exit 1 else exit 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/NestedQuoteAddition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/NestedQuoteAddition.fs index 45015ba22ac..19546100179 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/NestedQuoteAddition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/NestedQuoteAddition.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:5339 // Make sure nested quotations are printing correctly. Nested quotation here used to print x in + expression as UnitVar0 @@ -9,9 +9,9 @@ let q = <@ fun () -> <@ fun x -> x + 1 @> @> let x = sprintf "%A" q let expected = "Lambda (unitVar0, Quote (Lambda (x, Call (None, op_Addition, [x, Value (1)]))))" - -exit <| if (x.Replace("\r\n", "\n") = expected.Replace("\r\n", "\n")) - then 0 + +exit <| if (x.Replace("\r\n", "\n") = expected.Replace("\r\n", "\n")) + then 0 else printfn "Expected:" printfn "=========" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/NullArgChecks.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/NullArgChecks.fs index 4c07db975c4..c48a8da29d2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/NullArgChecks.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/NullArgChecks.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:5643 // Call all the Expr factories with null to any args that accept it from normal F# (ex Method/PropertyInfos, not Expr/Var) open System open Microsoft.FSharp.Quotations // will swallow exceptions that represent graceful failures and spit back ones that don't (ex. ArgumentNullException, NullRef) -let throws f = - try f() with +let throws f = + try f() with | e -> let e2 = match e with | :? System.Reflection.TargetInvocationException -> e.InnerException | _ -> e match e2 with | :? ArgumentNullException | :? ArgumentException | :? InvalidOperationException -> () | _ -> raise e2 @@ -21,13 +21,13 @@ let result = if m.Name <> "Deserialize" && m.Name <> "Cast" && m.Name <> "RegisterReflectedDefinitions" then // these aren't Expr factories like the others let parameters = m.GetParameters() // create an array of args to pass, using null whenever possible - let args = seq { for p in parameters -> - if p.ParameterType = typeof then + let args = seq { for p in parameters -> + if p.ParameterType = typeof then Expr.Value(0, typeof) :> Object else if p.ParameterType = typeof then Var("x", typeof) :> Object else if p.ParameterType = typeof> then - [Expr.Value(0, typeof)] :> Object + [Expr.Value(0, typeof)] :> Object else null :> Object } |> Seq.toArray @@ -35,5 +35,5 @@ let result = 0 with | e -> 1 - + exit <| result diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/OperatorInSplice.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/OperatorInSplice.fs index 18c1bb8c8ba..c827befe130 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/OperatorInSplice.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/OperatorInSplice.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5665 // Some operators (subtraction, division) were throwing NotSupportedExceptions at runtime when evaluated in a splice open Microsoft.FSharp.Quotations - + // subtraction let rec expand_power (n : int) x = if n = 0 then <@ 1 @> - else + else <@ %x * %(expand_power (n - 1) x) @> - + let mk_power n : Expr int> = let v = Var("x", typeof, false) Expr.Lambda(v, expand_power n (Expr.Var v |> Expr.Cast)) |> Expr.Cast @@ -21,10 +21,10 @@ ignore <| mk_power 3 let rec expand_power2 (n : int) x = if n = 0 then <@ 1 @> - else + else let y = n - 1 // so we don't stack overflow <@ %x * %(expand_power2 (y / 1) x) @> - + let mk_power2 n : Expr int> = let v = Var("x", typeof, false) Expr.Lambda(v, expand_power2 n (Expr.Var v |> Expr.Cast)) |> Expr.Cast diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/PropertySetArgOrder.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/PropertySetArgOrder.fs index 61cae41d484..c2e93222eae 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/PropertySetArgOrder.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/PropertySetArgOrder.fs @@ -1,23 +1,23 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:5536 // PropertySet was returning args/value swapped into the wrong positions for multi arg indexers open System.Collections.Generic open Microsoft.FSharp.Quotations.Patterns -type PropTest = +type PropTest = { data : Dictionary<(string * string),int> } - member x.Item + member x.Item with get(a,b) = x.data.[(a,b)] - and set(a,b) v = x.data.[(a,b)] <- v - + and set(a,b) v = x.data.[(a,b)] <- v + let dict = new Dictionary() dict.Add(("a","b"), 1) let t = { new PropTest with data = dict } let q = <@ t.["a", "b"] <- 0 @> exit <| match q with - | PropertySet(inst, pi, args, value) -> + | PropertySet(inst, pi, args, value) -> if value.Type = typeof then match args with | Value x :: Value y :: [] -> if x.ToString() = "(a, System.String)" && y.ToString() = "(b, System.String)" then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationHoles01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationHoles01.fs index 1b5026aa821..37cea894a6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationHoles01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationHoles01.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations // Sanity check quotation holes @@ -10,7 +10,7 @@ open Microsoft.FSharp.Quotations.DerivedPatterns let quotationWithHole x = <@ 1 + %x @> let q = quotationWithHole (Expr.Cast (Expr.Value(2))) -let testPassed = +let testPassed = match q with | Call(None, methodInfo, args) -> let a = methodInfo.Name = "op_Addition" @@ -24,5 +24,5 @@ let testPassed = if not testPassed then exit 1 exit 0 - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions01.fs index 4855d28e5d8..d5617f6b139 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions01.fs @@ -1,15 +1,15 @@ -// #Conformance #Quotations +// #Conformance #Quotations // FSB 959, TOp_asm in pattern match open Microsoft.FSharp -let quotation = +let quotation = <@@ match ("a", "b") with | "a", sth -> sth | sth, "b" -> sth | _ -> "nada" @@> - + // Originally this code would cause a compile error. exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions02.fs index cff02395a75..a4d3a26d8d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // FSB 1075, TOp_asm in pattern match @@ -7,7 +7,7 @@ type T = | A of float [] let foo v = - match v with + match v with | A(1.0) -> 0 | _ -> 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions04.fs index 724bf6bf39e..8854800a2d6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations open Microsoft.FSharp.Quotations @@ -6,20 +6,20 @@ open Microsoft.FSharp.Quotations.Patterns // FSB 1332, ReflectedDefinition returning null should be allowed -module Repro = +module Repro = [] let a3 x = null - - let result = - match <@@ a3 @@> with - | Lambda(_,Call(_,minfo,_)) -> + + let result = + match <@@ a3 @@> with + | Lambda(_,Call(_,minfo,_)) -> match (Expr.TryGetReflectedDefinition minfo) with | Some(topExpr)-> "Resolved"; | None -> "Not Resolved"; | expr -> "Not a top definition"; - printfn "input = %A" <@ a3 @> + printfn "input = %A" <@ a3 @> printfn "result = %s" result if result <> "Resolved" then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions05.fs index cc24c89d4f7..d51ec063a16 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // FSB 2384, "Try with in quotations generates a stack overflow diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions06.fs index eb6ef2173a4..03083a4bce4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions06.fs @@ -1,7 +1,7 @@ -// #Conformance #Quotations +// #Conformance #Quotations -let quote = +let quote = <@ let facts = function | (1,"john","marge") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions07.fs index a34750ba59a..342b3045eeb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions07.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // See also FSHARP1.0:4710 -type C = - class - val x : int - val mutable y : int +type C = + class + val x : int + val mutable y : int new () = { x = 12; y = 13 } - end + end -let c = new C() +let c = new C() let test1 = <@@ c.x @@> |> sprintf "%A" let test2 = <@@ c.y @@> |> sprintf "%A" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions09.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions09.fs index 531d49bd507..bbf5648abab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions09.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions09.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:3999 - Issue with quotations over <- operator inside type constructor open System @@ -17,7 +17,7 @@ type Test() = let t = Test() // no exception and no compile time error -// let-declaration-in-a-class +// let-declaration-in-a-class type Test2() = let mutable z = 50 do printfn "%A" <@ z <- 5 @> @@ -43,7 +43,7 @@ let t4 = Test4() // This does not compile anymore (and it is covered in neg63 under fsharp suite) //no exception: -//let Test3() = +//let Test3() = // let mutable z = 50 // do printfn "%A" <@ z <- 1 @> // printf "\n" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions10.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions10.fs index 8d315fc238e..6de538f30ec 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions10.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuotationRegressions10.fs @@ -4,11 +4,11 @@ open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open Microsoft.FSharp.Quotations.DerivedPatterns -[] +[] let rec foo () = if true then foo () else 1.0 -let t = match <@ foo () @> with +let t = match <@ foo () @> with | Call(_,MethodWithReflectedDefinition(Lambdas(_,t)),_) -> t - | _ -> failwith "?" + | _ -> failwith "?" exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteDynamic01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteDynamic01.fs index f02d3bf8935..00abcced2d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteDynamic01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteDynamic01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations //Regression for FSHARP1.0:6030 //Quoting a class member ? results in error about 'trait members' but quoting it as op_Dynamic is ok // Confirm it works fine for let bound operators diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteSetMutable01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteSetMutable01.fs index af6a8842cb7..bec5bc78149 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteSetMutable01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteSetMutable01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5859 let q = <@ let mutable x = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteStructStaticFieldProp01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteStructStaticFieldProp01.fs index 6433bd25b71..e9cfa186345 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteStructStaticFieldProp01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteStructStaticFieldProp01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:5861 // Previously this would give an error that quotations cannot contain inline assembly code diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteWithSplice01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteWithSplice01.fs index cd58a8042f1..8fada99d028 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteWithSplice01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/QuoteWithSplice01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for Dev10:844084 // Previously the second quote would leave the op_Splice operator in the quoted tree @@ -14,8 +14,8 @@ let x1 = "Call (None, op_PipeRight, let y1 = "Application (Lambda (value, Call (None, Sin, [value])), Value (1.0))" -exit <| if (x.Replace("\r\n", "\n") = x1.Replace("\r\n", "\n")) && (y.Replace("\r\n", "\n") = y1.Replace("\r\n", "\n")) then - 0 +exit <| if (x.Replace("\r\n", "\n") = x1.Replace("\r\n", "\n")) && (y.Replace("\r\n", "\n") = y1.Replace("\r\n", "\n")) then + 0 else if(x.Replace("\r\n", "\n") <> x1.Replace("\r\n", "\n")) then printfn "Expected:" @@ -24,7 +24,7 @@ exit <| if (x.Replace("\r\n", "\n") = x1.Replace("\r\n", "\n")) && (y.Replace("\ printfn "Actual:" printfn "=========" printfn "%s" x - if(y.Replace("\r\n", "\n") <> y1.Replace("\r\n", "\n")) then + if(y.Replace("\r\n", "\n") <> y1.Replace("\r\n", "\n")) then printfn "Expected:" printfn "=========" printfn "%s" y1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/RawQuotation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/RawQuotation01.fs index dcc22161b1f..9b62ae80522 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/RawQuotation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/RawQuotation01.fs @@ -1,4 +1,4 @@ -// #Conformance #Quotations +// #Conformance #Quotations // Sanity check raw quotations @@ -12,5 +12,5 @@ if rawQuote.Type <> typeof then exit 1 if typedQuote.Raw <> rawQuote then exit 1 exit 0 - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefExtMember01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefExtMember01.fs index 6ce215d4786..92fac3b383c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefExtMember01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefExtMember01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression of FSB 5027, ICE when putting ReflectedDefinition on an extension member type System.String with member this.Foo = 1 - + [] member this.Bar = 2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefInterface01.fs index daefcb85e6d..40a391031ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefInterface01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #Quotations #ReflectedDefinition -// Regression for DevDiv:361318 +// Regression for DevDiv:361318 // open System.Reflection @@ -26,7 +26,7 @@ try for mthd in ty.GetMethods(bindingFlags) do match mthd with | MethodWithReflectedDefinition _ -> printfn "%s" mthd.Name - | _ -> () + | _ -> () 0 with | _ -> printfn "FAIL: exception detected (did DevDiv:361318 regress?)" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefInterface02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefInterface02.fs index 165d0dbec8b..644d2b3fae1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefInterface02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefInterface02.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #Quotations #ReflectedDefinition -// Regression for DevDiv:361318 +// Regression for DevDiv:361318 // open System.Reflection @@ -27,7 +27,7 @@ try for mthd in ty.GetMethods(bindingFlags) do match mthd with | MethodWithReflectedDefinition _ -> printfn "%s" mthd.Name - | _ -> () + | _ -> () 0 with | _ -> printfn "FAIL: exception detected (did DevDiv:361318 regress?)" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor01.fs index f4280c357d7..e7d3d4abf96 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor01.fs @@ -1,5 +1,5 @@ -// #Regression #Conformance #Quotations -// Regression for FSHARP1.0:5934 +// #Regression #Conformance #Quotations +// Regression for FSHARP1.0:5934 // ReflectedDefinitionAttribute on constructors wasn't working open Microsoft.FSharp.Quotations @@ -14,7 +14,7 @@ type Foo<'T>() = [] new (x:int) = Foo<'T>() member this.Test = 1 - + let q1 = <@ Foo(1) @> let q2 = <@ Foo() @> let q3 = <@ Foo(3) @> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor02.fs index 03aa1302dd5..3cf8a4a5da5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression for FSHARP1.0:6159 // Couldn't quote constructor diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor03.fs index 6eb613865c2..e2d039f0389 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/ReflectedDefinitionConstructor03.fs @@ -1,24 +1,24 @@ -// #Regression #Conformance #Quotations -// Regression for FSHARP1.0:5934 +// #Regression #Conformance #Quotations +// Regression for FSHARP1.0:5934 // ReflectedDefinitionAttribute on constructors wasn't working open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open Microsoft.FSharp.Quotations.ExprShape -type MyClassWithFields []() = +type MyClassWithFields []() = let x = 12 let y = x let w = x // note this variable is not used in any method and becomes local to the constructor [] member this.Bar z = x + z + y - + let mutable result = 0 let rec traverse q = match q with - | ShapeVar v -> + | ShapeVar v -> // ensure the this variable used in the constructor matches the global if v.Name = "this" then let th = Var.Global("this",typeof) @@ -28,12 +28,12 @@ let rec traverse q = Expr.Var(v) | ShapeLambda (v,e) -> Expr.Lambda(v, traverse e) | ShapeCombination (o,l) -> RebuildShapeCombination (o, (List.map traverse l)) - + let q = Expr.TryGetReflectedDefinition (typeof.GetConstructors().[0]) try traverse q.Value |> ignore with | _ -> result <- 1 - + exit <| if result = 4 then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/SpecificCall_Instance.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/SpecificCall_Instance.fs index 464574d5a9f..fee284f54db 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/SpecificCall_Instance.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/SpecificCall_Instance.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:5428 // Make sure SpecificCall pattern correctly returns Some for the instance obj of an instance call @@ -7,10 +7,10 @@ open Microsoft.FSharp.Quotations.DerivedPatterns let (|StringContainsQ|_|) x = (|SpecificCall|_|) <@ (fun (s1:string) (s2:string) -> s1.Contains(s2)) @> x -let m inp = match inp with +let m inp = match inp with | StringContainsQ (None, _, [arg]) -> 1 | StringContainsQ (Some obj, _, [arg]) -> 0 | _ -> 1 - + let q = <@ "a".Contains("a") @> m q |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/SpecificCall_Static.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/SpecificCall_Static.fs index 15351718538..3342d53c47f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/SpecificCall_Static.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/SpecificCall_Static.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:5428 // Make sure SpecificCall pattern returns None as the instance of SpecificCall @@ -7,10 +7,10 @@ open Microsoft.FSharp.Quotations.DerivedPatterns let (|EqualsQ|_|) x = (|SpecificCall|_|) <@ ( = ) @> x -let m inp = match inp with +let m inp = match inp with | EqualsQ (Some inst, _, [x1;x2]) -> 1 | EqualsQ (None, _, [x1;x2]) -> 0 | _ -> 1 - + let q = <@ 1 = 2 @> m q |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01a.fs index ffdc71e5e46..e09a9ecc7c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01a.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:4606 // Make sure we expose a .IsMutable property // isMutable = true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01b.fs index 9d4364199ca..9c1f1e48b6e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:4606 // Make sure we expose a .IsMutable property // isMutable = false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01c.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01c.fs index e5f392fe855..7fb044e8340 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01c.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable01c.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:4606 // Make sure we expose a .IsMutable property // isMutable = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable02.fs index f596269e4b0..910ad67c3e7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ExpressionQuotations/Regressions/VarIsMutable02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Quotations +// #Regression #Conformance #Quotations // Regression test for FSHARP1.0:5534 // Make sure isMutable is set correctly for quoted mutables open Microsoft.FSharp.Quotations diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ObjectExpressions/ObjectExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ObjectExpressions/ObjectExpressions.fs index 7838300082a..6120feb6ff8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ObjectExpressions/ObjectExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ObjectExpressions/ObjectExpressions.fs @@ -22,7 +22,7 @@ let x = { new _ with member this.MyMember() = 42 } |> withDiagnostics [ (Error 772, Line 5, Col 11, Line 5, Col 16, "'new' must be used with a named type") ] - + [] let ``Object expression can not implement a class class end`` () = Fsx """ @@ -36,7 +36,7 @@ let implementer = { new Class() } |> withDiagnostics [ (Error 738, Line 4, Col 19, Line 4, Col 35, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") ] - + [] let ``Object expression can not implement a class without members`` () = Fsx """ @@ -51,7 +51,7 @@ let implementer = { new Class() } |> withDiagnostics [ (Error 738, Line 5, Col 19, Line 5, Col 35, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") ] - + [] let ``Object expression implementing an interface without members`` () = Fsx """ @@ -85,7 +85,7 @@ type MyClass() = class end |> withLangVersion90 |> typecheck |> shouldSucceed - + [] let ``Object expression can construct an abstract class(missing with...) and also implement interfaces with and without abstract members.`` () = Fsx """ @@ -105,7 +105,7 @@ type MyClass() = class end |> withLangVersion90 |> typecheck |> shouldSucceed - + [] let ``Object expression can construct an abstract class(missing with... and interface in the next line) and also implement interfaces with and without abstract members.`` () = Fsx """ @@ -126,7 +126,7 @@ type MyClass() = class end |> withLangVersion90 |> typecheck |> shouldSucceed - + [] let ``Verifies that the object expression built type has the interface.`` () = Fsx """ @@ -149,7 +149,7 @@ let expr = { new MyClass() interface IFirst } |> withStdOutContainsAllInOrder [ "It works" ] - + [] let ``Parameterized object expression implementing an interface with members`` () = Fsx """ @@ -172,7 +172,7 @@ let implSomeDU someDu = |> withLangVersion90 |> typecheck |> shouldSucceed - + [] let ``Object expression cannot implement an abstract class having no abstract members.`` () = Fsx """ @@ -192,8 +192,8 @@ let foo2 = { new Foo() with member __.ToString() = base.ToString() } |> withDiagnostics [ (Error 738, Line 5, Col 11, Line 5, Col 24, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces."); (Error 759, Line 7, Col 12, Line 7, Col 21, "Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations. Consider using an object expression '{ new ... with ... }' instead.") - ] - + ] + [] let ``Object expression can not implement an abstract class having no abstract members`` () = Fsx """ @@ -209,7 +209,7 @@ let res = { new AbstractClass() } |> withDiagnostics [ (Error 738, Line 6, Col 11, Line 6, Col 34, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") ] - + [] let ``Object expression can not implement an abstract class having abstract members with default implementation`` () = Fsx """ @@ -241,7 +241,7 @@ let res = { new AbstractClass() with |> withLangVersion90 |> typecheck |> shouldSucceed - + [] let ``Object expression can not implement an abstract class having abstract members`` () = Fsx """ @@ -259,7 +259,7 @@ let res = { new AbstractClass() } (Error 365, Line 7, Col 11, Line 7, Col 34, "No implementation was given for 'abstract AbstractClass.M: unit -> unit'"); (Error 738, Line 7, Col 11, Line 7, Col 34, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") ] - + [] let ``Object expression can implement an abstract class and interface having no abstract members.`` () = Fsx """ @@ -297,8 +297,8 @@ let res = { new MyClass() } |> withDiagnostics [ (Error 365, Line 11, Col 11, Line 11, Col 28, "No implementation was given for 'abstract MyClass.M: unit -> unit'"); (Error 738, Line 11, Col 11, Line 11, Col 28, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") - ] - + ] + [] let ``C# abstract class with protected constructor can not be implemented by F# object expression`` () = @@ -337,7 +337,7 @@ let res = { new Animal() } |> withDiagnostics [ (Error 738, Line 5, Col 11, Line 5, Col 27, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") ] - + [] let ``C# abstract class with protected constructor and abstract method and default implementation can be implemented by F# object expression unless the abstract method is implemented.`` () = let csharp = @@ -378,7 +378,7 @@ let res = { new Animal() } (Error 365, Line 5, Col 11, Line 5, Col 27, "No implementation was given for 'Animal.M() : unit'"); (Error 738, Line 5, Col 11, Line 5, Col 27, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") ] - + [] let ``C# abstract class with protected constructor and abstract method can not be implemented by F# object expression unless the abstract method is implemented.`` () = let csharp = @@ -467,7 +467,7 @@ let f() = { new BaseHashtable<_,_>(2) with |> withDiagnostics [ (Error 359, Line 10, Col 11, Line 13, Col 12, "More than one override implements 'Next: StrongToWeakEntry<'a> array -> int when 'a: not struct'") ] - + [] let ``Object expression cannot implement an interface when it contains a method with no types that can refer to the type for which the implementation is being used`` () = Fsx """ @@ -547,7 +547,7 @@ let implementer() = |> withLangVersion90 |> typecheck |> shouldSucceed - + [] let ``Object expression implementing an interface`` () = Fsx """ @@ -587,7 +587,7 @@ let objExpr = (Error 17, Line 8, Col 18, Line 8, Col 25, "The member 'Execute: unit -> unit' does not have the correct type to override the corresponding abstract method. Non-static member is expected."); (Error 783, Line 7, Col 11, Line 7, Col 21, "At least one override did not correctly implement its corresponding abstract member") ] - + [] let ``Produce an error when one leaves keyword "static" when implementing IWSAM in an object expression`` () = Fsx """ @@ -609,7 +609,7 @@ let _ = (Error 3860, Line 7, Col 11, Line 7, Col 21, "Object expressions cannot implement interfaces with static abstract members or declare static members."); (Error 3860, Line 8, Col 23, Line 8, Col 30, "Object expressions cannot implement interfaces with static abstract members or declare static members.") ] - + [] let ``Produce an error when one leaves keyword "static" when implementing multiple IWSAM in an object expression`` () = Fsx """ @@ -632,7 +632,7 @@ let _ = (Error 3860, Line 8, Col 23, Line 8, Col 30, "Object expressions cannot implement interfaces with static abstract members or declare static members."); (Error 3860, Line 9, Col 23, Line 9, Col 31, "Object expressions cannot implement interfaces with static abstract members or declare static members.") ] - + [] let ``Produce an error when one leaves keyword "static" when implementing static and not static members in an object expression`` () = Fsx """ @@ -659,7 +659,7 @@ let _ = (Error 3860, Line 10, Col 23, Line 10, Col 30, "Object expressions cannot implement interfaces with static abstract members or declare static members."); (Error 3860, Line 12, Col 23, Line 12, Col 31, "Object expressions cannot implement interfaces with static abstract members or declare static members."); ] - + [] let ``No error when implementing only instance members from IWSAM in an object expression`` () = Fsx """ @@ -680,7 +680,7 @@ consoleLogger.Log("Hello World") |> compile |> shouldFail |> withSingleDiagnostic (Error 3860, Line 7, Col 11, Line 7, Col 18, "Object expressions cannot implement interfaces with static abstract members or declare static members.") - + [] let ``No error when implementing only instance members from IWSAM(Interface attribute) in an object expression`` () = Fsx """ @@ -702,7 +702,7 @@ consoleLogger.Log("Hello World") |> compile |> shouldFail |> withSingleDiagnostic (Error 3860, Line 8, Col 11, Line 8, Col 18, "Object expressions cannot implement interfaces with static abstract members or declare static members.") - + [] let ``No error when implementing only instance members from a type(Interface attribute) in an object expression`` () = Fsx """ @@ -750,7 +750,7 @@ Please restrict it to one of the following: (Error 358, Line 8, Col 19, Line 8, Col 29, "The override for 'Overloaded: string -> bool' was ambiguous") (Error 783, Line 7, Col 11, Line 7, Col 19, "At least one override did not correctly implement its corresponding abstract member") ] - + module AllowObjectExpressionWithoutOverrides = [] let ``Object expression can implement a class class end`` () = @@ -761,7 +761,7 @@ let implementer = { new Class() } """ |> typecheck |> shouldSucceed - + [] let ``Object expression can implement a class without members`` () = Fsx """ @@ -786,7 +786,7 @@ let x = { new _ with member this.MyMember() = 42 } |> withDiagnostics [ (Error 772, Line 5, Col 11, Line 5, Col 16, "'new' must be used with a named type") ] - + [] let ``Verifies that the object expression built type has the interface`` () = Fsx """ @@ -808,7 +808,7 @@ let expr = { new MyClass() } |> withStdOutContainsAllInOrder [ "It works" ] - + [] let ``Object expression implementing an interface without members`` () = Fsx """ @@ -818,7 +818,7 @@ let implementer() ={ new IFirst } """ |> typecheck |> shouldSucceed - + [] let ``Object expression can implement an abstract class having abstract members with default implementation`` () = Fsx """ @@ -845,7 +845,7 @@ let res = { new AbstractClass() with """ |> typecheck |> shouldSucceed - + [] let ``Object expression can implement an abstract class with a protected constructor`` () = Fsx """ @@ -859,7 +859,7 @@ let res = { new AbstractClass() } |> withStdOutContainsAllInOrder [ "AbstractClass constructor" ] - + [] let ``Object expression can not implement an abstract class having abstract members, unless the abstract members are implemented`` () = Fsx """ @@ -888,7 +888,7 @@ let foo2 = { new Foo() with member __.ToString() = base.ToString() } """ |> typecheck |> shouldSucceed - + [] let ``Object expression can not implement an abstract class and interface having no abstract members`` () = Fsx """ @@ -904,7 +904,7 @@ type MyClass() = class end """ |> typecheck |> shouldSucceed - + [] let ``Object expression can implement an abstract class having no abstract members. But trying to instantiate an abstract class will fail`` () = Fsx """ @@ -920,7 +920,7 @@ let foo1 = new Foo() |> withDiagnostics [ (Error 759, Line 7, Col 12, Line 7, Col 21, "Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations. Consider using an object expression '{ new ... with ... }' instead.") ] - + [] let ``Object expression shows error when object expression does not implement all abstract members of the abstract class`` () = Fsx """ @@ -939,7 +939,7 @@ let res = { new MyClass() } |> shouldFail |> withDiagnostics [ (Error 365, Line 11, Col 11, Line 11, Col 28, "No implementation was given for 'abstract MyClass.M: unit -> unit'") - ] + ] [] let ``C# abstract class with protected constructor can be implemented by F# object expression`` () = @@ -975,7 +975,7 @@ let res = { new Animal() } fsharp |> compile |> shouldSucceed - + [] let ``C# abstract class with protected constructor and abstract method can not be implemented by F# object expression unless the abstract method is implemented`` () = @@ -1015,4 +1015,3 @@ let res = { new Animal() } |> withDiagnostics [ (Error 365, Line 5, Col 11, Line 5, Col 27, "No implementation was given for 'Animal.M() : unit'") ] - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/OverloadResolutionAdversarialTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/OverloadResolutionAdversarialTests.fs index bbf13fe7784..bf0817b9690 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/OverloadResolutionAdversarialTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/OverloadResolutionAdversarialTests.fs @@ -45,36 +45,36 @@ let main _ = "Boolean", GenericOverload.Process(true, false) "Double", GenericOverload.Process(1.0, 2.0) "Int32", GenericOverload.Process(3, 4) - + "string", SubtypeOverload.Accept("hello") "int", SubtypeOverload.Accept(42) "float", SubtypeOverload.Accept(3.14) "obj", SubtypeOverload.Accept(box [1;2;3]) "string", SubtypeOverload.Accept("world") "int", SubtypeOverload.Accept(99) - + "List", NestedGeneric.Process([1;2;3] |> List) "List", NestedGeneric.Process(["a";"b"] |> List) "Array", NestedGeneric.Process([|1;2;3|]) "Array", NestedGeneric.Process([|"a";"b"|]) - + "100", (let mutable v = 0 in if ByrefOverload.TryGet("k", &v) then sprintf "%d" v else "failed") "value", (let mutable v = "" in if ByrefOverload.TryGet("k", &v) then v else "failed") "100", (let mutable v = 0 in if ByrefOverload.TryGet("x", &v) then sprintf "%d" v else "failed") - + "two-int", MixedParamArray.Call(1, 2) "params-int[3]", MixedParamArray.Call(1, 2, 3) "params-int[4]", MixedParamArray.Call(1, 2, 3, 4) "string+params[3]", MixedParamArray.Call("x", "a", "b", "c") - + "alternating-correct", stressSequence() ] - + let mutable failures = 0 for (expected, actual) in results do if actual = expected then printfn "PASS: %s" actual else printfn "FAIL: got %s (expected %s)" actual expected; failures <- failures + 1 - + if failures = 0 then printfn "All %d adversarial tests passed!" results.Length else printfn "%d of %d adversarial tests failed!" failures results.Length failures diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/OverloadResolutionBasicTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/OverloadResolutionBasicTests.fs index 6279f45a8ab..952ee5caaec 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/OverloadResolutionBasicTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/OverloadResolutionBasicTests.fs @@ -76,8 +76,8 @@ let cacheStress () = if all then "all-int" else "MISMATCH" let cacheAlternating () = - sprintf "%s,%s,%s,%s,%s,%s" - (BasicOverload.Pick 1) (BasicOverload.Pick "a") + sprintf "%s,%s,%s,%s,%s,%s" + (BasicOverload.Pick 1) (BasicOverload.Pick "a") (BasicOverload.Pick 2) (BasicOverload.Pick "b") (BasicOverload.Pick 3) (BasicOverload.Pick "c") @@ -89,64 +89,64 @@ let main _ = "float", BasicOverload.Pick(3.14) "bool", BasicOverload.Pick(true) "generic", BasicOverload.Pick([1;2;3]) - + "int,int", MultiArg.Pick(1, 2) "string,string", MultiArg.Pick("a", "b") "int,string", MultiArg.Pick(1, "b") "string,int", MultiArg.Pick("a", 2) "generic,same", MultiArg.Pick(true, false) - + "int[0]", ParamArrayOverload.Pick([||] : int[]) "int[3]", ParamArrayOverload.Pick(1, 2, 3) "string[3]", ParamArrayOverload.Pick("a", "b", "c") "single-int", ParamArrayOverload.Pick(42) "single-string", ParamArrayOverload.Pick("single") - + "Animal", HierarchyOverload.Accept(Animal()) "Dog", HierarchyOverload.Accept(Dog()) "Cat", HierarchyOverload.Accept(Cat()) "seq", HierarchyOverload.Accept([Dog(); Dog()]) - + "String.ExtPick(int)", "hello".ExtPick(42) "String.ExtPick(string)", "hello".ExtPick("world") "Int32.ExtPick(int)", (5).ExtPick(10) "Int32.ExtPick(string)", (5).ExtPick("ten") - + "int,none", OptionalOverload.Pick(1) "int,2", OptionalOverload.Pick(1, 2) "string,none", OptionalOverload.Pick("a") "string,b", OptionalOverload.Pick("a", "b") - + "all-int", cacheStress() "int,string,int,string,int,string", cacheAlternating() - + "generic", pickRigid 42 "generic", pickRigid "hello" "generic", pickRigid true - + "tuple", TupleOverload.Pick((1, "a")) "separate", TupleOverload.Pick(1, "a") - + "first:int,second:string", NamedArgOverload.Pick(1, "a") "first:string,second:int", NamedArgOverload.Pick("a", 1) "first:int,second:string", NamedArgOverload.Pick(first = 1, second = "b") - + "obj", ConstrainedCheck.Pick(42) "obj", ConstrainedCheck.Pick("hi") - + "int", TDCOverload.Pick(42) "int64", TDCOverload.Pick(42L) "float", TDCOverload.Pick(3.14) - + "success:42", (let mutable v = 0 in if OutArgOverload.TryGet("k", &v) then sprintf "success:%d" v else "failed") "success:found", (let mutable v = "" in if OutArgOverload.TryGet("k", &v) then sprintf "success:%s" v else "failed") ] - + let mutable failures = 0 for (expected, actual) in results do if actual = expected then printfn "PASS: %s" actual else printfn "FAIL: got %s (expected %s)" actual expected; failures <- failures + 1 - + if failures = 0 then printfn "All %d tests passed!" results.Length else printfn "%d of %d tests failed!" failures results.Length failures diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/E_GetSliceNotDef01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/E_GetSliceNotDef01.fs index a91d573ba81..35dbb7beacd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/E_GetSliceNotDef01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/E_GetSliceNotDef01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SyntacticSugar +// #Regression #Conformance #SyntacticSugar // Verify error if GetSlice is not defined diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/E_GetSliceNotDef02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/E_GetSliceNotDef02.fs index a7f3fe47c97..527eba1c2b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/E_GetSliceNotDef02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/E_GetSliceNotDef02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SyntacticSugar +// #Regression #Conformance #SyntacticSugar // Verify error using a 1D slice if only a 2D version added @@ -12,7 +12,7 @@ type Foo<'a>() = let mutable m_lastUB2 : 'a option = None - member this.GetSlice(lb1, ub1, lb2, ub2) = + member this.GetSlice(lb1, ub1, lb2, ub2) = m_lastLB1 <- lb1 m_lastUB1 <- ub1 m_lastLB2 <- lb2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices01.fs index fc6b1459d62..6aa7970ea63 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices01.fs @@ -1,4 +1,4 @@ -// #Conformance #SyntacticSugar +// #Conformance #SyntacticSugar // Sanity check slices @@ -7,10 +7,10 @@ let letters = [| 'a' .. 'z' |] if letters.[0..2] <> [| 'a'; 'b'; 'c' |] then exit 1 if letters.[23..] <> [| 'x'; 'y'; 'z' |] then exit 1 if letters.[ ..2] <> [| 'a'; 'b'; 'c' |] then exit 1 -if letters.[*] <> [|'a'; 'b'; 'c'; 'd'; 'e'; - 'f'; 'g'; 'h'; 'i'; 'j'; +if letters.[*] <> [|'a'; 'b'; 'c'; 'd'; 'e'; + 'f'; 'g'; 'h'; 'i'; 'j'; 'k'; 'l'; 'm'; 'n'; 'o'; - 'p'; 'q'; 'r'; 's'; 't'; + 'p'; 'q'; 'r'; 's'; 't'; 'u'; 'v'; 'w'; 'x'; 'y'; 'z'|] then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices02.fs index ec2850939fc..bc2261b33c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices02.fs @@ -1,4 +1,4 @@ -// #Conformance #SyntacticSugar +// #Conformance #SyntacticSugar // Verify slices syntax on types with a get slice method @@ -7,7 +7,7 @@ type Foo<'a>() = let mutable m_lastLB : 'a option = None let mutable m_lastUB : 'a option = None - member this.GetSlice(lb, ub) = + member this.GetSlice(lb, ub) = m_lastLB <- lb m_lastUB <- ub () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices03.fs index a7d6da5abfc..b44b64cbbf2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices03.fs @@ -1,4 +1,4 @@ -// #Conformance #SyntacticSugar #ReqNOMT +// #Conformance #SyntacticSugar #ReqNOMT // Verify 2D slices. Note that in F# you (currently?) cannot @@ -8,14 +8,14 @@ let toSquare (jagged : 'a[][]) : 'a[,] = if jagged = null then raise <| new System.ArgumentNullException() if jagged.Length = 0 then raise <| new System.ArgumentException() if jagged.[0].Length = 0 then raise <| new System.ArgumentException() - + let cols = jagged.Length let rows = jagged.[0].Length - + let square = Array2D.create cols rows (Unchecked.defaultof<'a>) // Copy the contents over Array.iteri - (fun yIdx row -> + (fun yIdx row -> Array.iteri (fun xIdx value -> square.[yIdx, xIdx] <- value) row diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices04.fs index 03771309419..3898d8c40e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices04.fs @@ -1,4 +1,4 @@ -// #Conformance #SyntacticSugar +// #Conformance #SyntacticSugar // Verify slices syntax on types with get and set slice 2D methods @@ -19,14 +19,14 @@ type Foo<'a>() = let mutable m_lastV1D : 'a list = List.empty let mutable m_lastV2D : 'a list list = [List.empty] - member this.GetSlice(lb1, ub1, lb2, ub2) = + member this.GetSlice(lb1, ub1, lb2, ub2) = m_lastLB1 <- lb1 m_lastUB1 <- ub1 m_lastLB2 <- lb2 m_lastUB2 <- ub2 () - member this.SetSlice(lb1, ub1, lb2, ub2, v2D) = + member this.SetSlice(lb1, ub1, lb2, ub2, v2D) = m_lastLB1 <- lb1 m_lastUB1 <- ub1 m_lastLB2 <- lb2 @@ -34,52 +34,52 @@ type Foo<'a>() = m_lastV2D <- v2D () - member this.GetSlice(lb1, ub1, f2) = + member this.GetSlice(lb1, ub1, f2) = m_lastLB1 <- lb1 m_lastUB1 <- ub1 m_lastFixed2 <- f2 () - member this.SetSlice(lb1, ub1, f2, v1D) = + member this.SetSlice(lb1, ub1, f2, v1D) = m_lastLB1 <- lb1 m_lastUB1 <- ub1 m_lastFixed2 <- f2 m_lastV1D <- v1D () - member this.GetSlice(f1, lb2, ub2) = + member this.GetSlice(f1, lb2, ub2) = m_lastFixed1 <- f1 m_lastLB2 <- lb2 - m_lastUB2 <- ub2 + m_lastUB2 <- ub2 () - member this.SetSlice(f1, lb2, ub2, v1D) = + member this.SetSlice(f1, lb2, ub2, v1D) = m_lastFixed1 <- f1 m_lastLB2 <- lb2 m_lastUB2 <- ub2 - m_lastV1D <- v1D + m_lastV1D <- v1D () - member this.GetSlice(i1 : seq<_>, lb2, ub2) = + member this.GetSlice(i1 : seq<_>, lb2, ub2) = m_lasti1 <- i1 m_lastLB2 <- lb2 m_lastUB2 <- ub2 () - member this.SetSlice(i1 : seq<_>, lb2, ub2, v2D) = + member this.SetSlice(i1 : seq<_>, lb2, ub2, v2D) = m_lasti1 <- i1 m_lastLB2 <- lb2 m_lastUB2 <- ub2 m_lastV2D <- v2D () - member this.GetSlice(lb1, ub1, i2 : seq<_>) = + member this.GetSlice(lb1, ub1, i2 : seq<_>) = m_lastLB1 <- lb1 m_lastUB1 <- ub1 m_lasti2 <- i2 () - member this.SetSlice(lb1, ub1, i2 : seq<_>, v2D) = + member this.SetSlice(lb1, ub1, i2 : seq<_>, v2D) = m_lastLB1 <- lb1 m_lastUB1 <- ub1 m_lasti2 <- i2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices05.fs index e6790648635..e4405775260 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices05.fs @@ -1,9 +1,9 @@ -// #Conformance #SyntacticSugar +// #Conformance #SyntacticSugar // Verify array slicing for 3D arrays /// Augment the existing Array2D type with Array2D and Array slicing -module Extensions = - type ``[,,]``<'T> with +module Extensions = + type ``[,,]``<'T> with // Slice 2D from 3D member q.GetSlice(x : int, y1 : int option, y2 : int option, z1 : int option, z2 : int option) = array2D [| [| 1.0 |] |] member q.GetSlice(x1 : int option, x2 : int option, y : int, z1 : int option, z2 : int option) = array2D [| [| 1.0 |] |] @@ -33,61 +33,61 @@ module Extensions = open Extensions -let array3D () = Array3D.zeroCreate 1 1 1 +let array3D () = Array3D.zeroCreate 1 1 1 let x : double [,,] = array3D () // fix the first index - getting let y1 = x.[1,*,1..4] let y2 = x.[1,1..4,*] let y3 = x.[1,1..3,*] -let z0 = x.[1,*,1..4] -let z1 = x.[1,1,1..4] -let z2 = x.[1,*,1..] -let z2b = x.[1,1,1..] -let z3 = x.[1,1,..4] -let z3b = x.[1,*,..4] -let z4 : double[] = x.[1,1..,1] -let z4b : double[,] = x.[1,1..,*] -let z5 : double[] = x.[1,..4,1] -let z5b : double[,] = x.[1,..4,*] -let z6 : double[] = x.[1,1..4,1] -let z6b : double[,] = x.[1,1..4,*] -let z7 : double = x.[0,0,0] +let z0 = x.[1,*,1..4] +let z1 = x.[1,1,1..4] +let z2 = x.[1,*,1..] +let z2b = x.[1,1,1..] +let z3 = x.[1,1,..4] +let z3b = x.[1,*,..4] +let z4 : double[] = x.[1,1..,1] +let z4b : double[,] = x.[1,1..,*] +let z5 : double[] = x.[1,..4,1] +let z5b : double[,] = x.[1,..4,*] +let z6 : double[] = x.[1,1..4,1] +let z6b : double[,] = x.[1,1..4,*] +let z7 : double = x.[0,0,0] // fix the second index - getting let qy1 = x.[*,1,1..4] let qy2 = x.[1..4,1,*] let qy3 = x.[1..3,1,*] -let qz0 = x.[*,1,1..4] -let qz1 = x.[1,1,1..4] -let qz2 = x.[*,1,1..] -let qz2b = x.[1,1,1..] -let qz3 = x.[1,1,..4] -let qz3b = x.[*,1,..4] -let qz4 : double[] = x.[1..,1,1] -let qz4b : double[,] = x.[1..,1,*] -let qz5 : double[] = x.[..4,1,1] -let qz5b : double[,] = x.[..4,1,*] -let qz6 : double[] = x.[1..4,1,1] -let qz6b : double[,] = x.[1..4,1,*] -let qz7 : double = x.[0,0,0] +let qz0 = x.[*,1,1..4] +let qz1 = x.[1,1,1..4] +let qz2 = x.[*,1,1..] +let qz2b = x.[1,1,1..] +let qz3 = x.[1,1,..4] +let qz3b = x.[*,1,..4] +let qz4 : double[] = x.[1..,1,1] +let qz4b : double[,] = x.[1..,1,*] +let qz5 : double[] = x.[..4,1,1] +let qz5b : double[,] = x.[..4,1,*] +let qz6 : double[] = x.[1..4,1,1] +let qz6b : double[,] = x.[1..4,1,*] +let qz7 : double = x.[0,0,0] // fix the third index - getting let zqy1 = x.[*,1..4,1] let zqy2 = x.[1..4,*,1] let zqy3 = x.[1..3,*,1] -let zqz0 = x.[*,1..4,1] -let zqz1 = x.[1,1..4,1] -let zqz2 = x.[*,1..,1] -let zqz2b = x.[1,1..,1] -let zqz3 = x.[1,..4,1] -let zqz3b = x.[*,..4,1] -let zqz4 : double[] = x.[1..,1,1] -let zqz4b : double[,] = x.[1..,*,1] -let zqz5 : double[] = x.[..4,1,1] -let zqz5b : double[,] = x.[..4,*,1] -let zqz6 : double[] = x.[1..4,1,1] -let zqz6b : double[,] = x.[1..4,*,1] +let zqz0 = x.[*,1..4,1] +let zqz1 = x.[1,1..4,1] +let zqz2 = x.[*,1..,1] +let zqz2b = x.[1,1..,1] +let zqz3 = x.[1,..4,1] +let zqz3b = x.[*,..4,1] +let zqz4 : double[] = x.[1..,1,1] +let zqz4b : double[,] = x.[1..,*,1] +let zqz5 : double[] = x.[..4,1,1] +let zqz5b : double[,] = x.[..4,*,1] +let zqz6 : double[] = x.[1..4,1,1] +let zqz6b : double[,] = x.[1..4,*,1] let zqz7 : double = x.[0,0,0] let zqz8 : double[,] = x.[[1;2], *, 1] let zqz9 = x.[System.DateTime.Now, *, 1] @@ -100,9 +100,9 @@ x.[1,1,1..4] <- [| 1.0;2.0 |] x.[1,1,1..] <- [| 1.0;2.0 |] x.[1,1,..4] <- [| 1.0;2.0 |] x.[1,1..,1] <- [| 1.0;2.0 |] -x.[1,..4,1] <- [| 1.0;2.0 |] +x.[1,..4,1] <- [| 1.0;2.0 |] x.[1,1..4,1] <- [| 1.0;2.0 |] -x.[0,0,0] <- 1.0 +x.[0,0,0] <- 1.0 x.[1,*,..4] <- array2D [ [1.0;2.0] ] x.[1,1..,*] <- array2D [ [1.0;2.0] ] x.[1,..4,*] <- array2D [ [1.0;2.0] ] @@ -116,9 +116,9 @@ x.[1,1,1..4] <- [| 1.0;2.0 |] x.[1,1,1..] <- [| 1.0;2.0 |] x.[1,1,..4] <- [| 1.0;2.0 |] x.[1..,1,1] <- [| 1.0;2.0 |] -x.[..4,1,1] <- [| 1.0;2.0 |] +x.[..4,1,1] <- [| 1.0;2.0 |] x.[1..4,1,1] <- [| 1.0;2.0 |] -x.[0,0,0] <- 1.0 +x.[0,0,0] <- 1.0 x.[*,1,..4] <- array2D [ [1.0;2.0] ] x.[1..,1,*] <- array2D [ [1.0;2.0] ] x.[..4,1,*] <- array2D [ [1.0;2.0] ] @@ -132,9 +132,9 @@ x.[1,1..4,1] <- [| 1.0;2.0 |] x.[1,1..,1] <- [| 1.0;2.0 |] x.[1,..4,1] <- [| 1.0;2.0 |] x.[1..,1,1] <- [| 1.0;2.0 |] -x.[..4,1,1] <- [| 1.0;2.0 |] +x.[..4,1,1] <- [| 1.0;2.0 |] x.[1..4,1,1] <- [| 1.0;2.0 |] -x.[0,0,0] <- 1.0 +x.[0,0,0] <- 1.0 x.[*,..4,1] <- array2D [ [1.0;2.0] ] x.[1..,*,1] <- array2D [ [1.0;2.0] ] x.[..4,*,1] <- array2D [ [1.0;2.0] ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices06.fs index 414ec3ed6eb..c38e40660eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices06.fs @@ -1,23 +1,23 @@ -// #Conformance #SyntacticSugar +// #Conformance #SyntacticSugar // Verify multiple ways to slice a type: [*, type Foo<'a>() = let mutable m_last1LB : 'a option = None - let mutable m_last1UB : 'a option = None - + let mutable m_last1UB : 'a option = None + let mutable m_last2LB1 : 'a option = None let mutable m_last2UB1 : 'a option = None let mutable m_last2LB2 : 'a option = None let mutable m_last2UB2 : 'a option = None - member this.GetSlice(lb1, ub1, lb2, ub2) = + member this.GetSlice(lb1, ub1, lb2, ub2) = m_last2LB1 <- lb1 m_last2UB1 <- ub1 m_last2LB2 <- lb2 m_last2UB2 <- ub2 () - + member this.Last1LB = m_last1LB member this.Last1UB = m_last1UB diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices07.fs index 904be7dd63f..f3fd92867e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugar/Slices07.fs @@ -1,22 +1,22 @@ -// #Conformance #SyntacticSugar +// #Conformance #SyntacticSugar // Verify 1D slices. type Foo<'a>() = let mutable m_lastLB : 'a option = None - let mutable m_lastUB : 'a option = None - let mutable m_lastValue : 'a option = None - - member this.GetSlice(lb, ub) = + let mutable m_lastUB : 'a option = None + let mutable m_lastValue : 'a option = None + + member this.GetSlice(lb, ub) = m_lastLB <- lb m_lastUB <- ub () - member this.SetSlice(lb, ub, value) = + member this.SetSlice(lb, ub, value) = m_lastLB <- lb m_lastUB <- ub m_lastValue <- Some value () - + member this.LastLB = m_lastLB member this.LastUB = m_lastUB member this.LastValue = m_lastValue diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugarAndAmbiguities/SyntacticSugar01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugarAndAmbiguities/SyntacticSugar01.fs index 5c0f1e3f309..cbc11441e97 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugarAndAmbiguities/SyntacticSugar01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/SyntacticSugarAndAmbiguities/SyntacticSugar01.fs @@ -1,4 +1,4 @@ -// #Conformance #SyntacticSugar +// #Conformance #SyntacticSugar // Verify e1.[e2] is just syntactic sugar for calling the 'item' property. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/E_AdjustUses01a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/E_AdjustUses01a.fs index f0faca0ad5d..4fa559ec506 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/E_AdjustUses01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/E_AdjustUses01a.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes #Diagnostics +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes #Diagnostics // Regression test for FSHARP1.0:5406 // Scenario #2: I'm writing my own custom IComparable implementation - don't bother giving me one //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ [] [] -type DU = +type DU = | A of int interface System.IComparable with override this.CompareTo(a:obj) = -1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/E_AdjustUses01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/E_AdjustUses01b.fs index 9ba57bfab71..8a02fd4ad08 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/E_AdjustUses01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/E_AdjustUses01b.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes #Diagnostics +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes #Diagnostics // Regression test for FSHARP1.0:5406 // Scenario #1: I'm not writing my own custom IComparable implementation, assume the reference equality //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ [] [] -type DU = +type DU = | A of int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test01.fs index cb41e83901c..5230792ece5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M01 = +module M01 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test02.fs index a344977e490..2c98fe9c745 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test02.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M02 = +module M02 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test03.fs index 26a72184aa8..eec70db6ae0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test03.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ -module M03 = +module M03 = [] [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test04.fs index 71cdc57d59d..63cf32b5fa4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test04.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M04 = +module M04 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test05.fs index 0a186d4b7f0..ff4f2c0cabf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test05.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M05 = +module M05 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test06.fs index 21cddcca854..54b25101362 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test06.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ -module M06 = +module M06 = [] [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test07.fs index 1bf01b17117..01b8e98804f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test07.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M07 = +module M07 = [] (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test08.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test08.fs index b98f8046534..520ef7c56a3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test08.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test08.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M08 = +module M08 = [] (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test09.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test09.fs index afb07b29c35..e6079e88b9a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test09.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test09.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ -module M09 = +module M09 = [] (* [] *) (* [] *) @@ -12,13 +12,13 @@ module M09 = let r2b = { X = 11} let v1 = not (r1 = r2) // expected true let v2 = not (r2 = r2b) // expected true - - let v3 = try + + let v3 = try r1 < r2 |> ignore // expected true false with | _ -> true - + printfn "v1=%b" v1 printfn "v2=%b" v2 printfn "v3=%b" v3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test10.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test10.fs index ebed7192847..c8bbb772381 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test10.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test10.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M10 = +module M10 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test11.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test11.fs index 3d85d64273b..09a3386278d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test11.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test11.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M11 = +module M11 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test12.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test12.fs index 75e6fefbd7e..30f686173c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test12.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test12.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ -module M12 = +module M12 = [] [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test13.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test13.fs index 781e3dacfef..a4c5790c206 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test13.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test13.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M13 = +module M13 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test14.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test14.fs index 46a4d480006..40fb5a95bea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test14.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test14.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M14 = +module M14 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test15.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test15.fs index 2d1055ece55..b96a43fc5ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test15.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test15.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ -module M15 = +module M15 = [] [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test16.fs index 999e5500305..fff87f586eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test16.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M16 = +module M16 = [] (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test17.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test17.fs index c3e1f707ccd..0dceec8d924 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test17.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test17.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M17 = +module M17 = [] (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test18.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test18.fs index 77683c65c7f..5e43f75846f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test18.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test18.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'ReferenceEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> ReferenceEqualityAttribute'\.$ -module M18 = +module M18 = [] (* [] *) (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test19.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test19.fs index 4f69424b167..8e086b56136 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test19.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test19.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M19 = +module M19 = (* [] *) [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test20.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test20.fs index ff3964c6956..e622c74b40a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test20.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test20.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M20 = +module M20 = (* [] *) [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test21.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test21.fs index 9efe8550faa..e9b1a3b0cea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test21.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test21.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ -module M21 = +module M21 = (* [] *) [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test22.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test22.fs index 11f347eb242..eb2fb70a4f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test22.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test22.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M22 = +module M22 = (* [] *) [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test23.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test23.fs index c6e35f8bc3c..3add68c93c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test23.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test23.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M23 = +module M23 = (* [] *) [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test24.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test24.fs index 05793f829b9..2cb1e03844d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test24.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test24.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'StructuralComparisonAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralComparisonAttribute'\.$ -module M24 = +module M24 = (* [] *) [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test25.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test25.fs index 5a6b1909b8a..e30897038ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test25.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test25.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M25 = +module M25 = (* [] *) (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test26.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test26.fs index 72120840784..745cb9948e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test26.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test26.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The object constructor 'StructuralEqualityAttribute' takes 0 argument\(s\) but is here given 1\. The required signature is 'new: unit -> StructuralEqualityAttribute'\.$ -module M26 = +module M26 = (* [] *) (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test27.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test27.fs index fc5d2804549..59c400df75d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test27.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test27.fs @@ -1,7 +1,7 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // -module M27 = +module M27 = (* [] *) (* [] *) (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test28.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test28.fs index 8d1990fbe1e..76968ca266b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test28.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Test28.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // Regression test for FSHARP1.0:4571 //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/GeneratedEqualityHashingComparison/Attributes/New/Test01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test01.fs index 1bf178c9cd3..fdf74a600be 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test01.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //A type cannot have both the 'ReferenceEquality' and 'StructuralEquality' or 'StructuralComparison' attributes$ -module M01 = +module M01 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test02.fs index dfcd6752f9e..cef86331b67 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test02.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface$ -module M02 = +module M02 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test03.fs index 48dc2b54e63..4dc002737e7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test03.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface$ -module M03 = +module M03 = [] [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test04.fs index d74c45b7e45..d5da2a41921 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test04.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes$ //A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System\.IComparable' or 'System\.Collections\.IStructuralComparable'$ -module M04 = +module M04 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test05.fs index 1aa8482a7b2..497ff3462f1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test06.fs index 3df3455a613..b5ea24b1639 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test06.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //This type uses an invalid mix of the attributes 'NoEquality', 'ReferenceEquality', 'StructuralEquality', 'NoComparison' and 'StructuralComparison'$ //A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System\.IComparable' or 'System\.Collections\.IStructuralComparable'$ -module M06 = +module M06 = [] [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test07.fs index 8f95a18d14e..b34091745a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test07.fs @@ -1,6 +1,6 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes$ -module M07 = +module M07 = [] (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test08.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test08.fs index 53542ca8d63..eb0827c8295 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test08.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test08.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ -module M08 = +module M08 = [] (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test09.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test09.fs index 9c9e287b349..eaddac60b74 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test09.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test09.fs @@ -1,7 +1,7 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // -module M09 = +module M09 = [] (* [] *) (* [] *) @@ -11,13 +11,13 @@ module M09 = let r2b = { X = 11} let v1 = not (r1 = r2) // expected true let v2 = not (r2 = r2b) // expected true - -// let v3 = try + +// let v3 = try // r1 < r2 |> ignore // expected true // false // with // | _ -> true - + printfn "v1=%b" v1 printfn "v2=%b" v2 //printfn "v3=%b" v3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test10.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test10.fs index 077e4a04110..8254ab0d8b7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test10.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test10.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //A type cannot have both the 'ReferenceEquality' and 'StructuralEquality' or 'StructuralComparison' attributes$ -module M10 = +module M10 = [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test11.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test11.fs index 37bec2df508..3286974da63 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test11.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test11.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface$ -module M11 = +module M11 = //[] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test12.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test12.fs index d0b4a928818..08ea88b6233 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test12.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test12.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute$ -module M12 = +module M12 = //[] [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test13.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test13.fs index 4b503eb5990..e04996d0591 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test13.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test13.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System\.IComparable' or 'System\.Collections\.IStructuralComparable'$ -module M13 = +module M13 = //[] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test14.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test14.fs index 616d7f084d3..0feabc75803 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test14.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test14.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute$ -module M14 = +module M14 = //[] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test15.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test15.fs index 8f1afa9fce6..f09e56adb37 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test15.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test15.fs @@ -1,7 +1,7 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // -module M15 = +module M15 = //[] [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test16.fs index 8068615cf13..2e2b8351ac2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test16.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes$ -module M16 = +module M16 = //[] (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test17.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test17.fs index a2bd507423e..750bd7563df 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test17.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test17.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface$ -module M17 = +module M17 = [] (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test18.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test18.fs index 26fc4ccc782..f135d8d8f95 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test18.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test18.fs @@ -1,7 +1,7 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // -module M18 = +module M18 = //[] (* [] *) (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test19.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test19.fs index 3e34176dbd3..23caf06cc91 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test19.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test19.fs @@ -1,7 +1,7 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // -module M19 = +module M19 = (* [] *) [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test20.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test20.fs index 2b3049479fe..27334ef20c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test20.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test20.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface$ -module M20 = +module M20 = (* [] *) [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test21.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test21.fs index 90aac4f1958..d9a6b02386a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test21.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test21.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute$ -module M21 = +module M21 = (* [] *) [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test22.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test22.fs index bb16ddcb511..43b33a00935 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test22.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test22.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute$ -module M22 = +module M22 = (* [] *) [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test23.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test23.fs index 9e4d4afda44..4d4adf6f427 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test23.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test23.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute$ -module M23 = +module M23 = (* [] *) [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test24.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test24.fs index 111c3ee115c..3af6a893c20 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test24.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test24.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute$ -module M24 = +module M24 = (* [] *) [] (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test25.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test25.fs index ea3a3b5a274..b78de8c8feb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test25.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test25.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface$ -module M25 = +module M25 = (* [] *) (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test26.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test26.fs index 718668a4f5a..693ede88e7f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test26.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test26.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute$ //The type 'R' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface$ -module M26 = +module M26 = (* [] *) (* [] *) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test27.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test27.fs index fc5d2804549..59c400df75d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test27.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test27.fs @@ -1,7 +1,7 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // -module M27 = +module M27 = (* [] *) (* [] *) (* [] *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test28.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test28.fs index 63fca01b03d..81746abbbca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test28.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Test28.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // Regression test for FSHARP1.0:4571 //The 'NoEquality' attribute must be used in conjunction with the 'NoComparison' attribute$ //The struct, record or union type 'MyType' has an explicit implementation of 'Object\.Equals'\. Consider implementing a matching override for 'Object\.GetHashCode\(\)'$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Comparison01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Comparison01.fs index 3fe461af4aa..e2a97b6543e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Comparison01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Comparison01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing // Test generated comparison on tuples. @@ -78,5 +78,5 @@ if foo (ref 0.0) (ref nan) then exit 1 if foo (ref nan) (ref 0.0) then exit 1 if foo (ref 0.0f) (ref nanf) then exit 1 if foo (ref nanf) (ref 0.0f) then exit 1 - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/CustomEquality01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/CustomEquality01.fs index 6b027718f4a..8ccc0c38599 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/CustomEquality01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/CustomEquality01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing // FSharp1.0:4913 - elevate warning to an error for structural equality case // Make sure everything is OK when explicitly setting 'CustomEquality' attribute // on structs/records/union while overriding GetHashCode/Equals. @@ -15,21 +15,21 @@ type R = [] [] -type U = +type U = | A | B override x.Equals(obj) = true override x.GetHashCode() = 0 [] [] -type S = +type S = struct val mutable a : int override x.Equals(obj) = true override x.GetHashCode() = 0 end - -type C = + +type C = class override x.Equals(obj) = true override x.GetHashCode() = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityEquals01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityEquals01.fs index c34bb3295ba..91e7eb59f8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityEquals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityEquals01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing // FSharp1.0:4913 - elevate warning to an error for structural equality case // Make sure F# compiler emits an error message when Record, Union, Struct types override default System.Object.Equals() // without explicitly specifying CustomEquality attribute @@ -14,11 +14,11 @@ type R = { a : int; b : string } override x.Equals(obj) = true -type U = +type U = | A | B override x.Equals(obj) = true -type S = +type S = struct val mutable a : int override x.Equals(obj) = true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityGetHashCode01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityGetHashCode01.fs index 748c32e2bb2..472b8365688 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityGetHashCode01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityGetHashCode01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing // FSharp1.0:4913 - elevate warning to an error for structural equality case // Make sure F# compiler emits an error message when Record, Union, Struct types override default System.Object.GetHashCode() // without explicitly specifying CustomEquality attribute @@ -14,11 +14,11 @@ type R = { a : int; b : string } override x.GetHashCode() = x.a + x.b.Length -type U = +type U = | A | B override x.GetHashCode() = 0 -type S = +type S = struct val mutable a : int override x.GetHashCode() = x.a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_ExceptionsNoComparison.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_ExceptionsNoComparison.fs index eca1cc9b283..463bedb5015 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_ExceptionsNoComparison.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_ExceptionsNoComparison.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing // Regression test for FSHARP1.0:5345 // exception types do not allow structural comparison //The type 'exn' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Equality01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Equality01.fs index b903e1a2f97..cf885bd80ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Equality01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Equality01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing // Sanity check generated equality diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Hashing01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Hashing01.fs index f5b9ccf2bab..76b993f4106 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Hashing01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Hashing01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #GeneratedEqualityAndHashing +// #Conformance #TypesAndModules #GeneratedEqualityAndHashing // Sanity check generated equality diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/DU.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/DU.fs index 13defda4f7d..7c8ffa44e4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/DU.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/DU.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // Regression test for FSHARP1.0:5181 // DU [] [] -type DU = +type DU = | A of int interface System.IComparable with override this.CompareTo(a:obj) = -1 // first always less than second diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/Record.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/Record.fs index b0ea12abc09..0363f944220 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/Record.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/Record.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // Regression test for FSHARP1.0:5181 // Record diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/Struct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/Struct.fs index eb11ca6e7d5..3774bea740a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/Struct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/Struct.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // Regression test for FSHARP1.0:5181 // Struct diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/W_ImplIComparable.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/W_ImplIComparable.fs index f62da35a5b4..febb88eeb63 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/W_ImplIComparable.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/W_ImplIComparable.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes +// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes // Verify warning when implementing IComparable on structs / classes // See FSB 2653 @@ -8,11 +8,11 @@ [] [] type S = struct - interface System.IComparable with + interface System.IComparable with member x.CompareTo(y:obj) = 0 end type C = class - interface System.IComparable with + interface System.IComparable with member x.CompareTo(y:obj) = 0 end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam.fs index 117cee69147..9aa7ef3cba2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam.fs @@ -1,7 +1,7 @@ open Prelude -module ByRefParam = - type C() = +module ByRefParam = + type C() = static member M(x: byref) = x <- 5 let mutable res = 9 let v = C.M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_ExplicitInAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_ExplicitInAttribute.fs index 8923fe74272..ef2a5275214 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_ExplicitInAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_ExplicitInAttribute.fs @@ -1,7 +1,7 @@ open Prelude -module ByRefParam_ExplicitInAttribute = - type C() = +module ByRefParam_ExplicitInAttribute = + type C() = static member M([] x: byref) = x <- 5 let mutable res = 9 let v = C.M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_ExplicitOutAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_ExplicitOutAttribute.fs index 1606d19a781..3145ec7a766 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_ExplicitOutAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_ExplicitOutAttribute.fs @@ -1,7 +1,7 @@ open Prelude -module ByRefParam_ExplicitOutAttribute = - type C() = +module ByRefParam_ExplicitOutAttribute = + type C() = static member M([] x: byref) = x <- 5 let mutable res = 9 let v = C.M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_OverloadedTest_ExplicitOutAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_OverloadedTest_ExplicitOutAttribute.fs index a52bd3bb71d..d5131749105 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_OverloadedTest_ExplicitOutAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefParam_OverloadedTest_ExplicitOutAttribute.fs @@ -1,7 +1,7 @@ open Prelude -module ByRefParam_OverloadedTest_ExplicitOutAttribute = - type C() = +module ByRefParam_OverloadedTest_ExplicitOutAttribute = + type C() = static member M(a: int, [] x: byref) = x <- 7 static member M(a: string, [] x: byref) = x <- 8 let mutable res = 9 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefReturn.fs index ac41aba2cc9..14707bea333 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByRefReturn.fs @@ -1,7 +1,7 @@ open Prelude -module ByRefReturn = - type C() = +module ByRefReturn = + type C() = static member M(x: byref) = x <- x + 1; &x let mutable res = 9 let v = C.M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestArrayParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestArrayParam.fs index 848a9c7732c..1157f807914 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestArrayParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestArrayParam.fs @@ -4,7 +4,7 @@ module TestArrayParam = let f (x:int[]) = &x.[0] - let test() = + let test() = let r = [| 1 |] let addr = &f r addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestClassParamMutableField.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestClassParamMutableField.fs index 3374a948d90..a22045f2b98 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestClassParamMutableField.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestClassParamMutableField.fs @@ -6,10 +6,10 @@ module TestClassParamMutableField = let f (x:C) = &x.z - let test() = + let test() = let c = C() let addr = &f c addr <- addr + 1 - check2 "cepojcwem13b" 1 c.z + check2 "cepojcwem13b" 1 c.z test() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestConditionalReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestConditionalReturn.fs index 7918219ab6b..64b40154b7a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestConditionalReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestConditionalReturn.fs @@ -6,7 +6,7 @@ module TestConditionalReturn = let f inp = if inp = 3 then &x else &y - let test() = + let test() = let addr = &f 3 addr <- addr + 1 check2 "cepojcwem6" 2 x @@ -16,7 +16,7 @@ module TestConditionalReturn = check2 "cepojcwem8" 2 x check2 "cepojcwem9" 2 y - let test2() = + let test2() = let res = f 3 let res2 = res + 1 check2 "cepojcwem8b" 3 res2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestDelegateMethod.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestDelegateMethod.fs index cdb5cb21633..94de1bdc5c1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestDelegateMethod.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestDelegateMethod.fs @@ -9,8 +9,8 @@ module TestDelegateMethod = let f (d:D) = &d.Invoke() - let test() = - let addr = &f (d()) + let test() = + let addr = &f (d()) check2 "cepojcwem18a" 1 x addr <- addr + 1 check2 "cepojcwem18b" 2 x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestDelegateMethod2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestDelegateMethod2.fs index 38445e80dde..e56c1ceeccd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestDelegateMethod2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestDelegateMethod2.fs @@ -9,8 +9,8 @@ module TestDelegateMethod2 = let f (d:D) = &d.Invoke(&x) - let test() = - let addr = &f (d()) + let test() = + let addr = &f (d()) check2 "cepojcwem18a2" 1 x addr <- addr + 1 check2 "cepojcwem18b3" 2 x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestImmediateReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestImmediateReturn.fs index 281c2e70ffd..c0614a61617 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestImmediateReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestImmediateReturn.fs @@ -5,13 +5,13 @@ module TestImmediateReturn = let f () = &x - let test() = + let test() = let addr : byref = &f() addr <- addr + 1 check2 "cepojcwem1" 2 x - let test2() = + let test2() = let v = f() let res = v + 1 check2 "cepojcwem1b" 3 res diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestInterfaceMethod.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestInterfaceMethod.fs index 7eef5444b04..42696af3303 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestInterfaceMethod.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestInterfaceMethod.fs @@ -3,23 +3,23 @@ open Prelude module TestInterfaceMethod = let mutable x = 1 - type I = + type I = abstract M : unit -> byref - type C() = - interface I with + type C() = + interface I with member this.M() = &x - let ObjExpr() = - { new I with + let ObjExpr() = + { new I with member this.M() = &x } let f (i:I) = &i.M() - let test() = - let addr = &f (C()) + let test() = + let addr = &f (C()) addr <- addr + 1 - let addr = &f (ObjExpr()) + let addr = &f (ObjExpr()) addr <- addr + 1 check2 "cepojcwem16" 3 x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestInterfaceProperty.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestInterfaceProperty.fs index fd36f7ae985..4599bafdf15 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestInterfaceProperty.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestInterfaceProperty.fs @@ -3,23 +3,23 @@ open Prelude module TestInterfaceProperty = let mutable x = 1 - type I = + type I = abstract P : byref - type C() = - interface I with + type C() = + interface I with member this.P = &x - let ObjExpr() = - { new I with + let ObjExpr() = + { new I with member this.P = &x } let f (i:I) = &i.P - let test() = - let addr = &f (C()) + let test() = + let addr = &f (C()) addr <- addr + 1 - let addr = &f (ObjExpr()) + let addr = &f (ObjExpr()) addr <- addr + 1 check2 "cepojcwem17" 3 x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestMatchReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestMatchReturn.fs index 742bba96e41..66aca38ba56 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestMatchReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestMatchReturn.fs @@ -6,7 +6,7 @@ module TestMatchReturn = let f inp = match inp with 3 -> &x | _ -> &y - let test() = + let test() = let addr = &f 3 addr <- addr + 1 check2 "cepojcwem2" 2 x @@ -16,7 +16,7 @@ module TestMatchReturn = check2 "cepojcwem4" 2 x check2 "cepojcwem5" 2 y - let test2() = + let test2() = let res = f 3 let res2 = res + 1 check2 "cepojcwem2b" 3 res2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestOneArgument.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestOneArgument.fs index c2ae2a8b203..1e18a41a9e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestOneArgument.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestOneArgument.fs @@ -4,7 +4,7 @@ module TestOneArgument = let f (x:byref) = &x - let test() = + let test() = let mutable r1 = 1 let addr = &f &r1 addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestRecordParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestRecordParam.fs index ff27acbf6d3..0c8842e1d69 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestRecordParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestRecordParam.fs @@ -5,7 +5,7 @@ module TestRecordParam = type R = { mutable z : int } let f (x:R) = &x.z - let test() = + let test() = let r = { z = 1 } let addr = &f r addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestRecordParam2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestRecordParam2.fs index 8b5404d3309..93e3157aab9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestRecordParam2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestRecordParam2.fs @@ -5,7 +5,7 @@ module TestRecordParam2 = type R = { mutable z : int } let f (x:byref) = &x.z - let test() = + let test() = let mutable r = { z = 1 } let addr = &f &r addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestStructParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestStructParam.fs index cb5cd1f08e7..1b11f9d616f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestStructParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestStructParam.fs @@ -7,7 +7,7 @@ module TestStructParam = let f (x:byref) = &x.z - let test() = + let test() = let mutable r = { z = 1 } let addr = &f &r addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTryFinallyReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTryFinallyReturn.fs index 35c237dc5c8..c8d7da3ac17 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTryFinallyReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTryFinallyReturn.fs @@ -6,7 +6,7 @@ module TestTryFinallyReturn = let f inp = try &x with _ -> &y - let test() = + let test() = let addr = &f 3 addr <- addr + 1 check2 "cepojcwem6b" 2 x @@ -16,7 +16,7 @@ module TestTryFinallyReturn = check2 "cepojcwem8b" 3 x check2 "cepojcwem9b" 1 y - let test2() = + let test2() = let res = f 3 let res2 = res + 1 check2 "cepojcwem2tf" 4 res2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTryWithReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTryWithReturn.fs index 31f4b6fe0bc..af6fbbc5a37 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTryWithReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTryWithReturn.fs @@ -6,7 +6,7 @@ module TestTryWithReturn = let f inp = try &x with _ -> &y - let test() = + let test() = let addr = &f 3 addr <- addr + 1 check2 "cepojcwem6b" 2 x @@ -16,7 +16,7 @@ module TestTryWithReturn = check2 "cepojcwem8b" 3 x check2 "cepojcwem9b" 1 y - let test2() = + let test2() = let res = f 3 let res2 = res + 1 check2 "cepojcwem2ff" 4 res2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTwoArguments.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTwoArguments.fs index 84c1472e4f3..13d27aa8d52 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTwoArguments.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturn/TestTwoArguments.fs @@ -4,7 +4,7 @@ module TestTwoArguments = let f (x:byref, y:byref) = &x - let test() = + let test() = let mutable r1 = 1 let mutable r2 = 0 let addr = &f (&r1, &r2) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/BaseCallByref.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/BaseCallByref.fs index 315f4af7108..2b9d0d15aae 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/BaseCallByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/BaseCallByref.fs @@ -1,6 +1,6 @@ open Prelude -module BaseCallByref = +module BaseCallByref = type Incrementor(z) = abstract member Increment : int byref * int byref -> unit default this.Increment(i : int byref,j : int byref) = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/Bug820.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/Bug820.fs index 9683efb8f6e..cf209a1bef3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/Bug820.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/Bug820.fs @@ -1,6 +1,6 @@ open Prelude -module Bug820 = +module Bug820 = let inline f (x, r:byref<_>) = r <- x let mutable x = Unchecked.defaultof<_> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/Bug820b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/Bug820b.fs index 3abbbca2e04..6b0cc7e86cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/Bug820b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/Bug820b.fs @@ -1,8 +1,8 @@ open Prelude -module Bug820b = +module Bug820b = - type Bug820x() = + type Bug820x() = let f (x, r:byref<_>) = r <- x let mutable x = Unchecked.defaultof<_> member __.P = f (0, &x) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/ByRefExtensionMethods1.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/ByRefExtensionMethods1.fs index d79a94cb74e..dfdbb18afa2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/ByRefExtensionMethods1.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/ByRefExtensionMethods1.fs @@ -1,18 +1,17 @@ open Prelude -module ByRefExtensionMethods1 = +module ByRefExtensionMethods1 = open System open System.Runtime.CompilerServices [] - type Ext = - + type Ext = + [] static member ExtDateTime2(dt: inref, x:int) = dt.AddDays(double x) - - module UseExt = + + module UseExt = let now = DateTime.Now let dt2 = now.ExtDateTime2(3) check "£f3mllkm2" dt2 (now.AddDays(3.0)) - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/ByRefExtensionMethodsOverloading.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/ByRefExtensionMethodsOverloading.fs index 12db461f322..a81425e1f78 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/ByRefExtensionMethodsOverloading.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/ByRefExtensionMethodsOverloading.fs @@ -1,18 +1,18 @@ open Prelude -module ByRefExtensionMethodsOverloading = +module ByRefExtensionMethodsOverloading = open System open System.Runtime.CompilerServices [] - type Ext = + type Ext = [] static member ExtDateTime(dt: DateTime, x:int) = dt.AddDays(double x) - + [] static member ExtDateTime(dt: inref, x:int) = dt.AddDays(2.0 * double x) - - module UseExt = + + module UseExt = let dt = DateTime.Now.ExtDateTime(3) let dt2 = DateTime.Now.ExtDateTime(3) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/GenericTestNameRecursive.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/GenericTestNameRecursive.fs index 9cdf1b27a65..9addcc65dfd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/GenericTestNameRecursive.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/GenericTestNameRecursive.fs @@ -7,7 +7,7 @@ type GenericTestNameRecursive() = static do GenericTestNameRecursive().Test() - member __.Test() = + member __.Test() = let mutable x = 0uy testValue "unused" 0 &x check "vruoer3rv" x 3uy diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/MatrixOfTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/MatrixOfTests.fs index 5d1f006f809..80b1e9b1231 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/MatrixOfTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/MatrixOfTests.fs @@ -1,154 +1,154 @@ open Prelude [] -type S = +type S = [] val mutable X : int -module MatrixOfTests = +module MatrixOfTests = - module ReturnAddressOfByRef = - let f1 (x: byref) = &x + module ReturnAddressOfByRef = + let f1 (x: byref) = &x - module ReturnAddressOfInRef = - let f1 (x: inref) = &x + module ReturnAddressOfInRef = + let f1 (x: inref) = &x - module ReturnAddressOfOutRef = - let f1 (x: outref) = &x + module ReturnAddressOfOutRef = + let f1 (x: outref) = &x //----- - module ReadByRef = - let f1 (x: byref) = x + module ReadByRef = + let f1 (x: byref) = x - module ReadInRef = - let f1 (x: inref) = x + module ReadInRef = + let f1 (x: inref) = x - module ReadOutRef = - let f1 (x: outref) = x + module ReadOutRef = + let f1 (x: outref) = x //----- - module ReadByRefStructInner = + module ReadByRefStructInner = let f1 (x: byref) = x.X - module ReadInRefStructInner = + module ReadInRefStructInner = let f1 (x: inref) = x.X - module ReadOutRefStructInner = + module ReadOutRefStructInner = let f1 (x: outref) = x.X //----- - module WriteToByRef = + module WriteToByRef = let f1 (x: byref) = x <- 1 - module WriteToOutRef = + module WriteToOutRef = let f1 (x: outref) = x <- 1 //----- - module WriteToByRefStructInner = + module WriteToByRefStructInner = let f1 (x: byref) = x.X <- 1 - module WriteToOutRefStructInner = + module WriteToOutRefStructInner = let f1 (x: outref) = x.X <- 1 //----- - module OutRefToByRef = + module OutRefToByRef = let f1 (x: byref<'T>) = 1 - let f2 (x: outref<'T>) = f1 &x + let f2 (x: outref<'T>) = f1 &x - module ByRefToByRef = + module ByRefToByRef = let f1 (x: byref<'T>) = 1 - let f2 (x: byref<'T>) = f1 &x + let f2 (x: byref<'T>) = f1 &x - module ByRefToOutRef = + module ByRefToOutRef = let f1 (x: outref<'T>) = 1 - let f2 (x: byref<'T>) = f1 &x + let f2 (x: byref<'T>) = f1 &x - module OutRefToOutRef = + module OutRefToOutRef = let f1 (x: outref<'T>) = 1 - let f2 (x: outref<'T>) = f1 &x + let f2 (x: outref<'T>) = f1 &x - module ByRefToInRef = + module ByRefToInRef = let f1 (x: inref<'T>) = 1 - let f2 (x: byref<'T>) = f1 &x + let f2 (x: byref<'T>) = f1 &x - module InRefToInRef = + module InRefToInRef = let f1 (x: inref<'T>) = 1 - let f2 (x: inref<'T>) = f1 &x + let f2 (x: inref<'T>) = f1 &x - module OutRefToInRef = + module OutRefToInRef = let f1 (x: inref<'T>) = 1 let f2 (x: outref<'T>) = f1 &x // allowed, because &outref are treated as byref, see RFC //--------------- - module OutRefToByRefClassMethod = - type C() = + module OutRefToByRefClassMethod = + type C() = static member f1 (x: byref<'T>) = 1 let f2 (x: outref<'T>) = C.f1 &x module ByRefToByRefClassMethod = - type C() = + type C() = static member f1 (x: byref<'T>) = 1 - let f2 (x: byref<'T>) = C.f1 &x + let f2 (x: byref<'T>) = C.f1 &x module ByRefToOutRefClassMethod = - type C() = + type C() = static member f1 (x: outref<'T>) = 1 - let f2 (x: byref<'T>) = C.f1 &x + let f2 (x: byref<'T>) = C.f1 &x module OutRefToOutRefClassMethod = - type C() = + type C() = static member f1 (x: outref<'T>) = 1 - let f2 (x: outref<'T>) = C.f1 &x + let f2 (x: outref<'T>) = C.f1 &x module ByRefToInRefClassMethod = - type C() = + type C() = static member f1 (x: inref<'T>) = 1 - let f2 (x: byref<'T>) = C.f1 &x + let f2 (x: byref<'T>) = C.f1 &x module InRefToInRefClassMethod = - type C() = + type C() = static member f1 (x: inref<'T>) = 1 - let f2 (x: inref<'T>) = C.f1 &x + let f2 (x: inref<'T>) = C.f1 &x module OutRefToInRefClassMethod = - type C() = + type C() = static member f1 (x: inref<'T>) = 1 - let f2 (x: outref<'T>) = C.f1 &x + let f2 (x: outref<'T>) = C.f1 &x //--------------- - module OutRefToByRefClassMethod2 = - type C() = + module OutRefToByRefClassMethod2 = + type C() = static member f1 (x: byref<'T>) = 1 let f2 (x: outref<'T>) = C.f1(&x) module ByRefToByRefClassMethod2 = - type C() = + type C() = static member f1 (x: byref<'T>) = 1 - let f2 (x: byref<'T>) = C.f1(&x) + let f2 (x: byref<'T>) = C.f1(&x) module ByRefToOutRefClassMethod2 = - type C() = + type C() = static member f1 (x: outref<'T>) = 1 - let f2 (x: byref<'T>) = C.f1(&x) + let f2 (x: byref<'T>) = C.f1(&x) module OutRefToOutRefClassMethod2 = - type C() = + type C() = static member f1 (x: outref<'T>) = 1 - let f2 (x: outref<'T>) = C.f1(&x) + let f2 (x: outref<'T>) = C.f1(&x) module ByRefToInRefClassMethod2 = - type C() = + type C() = static member f1 (x: inref<'T>) = 1 - let f2 (x: byref<'T>) = C.f1(&x) + let f2 (x: byref<'T>) = C.f1(&x) module InRefToInRefClassMethod2 = - type C() = + type C() = static member f1 (x: inref<'T>) = 1 - let f2 (x: inref<'T>) = C.f1(&x) + let f2 (x: inref<'T>) = C.f1(&x) module OutRefToInRefClassMethod2 = - type C() = + type C() = static member f1 (x: inref<'T>) = 1 let f2 (x: outref<'T>) = C.f1(&x) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/MutateInRef3.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/MutateInRef3.fs index 26eeef6e5f5..bde329354fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/MutateInRef3.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/MutateInRef3.fs @@ -8,7 +8,7 @@ module MutateInRef3 = member this.XAddr = &x.contents let testIn (m: inref) = - // If the struct API indirectly reveals a byref return of a field in a reference type then + // If the struct API indirectly reveals a byref return of a field in a reference type then // there is nothing stopping it being written to. m.XAddr <- 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/NonGenericTestNameRecursiveInClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/NonGenericTestNameRecursiveInClass.fs index 8c9a913b7ec..b7b21fd70e9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/NonGenericTestNameRecursiveInClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/NonGenericTestNameRecursiveInClass.fs @@ -3,14 +3,14 @@ open Prelude type NonGenericTestNameRecursiveInClass() = let rec testValue id (data: byref) : unit = - if id = 10 then - data <- 3uy - else + if id = 10 then + data <- 3uy + else testValue (id + 1) &data static do NonGenericTestNameRecursiveInClass().Test() - member __.Test() = + member __.Test() = let mutable x = 0uy testValue 0 &x check "vruoer3rvvremtys" x 3uy \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/NonGenericTestNameRecursiveInClassSubsume.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/NonGenericTestNameRecursiveInClassSubsume.fs index 0b075d00ced..47353b6bf66 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/NonGenericTestNameRecursiveInClassSubsume.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/NonGenericTestNameRecursiveInClassSubsume.fs @@ -3,14 +3,14 @@ open Prelude type NonGenericTestNameRecursiveInClassSubsume() = let rec testValue id (data: byref) (y:System.IComparable) : unit = - if id = 10 then - data <- 3uy - else + if id = 10 then + data <- 3uy + else testValue (id + 1) &data y static do NonGenericTestNameRecursiveInClassSubsume().Test() - member __.Test() = + member __.Test() = let mutable x = 0uy testValue 0 &x Unchecked.defaultof check "vruoer3rvvremtys" x 3uy \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/StaticGenericTestNameRecursiveInClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/StaticGenericTestNameRecursiveInClass.fs index 63a71e7192e..57c90ab0443 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/StaticGenericTestNameRecursiveInClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/StaticGenericTestNameRecursiveInClass.fs @@ -7,7 +7,7 @@ type StaticGenericTestNameRecursiveInClass() = static do StaticGenericTestNameRecursiveInClass.Test() - static member Test() = + static member Test() = let mutable x = 0uy testValue "unused" 0 &x check "vruoer3rv" x 3uy diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/StaticNonGenericTestNameRecursiveInClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/StaticNonGenericTestNameRecursiveInClass.fs index 27495aee9cf..e3e724ec9c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/StaticNonGenericTestNameRecursiveInClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/StaticNonGenericTestNameRecursiveInClass.fs @@ -7,7 +7,7 @@ type StaticNonGenericTestNameRecursiveInClass() = static do StaticNonGenericTestNameRecursiveInClass.Test() - static member Test() = + static member Test() = let mutable x = 0uy testValue 0 &x check "vruoer3rvvrebae" x 3uy \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestArrayParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestArrayParam.fs index 959e18d5084..2130b468d61 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestArrayParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestArrayParam.fs @@ -2,10 +2,10 @@ open Prelude module TestArrayParam = - type C() = + type C() = static member M (x:int[]) = &x.[0] - let test() = + let test() = let r = [| 1 |] let addr = &C.M r addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestAssignToReturnByref.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestAssignToReturnByref.fs index 5cfba19159f..a74fadccf55 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestAssignToReturnByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestAssignToReturnByref.fs @@ -1,7 +1,7 @@ open Prelude -module TestAssignToReturnByref = - type C() = +module TestAssignToReturnByref = + type C() = static let mutable v = System.DateTime.Now static member M() = &v static member P = &v @@ -9,13 +9,13 @@ module TestAssignToReturnByref = member __.InstanceP with get() = &v static member Value = v - let F1() = + let F1() = let today = System.DateTime.Now.Date C.M() <- today check "cwecjc" C.Value today C.P <- C.M().AddDays(1.0) check "cwecjc1" C.Value (today.AddDays(1.0)) - let c = C() + let c = C() c.InstanceM() <- today.AddDays(2.0) check "cwecjc2" C.Value (today.AddDays(2.0)) c.InstanceP <- today.AddDays(3.0) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestAssignToReturnByref2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestAssignToReturnByref2.fs index 27b9b76f283..990b2e00dd8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestAssignToReturnByref2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestAssignToReturnByref2.fs @@ -1,10 +1,10 @@ open Prelude -module TestAssignToReturnByref2 = +module TestAssignToReturnByref2 = let mutable v = System.DateTime.Now let M() = &v - let F1() = + let F1() = let today = System.DateTime.Now.Date M() <- today check "cwecjc" v today diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestClassParamMutableField.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestClassParamMutableField.fs index efc89a89c8f..db5c696f042 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestClassParamMutableField.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestClassParamMutableField.fs @@ -4,13 +4,13 @@ module TestClassParamMutableField = type C() = [] val mutable z : int - type C2() = + type C2() = static member M (x:C) = &x.z - let test() = + let test() = let c = C() let addr = &C2.M c addr <- addr + 1 - check2 "mepojcwem13b" 1 c.z + check2 "mepojcwem13b" 1 c.z test() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestConditionalReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestConditionalReturn.fs index 3a9737c8f8b..a2d280f74cd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestConditionalReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestConditionalReturn.fs @@ -4,10 +4,10 @@ module TestConditionalReturn = let mutable x = 1 let mutable y = 1 - type C() = + type C() = static member M inp = if inp = 3 then &x else &y - let test() = + let test() = let addr = &C.M 3 addr <- addr + 1 check2 "mepojcwem6" 2 x @@ -17,7 +17,7 @@ module TestConditionalReturn = check2 "mepojcwem8" 2 x check2 "mepojcwem9" 2 y - let test2() = + let test2() = let res = &C.M 3 let res2 = res + 1 check2 "mepojcwem8b" 3 res2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestDelegateMethod.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestDelegateMethod.fs index 20e1056c54d..af5cc30488a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestDelegateMethod.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestDelegateMethod.fs @@ -5,7 +5,7 @@ module TestDelegateMethod = type D = delegate of unit -> byref - let test() = + let test() = let d = D(fun () -> &x) let addr = &d.Invoke() check2 "mepojcwem18a" 1 x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestDelegateMethod2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestDelegateMethod2.fs index 550cfd20f8f..2d4f7fd6dc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestDelegateMethod2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestDelegateMethod2.fs @@ -7,7 +7,7 @@ module TestDelegateMethod2 = let d = D(fun xb -> &xb) - let test() = + let test() = let addr = &d.Invoke(&x) check2 "mepojcwem18a2" 1 x addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestImmediateReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestImmediateReturn.fs index 1b3f1c29c03..544030c400e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestImmediateReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestImmediateReturn.fs @@ -3,16 +3,16 @@ open Prelude module TestImmediateReturn = let mutable x = 1 - type C() = + type C() = static member M () = &x - let test() = + let test() = let addr : byref = &C.M() addr <- addr + 1 check2 "mepojcwem1" 2 x - let test2() = + let test2() = let v = &C.M() let res = v + 1 check2 "mepojcwem1b" 3 res diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInRefMutation.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInRefMutation.fs index ac592fd1036..bc8683559f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInRefMutation.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInRefMutation.fs @@ -1,6 +1,6 @@ open Prelude -module TestInRefMutation = +module TestInRefMutation = [] type TestMut = @@ -17,5 +17,5 @@ module TestInRefMutation = let x = TestMut() //testIn (&x) testAction (&x) - x + x test() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInterfaceMethod.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInterfaceMethod.fs index 39c94a1dec9..c050701ebc3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInterfaceMethod.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInterfaceMethod.fs @@ -3,18 +3,18 @@ open Prelude module TestInterfaceMethod = let mutable x = 1 - type I = + type I = abstract M : unit -> byref - type C() = - interface I with + type C() = + interface I with member this.M() = &x - let ObjExpr() = - { new I with + let ObjExpr() = + { new I with member this.M() = &x } - let test() = + let test() = let addr = &(C() :> I).M() addr <- addr + 1 let addr = &(ObjExpr()).M() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInterfaceProperty.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInterfaceProperty.fs index a0035f526fc..4d7968d1bd0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInterfaceProperty.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestInterfaceProperty.fs @@ -3,18 +3,18 @@ open Prelude module TestInterfaceProperty = let mutable x = 1 - type I = + type I = abstract P : byref - type C() = - interface I with + type C() = + interface I with member this.P = &x - let ObjExpr() = - { new I with + let ObjExpr() = + { new I with member this.P = &x } - let test() = + let test() = let addr = &(C() :> I).P addr <- addr + 1 let addr = &(ObjExpr()).P diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestMatchReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestMatchReturn.fs index ef29ad77b18..dcc25889e20 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestMatchReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestMatchReturn.fs @@ -4,10 +4,10 @@ module TestMatchReturn = let mutable x = 1 let mutable y = 1 - type C() = + type C() = static member M inp = match inp with 3 -> &x | _ -> &y - let test() = + let test() = let addr = &C.M 3 addr <- addr + 1 check2 "mepojcwem2" 2 x @@ -17,7 +17,7 @@ module TestMatchReturn = check2 "mepojcwem4" 2 x check2 "mepojcwem5" 2 y - let test2() = + let test2() = let res = &C.M 3 let res2 = res + 1 check2 "mepojcwem2b" 3 res2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleGeneric.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleGeneric.fs index c5826ae846c..bc70c677459 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleGeneric.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleGeneric.fs @@ -4,11 +4,11 @@ open Prelude module TestNameModuleGeneric = let rec testValue (unused: 'T) id (data: byref) : unit = - if id = 10 then - data <- 3uy + if id = 10 then + data <- 3uy else testValue unused (id + 1) &data - let Test() = + let Test() = let mutable x = 0uy testValue "unused" 0 &x check "vruoer" x 3uy diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleNonGeneric.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleNonGeneric.fs index 005435649b2..dafd7709786 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleNonGeneric.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleNonGeneric.fs @@ -3,12 +3,12 @@ open Prelude module TestNameModuleNonGeneric = let rec testValue id (data: byref) : unit = - if id = 10 then - data <- 3uy - else + if id = 10 then + data <- 3uy + else testValue (id + 1) &data - let Test() = + let Test() = let mutable x = 0uy testValue 0 &x check "vruoer3r" x 3uy diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleNonGenericSubsume.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleNonGenericSubsume.fs index b5af70ab710..a2f10802ce0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleNonGenericSubsume.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestNameModuleNonGenericSubsume.fs @@ -3,14 +3,14 @@ open Prelude module TestNameModuleNonGenericSubsume = let rec testValue id (data: byref) (y: System.IComparable) : unit = - if id = 10 then - data <- 3uy - else + if id = 10 then + data <- 3uy + else testValue (id + 1) &data y - let Test() = + let Test() = let mutable x = 0uy testValue 0 &x Unchecked.defaultof - check "vruoer3r" x 3uy + check "vruoer3r" x 3uy Test() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgument.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgument.fs index db6992196e7..34d11f397ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgument.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgument.fs @@ -2,10 +2,10 @@ open Prelude module TestOneArgument = - type C() = + type C() = static member M (x:byref) = &x - let test() = + let test() = let mutable r1 = 1 let addr = &C.M (&r1) addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgumentInRefReturned.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgumentInRefReturned.fs index ec4f12ed4d7..5ed7a096bee 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgumentInRefReturned.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgumentInRefReturned.fs @@ -2,10 +2,10 @@ open Prelude module TestOneArgumentInRefReturned = - type C() = + type C() = static member M (x:inref) = &x - let test() = + let test() = let mutable r1 = 1 let addr = &C.M (&r1) let x = addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgumentOutRef.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgumentOutRef.fs index 12f4ee80502..e588feee65d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgumentOutRef.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestOneArgumentOutRef.fs @@ -2,10 +2,10 @@ open Prelude module TestOneArgumentOutRef = - type C() = + type C() = static member M (x:outref) = &x - let test() = + let test() = let mutable r1 = 1 let addr = &C.M (&r1) addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestReadOnlyAddressOfStaticField.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestReadOnlyAddressOfStaticField.fs index 237f20f7673..55b1153f23a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestReadOnlyAddressOfStaticField.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestReadOnlyAddressOfStaticField.fs @@ -1,6 +1,6 @@ open Prelude -module TestReadOnlyAddressOfStaticField = +module TestReadOnlyAddressOfStaticField = type C() = static let x = 1 static member F() = &x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestRecordParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestRecordParam.fs index 92b0c0a17a8..952099f8d95 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestRecordParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestRecordParam.fs @@ -3,10 +3,10 @@ open Prelude module TestRecordParam = type R = { mutable z : int } - type C() = + type C() = static member M (x:R) = &x.z - let test() = + let test() = let r = { z = 1 } let addr = &C.M r addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestRecordParam2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestRecordParam2.fs index 3a0ee11ed96..61407bc1af0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestRecordParam2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestRecordParam2.fs @@ -3,10 +3,10 @@ open Prelude module TestRecordParam2 = type R = { mutable z : int } - type C() = + type C() = static member M (x:byref) = &x.z - let test() = + let test() = let mutable r = { z = 1 } let addr = &C.M(&r) addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestStructParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestStructParam.fs index 984470b78a3..6fdaf7f78c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestStructParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestStructParam.fs @@ -5,10 +5,10 @@ module TestStructParam = [] type R = { mutable z : int } - type C() = + type C() = static member M (x:byref) = &x.z - let test() = + let test() = let mutable r = { z = 1 } let addr = &C.M(&r) addr <- addr + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestStructRecord.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestStructRecord.fs index 8666dbd4945..607cf43cb1c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestStructRecord.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestStructRecord.fs @@ -6,4 +6,4 @@ module TestStructRecord = { Link: string } let link item = - { item with Link = "" } \ No newline at end of file + { item with Link = "" } \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTryFinallyReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTryFinallyReturn.fs index 0da75201cc0..da3b90e96b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTryFinallyReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTryFinallyReturn.fs @@ -4,10 +4,10 @@ module TestTryFinallyReturn = let mutable x = 1 let mutable y = 1 - type C() = + type C() = static member M inp = try &x with _ -> &y - let test() = + let test() = let addr = &C.M 3 addr <- addr + 1 check2 "mepojcwem6b" 2 x @@ -17,7 +17,7 @@ module TestTryFinallyReturn = check2 "mepojcwem8b" 3 x check2 "mepojcwem9b" 1 y - let test2() = + let test2() = let res = &C.M 3 let res2 = res + 1 check2 "mepojcwem2tf" 4 res2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTryWithReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTryWithReturn.fs index 37687b5b28a..74152be77c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTryWithReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTryWithReturn.fs @@ -4,10 +4,10 @@ module TestTryWithReturn = let mutable x = 1 let mutable y = 1 - type C() = + type C() = static member M inp = try &x with _ -> &y - let test() = + let test() = let addr = &C.M 3 addr <- addr + 1 check2 "mepojcwem6b" 2 x @@ -17,7 +17,7 @@ module TestTryWithReturn = check2 "mepojcwem8b" 3 x check2 "mepojcwem9b" 1 y - let test2() = + let test2() = let res = &C.M 3 let res2 = res + 1 check2 "mepojcwem2ff" 4 res2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTwoArguments.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTwoArguments.fs index e49f40d7536..0e56e60d4e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTwoArguments.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefReturnMember/TestTwoArguments.fs @@ -2,10 +2,10 @@ open Prelude module TestTwoArguments = - type C() = + type C() = static member M (x:byref, y:byref) = &x - let test() = + let test() = let mutable r1 = 1 let mutable r2 = 0 let addr = &C.M (&r1, &r2) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs index 32f18bfb19f..45bc8a09265 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs @@ -12,7 +12,7 @@ module ByrefSafetyAnalysis = FsFromPath (__SOURCE_DIRECTORY__ ++ "Prelude.fs") |> withName "Prelude" ] - + let verifyCompile compilation = compilation |> asExe @@ -20,7 +20,7 @@ module ByrefSafetyAnalysis = |> withOptions ["--test:ErrorRanges"] |> withPrelude |> compile - + let verifyCompileAndRun compilation = compilation |> asExe @@ -28,7 +28,7 @@ module ByrefSafetyAnalysis = |> withOptions ["--test:ErrorRanges"] |> withPrelude |> compileAndRun - + // SOURCE=Migrated02.fs SCFLAGS="--test:ErrorRanges" # Migrated02.fs [] let``MigratedTest02_fs`` compilation = @@ -109,28 +109,28 @@ module ByrefSafetyAnalysis = (Error 412, Line 210, Col 13, Line 210, Col 14, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 412, Line 210, Col 17, Line 210, Col 26, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") ] - + // SOURCE=Migrated03.fs SCFLAGS="--test:ErrorRanges" # Migrated03.fs [] let``MigratedTest03_fs`` compilation = let csharpLib = CSharpFromPath (__SOURCE_DIRECTORY__ ++ "MigratedTest03CSharpLib.cs") |> withName "CSharpLib3" - + compilation |> getCompilation |> withReferences [ csharpLib ] |> withOptions ["--nowarn:3370"] |> compileExeAndRun |> shouldSucceed - + // SOURCE=E_Migrated03.fs SCFLAGS="--test:ErrorRanges" # E_Migrated03.fs [] let``E_Migrated03_fs`` compilation = let csharpLib = CSharpFromPath (__SOURCE_DIRECTORY__ ++ "MigratedTest03CSharpLib.cs") |> withName "CSharpLib3" - + compilation |> getCompilation |> asExe @@ -153,13 +153,13 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") (Error 3239, Line 45, Col 17, Line 45, Col 26, "Cannot partially apply the extension method 'Change' because the first parameter is a byref type.") (Error 3239, Line 46, Col 17, Line 46, Col 25, "Cannot partially apply the extension method 'Test2' because the first parameter is a byref type.") ] - + [] let``TryGetValue_fs`` compilation = compilation |> getCompilation |> withPrelude |> compileExeAndRun |> shouldSucceed - + [] let``CompareExchange_fs`` compilation = compilation @@ -168,7 +168,7 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") |> withOptions ["--nowarn:3370"] |> compileExeAndRun |> shouldSucceed - + [] let``ByRefParam_fs`` compilation = compilation @@ -327,7 +327,7 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") let``InRefParam_DateTime_ImplicitAddressOfAtCallSite4`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed #endif - + [] let``InRefParam_Generic_ExplicitAddressOfAttCallSite1`` compilation = compilation @@ -346,224 +346,224 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") [] let``TestImmediateReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestMatchReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestConditionalReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestTryWithReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestTryFinallyReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestOneArgument`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestTwoArguments`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestRecordParam`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestRecordParam2`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestClassParamMutableField`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestArrayParam`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestStructParam`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestInterfaceMethod`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestInterfaceProperty`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestDelegateMethod`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestBaseCall`` compilation = compilation |> withNoWarn 988 |> verifyCompileAndRun |> shouldSucceed - + [] let``TestDelegateMethod2`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + module ByrefReturnMember = [] let``TestImmediateReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestMatchReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestConditionalReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestTryWithReturn`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestOneArgument`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestOneArgumentInRefReturned`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestOneArgumentOutRef`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestTwoArguments`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestRecordParam`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestRecordParam2`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestClassParamMutableField`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestArrayParam`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestStructParam`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestInterfaceMethod`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestInterfaceProperty`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestDelegateMethod`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestBaseCall`` compilation = compilation |> withNoWarn 988 |> verifyCompileAndRun |> shouldSucceed - + [] let``TestDelegateMethod2`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``ByRefExtensionMethods1`` compilation = compilation |> withNoWarn 52 |> verifyCompileAndRun |> shouldSucceed - + // [] // let``ByRefExtensionMethodsOverloading`` compilation = // compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestReadOnlyAddressOfStaticField`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestAssignToReturnByref`` compilation = compilation |> withNoWarn 52 |> verifyCompileAndRun |> shouldSucceed - + [] let``TestAssignToReturnByref2`` compilation = compilation |> withNoWarn 52 |> verifyCompileAndRun |> shouldSucceed - + [] let``BaseCallByref`` compilation = compilation |> withNoWarn 988 |> verifyCompileAndRun |> shouldSucceed - + [] let``Bug820`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``Bug820b`` compilation = compilation |> withNoWarn 988 |> verifyCompileAndRun |> shouldSucceed - + [] let``TestNameModuleGeneric`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestNameModuleNonGeneric`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestNameModuleNonGenericSubsume`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``GenericTestNameRecursive`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``NonGenericTestNameRecursiveInClass`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``NonGenericTestNameRecursiveInClassSubsume`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``StaticGenericTestNameRecursiveInClass`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``StaticNonGenericTestNameRecursiveInClass`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``TestInRefMutation`` compilation = compilation |> withNoWarn 52 |> withNoWarn 20 |> verifyCompileAndRun |> shouldSucceed - + [] let``MutateInRef3`` compilation = compilation |> verifyCompileAndRun |> shouldSucceed - + [] let``MatrixOfTests`` compilation = compilation |> withNoWarn 988 |> verifyCompileAndRun |> shouldSucceed - + [] let``TestStructRecord`` compilation = compilation |> withNoWarn 988 |> withNoWarn 3560 |> verifyCompileAndRun |> shouldSucceed - + [] let``NoTailcallToByrefsWithModReq`` compilation = compilation @@ -571,7 +571,7 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") |> withNoWarn 20 |> verifyCompileAndRun |> shouldSucceed - + [] let``E_CantTakeAddressOfExpressionReturningReferenceType`` compilation = compilation @@ -588,9 +588,9 @@ but given a The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") (Error 3236, Line 20, Col 17, Line 20, Col 25, "Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address.") ] - - - + + + [] let ``E_WriteToInRef`` () = FSharp """let f1 (x: inref) = x <- 1""" @@ -600,7 +600,7 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") |> withDiagnostics [ (Error 3224, Line 1, Col 26, Line 1, Col 32, "The byref pointer is readonly, so this write is not permitted.") ] - + [] let ``E_WriteToInRefStructInner`` () = FSharp """let f1 (x: inref) = x.X <- 1""" @@ -611,7 +611,7 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") (Error 39, Line 1, Col 18, Line 1, Col 19, "The type 'S' is not defined.") (Error 72, Line 1, Col 24, Line 1, Col 27, "The type of this expression could not be inferred before accessing its members. Add a type annotation, e.g. (expr: SomeType), to constrain the type before this point.") ] - + [] let ``E_InRefToByRef`` () = FSharp """ @@ -628,7 +628,7 @@ but given a 'inref<'T>' The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") ] - + [] let ``E_InRefToOutRef`` () = FSharp """ @@ -645,7 +645,7 @@ but given a 'inref<'T>' The type 'ByRefKinds.Out' does not match the type 'ByRefKinds.In'") ] - + [] let ``E_InRefToByRefClassMethod`` () = FSharp """ @@ -663,7 +663,7 @@ but given a 'inref<'T>' The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") ] - + [] let ``E_InRefToOutRefClassMethod`` () = FSharp """ @@ -681,7 +681,7 @@ but given a 'inref<'T>' The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") ] - + [] let ``E_InRefToByRefClassMethod2`` () = FSharp """ @@ -699,7 +699,7 @@ but given a 'inref<'T>' The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") ] - + [] let ``E_InRefToOutRefClassMethod2`` () = FSharp """ @@ -717,7 +717,7 @@ but given a 'inref<'T>' The type 'ByRefKinds.Out' does not match the type 'ByRefKinds.In'") ] - + [] let ``E_UseOfLibraryOnly`` () = FSharp """ @@ -730,7 +730,7 @@ type C() = |> withDiagnostics [ (Error 1204, Line 3, Col 26, Line 3, Col 39, "This construct is for use in the FSharp.Core library and should not be used directly") ] - + [] let ``E_CantTakeAddress`` () = FSharp """ @@ -753,7 +753,7 @@ let test2 () = (Error 3236, Line 4, Col 13, Line 4, Col 15, "Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address."); (Error 3236, Line 10, Col 13, Line 10, Col 29, "Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address.") ] - + [] let ``E_InRefParam_DateTime`` () = FSharp """ @@ -775,7 +775,7 @@ but here has type Checked Unchecked") ] - + [] let ``E_ExtensionMethodOnByrefType`` () = FSharp """ @@ -796,8 +796,8 @@ type outref<'T> with (Error 3238, Line 5, Col 6, Line 5, Col 11, "Byref types are not allowed to have optional type extensions.") (Error 3238, Line 8, Col 6, Line 8, Col 12, "Byref types are not allowed to have optional type extensions.") ] - - + + // SOURCE=E_ByrefAsArrayElement.fs SCFLAGS="--test:ErrorRanges" # E_ByrefAsArrayElement.fs [] let``E_ByrefAsArrayElement_fs`` compilation = @@ -978,7 +978,7 @@ type outref<'T> with |> withOptions ["--warnaserror+"; "--nowarn:988"] |> compileExeAndRun |> shouldSucceed - + #if NET7_0_OR_GREATER // This constructor added in .NET 7: https://learn.microsoft.com/en-us/dotnet/api/system.span-1.-ctor?view=net-7.0#system-span-1-ctor(-0@) [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/CompareExchange.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/CompareExchange.fs index 7e37a911e34..0d4626b2e3a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/CompareExchange.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/CompareExchange.fs @@ -1,7 +1,7 @@ open Prelude // Test a simple ref argument -module CompareExchangeTests = +module CompareExchangeTests = let mutable x = 3 let v = System.Threading.Interlocked.CompareExchange(&x, 4, 3) check "cweweoiwekla" v 3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsArrayElement.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsArrayElement.fs index 3b5e7a60ccd..af0937fca37 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsArrayElement.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsArrayElement.fs @@ -1,8 +1,8 @@ -// #FSharpQA #Conformance #TypeInference #ByRef +// #FSharpQA #Conformance #TypeInference #ByRef //The address of an array element cannot be used at this point let mutable xs = [|1|] -let applyWithOne f = +let applyWithOne f = f &xs.[0] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsGenericArgument01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsGenericArgument01.fs index b465cca7037..901d4f117c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsGenericArgument01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsGenericArgument01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Verify error when trying to use a byref<_> as generic argument. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefFieldEscapingLocalScope01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefFieldEscapingLocalScope01.fs index 99f09259159..d708dcdadca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefFieldEscapingLocalScope01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefFieldEscapingLocalScope01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef open System let testFunction() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefFieldEscapingLocalScope02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefFieldEscapingLocalScope02.fs index 50a1cbeaccf..0dfc6ff8934 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefFieldEscapingLocalScope02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefFieldEscapingLocalScope02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef open System let testFunction = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda01.fs index 90819509222..e0b7055ffe9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Verify that byref values may not escape into inner lambdas. // (Disallowed by the CLR.) @@ -7,11 +7,11 @@ let testFunction() = let mutable x = 0 let byrefValue = &x - + // If you simply use a byrev value, F# automatically dereferences it let nestedLambda (x : int) = byrefValue + x - + nestedLambda 42 -// Code shouldn't compile +// Code shouldn't compile exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda02.fs index ef9a349d0da..0bdb8426a29 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Verify that byref values may not escape into inner lambdas. // (Disallowed by the CLR.) @@ -7,10 +7,10 @@ let testFunction() = let mutable x = 0 let byrefValue = &x - + let nestedLambda = fun (x : int) -> x + byrefValue - + nestedLambda 42 -// Code shouldn't compile +// Code shouldn't compile exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda03.fs index dad0c477b17..c2185584498 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Verify that byref values may not escape into inner lambdas. // (Disallowed by the CLR.) // This test is currently emitting 2 copies of the same error message due to a known bug @@ -7,7 +7,7 @@ let testFunction() = let mutable x = 0 let byrefValue = &x - + let nestedLambda = function (x : int) -> x + byrefValue - + nestedLambda 42 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInQuotation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInQuotation01.fs index dc4699c99ab..51b35e56a40 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInQuotation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInQuotation01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Attempt to use a byref in a quotation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_CantTakeAddressOfExpressionReturningReferenceType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_CantTakeAddressOfExpressionReturningReferenceType.fs index 4cbd2c8c739..fd44ce4e922 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_CantTakeAddressOfExpressionReturningReferenceType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_CantTakeAddressOfExpressionReturningReferenceType.fs @@ -3,7 +3,7 @@ module CantTakeAddressOfExpressionReturningReferenceType = open System.Collections.Generic let test1 () = - let aggregator = + let aggregator = new ConcurrentDictionary< string, ConcurrentDictionary >() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_FirstClassFuncTakesByref.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_FirstClassFuncTakesByref.fs index 84a89e6502e..ebf31fbb24f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_FirstClassFuncTakesByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_FirstClassFuncTakesByref.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef let f (x : byref<'a>) = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_MigratedTest02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_MigratedTest02.fs index d91c9a3b56d..4e822323430 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_MigratedTest02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_MigratedTest02.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants #Recursion #LetBindings #MemberDefinitions #Mutable +// #Conformance #Constants #Recursion #LetBindings #MemberDefinitions #Mutable #if TESTS_AS_APP module Core_byrefs #endif @@ -14,7 +14,7 @@ module NegativeTests = else &x - let c = + let c = if doIt then let mutable z = 2 &z // not allowed @@ -62,7 +62,7 @@ module NegativeTests = let x = 1 &Coolio.Cool(&x) // not allowed - () + () let test6 () = @@ -70,14 +70,14 @@ module NegativeTests = let mutable x = 1 &Coolio.Cool(&x) // not allowed - () + () let test7 () = let mutable x = 1 let f = fun () -> &x // not allowed - + () - + type ByRefInterface = abstract Test : byref * byref -> byref @@ -101,7 +101,7 @@ module NegativeTests = let mutable y = 500 obj.Test(&x, &y) |> ignore a - + type TestDelegate = delegate of unit-> byref let testFunction () = let mutable x = 1 @@ -209,4 +209,3 @@ module NegativeTests = let test26 () = let x = test24 () () - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref01.fs index 6ae5ee8cbb6..68d050b68a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref01.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef -// Verify error when setting object field to a byref value. +// Verify error when setting object field to a byref value. // (This is disallowed by the CLR.) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref02.fs index 2a55295c347..0e0eae28243 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Verify you cannot set an object field to store a byref value @@ -7,4 +7,4 @@ module ModuleFoo = let mutable x = 0 let byrefVal = &x - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref03.fs index d15ca81386e..24db5b6ee1a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Verify appropriate error if attempting to assign a ByRef value to an // object field. (Disallowed by the CLR.) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref04.fs index 14b03d62293..7e04ec8ba3c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Verify appropriate error if attempting to assign a ByRef value to an // object field. (Disallowed by the CLR.) @@ -19,6 +19,6 @@ let someOtherFunction() = let byrefVar = mutableObjectField :?> byref let valueInByrefSquared = byrefVar * byrefVar () - + // This file shouldn't compile exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref05.fs index 629b6423176..7e2bbf92356 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Verify appropriate error if attempting to assign a ByRef value to an // object field. (Disallowed by the CLR.) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SpanUsedInInnerLambda01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SpanUsedInInnerLambda01.fs index 887d03e7291..041f5c57bd4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SpanUsedInInnerLambda01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SpanUsedInInnerLambda01.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef open System let testFunction() = let mutable x = [| 1; 2; 3|] let span = Span(x) - + let nestedLambda (x : int) = span[0] + x - + nestedLambda 42 // Code shouldn't compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SpanUsedInInnerLambda02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SpanUsedInInnerLambda02.fs index 0e1e1590462..d51e5c4f793 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SpanUsedInInnerLambda02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SpanUsedInInnerLambda02.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef open System let testFunction() = let mutable x = 0 let span = Span(&x) - + let nestedLambda (x : int) = span[0] + x - + nestedLambda 42 // Code shouldn't compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_StaticallyResolvedByRef01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_StaticallyResolvedByRef01.fs index 03ad1c9d06d..69a47a92e35 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_StaticallyResolvedByRef01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_StaticallyResolvedByRef01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef // Regression for FSHARP1.0:5680 // Statically resolved types and tupled byref parameters generating InvalidProgramException //The member or object constructor 'TryParse' does not take 1 argument\(s\)\. An overload was found taking 2 arguments\. @@ -7,5 +7,5 @@ module M let inline try_parse x = (^a: (static member TryParse: string -> bool * ^a) x) -let _, x = try_parse "4" +let _, x = try_parse "4" let z = x + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_TopLevelByref.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_TopLevelByref.fs index de89415f027..766ac21bde4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_TopLevelByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_TopLevelByref.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ByRef +// #Regression #Conformance #TypeInference #ByRef module MyModule open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime.fs index f382bd02bdf..6be63d88a2d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime.fs @@ -1,7 +1,7 @@ open Prelude -module InRefParam_DateTime = - type C() = +module InRefParam_DateTime = + type C() = static member M(x: inref) = x let w = System.DateTime.Now let v = C.M(w) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite.fs index a92b31d26b2..0de47b6a46d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite.fs @@ -1,7 +1,7 @@ open Prelude -module InRefParam_DateTime_ImplicitAddressOfAtCallSite = - type C() = +module InRefParam_DateTime_ImplicitAddressOfAtCallSite = + type C() = static member M(x: inref) = x let v = C.M(System.DateTime.Now) check "cweweoiwe51btw" v.Date System.DateTime.Now.Date \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite2.fs index 27f9b0f0da7..80befe08f1e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite2.fs @@ -1,7 +1,7 @@ open Prelude -module InRefParam_DateTime_ImplicitAddressOfAtCallSite2 = - type C() = +module InRefParam_DateTime_ImplicitAddressOfAtCallSite2 = + type C() = static member M(x: inref) = x let v = C.M(System.DateTime.Now.AddDays(1.0)) check "cweweoiwe51btw" v.Date (System.DateTime.Now.AddDays(1.0).Date) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite3.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite3.fs index 7c7feb9d6d5..3bc51ef00b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite3.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite3.fs @@ -1,7 +1,7 @@ open Prelude -module InRefParam_DateTime_ImplicitAddressOfAtCallSite3 = - type C() = +module InRefParam_DateTime_ImplicitAddressOfAtCallSite3 = + type C() = static member M(x: inref) = x let mutable w = System.DateTime.Now let v = C.M(w) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite4.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite4.fs index aed55843049..2ad8aa46904 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite4.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ImplicitAddressOf/InRefParam_DateTime_ImplicitAddressOfAtCallSite4.fs @@ -1,7 +1,7 @@ open Prelude -module InRefParam_DateTime_ImplicitAddressOfAtCallSite4 = - type C() = +module InRefParam_DateTime_ImplicitAddressOfAtCallSite4 = + type C() = static member M(x: inref) = x let date = System.DateTime.Now.Date let w = [| date |] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam.fs index 6350992e0be..77700db26d6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam.fs @@ -1,9 +1,9 @@ open Prelude -module InRefParam = - type C() = +module InRefParam = + type C() = static member M(x: inref) = x - let Test() = + let Test() = let res = System.DateTime.Now let v = C.M(&res) check "cweweoiwe51btw" v res diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ExplicitAddressOfAtCallSite.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ExplicitAddressOfAtCallSite.fs index 37586989a33..9ac07efb49c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ExplicitAddressOfAtCallSite.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ExplicitAddressOfAtCallSite.fs @@ -1,13 +1,13 @@ open Prelude -module InRefParamOverload_ExplicitAddressOfAtCallSite = - type C() = +module InRefParamOverload_ExplicitAddressOfAtCallSite = + type C() = static member M(x: System.DateTime) = x.AddDays(1.0) static member M(x: inref) = x.AddDays(2.0) static member M2(x: System.DateTime, y: int) = x.AddDays(1.0) static member M2(x: inref, y: int) = x.AddDays(2.0) - let Test() = + let Test() = let res = System.DateTime.Now let v = C.M(&res) check "cweweoiwe51btw8" v (res.AddDays(2.0)) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ImplicitAddressOfAtCallSite.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ImplicitAddressOfAtCallSite.fs index 8e6fff8a1f7..9f7fbaff255 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ImplicitAddressOfAtCallSite.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ImplicitAddressOfAtCallSite.fs @@ -1,7 +1,7 @@ open Prelude -module InRefParamOverload_ImplicitAddressOfAtCallSite = - type C() = +module InRefParamOverload_ImplicitAddressOfAtCallSite = + type C() = static member M(x: System.DateTime) = x.AddDays(1.0) static member M(x: inref) = x.AddDays(2.0) static member M2(x: System.DateTime, y: int) = x.AddDays(1.0) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ImplicitAddressOfAtCallSite2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ImplicitAddressOfAtCallSite2.fs index be6c7efbbf4..c453af1eead 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ImplicitAddressOfAtCallSite2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParamOverload_ImplicitAddressOfAtCallSite2.fs @@ -1,12 +1,12 @@ open Prelude -module InRefParamOverload_ImplicitAddressOfAtCallSite2 = - type C() = +module InRefParamOverload_ImplicitAddressOfAtCallSite2 = + type C() = static member M(x: System.DateTime) = x.AddDays(1.0) static member M(x: inref) = x.AddDays(2.0) static member M2(x: System.DateTime, y: int) = x.AddDays(1.0) static member M2(x: inref, y: int) = x.AddDays(2.0) - let Test() = + let Test() = let res = System.DateTime.Now let v = C.M(res) check "cweweoiwe51btw1" v (res.AddDays(1.0)) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_ExplicitInAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_ExplicitInAttribute.fs index 60ae45f8943..63f9fca2ef5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_ExplicitInAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_ExplicitInAttribute.fs @@ -1,7 +1,7 @@ open Prelude -module InRefParam_ExplicitInAttribute = - type C() = +module InRefParam_ExplicitInAttribute = + type C() = static member M([] x: inref) = () let mutable res = 9 C.M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_ExplicitInAttributeDateTime.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_ExplicitInAttributeDateTime.fs index 0624e5f65bd..a0623dc4f35 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_ExplicitInAttributeDateTime.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_ExplicitInAttributeDateTime.fs @@ -1,9 +1,9 @@ open Prelude -module InRefParam_ExplicitInAttributeDateTime = - type C() = +module InRefParam_ExplicitInAttributeDateTime = + type C() = static member M([] x: inref) = x - let Test() = + let Test() = let res = System.DateTime.Now let v = C.M(&res) check "cweweoiwe519cw" v res diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_Generic_ExplicitAddressOfAttCallSite1.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_Generic_ExplicitAddressOfAttCallSite1.fs index 7e7c84acc24..d0fd2b31199 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_Generic_ExplicitAddressOfAttCallSite1.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_Generic_ExplicitAddressOfAttCallSite1.fs @@ -1,9 +1,9 @@ open Prelude -module InRefParam_Generic_ExplicitAddressOfAttCallSite1 = - type C() = +module InRefParam_Generic_ExplicitAddressOfAttCallSite1 = + type C() = static member M(x: inref<'T>) = x - let Test() = + let Test() = let res = "abc" let v = C.M(&res) check "lmvjvwo2" res "abc" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_Generic_ExplicitAddressOfAttCallSite2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_Generic_ExplicitAddressOfAttCallSite2.fs index 3bcc44d6faa..acb3e2c6091 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_Generic_ExplicitAddressOfAttCallSite2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefParam_Generic_ExplicitAddressOfAttCallSite2.fs @@ -1,9 +1,9 @@ open Prelude -module InRefParam_Generic_ExplicitAddressOfAttCallSite2 = - type C() = +module InRefParam_Generic_ExplicitAddressOfAttCallSite2 = + type C() = static member M(x: inref<'T>) = x - let Test() = + let Test() = let res = "abc" let v = C.M(&res) check "lmvjvwo4" v "abc" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefReturn.fs index 4c8b9065f72..8ba1af6f8ac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/InRefReturn.fs @@ -1,7 +1,7 @@ open Prelude -module InRefReturn = - type C() = +module InRefReturn = + type C() = static member M(x: inref) = &x let mutable res = 9 let v = C.M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs index 9c166a47aac..5a701bb3129 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs @@ -1,13 +1,13 @@ -// #Conformance #Constants #Recursion #LetBindings #MemberDefinitions #Mutable +// #Conformance #Constants #Recursion #LetBindings #MemberDefinitions #Mutable module Core_byrefs -let test s b = if b then () else failwith s +let test s b = if b then () else failwith s (* TEST SUITE FOR Int32 *) let out r (s:string) = r := !r @ [s] -let check s actual expected = +let check s actual expected = if actual = expected then printfn "%s: OK" s else failwithf "%s: FAILED, expected %A, got %A" s expected actual @@ -38,7 +38,7 @@ module Tests = abstract Test : byref * byref -> byref - // This looks like it should fail, but its sig is 'val test2 : x: byref -> y: byref -> unit' + // This looks like it should fail, but its sig is 'val test2 : x: byref -> y: byref -> unit' // unless a signature tells it otherwise, e.g. 'val test2 : (byref -> byref) -> unit' let test2 (x: byref) = fun (y: byref) -> () @@ -57,4 +57,4 @@ module Tests = let test3 () = StaticTest.Test2 // is passing, but probably shouldn't be -printf "TEST PASSED OK" +printf "TEST PASSED OK" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest03.fs index 163f4a3b723..bc3b6fdfc00 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest03.fs @@ -1,4 +1,4 @@ -// #Conformance #Constants #Recursion #LetBindings #MemberDefinitions #Mutable +// #Conformance #Constants #Recursion #LetBindings #MemberDefinitions #Mutable module Core_byrefs open System @@ -11,7 +11,7 @@ let test s b = if b then () else failwith s let out r (s:string) = r := !r @ [s] -let check s actual expected = +let check s actual expected = if actual = expected then printfn "%s: OK" s else failwithf "%s: FAILED, expected %A, got %A" s expected actual diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/NoTailcallToByrefsWithModReq.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/NoTailcallToByrefsWithModReq.fs index 2355470c8fe..5cb430d2472 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/NoTailcallToByrefsWithModReq.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/NoTailcallToByrefsWithModReq.fs @@ -3,15 +3,15 @@ module NoTailcallToByrefsWithModReq = module ClassLibrary = // F# equivalent of `public delegate FieldType Getter(in DeclaringType);` - type Getter<'DeclaringType, 'FieldType> = delegate of inref<'DeclaringType> -> 'FieldType + type Getter<'DeclaringType, 'FieldType> = delegate of inref<'DeclaringType> -> 'FieldType type GetterWrapper<'DeclaringType, 'FieldType> (getter : Getter<'DeclaringType, 'FieldType>) = member _.Get (instance : 'DeclaringType) = getter.Invoke &instance - + open ClassLibrary type MyRecord = { Value: int[] } let App() = - + let wrapper = new GetterWrapper(fun (record: inref) -> record.Value) let record = { Value = [| 42 |] } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam.fs index f788e4c7e4e..5809bf286b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam.fs @@ -1,7 +1,7 @@ open Prelude -module OutRefParam = - type C() = +module OutRefParam = + type C() = static member M(x: outref) = x <- 5 let mutable res = 9 C.M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_ExplicitOutAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_ExplicitOutAttribute.fs index ad58031a6c1..9252a5a5ff3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_ExplicitOutAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_ExplicitOutAttribute.fs @@ -1,7 +1,7 @@ open Prelude -module OutRefParam_ExplicitOutAttribute = - type C() = +module OutRefParam_ExplicitOutAttribute = + type C() = static member M([] x: outref) = x <- 5 let mutable res = 9 C.M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_Overloaded.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_Overloaded.fs index ef8a20caba5..ca360894527 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_Overloaded.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_Overloaded.fs @@ -1,7 +1,7 @@ open Prelude -module OutRefParam_Overloaded = - type C() = +module OutRefParam_Overloaded = + type C() = static member M(a: int, x: outref) = x <- 7 static member M(a: string, x: outref) = x <- 8 let mutable res = 9 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_Overloaded_ExplicitOutAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_Overloaded_ExplicitOutAttribute.fs index 2a67aeab8d0..a22f03b7b21 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_Overloaded_ExplicitOutAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/OutRefParam_Overloaded_ExplicitOutAttribute.fs @@ -1,7 +1,7 @@ open Prelude -module OutRefParam_Overloaded_ExplicitOutAttribute = - type C() = +module OutRefParam_Overloaded_ExplicitOutAttribute = + type C() = static member M(a: int, [] x: outref) = x <- 7 static member M(a: string, [] x: outref) = x <- 8 let mutable res = 9 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Prelude.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Prelude.fs index a8e4c9ab45f..d4830c4810f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Prelude.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Prelude.fs @@ -2,11 +2,11 @@ module Prelude #nowarn "3370" -let test s b = if b then () else failwith s +let test s b = if b then () else failwith s let out r (s:string) = r := !r @ [s] -let check s actual expected = +let check s actual expected = if actual = expected then printfn "%s: OK" s else failwithf "%s: FAILED, expected %A, got %A" s expected actual diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ReturnFieldSetBySpan.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ReturnFieldSetBySpan.fs index 5bb42474102..0ee846fe9bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ReturnFieldSetBySpan.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ReturnFieldSetBySpan.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #ByRef +// #Conformance #TypeInference #ByRef open System let testFunction() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ReturnSpan01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ReturnSpan01.fs index 514ecc520d5..fb7c009c234 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ReturnSpan01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ReturnSpan01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #ByRef +// #Conformance #TypeInference #ByRef open System let testFunction() = @@ -9,5 +9,5 @@ let testFunction() = do let result = testFunction() - let x = &result[0] + let x = &result[0] if x <> 13 then failwith "Failed" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_ByRefReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_ByRefReturn.fs index 73c0979ef04..7ccfbce0387 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_ByRefReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_ByRefReturn.fs @@ -1,10 +1,10 @@ open Prelude -module Slot_ByRefReturn = - type I = +module Slot_ByRefReturn = + type I = abstract M : x: byref -> byref - type C() = - interface I with + type C() = + interface I with member __.M(x: byref) = x <- 5; &x let mutable res = 9 let v = (C() :> I).M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_InRefReturn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_InRefReturn.fs index 8c50306a3cc..0b0d930113b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_InRefReturn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_InRefReturn.fs @@ -1,10 +1,10 @@ open Prelude -module Slot_InRefReturn = - type I = +module Slot_InRefReturn = + type I = abstract M : x: inref -> inref - type C() = - interface I with + type C() = + interface I with member __.M(x: inref) = &x let mutable res = 9 let v = (C() :> I).M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_OutRefParam.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_OutRefParam.fs index 27fdb7d861e..0435fe6d68c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_OutRefParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/Slot_OutRefParam.fs @@ -1,10 +1,10 @@ open Prelude -module Slot_OutRefParam = - type I = +module Slot_OutRefParam = + type I = abstract M : x: outref -> unit - type C() = - interface I with + type C() = + interface I with member __.M(x: outref) = x <- 5 let mutable res = 9 (C() :> I).M(&res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/TryGetValue.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/TryGetValue.fs index d2468617919..ab032e6e9f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/TryGetValue.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/TryGetValue.fs @@ -1,7 +1,7 @@ open Prelude // Test a simple out argument -module TryGetValueTests = +module TryGetValueTests = let d = dict [ (3,4) ] let mutable res = 9 let v = d.TryGetValue(3, &res) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/UseByrefInLambda01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/UseByrefInLambda01.fs index 177fe74fe32..bc7fc33befa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/UseByrefInLambda01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/UseByrefInLambda01.fs @@ -1,11 +1,11 @@ -// #Conformance #TypeInference #ByRef +// #Conformance #TypeInference #ByRef // Test that byref values can be used in inner lambdas if they // do not escape. -let testFunc = - fun () -> +let testFunc = + fun () -> let mutable x = 0 let byrefVal = &x byrefVal diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/ConstructorConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/ConstructorConstraint01.fs index d1dd9af347e..6e3e072840b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/ConstructorConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/ConstructorConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #TypeConstraints +// #Regression #Conformance #TypeInference #TypeConstraints // Regression test for FSHARP1.0:4850 // Title: incorrectly unsatisfied default constructor constraints @@ -20,7 +20,7 @@ type D() = let f = 0 interface I with member x.foo = f + 1 - + let c = new C() let d = new D() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/DelegateConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/DelegateConstraint01.fs index 3b60b195a45..1e6a5aa1ecf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/DelegateConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/DelegateConstraint01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #TypeConstraints +// #Conformance #TypeInference #TypeConstraints // Sanity check delegate constraints @@ -7,18 +7,18 @@ type CallbackAlpha = delegate of obj * unit * unit -> int type CallbackBravo = delegate of obj * unit * unit -> int type DelegateUtils<'del when 'del : delegate and 'del :> System.Delegate> = - static member Invoke (x : 'del) = + static member Invoke (x : 'del) = // null is the 'sender', the two units are normal parameters x.DynamicInvoke([| null; box (); box () |]) // --------------------------------------- let timesInvoked = ref 0 -let lambda = fun (_ : obj) (_ : unit) (_ : unit) -> +let lambda = fun (_ : obj) (_ : unit) (_ : unit) -> printfn "Lamda invoked!" timesInvoked := !timesInvoked + 1 !timesInvoked - + let alpha = new CallbackAlpha(lambda) let bravo = new CallbackBravo(lambda) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_DelegateConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_DelegateConstraint01.fs index 27b8e131527..5fe5bd3ea38 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_DelegateConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_DelegateConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #TypeConstraints +// #Regression #Conformance #TypeInference #TypeConstraints // Verify error message if delegate type doesn't have first parameter of type 'object'. @@ -11,13 +11,13 @@ type CallbackAlpha = delegate of unit * unit -> int type CallbackBravo = delegate of unit * unit -> int type DelegateUtils<'del when 'del : delegate and 'del :> System.Delegate> = - static member Invoke (x : 'del) = + static member Invoke (x : 'del) = x.DynamicInvoke([| box (); box () |]) // --------------------------------------- let lambda = fun (_ : unit) (_ : unit) -> 0 - + let alpha = new CallbackAlpha(lambda) let bravo = new CallbackBravo(lambda) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_EnumConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_EnumConstraint01.fs index 95b27eb867f..ccd8bc7ccf6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_EnumConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_EnumConstraint01.fs @@ -1,18 +1,18 @@ -// #Regression #Conformance #TypeInference #TypeConstraints +// #Regression #Conformance #TypeInference #TypeConstraints // Verify error message when an enum constraint fails. //The type 'int16' does not match the type 'int64' type EnumValUtils<'a when 'a : enum> = - static member Print (x : 'a) = + static member Print (x : 'a) = let eVal = printfn "%A" x () - -type Int64Enum = + +type Int64Enum = | Zero = 0L | One = 1L - + EnumValUtils.Print(Int64Enum.Zero) exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_TypeFuncDeclaredExplicit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_TypeFuncDeclaredExplicit01.fs index a628a65e061..6f085e0550e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_TypeFuncDeclaredExplicit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_TypeFuncDeclaredExplicit01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #TypeConstraints +// #Regression #Conformance #TypeInference #TypeConstraints // Verify that type functions need to be declared explicitly diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_ValueRestriction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_ValueRestriction01.fs index 4dd7e25e290..ff85c09613f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_ValueRestriction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/E_ValueRestriction01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #TypeConstraints +// #Regression #Conformance #TypeInference #TypeConstraints // Verify error associated with open type variable diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/EnumConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/EnumConstraint01.fs index 1e3f43a4053..4a411f680d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/EnumConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/EnumConstraint01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #TypeConstraints +// #Conformance #TypeInference #TypeConstraints // Verify happy case with an enum constraint diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/ValueRestriction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/ValueRestriction01.fs index 106a8452436..b4273860efa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/ValueRestriction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ConstraintSolving/ValueRestriction01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #TypeConstraints +// #Conformance #TypeInference #TypeConstraints // Verify ability to have unknown open variables if diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotChecking/InferSlotType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotChecking/InferSlotType01.fs index 8433debdb57..e03284facf2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotChecking/InferSlotType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotChecking/InferSlotType01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference +// #Conformance #TypeInference // Leave parameters generic, verify ability to infer which dispatch slot member corresponds to diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/E_GenInterfaceWGenMethods01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/E_GenInterfaceWGenMethods01.fs index 8a65831546e..a4b93a81f32 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/E_GenInterfaceWGenMethods01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/E_GenInterfaceWGenMethods01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // FSHARP1.0:1445. See also FSHARP1.0:4721 // Failure when generating code for generic interface with generic method //Value restriction: The value 'result' has an inferred generic type val result: '_a array when '_a: equality and '_a: nullHowever, values cannot have generic type variables like '_a in "let x: '_a"\. You can do one of the following:- Define it as a simple data term like an integer literal, a string literal or a union case like "let x = 1"- Add an explicit type annotation like "let x : int"- Use the value as a non-generic type in later code for type inference like "do x"or if you still want type-dependent results, you can define 'result' as a function instead by doing either:- Add a unit parameter like "let x\(\)"- Write explicit type parameters like "let x<'a>".This error is because a let binding without parameters defines a value, not a function\. Values cannot be generic because reading a value is assumed to result in the same everywhere but generic type parameters may invalidate this assumption by enabling type-dependent results\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/E_MoreThanOneDispatchSlotMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/E_MoreThanOneDispatchSlotMatch01.fs index 42c921ab237..de2b08cad52 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/E_MoreThanOneDispatchSlotMatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/E_MoreThanOneDispatchSlotMatch01.fs @@ -1,19 +1,19 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // FSB 1625, fsc generates assemblies that don't load/peverify //The override 'M: int -> int' implements more than one abstract slot, e\.g\. 'abstract IB\.M: int -> int' and 'abstract IA\.M: int -> int' -type IA = - abstract M : int -> int +type IA = + abstract M : int -> int -type IB = +type IB = inherit IA - abstract M : int -> int + abstract M : int -> int -type C() = +type C() = // By removing this, the dispatch slot IA_M is not filled - //interface IA with + //interface IA with // member x.M(y) = y+3 - - interface IB with + + interface IB with member x.M(y) = y+3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/GenInterfaceWGenMethods01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/GenInterfaceWGenMethods01.fs index f5eb46120c6..852f2f63825 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/GenInterfaceWGenMethods01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/DispatchSlotInference/GenInterfaceWGenMethods01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // FSHARP1.0:1445. See also FSHARP1.0:4721 // Failure when generating code for generic interface with generic method diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/E_FOFunction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/E_FOFunction01.fs index 1c77a206bcf..c27b3e8b705 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/E_FOFunction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/E_FOFunction01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ApplicationExpressions +// #Regression #Conformance #TypeInference #ApplicationExpressions // Verify error if applying a curried first order function where the parameters don't match //This expression was expected to have type. 'int' .but here has type. 'string' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/InferGenericArgAsTuple01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/InferGenericArgAsTuple01.fs index b15e01149cf..348a741d1b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/InferGenericArgAsTuple01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/InferGenericArgAsTuple01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #ApplicationExpressions +// #Conformance #TypeInference #ApplicationExpressions // Verify we can infer generic type args to be a tuple without adding diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/InferGenericArgAsTuple02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/InferGenericArgAsTuple02.fs index 0e581d60ff8..113d3843c6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/InferGenericArgAsTuple02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/FunctionApplicationResolution/InferGenericArgAsTuple02.fs @@ -1,10 +1,10 @@ -// #Conformance #TypeInference #ApplicationExpressions #ReqNOMT +// #Conformance #TypeInference #ApplicationExpressions #ReqNOMT // Infer multiple parameters as a tuple when expecting a single generic arg type Fruit (shelfLife : int) = - + let mutable m_age = 0 let expireEvent = new Event() @@ -13,12 +13,12 @@ type Fruit (shelfLife : int) = m_age <- m_age + x if m_age > shelfLife then - // This used to give... - // ERROR: The member or object constructor 'Trigger' takes 1 argument(s) but is here given 2. + // This used to give... + // ERROR: The member or object constructor 'Trigger' takes 1 argument(s) but is here given 2. // The required signature is 'member Event.Trigger : arg:'a -> unit'. // But now is inferred as the correct tuple argument. expireEvent.Trigger(m_age, shelfLife) - + member this.OnExpire = expireEvent.Publish let apple = new Fruit(10) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_DynamicTypeTestOverFreeArg01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_DynamicTypeTestOverFreeArg01.fs index 4dce000e16d..ab8e0546983 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_DynamicTypeTestOverFreeArg01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_DynamicTypeTestOverFreeArg01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference //This construct causes code to be less generic than indicated by its type annotations\. The type variable implied by the use of a '#', '_' or other type annotation at or near '.+\.fs\(8,13\)-\(8,14\)' has been constrained to be type 'obj' -let f () = - match box 1 with +let f () = + match box 1 with | :? list<_> -> 3 // this line should give a warning | _ -> 4 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_GeneralizeMemberInGeneric01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_GeneralizeMemberInGeneric01.fs index db79a5bb18e..6d2e8ef4bdc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_GeneralizeMemberInGeneric01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_GeneralizeMemberInGeneric01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression for Dev11:10649, we used to generalize some members too early which could be unsound if that member was in a generic type //The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types\. The inferred signature is 'static member private Foo\.Inf: \('T list -> 'T list\)'\.$ //The function or member 'Foo' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types\. The inferred signature is 'static member private Qux\.Foo: \('T list -> 'T list\)'\.$ @@ -13,7 +13,7 @@ type Foo<'T> = FooCase of 'T member this.Bar() = let (FooCase(x)) = this Foo<_>.Inf [x; x] - + // compiles ok type Qux<'T>(x:'T) = static member private Foo = function diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_NoMoreValueRestriction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_NoMoreValueRestriction01.fs index eb925d7537c..4fc054ec83b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_NoMoreValueRestriction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/E_NoMoreValueRestriction01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Verify error if you only specify some, but not all, type args //This expression was expected to have type 'char' but here has type 'float32' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/GenGroup01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/GenGroup01.fs index ebd0426f2b6..7e5a7a9ed21 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/GenGroup01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/GenGroup01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference +// #Conformance #TypeInference // Verify you generalization applies to groups of methods at once diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive01.fs index 62006ac4145..e82e33e08d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression test for FSharp1.0:3187 // Title: better inference for mutually recursive generic classes // Descr: Verify types are inferred correctly for generic classes @@ -7,19 +7,19 @@ type Vec<'a>(x:'a,y:'a) = member v.x : 'a = x member v.y = y member v.Mul(w:Vec<'b>) : Vec<'a*'b> = new Vec<'a*'b>((v.x,w.x),(v.y,w.y)) - + let vecA = Vec(1, 1) let vecB = Vec(1.0, 1.0) let c = vecA.Mul(vecB) -type Lazy<'T> = +type Lazy<'T> = { /// This field holds the result of a successful computation. It's initial value is Unchecked.defaultof mutable value : 'T - /// This field holds either the function to run or a LazyFailure object recording the exception raised + /// This field holds either the function to run or a LazyFailure object recording the exception raised /// from running the function. It is null if the thunk has been evaluated successfully. mutable funcOrException: obj } member x.Force() : 'T = x.UnsynchronizedForce() - member x.UnsynchronizedForce() = x.value - + member x.UnsynchronizedForce() = x.value + let lazyVal = { value = 1; funcOrException = null } if lazyVal.Force() <> 1 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive02.fs index ea59f58d0b3..ca6e2d360d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive02.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression test for FSharp1.0:3187 // Title: better inference for mutually recursive generic classes // Descr: Verify types are inferred correctly for generic classes -module Example_Chris = +module Example_Chris = open System // Type to represent a stateful function. A function which takes an input state and @@ -13,107 +13,107 @@ module Example_Chris = // Run our stateful function let Run (StatefulFunc f) initialState = f initialState - type StateBuilder() = + type StateBuilder() = member this.Bind( - result : StatefulFunc<'state, 'a>, + result : StatefulFunc<'state, 'a>, restOfComputation : 'a -> StatefulFunc<'state, 'b> - ) = - + ) = + StatefulFunc(fun initialState -> let result, updatedState = Run result initialState Run (restOfComputation result) updatedState ) member this.Using( - x : 'a when 'a :> IDisposable, + x : 'a when 'a :> IDisposable, restOfComputation : 'a -> StatefulFunc<'state, 'b> - ) = - + ) = + StatefulFunc(fun initialState -> try Run (restOfComputation x) initialState finally x.Dispose() ) - + member this.Combine( - partOne : StatefulFunc<'state, unit>, + partOne : StatefulFunc<'state, unit>, partTwo : StatefulFunc<'state, 'a> - ) = - + ) = + StatefulFunc(fun initialState -> let (), updatedState = Run partOne initialState Run partTwo updatedState ) - + member this.Delay( restOfComputation : unit -> StatefulFunc<'state, 'a> - ) = + ) = - StatefulFunc (fun initialState -> + StatefulFunc (fun initialState -> Run ( restOfComputation() ) initialState ) - - member this.For(elements : seq<'a>, forBody : ('a -> StatefulFunc<'state, unit>)) = - + + member this.For(elements : seq<'a>, forBody : ('a -> StatefulFunc<'state, unit>)) = + StatefulFunc(fun initialState -> let mutable state = initialState - + for e in elements do let (), updatedState = Run (forBody e) (state) state <- updatedState - + // Return unit * finalState (), state ) - - member this.Return(x : 'a) = + + member this.Return(x : 'a) = StatefulFunc(fun initialState -> x, initialState) - + member this.TryFinally( - tryBlock : StatefulFunc<'state, 'a>, + tryBlock : StatefulFunc<'state, 'a>, finallyBlock : unit -> unit - ) = - + ) = + StatefulFunc(fun initialState -> try Run tryBlock initialState finally finallyBlock() ) - - + + member this.TryWith( - tryBlock : StatefulFunc<'state, 'a>, + tryBlock : StatefulFunc<'state, 'a>, exnHandler : exn -> StatefulFunc<'state, 'a> - ) = + ) = StatefulFunc(fun initialState -> try Run tryBlock initialState with - | e -> + | e -> Run (exnHandler e) initialState - ) + ) member this.While( - predicate : unit -> bool, + predicate : unit -> bool, body : StatefulFunc<'state, unit> - ) = - - StatefulFunc(fun initialState -> + ) = + + StatefulFunc(fun initialState -> let state = ref initialState while predicate() = true do let (), updatedState = Run body (!state) state := updatedState - + // Return unit * finalState (), !state ) - - member this.Zero() = + + member this.Zero() = StatefulFunc(fun initialState -> (), initialState) // Declare the state workflow builder @@ -124,21 +124,21 @@ module Example_Chris = let SetState newState = StatefulFunc (fun prevState -> (), newState) let Add x = - state { + state { let! currentTotal, history = GetState - do! SetState (currentTotal + x, (sprintf "Added %d" x) :: history) + do! SetState (currentTotal + x, (sprintf "Added %d" x) :: history) } - + let Subtract x = state { let! currentTotal, history = GetState - do! SetState (currentTotal - x, (sprintf "Subtracted %d" x) :: history) + do! SetState (currentTotal - x, (sprintf "Subtracted %d" x) :: history) } - + let Multiply x = - state { + state { let! currentTotal, history = GetState - do! SetState (currentTotal * x, (sprintf "Multiplied by %d" x) :: history) + do! SetState (currentTotal * x, (sprintf "Multiplied by %d" x) :: history) } let calculatorActions = @@ -146,5 +146,5 @@ module Example_Chris = do! Add 2 do! Multiply 10 do! Subtract 3 - return "Finished" + return "Finished" } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive03.fs index 44e3142ff11..b711167ad26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/LessRestrictive03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression test for FSharp1.0:2419 // Title: Give each module or class binding an "empty" type parameter environment, apart from enclosing declared type parameters // Descr: Verify type constraint on the first <'a> doesn't propagate to other let's in chain of 'let recs' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/NoMoreValueRestriction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/NoMoreValueRestriction01.fs index 57b549b2e24..6ef11cfc7aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/NoMoreValueRestriction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/NoMoreValueRestriction01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference +// #Conformance #TypeInference // Verify error if you only specify some, but not all, type args // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/PropertyConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/PropertyConstraint01.fs index c14b54d71c2..401492c5eb6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/PropertyConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/PropertyConstraint01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Dev11:129910, this legal code was failing to compile -type C<'U> = +type C<'U> = member x.P with get v = (v :> System.IComparable<'U> |> ignore) -type C2<'U>() = +type C2<'U>() = member x.P with get v = (v :> System.IComparable<'U> |> ignore) let x = C2() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/RecordProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/RecordProperty01.fs index be701527266..47da0787eeb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/RecordProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/RecordProperty01.fs @@ -1,13 +1,13 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression for Dev11:41009, this class definition used to generate an error. Make sure we can use it too. //The function or member 'Empty' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types\. The inferred signature is 'static member Rope\.Empty: Rope<'T>'\. type Rope<'T> = - | Sub of 'T[] - static member Empty = + | Sub of 'T[] + static member Empty = Sub [| |] static member Create(lhs:Rope<'T>) = - match 0 with + match 0 with | 0 -> Rope<_>.Empty | n1 -> lhs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/TypeAnnotation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/TypeAnnotation01.fs index c6b75292426..2fb7fdbe14c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/TypeAnnotation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/Generalization/TypeAnnotation01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Former regression test for FSharp1.0:5685 // Title: squiggles under 'this' - unfortunate type inference // Descr: Make sure error span is correct for type inference error @@ -7,7 +7,7 @@ // type Foo<'a>(bar : Bar<'a>) = - member this.Blah() = bar.Foo() + member this.Blah() = bar.Foo() and Bar<'a>() = member this.Foo() = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/E_OverloadedGenericArgs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/E_OverloadedGenericArgs.fs index a233ef24952..bb1ccf70d28 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/E_OverloadedGenericArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/E_OverloadedGenericArgs.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // bug 1947 - the error message returned here should not be an overloading error message. //Incorrect generic instantiation\. No accessible member named 'M' takes 2 generic arguments\. -type T<'K>(n: int) = +type T<'K>(n: int) = new (n:int) = new T<'K>() new () = new T<'K>() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/MultiExtensionMethods01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/MultiExtensionMethods01.fs index 03b0d852e3c..dfcd575b8da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/MultiExtensionMethods01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/MultiExtensionMethods01.fs @@ -1,14 +1,14 @@ -// #Conformance #TypeInference +// #Conformance #TypeInference // Verify nothing explodes when you have multiple extension methods with the same // signature in scope. -module ExtensionMethodsTest1 = +module ExtensionMethodsTest1 = - type System.String with + type System.String with member this.LengthPlusX = this.Length + 1 -module ExtensionMethodsTest2 = - type System.String with +module ExtensionMethodsTest2 = + type System.String with member this.LengthPlusX = this.Length + 2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/ParamArrayToDelegate01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/ParamArrayToDelegate01.fs index d52b5810a71..b812dbf9b21 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/ParamArrayToDelegate01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/ParamArrayToDelegate01.fs @@ -5,7 +5,7 @@ open System open System.Threading.Tasks -type C() = +type C() = static member M1([] arg: System.Action []) = () static member M2([] arg: System.Func []) = () member x.M3([] arg: System.Action []) = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/UnitVsNoArgs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/UnitVsNoArgs.fs index 41c209ce2a9..da374adbd0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/UnitVsNoArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/UnitVsNoArgs.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference +// #Conformance #TypeInference // Verify the difference between 'unit' and 'no args' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/UnitVsNoArgs02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/UnitVsNoArgs02.fs index d8123ba218c..1c5ef30aad2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/UnitVsNoArgs02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/MethodApplicationResolution/UnitVsNoArgs02.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference +// #Conformance #TypeInference // Verify we allow units to be passed as values to generic functions type 'a GenericType() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/E_library_with_namespaces01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/E_library_with_namespaces01.fs index 057d62574ac..d718c8a7770 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/E_library_with_namespaces01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/E_library_with_namespaces01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Attributes #ReqNOMT +// #Regression #Conformance #TypeInference #Attributes #ReqNOMT // The Expects here is an artifact to make our automation happy. // It actually refers to E_Module02.fs //The type 'C2' is not defined @@ -19,7 +19,7 @@ namespace XX.YY end type G2<'a> = class end - + namespace XX type T1 = decimal [] type C1() = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/E_module02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/E_module02.fs index cbb3eb20fb6..8b9a0d331f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/E_module02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/E_module02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Attributes #ReqNOMT +// #Regression #Conformance #TypeInference #Attributes #ReqNOMT // Regression test for FSHARP1.0:2894 // Auto-open of my own namespace // Case: parent namespace is not visible diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/Module01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/Module01.fs index 23ce2e79060..171fd032d0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/Module01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/Module01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypeInference #Attributes #ReqNOMT +// #Regression #Conformance #TypeInference #Attributes #ReqNOMT // Regression test for FSHARP1.0:2894 // Auto-open of my own namespace // Case: no need to explicitly open XX.YY.ZZ -// +// module XX.YY.ZZ.MM diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/library_with_namespaces01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/library_with_namespaces01.fs index c4b72deb54e..18aebfea318 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/library_with_namespaces01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/library_with_namespaces01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #Attributes #ReqNOMT +// #Conformance #TypeInference #Attributes #ReqNOMT namespace XX.YY.ZZ @@ -16,7 +16,7 @@ namespace XX.YY end type G2<'a> = class end - + namespace XX type T1 = decimal [] type C1() = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/namespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/namespace01.fs index 1f0997bbb72..cdec9c43cf6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/namespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/namespace01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypeInference #Attributes #ReqNOMT +// #Regression #Conformance #TypeInference #Attributes #ReqNOMT // Regression test for FSHARP1.0:2894 // Auto-open of my own namespace // Case: namespace -// +// namespace XX.YY.ZZ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/redundant_open01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/redundant_open01.fs index 93181cd797d..3a1f7c38b68 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/redundant_open01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/redundant_open01.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #TypeInference #Attributes #ReqNOMT +// #Regression #Conformance #TypeInference #Attributes #ReqNOMT // Regression test for FSHARP1.0:2894 // Auto-open of my own namespace // Case: redundant open -// +// module XX.YY.ZZ.MM open XX.YY.ZZ // redundant, but ok! type t = C3 // t is a type abbreviation for XX.YY.ZZ.MM - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/type_abbreviation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/type_abbreviation01.fs index a8ffff49c41..d4c3f5d7013 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/type_abbreviation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/AutoOpen/type_abbreviation01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #TypeInference #Attributes #ReqNOMT +// #Regression #Conformance #TypeInference #Attributes #ReqNOMT // Regression test for FSHARP1.0:2894 // Auto-open of my own namespace // Case: type abbreviation -// +// module XX.YY.ZZ.MM type t = C3 // t is a type abbreviation for XX.YY.ZZ.MM - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E-DuplicateTypes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E-DuplicateTypes01.fs index 119221e2274..c1d76d56acf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E-DuplicateTypes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E-DuplicateTypes01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Verify error if declaring a duplicate types //Duplicate definition of type, exception or module 'Foo`1' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E_ClashingIdentifiersDU01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E_ClashingIdentifiersDU01.fs index 9be11409d64..8f98f1a68ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E_ClashingIdentifiersDU01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E_ClashingIdentifiersDU01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression test for FSHARP1.0:2364 // Clashing union case label and property //The member 'ClashingID' cannot be defined because the name 'ClashingID' clashes with the union case 'ClashingID' in this type or module diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E_ClashingIdentifiersDU02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E_ClashingIdentifiersDU02.fs index 1d744225351..4d7c9e990e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E_ClashingIdentifiersDU02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/E_ClashingIdentifiersDU02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression test for FSHARP1.0:2364 // Clashing union case label and property //The member 'ClashingID' cannot be defined because the name 'ClashingID' clashes with the union case 'ClashingID' in this type or module diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/NoPartiallyQualifiedPathWarning01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/NoPartiallyQualifiedPathWarning01.fs index 4b317281041..ea84483168d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/NoPartiallyQualifiedPathWarning01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/NoPartiallyQualifiedPathWarning01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #ReqNOMT +// #Regression #Conformance #TypeInference #ReqNOMT // Regression test for FSHARP1.0:3274 // This file is going to be loaded by fsi.exe // in the actual testcase. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/RecordInference01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/RecordInference01.fs index bf9169e0c04..b0a068a515a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/RecordInference01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/RecordInference01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference +// #Conformance #TypeInference // Verify the compiler can correctly infer record types // in the face of (partial) ambiguity. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/recordlabels.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/recordlabels.fs index 02664f190cb..25e199501a3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/recordlabels.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/Misc/recordlabels.fs @@ -1,13 +1,13 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // bug 3246 -type r1 = +type r1 = { x : int } - static member Empty = { x = 3 } - -and r2 = + static member Empty = { x = 3 } + +and r2 = { x : int } static member Empty = { x = 3 } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/E_OnDiscriminatedUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/E_OnDiscriminatedUnion.fs index bf9c59d102a..3865abc8d18 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/E_OnDiscriminatedUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/E_OnDiscriminatedUnion.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Attributes +// #Regression #Conformance #TypeInference #Attributes // Verify an error if not fully-qualifying discriminated union // when marked with RequireQualifiedAccess diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/E_OnRecord.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/E_OnRecord.fs index 5c554f2cffb..f22df7e0939 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/E_OnRecord.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/E_OnRecord.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Attributes +// #Regression #Conformance #TypeInference #Attributes // Verify error when not fully qualifying a record field when it // has the RequireQualifiedAccess attribute. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnDiscriminatedUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnDiscriminatedUnion.fs index 8ab44a00369..0a2aa45972b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnDiscriminatedUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnDiscriminatedUnion.fs @@ -1,9 +1,9 @@ -// #Conformance #TypeInference #Attributes +// #Conformance #TypeInference #Attributes // Verify the RequireQualifiedAccess attribute works on discriminated unions [] type DiscUnion = - | A + | A | B of string | C of DiscUnion * float @@ -12,7 +12,7 @@ let x = DiscUnion.C(DiscUnion.A, 1.0) do match x with | DiscUnion.C(a, 1.0) -> - match a with + match a with | DiscUnion.A -> exit 0 | _ -> exit 1 | _ -> exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecord.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecord.fs index 4a82dc60e4c..a9869c90e93 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecord.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecord.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #Attributes +// #Conformance #TypeInference #Attributes // Verify the RequireQualifiedAccess attribute works on records [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion.fs index 45222ba64f3..9dd7d9c1d4f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #Attributes +// #Conformance #TypeInference #Attributes // Verify the RequireQualifiedAccess attribute works on unions module A = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion2.fs index 6ee304d50c0..b69f8f195c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion2.fs @@ -15,5 +15,5 @@ let newChoice = R { a = 1} let choice2 v = match v with | Module.R r -> r - + let newChoice2 = Module.R { a = 1} \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion_NoRQA.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion_NoRQA.fs index 2fb35c7087f..56244b883bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion_NoRQA.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion_NoRQA.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #Attributes +// #Conformance #TypeInference #Attributes // Verify the access works on unions without RQA module A = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion_NoRQA2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion_NoRQA2.fs index d26a6024967..a790f78d35e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion_NoRQA2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnRecordVsUnion_NoRQA2.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #Attributes +// #Conformance #TypeInference #Attributes // Verify the access works on unions without RQA module A = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnUnionWithCaseOfSameName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnUnionWithCaseOfSameName.fs index eee2b7cdb5c..4a8dca7be86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnUnionWithCaseOfSameName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnUnionWithCaseOfSameName.fs @@ -1,9 +1,9 @@ -// #Conformance #TypeInference #Attributes +// #Conformance #TypeInference #Attributes // Verify the access works on unions where type name is case name module A = type C = - | B + | B | C let x = A.C \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnUnionWithCaseOfSameName2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnUnionWithCaseOfSameName2.fs index 7148ad9bea2..982aa8bab0d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnUnionWithCaseOfSameName2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/OnUnionWithCaseOfSameName2.fs @@ -1,10 +1,10 @@ -// #Conformance #TypeInference #Attributes +// #Conformance #TypeInference #Attributes // Verify the access works on unions where type name is case name module A = [] type C = - | B + | B | C let x = A.C \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_DuplicateRecursiveRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_DuplicateRecursiveRecords.fs index a255b4a31b5..6ac53f05369 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_DuplicateRecursiveRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_DuplicateRecursiveRecords.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Recursion +// #Regression #Conformance #TypeInference #Recursion // Regression for FSHARP1.0:5601 // ICE when compiling code with duplicate record type defined recursively diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_RecursiveInline.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_RecursiveInline.fs index 1330d9e4d3c..4fb3dc0ab33 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_RecursiveInline.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_RecursiveInline.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Recursion +// #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:3475 - ICE on rec inline function diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration01.fs index c4cb0e79e86..bedf2b4b4f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Recursion +// #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:3187 // Title: better inference for mutually recursive generic classes // Descr: Verify types are inferred correctly for generic classes @@ -6,11 +6,11 @@ //This expression was expected to have type // In the negative case, this tests that eager generalization is based on a transitive (greatest-fixed-point) computation -module OO_Example_GreatestFixedPoint = - type C() = +module OO_Example_GreatestFixedPoint = + type C() = member x.M1() = x.M2() |> fst member x.M2() = failwith "", x.M3() - member x.Mbbb() = - (x.M1() : int) |> ignore + member x.Mbbb() = + (x.M1() : int) |> ignore (x.M2() : string) |> ignore // M1 should not be generalized at this point member x.M3() = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration02.fs index f2848b95ba7..b05baa6393f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Recursion +// #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:5423 // Title: code sample stack overflow from fsc.exe and brings down VS2008 intellisense @@ -15,10 +15,10 @@ type SfsIntTerm<'a> () = static member ( - ) (l: myint<'a> , r: SfsIntTerm<'a>) = SfsModel.CreateIntConstant l - r static member ( * ) (l: myint<_> , r: SfsIntTerm<_> ) = let term = SfsModel.CreateIntConstant l - SfsModel.Product (term, r) + SfsModel.Product (term, r) static member ( * ) (l: SfsIntTerm<'c>, r: myint<'d>) = - let term = SfsModel.CreateIntConstant l - SfsModel.Product (r,r) + let term = SfsModel.CreateIntConstant l + SfsModel.Product (r,r) and SfsModel () = static member CreateIntConstant (x: myint<'a>) = Unchecked.defaultof> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_VariationsOnRecursiveStruct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_VariationsOnRecursiveStruct.fs index 252c6db4c56..a5325b0ef44 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_VariationsOnRecursiveStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_VariationsOnRecursiveStruct.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference #Recursion +// #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:4275 - still allowing variations on recursive structs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/InfiniteRecursiveExplicitConstructor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/InfiniteRecursiveExplicitConstructor.fs index b99d9ae27d2..42e60b820a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/InfiniteRecursiveExplicitConstructor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/InfiniteRecursiveExplicitConstructor.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypeInference #Recursion +// #Regression #Conformance #TypeInference #Recursion // Regression test for FSHARP1.0:3541 // PEVerification failure with infinite recursion in explicit constructor // Note: as per Don's comment in 3541, we should NOT disallow recursive call of own constructor open System -type A() = +type A() = new (x : string) = new A(x) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations01.fs index 0ee9593e70c..0156ffdc18b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations01.fs @@ -1,16 +1,16 @@ -// #Conformance #TypeInference #Recursion +// #Conformance #TypeInference #Recursion // Define a set of mutually recursive types. Verify compiles and works OK -type ClassType<'a>(x:'a) = +type ClassType<'a>(x:'a) = member self.Value = x - + and RecordType = { field1 : int; field2 : ClassType } member self.GetField2() = self.field2 - + and UnionType = | Case1 of string * AbbrevType1 | Case2 of string * AbbrevType2 @@ -20,12 +20,12 @@ and AbbrevType1 = ClassType and AbbrevType2 = ClassType -and AnotherClassType<'a>(x:'a) = +and AnotherClassType<'a>(x:'a) = member self.X = x - interface InterfaceType<'a> with + interface InterfaceType<'a> with member self.Ident = x - -and InterfaceType<'a> = + +and InterfaceType<'a> = abstract Ident : 'a let test1 = new ClassType(3) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations02.fs index b1e2087c30d..c0133b2a861 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations02.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #TypeInference #Recursion +// #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:3187 // Title: better inference for mutually recursive generic classes // Descr: Verify types are inferred correctly for generic classes -module OO_Example_Example1 = - type C<'T>() = +module OO_Example_Example1 = + type C<'T>() = member x.P = 1 member x.Q = (new C()).P // In the negative case, this tests that eager generalization is based on a transitive (greatest-fixed-point) computation -module OO_Example_GreatestFixedPoint = - type C() = +module OO_Example_GreatestFixedPoint = + type C() = member x.M1() = x.M2() |> fst member x.M2() = failwith "", x.M3() #if NEGATIVE @@ -22,49 +22,49 @@ module OO_Example_GreatestFixedPoint = member x.M3() = 1 -module OO_Example_RecordMemberCanBeGeneralized = - type R<'T> = - { x : 'T } +module OO_Example_RecordMemberCanBeGeneralized = + type R<'T> = + { x : 'T } member p.X = p.x // R.X is now generalized member p.OneA = {x = 3}.X, {x = "3"}.X -module OO_Example_MethodParametersCanAlwaysBeGeneralized1 = - type C() = +module OO_Example_MethodParametersCanAlwaysBeGeneralized1 = + type C() = static member M1<'T> (arg : 'T) = () // C.M1 is now generalized static member M2() = C.M1(2) ; C.M1("2") -module OO_Example_MethodParametersCanAlwaysBeGeneralized2 = - type C() = +module OO_Example_MethodParametersCanAlwaysBeGeneralized2 = + type C() = static member M1<'T> (arg : 'T) = C.M1b(arg); 1 // C.M1 should now generalized since its signature is closed. However M1b will still share a (generalized) type variable with M1. - static member Mtest() = + static member Mtest() = C.M1(2) |> ignore C.M1("2") static member M1b (arg) = C.M1b(arg) -module OO_Example3 = - type C<'T>() = +module OO_Example3 = + type C<'T>() = member x.Identity v = v - member x.Q = + member x.Q = (new C()).Identity 3 |> ignore (new C()).Identity "3" |> ignore -module OO_Example4 = +module OO_Example4 = type Vec<'a>(x:'a,y:'a) = member v.x = x member v.y = y member v.Mul(w:Vec<'b>) : Vec<'a*'b> = new Vec<'a*'b>((v.x,w.x),(v.y,w.y)) -module OO_Example5 = +module OO_Example5 = type Fred<'f>( nval: 'f ) = member this.Val = nval @@ -72,49 +72,49 @@ module OO_Example5 = let t = new Tom<'f>(nval) t.HintVal n2 t.ToFred() - + and Tom<'t>(initval: 't) = let mutable tval = initval member this.Val = tval member this.HintVal (z:'t) : unit = tval <- z member this.ToFred () :Fred<'t> = new Fred<_>(tval) - + let f = new Fred(3) let t = new Tom(5) -// In this example, 'f' can be generalized early because its type doesn't involve the type of 'g' -module Example1 = +// In this example, 'f' can be generalized early because its type doesn't involve the type of 'g' +module Example1 = let rec Example1_f x = x and Example1_g x = Example1_f 1 // SImilar to Example1 but actually excercise 'f' at multiple types within the recursive group -module Example1b = +module Example1b = let rec Example1b_f x = x - and Example1b_g x = + and Example1b_g x = Example1b_f 1 |> ignore Example1b_f "1" |> ignore Example1b_f 1.0 |> ignore Example1b_f x |> ignore -// In this example, 'f' can NOT be generalized early because its type involves the (undetermined) -// type of 'g' -module Example2 = +// In this example, 'f' can NOT be generalized early because its type involves the (undetermined) +// type of 'g' +module Example2 = let rec Example2_f x = Example2_g 1 and Example2_g x = x // In this example, 'f' can be generalized early because the type of 'g' is now fully known after type checking 'f' -module Example3 = - let rec Example3_f x = (Example3_g 1 : int) +module Example3 = + let rec Example3_f x = (Example3_g 1 : int) and Example3_g x = x // Similar to Example3 but actually excercise 'f' at multiple types within the recursive group -module Example3b = - let rec Example3b_f x = (Example3b_g 1 : int) - and Example3b_g x = +module Example3b = + let rec Example3b_f x = (Example3b_g 1 : int) + and Example3b_g x = Example3b_f 1 |> ignore Example3b_f "1" |> ignore Example3b_f 1.0 |> ignore @@ -125,16 +125,16 @@ module Example3b = // In this example, 'f1' and 'f2' can be generalized together after checking 'f2' // because the type of 'g' is fully known after type checking 'f2' -module Example4 = - let rec Example4_f1 x = Example4_g 1 - and Example4_f2 x = (Example4_g 1 : int) +module Example4 = + let rec Example4_f1 x = Example4_g 1 + and Example4_f2 x = (Example4_g 1 : int) and Example4_g x = x // Similar to Example4 but actually excercise 'f1' and 'f2' at multiple types within the recursive group -module Example4b = - let rec Example4b_f1 x = Example4b_g 1 - and Example4b_f2 x = (Example4b_g 1 : int) - and Example4b_g x = +module Example4b = + let rec Example4b_f1 x = Example4b_g 1 + and Example4b_f2 x = (Example4b_g 1 : int) + and Example4b_g x = Example4b_f1 1 |> ignore Example4b_f1 "1" |> ignore Example4b_f1 1.0 |> ignore @@ -146,19 +146,19 @@ module Example4b = 3 // In this example, 'f' SHOULD BE ABLE TO BE GENERALIZED EARLY because after checking 'f', its signature only involves the type -// variable associated with 'r', which is free in the environment. -module Example5 = +// variable associated with 'r', which is free in the environment. +module Example5 = let r = ref [] - let rec Example5_f x = (Example5_g r : int), r + let rec Example5_f x = (Example5_g r : int), r and Example5_g x = 3 r := [1] // Similar to Example5 but actually excercise 'f' at multiple types within the recursive group -module Example5b = +module Example5b = let r = ref [] - let rec Example5b_f x = (Example5b_g r : int), r - and Example5b_g x = + let rec Example5b_f x = (Example5b_g r : int), r + and Example5b_g x = Example5b_f 1 |> ignore Example5b_f "1" |> ignore Example5b_f 1.0 |> ignore @@ -167,9 +167,9 @@ module Example5b = r := [1] -module Example6 = +module Example6 = let rec Example6_f x = Example6_g () |> ignore - and Example6_g () = + and Example6_g () = Example6_f 1 |> ignore Example6_f "1" |> ignore Example6_f 1.0 |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveValueDeclarations01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveValueDeclarations01.fs index 08ff9a525a3..697db982187 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveValueDeclarations01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveValueDeclarations01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #TypeInference #Recursion +// #Regression #Conformance #TypeInference #Recursion // FSharp1.0:4821 // Copying of "when" bindings is losing a recursive fixup point (was: ICE on code with mutually recursive functions used in pattern matching guards?) -type Foo = +type Foo = | CSt of int*int*Foo | NCst of int @@ -23,7 +23,7 @@ and and can_discharge x ty tenv = List.exists (fun ty' -> lunifies ty ty') (instances x tenv) - + let rec f x tenv = match x with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ResolvingApplicationExpressions/ComplexExpression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ResolvingApplicationExpressions/ComplexExpression01.fs index 3542290f293..ed9d575aeee 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ResolvingApplicationExpressions/ComplexExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ResolvingApplicationExpressions/ComplexExpression01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeInference #ApplicationExpressions +// #Conformance #TypeInference #ApplicationExpressions // Verify you can pipe a complex expression through the F# compiler diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/AdHoc.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/AdHoc.fs index 19d6d8d2a2d..8f74654f64b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/AdHoc.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/AdHoc.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -11,19 +11,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = @@ -58,10 +58,10 @@ type C1234 = static member M<'a>(x:'a,y:C) = Four module Adhoc = - let gB12a1 (x:'a) (y:'b) = C12.M(x,y) - let gB12a2<'a,'b> (x:'a) (y:'b) = C12.M(x,y) - let rec gB12a3<'a,'b> (x:'a) (y:'b) = C12.M(x,y) - let gB12b (x:'a) (y:'b) = C12.M<'a,'b>(x,y) - let gB12c<'a,'b> (x:'a) (y:'b) = C12.M<'a,'b>(x,y) - let rec gB12d (x:'a) (y:'b) = C12.M<'a,'b>(x,y) - let rec gB12e<'a,'b> (x:'a) (y:'b) = C12.M<'a,'b>(x,y) + let gB12a1 (x:'a) (y:'b) = C12.M(x,y) + let gB12a2<'a,'b> (x:'a) (y:'b) = C12.M(x,y) + let rec gB12a3<'a,'b> (x:'a) (y:'b) = C12.M(x,y) + let gB12b (x:'a) (y:'b) = C12.M<'a,'b>(x,y) + let gB12c<'a,'b> (x:'a) (y:'b) = C12.M<'a,'b>(x,y) + let rec gB12d (x:'a) (y:'b) = C12.M<'a,'b>(x,y) + let rec gB12e<'a,'b> (x:'a) (y:'b) = C12.M<'a,'b>(x,y) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/CheckWarningsWhenVariablesInstantiatedToInt.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/CheckWarningsWhenVariablesInstantiatedToInt.fs index 2be3ea6896d..9868823df82 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/CheckWarningsWhenVariablesInstantiatedToInt.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/CheckWarningsWhenVariablesInstantiatedToInt.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Warnings When Variables Instantiated To Int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/CheckWarningsWhenVariablesInstantiatedToString.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/CheckWarningsWhenVariablesInstantiatedToString.fs index 93d31ef6074..b32e361ed43 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/CheckWarningsWhenVariablesInstantiatedToString.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/CheckWarningsWhenVariablesInstantiatedToString.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Warnings When Variables Instantiated To String @@ -10,7 +10,7 @@ //.+'a.+'string' module M let forceString (x:string) = () - + let ffA (x:'a) = x = "" // expect: warns 'a = string let ffB (x:'a) = [x;""] // expect: warns 'a = string let ffC (x:'a) = forceString x // expect: warns 'a = string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_LeftToRightOverloadResolution01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_LeftToRightOverloadResolution01.fs index 49f17817d17..a8764134a03 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_LeftToRightOverloadResolution01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_LeftToRightOverloadResolution01.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression for FSHARP1.0:5749 // Better error message for overload resolution to help ease pain associated with mismatch of intellisense information diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OnOverloadIDAttr01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OnOverloadIDAttr01.fs index 6e0d73ad9b1..741d0e72eb3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OnOverloadIDAttr01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OnOverloadIDAttr01.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Verify we emit an error when we use the deprecated OverloadID attribute //The type 'OverloadID' is not defined //The type 'OverloadID' is not defined diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OneTypeVariable03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OneTypeVariable03.fs index 7234b215800..fce1d13469d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OneTypeVariable03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OneTypeVariable03.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OneTypeVariable03rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OneTypeVariable03rec.fs index 8d69e6141c1..a2256458435 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OneTypeVariable03rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_OneTypeVariable03rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariables01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariables01.fs index 1e64b446500..ee1b0183cca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariables01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariables01.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -14,19 +14,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = @@ -61,8 +61,8 @@ type C1234 = static member M<'a>(x:'a,y:C) = Four module M1 = -// Errors +// Errors let gB13 (x:'a) (y:'b) = C13.M(x,y) // expect: ambiguity error (and note: both would instantiate 'a or 'b) - let gB24 (x:'a) (y:'b) = C24.M(x,y) = Four // expect: ambiguity error + let gB24 (x:'a) (y:'b) = C24.M(x,y) = Four // expect: ambiguity error let gC13 (x:'a) (y:'b) = C13.M<'a>(x,y) // expect: ambiguity error (and note: both would instantiate 'a or 'b) let gD13 (x:'a) (y:'b) = C13.M<_>(x,y) // expect: ambiguity error (and note: both would instantiate 'a or 'b) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariables01rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariables01rec.fs index 0aa04bd6696..5b04d0d1116 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariables01rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariables01rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = @@ -58,7 +58,7 @@ type C1234 = module M1Rec = let rec gB13 (x:'a) (y:'b) = C13.M(x,y) // expect: ambiguity error (and note: both would instantiate 'a or 'b) - let rec gB24 (x:'a) (y:'b) = C24.M(x,y) = Four // expect: ambiguity error + let rec gB24 (x:'a) (y:'b) = C24.M(x,y) = Four // expect: ambiguity error let rec gC13 (x:'a) (y:'b) = C13.M<'a>(x,y) // expect: ambiguity error (and note: both would instantiate 'a or 'b) let rec gD13 (x:'a) (y:'b) = C13.M<_>(x,y) // expect: ambiguity error (and note: both would instantiate 'a or 'b) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen00rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen00rec.fs index b4c54e0eaa1..1ef6cbc5ac5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen00rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen00rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = @@ -56,14 +56,14 @@ type C1234 = static member M<'a>(x:'a,y:int) = Three static member M<'a>(x:'a,y:C) = Four - + module M0Rec = let rec gB1<'a,'b> (x:'a) (y:'b) = C1.M(x,y) = One // expect: type error let rec gB3<'a,'b> (x:'a) (y:'b) = C3.M(x,y) = Three // expect: type error let rec gB13<'a,'b> (x:'a) (y:'b) = C13.M(x,y) // expect: ambiguity error (and note: both would instantiate 'a or 'b) let rec gC1<'a,'b> (x:'a) (y:'b) = C1.M<'a>(x,y) = One // expect: error let rec gC3<'a,'b> (x:'a) (y:'b) = C3.M<'b>(x,y) = Three // expect: error - let rec gC13<'a,'b> (x:'a) (y:'b) = C13.M<'a>(x,y) // expect: ambiguity error + let rec gC13<'a,'b> (x:'a) (y:'b) = C13.M<'a>(x,y) // expect: ambiguity error let rec gD1<'a,'b> (x:'a) (y:'b) = C1.M<_>(x,y) = One // expect: type error let rec gD13<'a,'b> (x:'a) (y:'b) = C13.M<_>(x,y) // expect: ambiguity error (and note: both would instantiate 'a or 'b) let rec gD3<'a,'b> (x:'a) (y:'b) = C3.M<_>(x,y) = Three // expect: error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen01rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen01rec.fs index 743eb8fffc0..40685500aa3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen01rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen01rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4776 (see also 4758) // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = @@ -56,7 +56,7 @@ type C1234 = static member M<'a>(x:'a,y:int) = Three static member M<'a>(x:'a,y:C) = Four - + module M0Rec = let rec gB4<'a,'b> (x:'a) (y:'b) = C4.M(x,y) = Four // expect: error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoEqualTypeVariables02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoEqualTypeVariables02.fs index 3eaf2c2e52e..df87ec6bf13 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoEqualTypeVariables02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoEqualTypeVariables02.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoEqualTypeVariables02rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoEqualTypeVariables02rec.fs index 4aec28a3480..7611e234da7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoEqualTypeVariables02rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/E_TwoEqualTypeVariables02rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/IgnoreUnitParameters.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/IgnoreUnitParameters.fs index 8a783980317..8b775e6f27b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/IgnoreUnitParameters.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/IgnoreUnitParameters.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for https://github.com/Microsoft/visualfsharp/issues/1749 // Type Inference // Explicit program entry point: [] @@ -12,14 +12,14 @@ let run4 (f:System.Func<_>) = f.Invoke() let mutable exitCode = 0 [] -let main (argsz:string []) = - +let main (argsz:string []) = + let a = run1 (fun () -> "hello world") let a' = run1 (fun _ -> "hello world") let a'' = run1 (fun x -> "hello world") - if a <> a' || a' <> a'' then + if a <> a' || a' <> a'' then exitCode <- 1 failwith "bug in a" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/OneTypeVariable03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/OneTypeVariable03.fs index 983a5d0eab1..997f56d65a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/OneTypeVariable03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/OneTypeVariable03.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/OneTypeVariable03rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/OneTypeVariable03rec.fs index 8e531e6e9d4..30d4a6268e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/OneTypeVariable03rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/OneTypeVariable03rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/RegressionTest01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/RegressionTest01.fs index 932582bb26c..608ef8292bf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/RegressionTest01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/RegressionTest01.fs @@ -1,13 +1,13 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference namespace N -module ActualTests1 = +module ActualTests1 = type Var<'a> = static member Foo(x:Var<'a>,y:'a) = failwith "" : Var static member Foo(x:Var<'a>,y:Var<'a>) = failwith "" : Var - module M = + module M = // let,let-rec,static-member with explicit instantiation and fully typed arguments and return type on lhs and Var<'a>.call let a1<'a> (x:Var<'a>,y:'a) : Var = Var<'a>.Foo( (x:Var<'a>), (y:'a) ) : Var let a2 (x:Var<'a>,y:'a) : Var = Var<'a>.Foo( (x:Var<'a>), (y:'a) ) : Var diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/RegressionTest02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/RegressionTest02.fs index ccb5255099a..007de7128d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/RegressionTest02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/RegressionTest02.fs @@ -1,16 +1,16 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference namespace N -module ActualTests2 = +module ActualTests2 = type Var<'a> = - static member Foo(y:'a) : Var = failwith "" - static member Foo(y:Var<'a>) : Var = failwith "" + static member Foo(y:'a) : Var = failwith "" + static member Foo(y:Var<'a>) : Var = failwith "" - module M = + module M = // let,let-rec,static-member with explicit instantiation and fully typed arguments and return type on lhs and Var<'a>.call - let a<'a> (y:'a) = Var<'a>.Foo( y ) - let rec c<'a> (y:'a) = Var<'a>.Foo( y ) + let a<'a> (y:'a) = Var<'a>.Foo( y ) + let rec c<'a> (y:'a) = Var<'a>.Foo( y ) // Expected all OK. - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariables01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariables01.fs index 401f439a41d..d5f751f14f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariables01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariables01.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariables01rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariables01rec.fs index 2b2193b09bc..7b3eca7e05b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariables01rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariables01rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariablesGen00.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariablesGen00.fs index 790b885d766..c9eebbcfcde 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariablesGen00.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariablesGen00.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariablesGen00rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariablesGen00rec.fs index 157074da583..3902d3ccf26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariablesGen00rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoDifferentTypeVariablesGen00rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758, FSHARP1.0:5461 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoEqualTypeVariables02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoEqualTypeVariables02.fs index 7cd8d6398e5..10f297735db 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoEqualTypeVariables02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoEqualTypeVariables02.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoEqualTypeVariables02rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoEqualTypeVariables02rec.fs index b7bf6a248ee..f5c76072f89 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoEqualTypeVariables02rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/TwoEqualTypeVariables02rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_GenericConstrained01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_GenericConstrained01.fs index 4c55d0c64ab..f4c6ff87193 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_GenericConstrained01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_GenericConstrained01.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression for FSB 4772, asymmetric warning on user supplied alpha instantiation // Verify we give appropriate warnings when a generic value is constrained //This construct causes code to be less generic than indicated by the type annotations. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_OneTypeVariable03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_OneTypeVariable03.fs index e81db963121..f2c9ea1632e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_OneTypeVariable03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_OneTypeVariable03.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_OneTypeVariable03rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_OneTypeVariable03rec.fs index 746be551255..0525e5e47b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_OneTypeVariable03rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_OneTypeVariable03rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = @@ -61,7 +61,7 @@ module M3Rec = let rec gC1 (x:'a) (y:int) = C1.M<'a>(x,y) = One // expect: less generic int (warning/error) int = 'a let rec gC3 (x:'a) (y:int) = C3.M(x,y) = Three // expect: less generic int (warning/error) int = int let rec gD1 (x:'a) (y:int) = C1.M<_>(x,y) = One // expect: less generic int (warning/error) int = 'a - + //This construct causes code to be less generic than indicated by the type annotations\. The type variable 'a has been constrained to be type 'int' //This construct causes code to be less generic than indicated by the type annotations\. The type variable 'a has been constrained to be type 'int' //This construct causes code to be less generic than indicated by the type annotations\. The type variable 'a has been constrained to be type 'int' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoDifferentTypeVariables01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoDifferentTypeVariables01.fs index d83966eb667..b22e33cc941 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoDifferentTypeVariables01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoDifferentTypeVariables01.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -18,19 +18,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoDifferentTypeVariables01rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoDifferentTypeVariables01rec.fs index 6a88370c93f..28a48b1792d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoDifferentTypeVariables01rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoDifferentTypeVariables01rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoEqualTypeVariables02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoEqualTypeVariables02.fs index 0f04ce290de..c207baf0d30 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoEqualTypeVariables02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoEqualTypeVariables02.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoEqualTypeVariables02rec.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoEqualTypeVariables02rec.fs index 1ee034fd03f..6c4047c4313 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoEqualTypeVariables02rec.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/TypeInference/W_TwoEqualTypeVariables02rec.fs @@ -1,4 +1,4 @@ -// #Regression #TypeInference +// #Regression #TypeInference // Regression test for FSHARP1.0:4758 // Type Inference // Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution @@ -10,19 +10,19 @@ type Three = | Three type Four = | Four // An unsealed type -type C() = +type C() = member x.P = 1 - + type C1 = static member M<'a>(x:'a,y:'a) = One type C2 = static member M<'a,'b>(x:'a,y:'b) = Two -type C3 = +type C3 = static member M<'a>(x:'a,y:int) = Three -type C4 = +type C4 = static member M<'a>(x:'a,y:C) = Four type C12 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Methods_in_Interface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Methods_in_Interface01.fs index 8e7deb1b37a..27475d388f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Methods_in_Interface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Methods_in_Interface01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression tests for FSHARP1.0:1348 //Duplicate method\. The method 'DoStuff' has the same name and signature as another method in type 'IFoo' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Methods_in_Interface02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Methods_in_Interface02.fs index fc1635526b1..51bf53b941f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Methods_in_Interface02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Methods_in_Interface02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression tests for FSHARP1.0:1348 // Method have different signatures, but the proper OverloadID attribute avoid the clash //Duplicate method\. The method 'DoStuff' has the same name and signature as another method in type 'IFoo'\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Record_Field_and_Member01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Record_Field_and_Member01.fs index 627fa86c158..523ab92a514 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Record_Field_and_Member01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Record_Field_and_Member01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression tests for FSHARP1.0:1348 //The member 'Name' cannot be defined because the name 'Name' clashes with the field 'Name' in this type or module -type Repro = +type Repro = { Name:decimal } member r.Name : decimal = r.Name diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Values_in_AbstractClass02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Values_in_AbstractClass02.fs index 586a0fdfd57..80ffdba7035 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Values_in_AbstractClass02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Clashing_Values_in_AbstractClass02.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression tests for FSHARP1.0:1348, FSHARP1.0:2949,FSHARP1.0:4927,FSHARP1.0: // Overloads that differ for the return type only are not allowed (in general) [] -type T() = +type T() = abstract X : unit -> decimal abstract X : unit -> int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs index f844bbfda6f..add825753d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression test for FSHARP1.0:6123 //No implementation was given for 'Derived\.get_Foo\(\) : int'$ //Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type\.$ -type FSDerived() = +type FSDerived() = inherit Derived() let x = new FSDerived() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Override_with_Incorrect_Type01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Override_with_Incorrect_Type01.fs index 9c1d398f3da..3b07a04da15 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Override_with_Incorrect_Type01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/WellFormednessChecking/E_Override_with_Incorrect_Type01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeInference +// #Regression #Conformance #TypeInference // Regression tests for FSHARP1.0:1348, 4253 //Duplicate method\. The abstract method 'DoStuff' has the same name and signature as an abstract method in an inherited type @@ -6,7 +6,7 @@ type A() = class abstract DoStuff : int -> int override x.DoStuff x' = 42 end - + type B() = class inherit A() abstract DoStuff : int -> int // error: duplicate method! diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/ByteStrings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/ByteStrings.fs index 174f71aa09e..4a2bbf64d3f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/ByteStrings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/ByteStrings.fs @@ -4,7 +4,7 @@ open Xunit open FSharp.Test.Compiler /// `'%s' is not a valid character literal.` with note about wrapped value and error soon -let private invalidCharWarningMsg (value: string) (wrapped: string) = +let private invalidCharWarningMsg (value: string) (wrapped: string) = FSComp.SR.lexInvalidCharLiteralInString (value, wrapped) |> snd |> _.Text @@ -79,7 +79,7 @@ let ``Values in different notations are invalid above 127``() = (Warning 1253, Line 6, Col 5, Line 6, Col 14, invalidAsciiWarningMsg 1) (Warning 1253, Line 7, Col 5, Line 7, Col 18, invalidAsciiWarningMsg 1) ] - + [] let ``Error messages for different notations only span invalid notation``() = Fs """ @@ -94,7 +94,7 @@ let ``Error messages for different notations only span invalid notation``() = // Note: Error for `\U00005678` spans full byte string: // Is a valid char, but two bytes -> not valid inside byte string - // But check for correct byte happens after string is finished + // But check for correct byte happens after string is finished // (because `B` suffix -> only know at end if it's a byte string) // -> Don't have direct access to range of invalid char any more (Error 1140, Line 2, Col 1, Line 2, Col 54,invalidTwoByteErrorMsg 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/CharByteLiterals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/CharByteLiterals.fs index 49d7dcb3f85..2e401835ad0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/CharByteLiterals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/CharByteLiterals.fs @@ -4,7 +4,7 @@ open Xunit open FSharp.Test.Compiler /// `This is not a valid ASCII byte literal. Value should be < 128y.` with note that error soon -let private invalidTrigraphCharWarningMsg = +let private invalidTrigraphCharWarningMsg = FSComp.SR.lexInvalidTrigraphAsciiByteLiteral () |> snd |> _.Text diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Comments.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Comments.fs index e13ca71f341..e1b3c517439 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Comments.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Comments.fs @@ -20,7 +20,7 @@ module Comments = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/LexicalAnalysis/Comments) - + [] let ``Comments - E_star02_fs - --test:ErrorRanges`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/NumericLiterals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/NumericLiterals.fs index 783c87f4e9f..355aaf032b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/NumericLiterals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/NumericLiterals.fs @@ -114,7 +114,7 @@ module NumericLiterals = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/LexicalAnalysis/NumericLiterals) - + [] let ``NumericLiterals - E_enumNegativeLiterals009_fs - --test:ErrorRanges`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Strings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Strings.fs index 7fc8edbac97..9c2b6f249c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Strings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Strings.fs @@ -4,7 +4,7 @@ open Xunit open FSharp.Test.Compiler /// `'%s' is not a valid character literal.` with note about wrapped value and error soon -let private invalidCharWarningMsg (value: string) (wrapped: string) = +let private invalidCharWarningMsg (value: string) (wrapped: string) = FSComp.SR.lexInvalidCharLiteralInString (value, wrapped) |> snd |> _.Text diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HashLight/IndentationWithComputationExpression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HashLight/IndentationWithComputationExpression01.fs index 5121084b063..c2e263da806 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HashLight/IndentationWithComputationExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HashLight/IndentationWithComputationExpression01.fs @@ -1,13 +1,13 @@ -// #Regression #Conformance #LexFilter +// #Regression #Conformance #LexFilter // Regression test for FSHARP1.0:6085 module M.N.A async { let! a = Async.StartChild( - async { + async { do! Async.Sleep(500) - return 5 + return 5 } ) let! b = a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HighPrecedenceApplication/RangeOperator01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HighPrecedenceApplication/RangeOperator01.fs index d69200019bb..908664beff6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HighPrecedenceApplication/RangeOperator01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HighPrecedenceApplication/RangeOperator01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexFilter #Precedence #ReqNOMT +// #Regression #Conformance #LexFilter #Precedence #ReqNOMT // Regression test for FSHARP1.0:4161 - Error when trying to lex/parse a range involving biggest negative number // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/InfixTokenPlusOne.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/InfixTokenPlusOne.fs index 20ab3d6bc8b..a62c7d629e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/InfixTokenPlusOne.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/InfixTokenPlusOne.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexFilter #Exceptions +// #Regression #Conformance #LexFilter #Exceptions // FSB 1624, LexFilter should consider infix tokens according to their length @@ -8,17 +8,17 @@ let x = 3 let y = x + x - + let (--) = (-) let z = x -- x - + let ( *** ) = (*) -let a = +let a = x *** x - + let (|>>>>>>>) = (|>) -let veryLongIdentifier = (* *)[1;2;3] - |> fun a -> a +let veryLongIdentifier = (* *)[1;2;3] + |> fun a -> a |>>>>>>> fun b -> b diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs index 13de73dcb28..7cff4f5dd79 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs @@ -35,7 +35,7 @@ module OffsideExceptions = [] let RelaxWhitespace2 compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withLangVersion80 |> withOptions ["--nowarn:25"; "--nowarn:3886"] // Incomplete pattern matches on this expression. @@ -46,7 +46,7 @@ module OffsideExceptions = [] let RelaxWhitespace2_Warning25 compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> withLangVersion80 |> withOptions ["--nowarn:3886"] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/RelaxWhitespace2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/RelaxWhitespace2.fs index 4b90ca2988a..2252763bd2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/RelaxWhitespace2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/RelaxWhitespace2.fs @@ -1,4 +1,4 @@ -// #Conformance #LexFilter #Exceptions +// #Conformance #LexFilter #Exceptions [] @@ -105,7 +105,7 @@ module BeginEnd = if true then x begin y = 1 end else x begin y = 2, z = 3 end - let e1 = + let e1 = if true then x begin y = 1, z = 3 end else x begin y = 2, @@ -2460,7 +2460,7 @@ let BeginEnd = if true then x begin y = 1 end else x begin y = 2, z = 3 end - let e1 = + let e1 = if true then x begin y = 1, z = 3 end else x begin y = 2, @@ -3467,13 +3467,13 @@ open System.IO type message = | HeatUp | CoolDown - + let climateControl1 = MailboxProcessor.Start( fun inbox -> // NOTE compiles let rec heating() = async { printfn "Heating" let! msg = inbox.Receive() - match msg with + match msg with | CoolDown -> return! cooling() | _ -> return! heating() } // NOTE placement of } @@ -3484,7 +3484,7 @@ let climateControl1 = MailboxProcessor.Start( fun inbox -> | HeatUp -> return! heating() | _ -> return! cooling() } // NOTE placement of } - + heating() ) @@ -3516,12 +3516,12 @@ let climateControl3 = MailboxProcessor.Start(fun inbox -> | HeatUp -> return! heating() | _ -> return! cooling() } // NOTE placement of } - + heating() ) // https://github.com/dotnet/fsharp/issues/10852 -let f _ b = b +let f _ b = b let g _ b = b let aaaaa<'t> = f >> g @@ -3551,25 +3551,25 @@ if System.Text.RegularExpressions.Regex.IsMatch( """^[a-zA-Z][a-zA-Z0-9']+$""" ) then () - + // https://github.com/fsharp/fslang-suggestions/issues/504 module Q = module Z = - type Alpha< ^b, ^a + type Alpha< ^b, ^a when ^ a : (member Name:string) and ^a: (member Zip : ^b when ^b : struct ) and ^a : (static member(+) - : 'a * 'a --> 'a -) - > () = + : 'a * 'a +-> 'a +) + > () = member inline __.X = () with static member inline Y = () - + type TypeWithALongName< ^a when ^a:(static member(+):'a * 'a -> 'a ) and ^a:(static member(-):'a * 'a -> 'a ) @@ -3577,17 +3577,17 @@ type TypeWithALongName< ^a and ^a:(static member(/):'a * 'a -> 'a ) > = static member inline X = 2 -type TypeWithALongName2< ^a +type TypeWithALongName2< ^a when ^a:(static member(+):'a * 'a -> 'a ) - and ^a:(static member(-):'a * 'a -> 'a ) - and ^a:(static member(*):'a * 'a -> 'a ) - and ^a:(static member(/):'a * 'a -> 'a ) + and ^a:(static member(-):'a * 'a -> 'a ) + and ^a:(static member(*):'a * 'a -> 'a ) + and ^a:(static member(/):'a * 'a -> 'a ) > = static member inline X = () -type TypeWithALongName3< 'a +type TypeWithALongName3< 'a when 'a: not struct - and ^a:(static member(-):'a * 'a -> 'a ) - and 'a:> System.IDisposable - and ^a:> System.Object + and ^a:(static member(-):'a * 'a -> 'a ) + and 'a:> System.IDisposable + and ^a:> System.Object > = static member inline X = () // https://github.com/fsharp/fslang-suggestions/issues/470 @@ -3629,13 +3629,13 @@ let ( ) = ignore (* -Currently, the general rules for indentation in F# is that the code on -the next line should be indented further than the thing that determines +Currently, the general rules for indentation in F# is that the code on +the next line should be indented further than the thing that determines its starting point on the previous line. -There are a number of cases where this quite annoyingly means that you -have to indent things very far (or, to avoid that, add lots of -unnecessary line breaks). One example is when you have nesting in a +There are a number of cases where this quite annoyingly means that you +have to indent things very far (or, to avoid that, add lots of +unnecessary line breaks). One example is when you have nesting in a method call. For example: *) Chart.Geo(growth) @@ -3645,7 +3645,7 @@ Now, there is almost no way to make this code snippet look decent. I would want to write something like this: *) Chart.Geo(growth) -|> Chart.WithOptions(Options(colorAxis=ColorAxis(values=[| -100;0;100;200;1000 |], +|> Chart.WithOptions(Options(colorAxis=ColorAxis(values=[| -100;0;100;200;1000 |], colors=[| "#77D53D";"#D1C855";"#E8A958";"#EA4C41";"#930700" |]))) (* But this is not allowed, because "colors" should start after the opening @@ -3658,33 +3658,33 @@ Chart.Geo(growth) (Options (colorAxis = ColorAxis - (values=[| -100;0;100;200;1000 |], + (values=[| -100;0;100;200;1000 |], colors=[| "#77D53D";"#D1C855";"#E8A958";"#EA4C41";"#930700" |]))) (* -Another example is very similar, but with list expressions. +Another example is very similar, but with list expressions. I want to write: *) -// let pop2010 = series [ for c in wb.Countries -> +// let pop2010 = series [ for c in wb.Countries -> // c.Name => c.Indicators.``CO2 emissions (kt)``.[2010]] // NOTE: That is probably is too much of an undentation. Try this instead: let pop2010 = series [ - for c in wb.Countries -> + for c in wb.Countries -> c.Name => c.Indicators.``CO2 emissions (kt)``.[2010]] (* This actually works, but it gives warning. Again, it wants me to indent the second line so that it is after "for", but then I'm not saving pretty much -anything by the newline. Or, I can introduce lots of additional newlines +anything by the newline. Or, I can introduce lots of additional newlines and write: *) let pop2011 = series - [ for c in wb.Countries -> + [ for c in wb.Countries -> c.Name => c.Indicators.``CO2 emissions (kt)``.[2010]] (* -I think that in situations like these, the rules should be relaxed. -In particular, we should not require new line to be intended further -than the "starting thing" on the previous line. Just further than the +I think that in situations like these, the rules should be relaxed. +In particular, we should not require new line to be intended further +than the "starting thing" on the previous line. Just further than the previous line. *) @@ -3835,7 +3835,7 @@ module M2 = return! messageLoop(state) } let RFC = - + let a = id [ 1 // No longer produces warning FS0058 after [RFC FS-1054] less strict indentation on common DSL pattern ] @@ -3849,7 +3849,7 @@ let RFC = 1 with _ -> 2 // Totally fine |> ignore - + match 1 with _ -> 2 // error FS0010: Unexpected start of structured construct in expression @@ -3870,7 +3870,7 @@ let RFC = if [3] = [ 2 // warning FS0058: Possible incorrect indentation ] then () - + let f = { a = 1 // Ok } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember01.fs index 90501ebbac4..4c16c13976b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember01.fs @@ -1,15 +1,15 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for TFS bug Dev10:834160 // [] -type B() = +type B() = abstract M : int -> float abstract M : string -> unit and [] - C() = + C() = inherit B() - static let v = { new C() with + static let v = { new C() with member x.M(a:int) : float = base.M(3) } default x.M(a:int) : float = 1.0 default x.M(a:string) : unit = (a:string) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember02.fs index 737e6acd00d..dbad4dd60a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember02.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot // [] -type B() = +type B() = abstract M : int -> float default x.M(a:int) : float = 1.0 and [] - C() = + C() = inherit B() - static let v = { new C() with + static let v = { new C() with member x.M(a:int) : float = base.M(3) } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember03.fs index c0f291c641c..4774a3cbde8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/CallToVirtualMember03.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot // [] -type B() = +type B() = abstract M : int -> float abstract M : string -> float default x.M(a:int) : float = 1.0 default x.M(a:string) : float = 1.0 and [] - C() = + C() = inherit B() - static let v = { new C() with - member x.M(a:int) : float = base.M(3) + static let v = { new C() with + member x.M(a:int) : float = base.M(3) member x.M(a:string) : float = base.M("3") } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/DerivedClassSameAssembly.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/DerivedClassSameAssembly.fs index 3f317694ad2..5e46aee6fa0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/DerivedClassSameAssembly.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/DerivedClassSameAssembly.fs @@ -1,21 +1,21 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for TFS#834683 -// Virtual interface implementation (same assembly) +// Virtual interface implementation (same assembly) // // Interface with a member type I = abstract M : unit -> unit -// Class that implements the interface I _and_ also has a -type C = +// Class that implements the interface I _and_ also has a +type C = new() = {} abstract member M : unit -> unit default this.M() = System.Console.WriteLine("I am my method") interface I with - member this.M() = + member this.M() = System.Console.WriteLine("I am going via the interface") this.M() -type D = +type D = inherit C new() = {} override this.M() = System.Console.WriteLine("I am MyMethod in MyDerivedClass") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember01.fs index 61c6aa0b1e3..593ffa7421e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember01.fs @@ -1,15 +1,15 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot //Cannot call an abstract base member: 'M'$ - + [] -type B() = +type B() = abstract M : int -> float abstract M : string -> unit and [] - C() = + C() = inherit B() - static let v = { new C() with + static let v = { new C() with member x.M(a:int) : float = base.M(3) } default x.M(a:string) : unit = (a:string) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember02.fs index 901344e7715..5e5b03d7f39 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember02.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot //No implementation was given for 'abstract B\.M: string -> unit'$ [] -type B() = +type B() = abstract M : int -> float abstract M : string -> unit and [] - C() = + C() = inherit B() - static let v = { new C() with + static let v = { new C() with member x.M(a:int) : float = 1.0 } default x.M(a:int) : float = 1.0 //default x.M(a:string) : unit = (a:string) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs index 18fc7c46d55..f933e4d5439 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot //No implementation was given for 'abstract B\.M: int -> float'$ //Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type\.$ [] -type B() = +type B() = abstract M : int -> float abstract M : string -> unit -and - C() = +and + C() = inherit B() - static let v = { new C() with + static let v = { new C() with member x.M(a:int) : float = 1.0 } //default x.M(a:int) : float = 1.0 default x.M(a:string) : unit = (a:string) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember04.fs index 0eba007fabd..abba599ad3c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember04.fs @@ -1,15 +1,15 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot //Cannot call an abstract base member: 'M'$ //Cannot call an abstract base member: 'M'$ [] -type B() = +type B() = abstract M : int -> float abstract M : string -> unit and [] - C() = + C() = inherit B() - static let v = { new C() with - member x.M(a:int) : float = base.M(3) + static let v = { new C() with + member x.M(a:int) : float = base.M(3) member x.M(a:string) : unit = base.M("3") } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToUnimplementedMethod01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToUnimplementedMethod01.fs index 2290e7c2f24..1dae79d20cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToUnimplementedMethod01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToUnimplementedMethod01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Regression test for FSHARP1.0:5815 //Cannot call an abstract base member: 'f'$ // - + [] type C1 () = abstract f : unit -> C1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_InlineVirtualMember01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_InlineVirtualMember01.fs index 1f30b38a054..6ce760627b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_InlineVirtualMember01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_InlineVirtualMember01.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Dev11:175889, used to not be an error to define a class like this //This member, function or value declaration may not be declared 'inline' //This member, function or value declaration may not be declared 'inline' [] -type Bad10 = +type Bad10 = abstract inline X : int [] -type Bad11 = +type Bad11 = abstract inline X : int -> int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_InlineVirtualMember02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_InlineVirtualMember02.fs index cf0c1f37db8..b007cb54fd1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_InlineVirtualMember02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_InlineVirtualMember02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #MethodsAndProperties #MemberDefinitions // Dev11:175889, used to not be an error to define a class like this //This member, function or value declaration may not be declared 'inline' //This member, function or value declaration may not be declared 'inline' @@ -9,7 +9,7 @@ type Ellipse(a0 : float, b0 : float, theta0 : float) = let mutable rotAngle = theta0 abstract member Rotate: float -> unit default inline this.Rotate(delta : float) = rotAngle <- rotAngle + delta - + type Circle(radius : float) = inherit Ellipse(radius, radius, 0.0) // Circles are invariant to rotation, so do nothing. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AsDeclarations/SanityCheck01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AsDeclarations/SanityCheck01.fs index ebd74c095aa..fddccae4fe5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AsDeclarations/SanityCheck01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AsDeclarations/SanityCheck01.fs @@ -1,7 +1,7 @@ -// #Conformance #ObjectOrientedTypes #Classes +// #Conformance #ObjectOrientedTypes #Classes -// Verify the use of 'as' in classes with implicit constructors to +// Verify the use of 'as' in classes with implicit constructors to // access the 'this' pointer type Point(x : float, y : float) as otherThisPtr = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AsDeclarations/SanityCheck02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AsDeclarations/SanityCheck02.fs index a356d7b1148..f4fb5be68ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AsDeclarations/SanityCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AsDeclarations/SanityCheck02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/AliasedType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/AliasedType01.fs index 5eda56eb4e1..d01ab22a313 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/AliasedType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/AliasedType01.fs @@ -1,6 +1,6 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties type AA = System.Nullable -type T() = +type T() = member val P = AA(1) with get,set let t = T() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Array01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Array01.fs index 2cbe2b42943..94dabd94fa5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Array01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Array01.fs @@ -1,5 +1,5 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties -type T() = +type T() = member val P = [||] with get,set let t = T() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Attributes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Attributes01.fs index 6ffe387d540..405b29adfad 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Attributes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Attributes01.fs @@ -3,7 +3,7 @@ type MyA() = inherit System.Attribute() type A(x) = - [] + [] member val Property = x with get, set [] member val Property2 = x with get, set diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_BadType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_BadType01.fs index e43ffcc3719..5793e421018 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_BadType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_BadType01.fs @@ -1,6 +1,6 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties // The value or constructor 'a' is not defined -type T() = +type T() = member val P = a with get,set exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_IllegalName01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_IllegalName01.fs index dc2ebe4e4f8..203f9d0252f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_IllegalName01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_IllegalName01.fs @@ -1,6 +1,6 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties // This is not a valid numeric literal. Valid numeric literals include -type T() = +type T() = member val 1P = [] with get,set exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_InternalProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_InternalProperty01.fs index fccef72000c..54c5ad17acf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_InternalProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_InternalProperty01.fs @@ -11,7 +11,7 @@ let x = T() x.InternalProperty <- 1 if x.InternalProperty <> 1 then exit 1 - + T.StaticInternalProperty <- 1 if T.StaticInternalProperty <> 1 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_PrivateProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_PrivateProperty01.fs index acb21f79b71..c07f21d87b8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_PrivateProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_PrivateProperty01.fs @@ -3,6 +3,6 @@ type private X() = class end type XX() = - member val public PublicProperty = X() with get,set + member val public PublicProperty = X() with get,set exit 1 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_PrivateProperty02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_PrivateProperty02.fs index 2b10e185f33..880c6272751 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_PrivateProperty02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/E_PrivateProperty02.fs @@ -12,5 +12,5 @@ type T() = let x = T() x.PrivateProperty <- 1 - + exit 1 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ExtensionProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ExtensionProperty01.fs index c4e9b633e4a..0bffbfb936d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ExtensionProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ExtensionProperty01.fs @@ -1,7 +1,7 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #TypeExtensions module M = - type T() = + type T() = let mutable x = 0 member this.NormalProperty with get() = x and set(v) = x <- v member this.DoStuff() = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/List01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/List01.fs index beddef9c01d..7ac22cda5b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/List01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/List01.fs @@ -1,5 +1,5 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties -type T() = +type T() = member val P = [] with get,set let t = T() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/PublicProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/PublicProperty01.fs index 52871d761b3..5f8a6da0b70 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/PublicProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/PublicProperty01.fs @@ -17,7 +17,7 @@ module M2 = x.InternalProperty <- 1 if x.InternalProperty <> 1 then exit 1 - + T.StaticPublicProperty <- 1 if T.StaticPublicProperty <> 1 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ReferenceType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ReferenceType01.fs index 7e73a8e3a7e..69092a6960a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ReferenceType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ReferenceType01.fs @@ -1,5 +1,5 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties -type T() = +type T() = member val P = "" with get,set let t = T() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Then01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Then01.fs index 632dea9ddbc..30502e50fa1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Then01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Then01.fs @@ -4,9 +4,9 @@ type T(x,y) = let mutable field = 0 member val Property = field with get,set member val OtherProperty = "" with get,set - new(x) as this = + new(x) as this = T(x,0) - then + then this.Property <- 5 this.OtherProperty <- "hi" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Tuple01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Tuple01.fs index 76c40525505..4e8ee77ffbb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Tuple01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/Tuple01.fs @@ -1,5 +1,5 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties -type T() = +type T() = member val P = (0,0) with get,set let t = T() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/UnitsOfMeasure01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/UnitsOfMeasure01.fs index 5c37b9386e8..74d560bc407 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/UnitsOfMeasure01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/UnitsOfMeasure01.fs @@ -1,7 +1,7 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #UnitsOfMeasure [] type MyM -type T() = +type T() = member val P = 0 with get,set let t = T() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ValueType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ValueType01.fs index 428367595e1..5426de335c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ValueType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/AutoProperties/ValueType01.fs @@ -1,12 +1,12 @@ // #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties -type T() = +type T() = member val P = 0 with get,set let t = T() t.P <- 3 if t.P <> 3 then exit 1 -type T2() = +type T2() = member val P = 0.0M with get,set let t2 = T2() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/ImplicitObjectConstructors/E_AddExplicitWithImplicit.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/ImplicitObjectConstructors/E_AddExplicitWithImplicit.fs index d06880ae242..808bc3d07af 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/ImplicitObjectConstructors/E_AddExplicitWithImplicit.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/ImplicitObjectConstructors/E_AddExplicitWithImplicit.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors +// #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors // Verify compiler error when adding an explicit constructor to a type which // already has an implicit constructor. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/BaseValue01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/BaseValue01.fs index 482c29362de..bdbd6ae6e87 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/BaseValue01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/BaseValue01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Classes #Inheritance +// #Conformance #ObjectOrientedTypes #Classes #Inheritance // Verify that the 'base' keyword refers to base type @@ -7,19 +7,19 @@ type Foo () = abstract DoStuff : unit -> string default this.DoStuff () = "Foo" override this.ToString() = "Foo" - + type Bar () = inherit Foo() - + member this.BaseDoStuff = base.DoStuff() member this.BaseToStringR = base.ToString() member this.ThisDoStuff = this.DoStuff() member this.ThisToStringR = this.ToString() - + override this.DoStuff () = "Bar" override this.ToString() = "Bar" - - + + let testFoo = new Foo() let testBar = new Bar() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_DefaultNoAbstractInBaseClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_DefaultNoAbstractInBaseClass.fs index 965131aa596..8ee8e705f0a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_DefaultNoAbstractInBaseClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_DefaultNoAbstractInBaseClass.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #Inheritance +// #Regression #Conformance #ObjectOrientedTypes #Classes #Inheritance // Regression test for FSHARP1.0:5421 // Assert/ICE when compiling code with override/default // Note: There are a few more errors in the code, but the point here is just to validate that we do not ICE @@ -9,30 +9,30 @@ module N.M type public FrameworkElement() = default (* member is ok *) this.VisualChildrenCount // default is the key to the repro! with get () = 1 - member this.GetVisualChild(index : int) = + member this.GetVisualChild(index : int) = 0 member this.LogicalChildren = 0 type DecoratorTest() as this = inherit FrameworkElement() let mutable content = 0 - member x.Content + member x.Content with get () = content - override x.VisualChildrenCount + override x.VisualChildrenCount with get () = 1 - override x.GetVisualChild(index) = + override x.GetVisualChild(index) = this.Content :> Visual override this.LogicalChildren with get () = let count = this.VisualChildrenCount let firstchild = this.GetVisualChild(0) - // Error: Method or object constructor 'GetVisualChild' not found. + // Error: Method or object constructor 'GetVisualChild' not found. let child i = this.GetVisualChild(i) - // Error: Unexpected error: empty property list - let elements = seq { for i in 0 .. this.VisualChildrenCount do yield FrameworkElement() } + // Error: Unexpected error: empty property list + let elements = seq { for i in 0 .. this.VisualChildrenCount do yield FrameworkElement() } // Error: Method or object constructor 'GetVisualChild' not found. - let children = seq { for i in 0 .. count do yield this.GetVisualChild(i) } + let children = seq { for i in 0 .. count do yield this.GetVisualChild(i) } children.GetEnumerator() :> IEnumerator diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_InheritFromGenericType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_InheritFromGenericType01.fs index 074799da8c3..ef9b1b74a45 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_InheritFromGenericType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_InheritFromGenericType01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #Inheritance +// #Regression #Conformance #ObjectOrientedTypes #Classes #Inheritance // Regression test for FSHARP1.0:3782 // Make sure we do not ICE when trying to // inherit from a type variable. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_InheritInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_InheritInterface01.fs index a7917a8798c..8b55787c5c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_InheritInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_InheritInterface01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #Inheritance +// #Regression #Conformance #ObjectOrientedTypes #Classes #Inheritance // Verify error when trying to inherit from interface type. @@ -10,7 +10,7 @@ type I = abstract VirtMethod : unit -> int - + type A() = inherit I with override this.VirtMethod () = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_MemberNoAbstractInBaseClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_MemberNoAbstractInBaseClass.fs index 657c71bb75e..b9b749445fd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_MemberNoAbstractInBaseClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/InheritsDeclarations/E_MemberNoAbstractInBaseClass.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #Inheritance +// #Regression #Conformance #ObjectOrientedTypes #Classes #Inheritance // Regression test for FSHARP1.0:5421 // Assert/ICE when compiling code with override/default // Note: There are a few more errors in the code, but the point here is just to validate that we do not ICE @@ -9,30 +9,30 @@ module N.M type public FrameworkElement() = member this.VisualChildrenCount with get () = 1 - member this.GetVisualChild(index : int) = + member this.GetVisualChild(index : int) = 0 member this.LogicalChildren = 0 type DecoratorTest() as this = inherit FrameworkElement() let mutable content = 0 - member x.Content + member x.Content with get () = content - override x.VisualChildrenCount + override x.VisualChildrenCount with get () = 1 - override x.GetVisualChild(index) = + override x.GetVisualChild(index) = this.Content :> Visual override this.LogicalChildren with get () = let count = this.VisualChildrenCount let firstchild = this.GetVisualChild(0) - // Error: Method or object constructor 'GetVisualChild' not found. + // Error: Method or object constructor 'GetVisualChild' not found. let child i = this.GetVisualChild(i) - // Error: Unexpected error: empty property list - let elements = seq { for i in 0 .. this.VisualChildrenCount do yield FrameworkElement() } + // Error: Unexpected error: empty property list + let elements = seq { for i in 0 .. this.VisualChildrenCount do yield FrameworkElement() } // Error: Method or object constructor 'GetVisualChild' not found. - let children = seq { for i in 0 .. count do yield this.GetVisualChild(i) } + let children = seq { for i in 0 .. count do yield this.GetVisualChild(i) } children.GetEnumerator() :> IEnumerator diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/CtorAndCCtor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/CtorAndCCtor01.fs index 133525b0b00..8ceb9e56e58 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/CtorAndCCtor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/CtorAndCCtor01.fs @@ -5,7 +5,7 @@ namespace N -type T1(``.ctor`` : char) = +type T1(``.ctor`` : char) = let ``.ctor`` = 10 static member ``.ctor ``(``.ctor`` : int) = ``.ctor`` + 1 member __.``.ctoR``(?``.ctor``) = T1.``.ctor ``(10) + ``.ctor``.Value diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/CtorAndCCtor02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/CtorAndCCtor02.fs index 92f2123ed62..720e7c72b0c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/CtorAndCCtor02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/CtorAndCCtor02.fs @@ -5,7 +5,7 @@ namespace N -type T2(``.cctor`` : char) = +type T2(``.cctor`` : char) = let ``.cctor`` = 10 static member ``.cctor ``(``.cctor`` : int) = ``.cctor`` + 1 member __.``.cctoR``(?``.cctor``) = T2.``.cctor ``(10) + ``.cctor``.Value diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_ClashingInstanceStaticProperties.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_ClashingInstanceStaticProperties.fs index 9c9455c5887..0e9f2e27ebc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_ClashingInstanceStaticProperties.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_ClashingInstanceStaticProperties.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Regression test for FSHARP1.0:5475 //Duplicate property\. The property 'M' has the same name and signature as another property in type 'C'\.$ type C = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_CtorAndCCtor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_CtorAndCCtor01.fs index ccc8fc0d08a..0237497d6d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_CtorAndCCtor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_CtorAndCCtor01.fs @@ -8,10 +8,10 @@ namespace N -type T1() = +type T1() = static member ``.ctor``() = () member __.``.ctor``() = () -type T2() = +type T2() = static member ``.cctor``() = () member __.``.cctor``() = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_GeneratedPropertyNameClash01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_GeneratedPropertyNameClash01.fs index 9fcba483dbd..961b4c1acda 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_GeneratedPropertyNameClash01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_GeneratedPropertyNameClash01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Regression for 858162, confirming we get a good error message here //The member 'Item1' cannot be defined because the name 'Item1' clashes with the generated property 'Item1' in this type or module diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_ImplementMemberNoExist.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_ImplementMemberNoExist.fs index ab58778e916..8c4df5abe04 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_ImplementMemberNoExist.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_ImplementMemberNoExist.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Regression test for FSharp1.0:3752 - internal error: dest_top_tau_type internal error, #curriedArgInfos.Length = 2, #argtys.Length = 1 (Failure) //This construct is deprecated: This form of object expression is not used in F#\. Use 'member this\.MemberName \.\.\. = \.\.\.' to define member implementations in object expressions\.$ //The member 'M' does not correspond to any abstract or virtual method available to override or implement @@ -7,7 +7,7 @@ module M type T () = class end - + let a = { new T () with M = 0 } exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetter01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetter01.fs index 89c8bf6f0ef..d34f2194c73 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetter01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetter01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Verify that omitting "()" for the getter simply yields an error (instead of internal error) // (Note: in 1.9.6.16, the compiler was throwing an ICE). This is regression test for FSHARP1.0:4537 // Regression test for FSHARP1.0:5375 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetter02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetter02.fs index 54eb857814a..aaf669050a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetter02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetter02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Verify compiler disallows duplicate getters (and setters) on the same property // Regression test for FSHARP1.0:4882 //'get' and/or 'set' required @@ -6,11 +6,11 @@ -type A() = - member this.Item with get (x: int, y: int) = 6 +type A() = + member this.Item with get (x: int, y: int) = 6 and get (x: int) = 6 -type B() = +type B() = member this.Item with set (x: int, y: int) = () and set (x: int) = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetterSetter01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetterSetter01.fs index 8679d30a42c..a000413ff81 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetterSetter01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertyInvalidGetterSetter01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Regression test for 342901 //A property's getter and setter must have the same type\. Property 'X' has getter of type 'obj option' but setter of type 'obj'\. type Foo(x) = let mutable x = x - member this.X + member this.X with get() = x and set(value) = x <- Some value diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertySameNameDiffArity.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertySameNameDiffArity.fs index 94fe834a998..8f5e0b2381e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertySameNameDiffArity.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertySameNameDiffArity.fs @@ -1,15 +1,15 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Verify that one should not be able to have two properties called �X� with different arities (number of arguments). // This is regression test for FSHARP1.0:4529 //The property 'X' has the same name as another property in type 'TestType1' -type TestType1( x : int ) = +type TestType1( x : int ) = let mutable x = x - + member this.X with get () = x and set x' = x <- x' member this.X with set x' x'' = x <- x' + x'' - + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertySetterUnit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertySetterUnit01.fs index bdc20b5b1f4..ddcc44c9fcf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertySetterUnit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_PropertySetterUnit01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Verify that it is ok to omitting the argument for the setter (no error) // (Note: in 1.9.6.2, the compiler was throwing an ICE). This is regression test for FSHARP1.0:3751 // See also bug #5456 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/InlineProperties01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/InlineProperties01.fs index 4dc15195236..f3ad209e2bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/InlineProperties01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/InlineProperties01.fs @@ -1,20 +1,20 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Regression test for FSHARP1.0:5173 // Title: individual get/set properties cannot be marked as "inline" // Descr: verify that with auto-#light-on, property getters/setters can be marked as inline -type A() = +type A() = member this.x = 1 member this.X with inline get () = this.x + 1 and inline set y = this.x + y |> ignore - + member this.X2 with inline get (i : int) = this.x + i - + member this.X3 with inline set (i : int) (y : string) = i + this.x |> ignore - + let a = new A() (a.X, a.X2(2), a.X3(5) <- "hi") |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/NoClashMemberIFaceMember.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/NoClashMemberIFaceMember.fs index 419758478c4..fd09728d1aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/NoClashMemberIFaceMember.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/NoClashMemberIFaceMember.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions +// #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions // Regression test for FSHARP1.0:4666 // Classes should be allowed to implement interfaces with methods same name as field -type IFoo = +type IFoo = abstract Bar: int8 // <- Bar is method in interface - + type Foo (value: int8) = // For a class - member this.Bar = value + member this.Bar = value interface IFoo with member this.Bar = this.Bar + 10y // <- no problem here! diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/QuestionOperatorAsMember01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/QuestionOperatorAsMember01.fs index 9ae42beeed9..89bfbb59f72 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/QuestionOperatorAsMember01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/QuestionOperatorAsMember01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #ObjectOrientedTypes #Classes #MethodsAndProperties #MemberDefinitions #Operators //Dev11:277085, used to give a warning here -type X() = +type X() = static member (?<-) (this, name, value) = printfn "%x: %s <- %d" (hash this) name value \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassAttribute01.fs index 878ab56f6ab..a2c5b065f71 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassAttribute01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassAttribute01.fs @@ -1,10 +1,10 @@ -// #Conformance #ObjectOrientedTypes #Classes +// #Conformance #ObjectOrientedTypes #Classes // Verify that the AbstractClass attribute works as expected. [] -type AbstractFoo() = +type AbstractFoo() = abstract Square : int -> int member this.Cube x = x * x * x @@ -15,7 +15,7 @@ type Foo() = override this.Square x = x * x -let t = new Foo() +let t = new Foo() if t.Square 4 <> 16 then exit 1 if t.Cube 3 <> 27 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassAttribute02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassAttribute02.fs index de4d33fdb8b..0572d2551a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassAttribute02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassAttribute02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Verify error associated with putting the AbstractClass attribute o diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassMultipleConstructors01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassMultipleConstructors01.fs index 8e15e790eab..fb0e507d7e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassMultipleConstructors01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/AbstractClassMultipleConstructors01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Regression for FSHARP:6039 // Abstract classes cannot have multiple constructors @@ -14,7 +14,7 @@ type MyType(x:int, s:string) = type A(x:int, s:string) = inherit MyType(x,s) with override this.Foo x = x + 1 - + let t = A(1, "a") let r = if t.X = 1 && t.S = "a" then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/Decondensation.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/Decondensation.fs index bf7683b34cb..38344db02f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/Decondensation.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/Decondensation.fs @@ -1,50 +1,50 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Regression test for FSB 3661, 'Properties, obj and de-condensation have awkward intersection' type Foo() = let mutable data : obj = null - + member this.Data1 = data - - member this.Data2 + + member this.Data2 with get () = data and set s = data <- s // ---------------------------- - -type Bar(f : obj -> string) = + +type Bar(f : obj -> string) = member this.F = f - + // ---------------------------- -type INodeMeta = obj -type IScenarioMeta = obj -type NodeIndex = int -type NodeValue = obj -type NodeType = - | DataNode - | FunctionNode - | ScenarioNode - -type ScenarioPerturbFunc = IScenarioMeta -> NodeIndex -> INodeMeta -> NodeValue -> (IScenarioMeta * NodeValue option) - -type Scenario ( scmeta: IScenarioMeta, name: string, sfunc: ScenarioPerturbFunc ) = - class - let mutable scmeta = scmeta - - member this.Name = name - member this.PerturbF = sfunc - member this.ScMeta - with get () = scmeta - and set s = scmeta <- s - - member this.xxPerturbF:ScenarioPerturbFunc = sfunc - member this.xxScMeta - with get ():IScenarioMeta = scmeta - and set (s:IScenarioMeta) = scmeta <- s - end - -// -------------------------------- +type INodeMeta = obj +type IScenarioMeta = obj +type NodeIndex = int +type NodeValue = obj +type NodeType = + | DataNode + | FunctionNode + | ScenarioNode + +type ScenarioPerturbFunc = IScenarioMeta -> NodeIndex -> INodeMeta -> NodeValue -> (IScenarioMeta * NodeValue option) + +type Scenario ( scmeta: IScenarioMeta, name: string, sfunc: ScenarioPerturbFunc ) = + class + let mutable scmeta = scmeta + + member this.Name = name + member this.PerturbF = sfunc + member this.ScMeta + with get () = scmeta + and set s = scmeta <- s + + member this.xxPerturbF:ScenarioPerturbFunc = sfunc + member this.xxScMeta + with get ():IScenarioMeta = scmeta + and set (s:IScenarioMeta) = scmeta <- s + end + +// -------------------------------- // Bug was about none of these code snippets compiling // (Converting obj to 'a, and then getting a value restriction) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs index d4d614ca1c9..b53e6b8fe5f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // FSB 1272, New-ing a sub class with unimplemented abstract members should not be allowed. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass02.fs index faff34cdc6e..02220bf4377 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // FSB 1272, New-ing a sub class with unimplemented abstract members should not be allowed. //Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations\. Consider using an object expression '{ new \.\.\. with \.\.\. }' instead diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass03.fs index 06864b3b3be..5fd92ea6e87 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass03.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // FSB 1467, What to do about marking types as abstract? //Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations\. Consider using an object expression '{ new \.\.\. with \.\.\. }' instead [] type Foo() = override this.ToString() = "stuff" - + // Should fail, since Foo is abstract let test = new Foo() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClassAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClassAttribute01.fs index 2262ddf86cc..a726811f138 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClassAttribute01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClassAttribute01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Regression test for FSharp1.0:2272 - new 'a() should not be allowed on types with AbstractClassAttribute //A generic construct requires that the type 'A' be non-abstract @@ -7,7 +7,7 @@ type A() = class end - + let f<'a when 'a : (new : unit -> 'a)>() = new 'a() let x = f() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_CyclicInheritance.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_CyclicInheritance.fs index f7c1ac01078..24aaf0ee3ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_CyclicInheritance.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_CyclicInheritance.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // FSB 1233, Cyclic inheritance bug //This type definition involves an immediate cyclic reference through a struct field or inheritance relation$ //Constructors cannot be defined for this type$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_ExplicitConstructor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_ExplicitConstructor.fs index 79b41e43de2..cdcfce016fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_ExplicitConstructor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_ExplicitConstructor.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Bug 3540 - this used to crash the compiler //The inherited type is not an object model type //This expression was expected to have type. 'A' .but here has type. 'int' //This is not a valid object construction expression\. Explicit object constructors must either call an alternate constructor or initialize all fields of the object and specify a call to a super class constructor\.$ type A = - inherit System.Exception + inherit System.Exception new (x : string) as y = { inherit System.Exception(x) }; 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_NoNestedTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_NoNestedTypes.fs index 5637ec7c05e..f678e0fc239 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_NoNestedTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_NoNestedTypes.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Verify error when attempting to declare a nested type //A type definition requires one or more members or other declarations\. If you intend to define an empty class, struct or interface, then use 'type \.\.\. = class end', 'interface end' or 'struct end'\.$ //Unexpected keyword 'end' in implementation file$ -type Bar = +type Bar = type IFoo = interface end end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_RestrictedSuperTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_RestrictedSuperTypes.fs index 98e8be57e11..33d12465dde 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_RestrictedSuperTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_RestrictedSuperTypes.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Regression test for FSharp1.0:3636 - PEVerify error when deriving from ValueType, Enum, Delegate, MulticastDelegate, and Array //The types System\.ValueType, System\.Enum, System\.Delegate, System\.MulticastDelegate and System\.Array cannot be used as super types in an object expression or class //The types System\.ValueType, System\.Enum, System\.Delegate, System\.MulticastDelegate and System\.Array cannot be used as super types in an object expression or class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_SealedClass01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_SealedClass01.fs index 19001d5f6b8..18902b68d5e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_SealedClass01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_SealedClass01.fs @@ -1,21 +1,21 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // FSB 1502, Implement a "sealed" attribute //Cannot inherit a sealed type -type BaseClass() = +type BaseClass() = override this.ToString() = "Base Class" - + [] type SealedClass() = inherit BaseClass() override this.ToString() = "Sealed Class" - + type DerivedClass() = inherit SealedClass() override this.ToString() = "Derived Class" - + // Should have compile errors exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_ZeroArity.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_ZeroArity.fs index 20cabc95897..2f954fb1832 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_ZeroArity.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_ZeroArity.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Verify error when providing an arity-zero type instantiation (requires a space) // FSB 4076 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/GenericClass01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/GenericClass01.fs index dd532ea1f9d..60425d7323a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/GenericClass01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/GenericClass01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // FS1 1326: Generic unit types do not work with the implicit class syntax diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/ValueRestrictionCtor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/ValueRestrictionCtor.fs index 222f7c66ed0..1afc7e14108 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/ValueRestrictionCtor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/ValueRestrictionCtor.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Verify you don't run into value restriction for values in class // constructors (both implicit and explicit constructor syntax) // FSB 4584 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/W_SealedClass02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/W_SealedClass02.fs index 02d2fa27c62..f0e5d09911d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/W_SealedClass02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/W_SealedClass02.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Test warnings associated with static upcasts to sealed types //This construct causes code to be less generic than indicated by its type annotations. -type BaseClass() = +type BaseClass() = override this.ToString() = "Base Class" - + [] type SealedClass() = inherit BaseClass() override this.ToString() = "Sealed Class" -let f (x : 'a when 'a :> SealedClass) = () - +let f (x : 'a when 'a :> SealedClass) = () + // Should have compile warnings exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/W_SealedClass03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/W_SealedClass03.fs index 9700a3ac7f1..ed294f4aa81 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/W_SealedClass03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/W_SealedClass03.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes +// #Regression #Conformance #ObjectOrientedTypes #Classes // Test warnings associated with static upcasts to sealed types //This construct causes code to be less generic than indicated by its type annotations\. The type variable implied by the use of a '#', '_' or other type annotation at or near -type BaseClass() = +type BaseClass() = override this.ToString() = "Base Class" - + [] type SealedClass() = inherit BaseClass() override this.ToString() = "Sealed Class" -let f (x : #SealedClass) = () - +let f (x : #SealedClass) = () + // Should have compile warnings exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/Attributes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/Attributes01.fs index 0b024be7b97..472c5415ed0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/Attributes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/Attributes01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Classes #LetBindings +// #Conformance #ObjectOrientedTypes #Classes #LetBindings // Attributes // As of Beta2, static let bindings may have attributes // @@ -9,11 +9,11 @@ type A() = inherit System.Attribute() type C() = class [] // some attribute (does not really matter) static let can_have_attributes = [1;2] // OK! - + [] let can_have_attributes2 = 1 [] let mutable can_have_attributes3 = 1 - + end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_LexicalScoping01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_LexicalScoping01.fs index 8105efe3e09..5bbb9c1d0e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_LexicalScoping01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_LexicalScoping01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #LetBindings +// #Regression #Conformance #ObjectOrientedTypes #Classes #LetBindings // Scoping: // identifier introduced by let is local //The value, namespace, type or module 'm' is not defined diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_RecMutable01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_RecMutable01.fs index 547b14724c1..636de0fc4a4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_RecMutable01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_RecMutable01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #LetBindings +// #Regression #Conformance #ObjectOrientedTypes #Classes #LetBindings // rec (mutable) -// See FSHARP1.0:2329 +// See FSHARP1.0:2329 //Mutable 'let' bindings can't be recursive or defined in recursive modules or namespaces type C() = class static let rec mutable m = 0 // only record fields and simple 'let' bindings may be marked mutable. end - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/LexicalScoping01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/LexicalScoping01.fs index c1adf2e5b73..2db7d29d895 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/LexicalScoping01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/LexicalScoping01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Classes #LetBindings +// #Conformance #ObjectOrientedTypes #Classes #LetBindings // Scoping: // identifier introduced by let is local // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/Offside01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/Offside01.fs index 0513d922530..c658db8a2d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/Offside01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/Offside01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Classes #LetBindings +// #Regression #Conformance #ObjectOrientedTypes #Classes #LetBindings // Offside rule for static let // We should start counting from the 'static' not from 'let' // Regression test for FSHARP1.0:2042 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/RecNonMutable01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/RecNonMutable01.fs index 5e15c6ae52c..af016032792 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/RecNonMutable01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/RecNonMutable01.fs @@ -1,9 +1,9 @@ -// #Conformance #ObjectOrientedTypes #Classes #LetBindings +// #Conformance #ObjectOrientedTypes #Classes #LetBindings // rec (non-mutable) // type C() = class - static let rec f a = if a = 0 then 1 else a*f(a-1) + static let rec f a = if a = 0 then 1 else a*f(a-1) member x.X a = f a end let verify = if (C().X 4 = 24) then 0 else 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/WithReferenceType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/WithReferenceType.fs index c5f162119bd..631512eb587 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/WithReferenceType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/WithReferenceType.fs @@ -5,7 +5,7 @@ type C() = member x.N() = 1 let n (c:C) = c.N() - + type T'() = static let c = C() let c2 = C() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/WithValueType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/WithValueType.fs index a8326cfa910..7bb2209c594 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/WithValueType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/WithValueType.fs @@ -5,7 +5,7 @@ type S = member x.M() = 1 let m (s:S) = s.M() - + type T() = static let s = S() let s2 = S() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ByrefArguments01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ByrefArguments01.fs index ea5fa5b96a2..c3fc8fb77f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ByrefArguments01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ByrefArguments01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Delegates +// #Conformance #ObjectOrientedTypes #Delegates // FSB 151, Cannot construct delegate values that accept byref arguments diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/E_InvalidSignature01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/E_InvalidSignature01.fs index 11c22512ec6..120c5e45c0e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/E_InvalidSignature01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/E_InvalidSignature01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Delegates +// #Regression #Conformance #ObjectOrientedTypes #Delegates // Verify error when given an invalid delegate signature type diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/E_InvalidSignature02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/E_InvalidSignature02.fs index 57a800225a1..b73c11a958b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/E_InvalidSignature02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/E_InvalidSignature02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Delegates +// #Regression #Conformance #ObjectOrientedTypes #Delegates // Verify error when given an invalid delegate signature type //Delegate specifications must not be curried types\. Use 'typ \* \.\.\. \* typ -> typ' for multi-argument delegates, and 'typ -> \(typ -> typ\)' for delegates returning function values diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ValidSignature_MultiArg01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ValidSignature_MultiArg01.fs index 18e7e81d0ab..5683b1610af 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ValidSignature_MultiArg01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ValidSignature_MultiArg01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Delegates +// #Conformance #ObjectOrientedTypes #Delegates // Delegate taking multiple arguments // Declaration is in the form: typ * ... * typ -> typ // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ValidSignature_ReturningValues01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ValidSignature_ReturningValues01.fs index 629659fad76..1cf51e1b52c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ValidSignature_ReturningValues01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/DelegateTypes/ValidSignature_ReturningValues01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Delegates +// #Conformance #ObjectOrientedTypes #Delegates // Delegate returning a function value // Declaration is in the form: typ -> (typ -> ... -> typ -> typ) // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/AttributesOn01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/AttributesOn01.fs index 9e1d75a51db..4cb51b50248 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/AttributesOn01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/AttributesOn01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Enums +// #Conformance #ObjectOrientedTypes #Enums // Verify ability to put attributes on Enum tags @@ -7,7 +7,7 @@ open System open System.Reflection open System.Xml.Serialization -type EnumType = +type EnumType = |[] A = 1 |[] B = 2 @@ -15,15 +15,15 @@ type EnumType = [] -let main (args: string[]) = - +let main (args: string[]) = + let anenum = new EnumType() let tp = anenum.GetType() - + let memberinfoa = Attribute.GetCustomAttribute(tp.GetMember("A").[0], typeof) let memberinfob = Attribute.GetCustomAttribute(tp.GetMember("B").[0], typeof) - + if memberinfoa = null then exit 1 if memberinfob = null then exit 1 - + 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/BinaryOr01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/BinaryOr01.fs index 08c81f8b419..d370d14fc1b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/BinaryOr01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/BinaryOr01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Enums +// #Conformance #ObjectOrientedTypes #Enums // FSB 531, Cannot use "A | B" in enum flags when specifying a custom attribute (not a recognised constant) @@ -14,7 +14,7 @@ type AnEnum = type CustomAttribute(x : AnEnum) = inherit Attribute() member this.Value = x - + [] type SomeClass() = override this.ToString() = "SomeClass" @@ -28,7 +28,7 @@ let testResult = | null -> false | _ -> let typedCustAttrib = custAttrib :?> CustomAttribute let value = typedCustAttrib.Value - if (int value) <> 15 then + if (int value) <> 15 then false else true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/CallCSharpEnum.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/CallCSharpEnum.fs index 1e826b5de27..92a391feaed 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/CallCSharpEnum.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/CallCSharpEnum.fs @@ -1,8 +1,8 @@ -// #Conformance #ObjectOrientedTypes #Enums #ReqNOMT +// #Conformance #ObjectOrientedTypes #Enums #ReqNOMT // Consume a C# Enum from F# namespace NF - module M = + module M = let e = NC.SimpleEnum.A (int e + int NC.SimpleEnum.B + int NC.SimpleEnum.C) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/ConsumeFromCS.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/ConsumeFromCS.fs index c85b458513e..593e03b8c08 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/ConsumeFromCS.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/ConsumeFromCS.fs @@ -1,7 +1,7 @@ -// #Conformance #ObjectOrientedTypes #Enums +// #Conformance #ObjectOrientedTypes #Enums namespace NF - module M = + module M = type SimpleEnum = | A = -1L | B = 1L diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_BoolUnderlyingType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_BoolUnderlyingType.fs index e36339737e4..893b7f9c052 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_BoolUnderlyingType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_BoolUnderlyingType.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // Test errors related to enums of invalid primitive/built-in types //Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char -type EnumOfBool = +type EnumOfBool = | A = true | B = false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_DiscriminantOfDifferentTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_DiscriminantOfDifferentTypes.fs index 4d4220df500..1cebecca804 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_DiscriminantOfDifferentTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_DiscriminantOfDifferentTypes.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // Verify that you cannot mix underlying types //This expression was expected to have type. 'int' .but here has type. 'int64' -type EnumType = +type EnumType = | D = 3 | A = 0L | B = 1UL diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_InvalidCase01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_InvalidCase01.fs index 0b2bbf228cc..2c0e7f7e04a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_InvalidCase01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_InvalidCase01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // FSB 1744, 'value__' is reserved and cannot be a name of enum element diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NamedTypeInScope.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NamedTypeInScope.fs index 52d533586f1..7f429b6645a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NamedTypeInScope.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NamedTypeInScope.fs @@ -1,15 +1,15 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // Verify that an Enum brings a named type into scope //Duplicate.*EnumType namespace NS - module Test = + module Test = type EnumType = static member A = 0 - type EnumType = + type EnumType = | A = 0 - - + + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NeedToQualify01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NeedToQualify01.fs index c5d84f4274e..9bbf9e3a15c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NeedToQualify01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NeedToQualify01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // FSB 1552, Internal error: badly formed Item_ctor_group. @@ -6,7 +6,7 @@ //The value or constructor 'White' is not defined //The value or constructor 'Empty' is not defined -// Unlike discriminated unions, Enums need to be fully qualified. +// Unlike discriminated unions, Enums need to be fully qualified. open System @@ -18,8 +18,8 @@ type Stone = | OffBoard = 0b1000 let blackStoneList = [ - [Black]; - [White]; + [Black]; + [White]; [Empty] ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoMethodsOnEnums01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoMethodsOnEnums01.fs index dca7226146d..0cc58118746 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoMethodsOnEnums01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoMethodsOnEnums01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums //Enumerations cannot have members$ type Season = Spring=0 | Summer=1 | Autumn=2 | Winter=3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoValueFieldOnEnum.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoValueFieldOnEnum.fs index 17588c344e6..f4a71d4cf57 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoValueFieldOnEnum.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NoValueFieldOnEnum.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // FS1 992: ilreflect error triggered with Enum value__ calls. //The type 'EnumType' does not define a field, constructor, or member named 'value__' -type EnumType = +type EnumType = | A = 1 | B = 2 | C = 3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NonInt32Enums01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NonInt32Enums01.fs index dc2de9310f1..30a2b7dce0c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NonInt32Enums01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NonInt32Enums01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // Test errors related to enums of invalid primitive/built-in types @@ -18,7 +18,7 @@ type EnumOfString = | A = "foo" | B = "bar" - + type EnumOfBigInt = | A = 0I // err | B = 1I @@ -48,7 +48,7 @@ type EnumOfDecimal = type EnumOfIEEE32 = | A = 0x000000000lf | B = 0x0000000FFlf - + type EnumOfIEEE64 = | A = 0x0000000000000000LF | B = 0x0000000000000001LF diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/EqualAndBoxing01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/EqualAndBoxing01.fs index f0a81d61773..1d075fc2af5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/EqualAndBoxing01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/EqualAndBoxing01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // Regression test for FSHARP1.0:5535 // Enum type type E = | A = 1y diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/EqualsTag.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/EqualsTag.fs index 50bc5c49c4a..4b931cd1ef9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/EqualsTag.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/EqualsTag.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Enums +// #Regression #Conformance #ObjectOrientedTypes #Enums // FSB 1574, Name resolution problem: Enum Case "Equals" not handled correctly. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/NamedTypeInScope.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/NamedTypeInScope.fs index c8f60ac79bb..96f906e54e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/NamedTypeInScope.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/NamedTypeInScope.fs @@ -1,20 +1,20 @@ -// #Conformance #ObjectOrientedTypes #Enums +// #Conformance #ObjectOrientedTypes #Enums -// +// namespace NS - module M = + module M = type EnumType = class static member A = 0 end module N = - type EnumType = + type EnumType = | A = 0 - - module Test = + + module Test = let a = M.EnumType.A let b = int N.EnumType.A - + (a + b) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/NonInt32Enums01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/NonInt32Enums01.fs index 18ebd7c3d61..428d056d401 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/NonInt32Enums01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/NonInt32Enums01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Enums +// #Conformance #ObjectOrientedTypes #Enums // FSB 937, enums on not int32 types? e.g. int64. @@ -6,16 +6,16 @@ type EnumOfLongs = | A = 0L | B = 0L - + type EnumOfULongs = | A = 0UL | B = 0UL -type EnumOfUInt = +type EnumOfUInt = | A = 0u | B = 0u -type EnumOfInt = +type EnumOfInt = | A = 0 | B = 0 @@ -26,12 +26,12 @@ type EnumOfHex = type EnumOfOctal = | A = 0o00 | B = 0o77 - + type EnumOfBit = | A = 0b0000 | B = 0b1111 - -type EnumOfUShort = + +type EnumOfUShort = | A = 0us | B = 0us @@ -51,7 +51,7 @@ type EnumOfChar = | A = 'a' | B = 'a' | C = 'A' - + // This test just ensures we can define these non-int32 enums exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/Simple001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/Simple001.fs index 3b7bb452703..f4cb37cc0ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/Simple001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/Simple001.fs @@ -1,7 +1,7 @@ -// #Conformance #ObjectOrientedTypes #Enums +// #Conformance #ObjectOrientedTypes #Enums namespace NS - module M = + module M = type SimpleEnum = | A = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_AnonymousTypeInInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_AnonymousTypeInInterface01.fs index e2c2d3cbc0e..7231df04729 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_AnonymousTypeInInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_AnonymousTypeInInterface01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression for 6457, this used to throw an internal error // The type parameter 'T is not defined // Anonymous type variables are not permitted in this declaration diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_ImplementGenIFaceTwice01_5.0.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_ImplementGenIFaceTwice01_5.0.fs index 3a50faac372..407c9b6ac07 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_ImplementGenIFaceTwice01_5.0.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_ImplementGenIFaceTwice01_5.0.fs @@ -1,27 +1,27 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Verify error when trying to implement the same generic interface twice. // Regression for FSB 3574, PE Verification failure when implementing multiple generic interfaces (one generic, one specific) //'IB<'b>' cannot implement the interface 'IA<_>' with the two instantiations 'IA' and 'IA<'b>' because they may unify. -type IA<'b> = +type IA<'b> = interface abstract Foo : int -> int end -type IB<'b> = +type IB<'b> = interface inherit IA<'b> inherit IA end - + type A() = class interface IB with member obj.Foo (x : int) = x end end - + let x = A() exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InheritInterface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InheritInterface.fs index 419440e1a87..ee4d0b20702 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InheritInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InheritInterface.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:5962 //Interfaces inherited by other interfaces should be declared using 'inherit \.\.\.' instead of 'interface \.\.\.'$ @@ -9,4 +9,4 @@ type I = interface type I' = interface I - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl01.fs index feaa5cc7cb0..7cbb14f17da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:3748 // This code used to compile and then throw at runtime // Now we emit an error. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl02.fs index 24596496e06..60952be1a1a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl02.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:3748 // Now we emit an error: //No abstract or interface member was found that corresponds to this override -module WireOld = +module WireOld = [] type 'a wire = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl03.fs index e0e48592464..3011e1defea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_InterfaceNotFullyImpl03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:3748 // Now we emit an error. @@ -15,11 +15,11 @@ type Dog() = member x.Action = [("bites", fun () -> printfn "ouch")] /// type checker passes but compiler reports /// error FS0193: internal error: Method 'get_Name' in type 'MyDog' from assembly 'FSI-ASSEMBLY, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. - /// Please build a small example that reproduces this problem and report it to fsbugs@microsoft.com. + /// Please build a small example that reproduces this problem and report it to fsbugs@microsoft.com. type MyDog() = - inherit Dog() + inherit Dog() /// Not sure if this is useful for anything but I'm dutifully reporting. - /// internal error: tcref_of_stripped_typ (Failure) + /// internal error: tcref_of_stripped_typ (Failure) /// Please build a small example that reproduces this problem and report it to fsbugs@microsoft.com diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_MultipleInst07.5.0.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_MultipleInst07.5.0.fs index 73d0be3c7aa..653126e4d53 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_MultipleInst07.5.0.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_MultipleInst07.5.0.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // int does not unify with in. //'C' cannot implement the interface 'IB<_>' with the two instantiations 'IB' and 'IB>' because they may unify. @@ -7,7 +7,7 @@ type MyInt = int [] type kg type IB<'a> = - interface + interface abstract X : unit -> int end @@ -16,5 +16,5 @@ type C() = member x.X() = 1 interface IB with member x.X() = 2 - + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_MultipleInterfaceInheritance.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_MultipleInterfaceInheritance.fs index 112b8894e1f..b4debdaf8af 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_MultipleInterfaceInheritance.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/E_MultipleInterfaceInheritance.fs @@ -1,31 +1,31 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Verify that the same generic interface can NOT be inherited multiple times with different type parameters. //Interface - empty type I_000<'a> = interface - end + end -//Interface with inherits-decl +//Interface with inherits-decl type I_001 = interface inherit I_000 inherit I_000 end -//Interface with type-defn-members +//Interface with type-defn-members type I_002<'a> = interface abstract Me: 'a -> int - end - -//Interface with inherits-decl & type-defn-members + end + +//Interface with inherits-decl & type-defn-members type I_003<'a> = interface inherit I_002 inherit I_002 abstract Home: 'a -> 'a - end + end type T () = class @@ -34,14 +34,14 @@ type T () = member x.Me (s:string) = 2 member x.Me (c:char) = 1 end - - + + let mutable res = true let t = new T() if (t.Me("F#") <> 2) then System.Console.WriteLine("t.Me(string) failed") res <- false - + if (t.Me('a') <> 1) then System.Console.WriteLine("t.Me(char) failed") res <- false @@ -50,14 +50,14 @@ if (t.Home(0) <> 0) then System.Console.WriteLine("t.Home failed") res <- false -if ( {new I_003 with - member x.Home(i) = i +if ( {new I_003 with + member x.Home(i) = i }.Home ( - {new I_002 with + {new I_002 with member x.Me (s:string) = 0 member x.Me (c:char) = 1 }.Me(5) ) <> 0 ) then - System.Console.WriteLine("I_003.Home failed") + System.Console.WriteLine("I_003.Home failed") res <- false //The type 'T' does not define a field, constructor, or member named 'Me' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/EmptyInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/EmptyInterface01.fs index f207e60b258..15a4e3a8103 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/EmptyInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/EmptyInterface01.fs @@ -1,11 +1,11 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Verify ability to define and implement an empty interface type IDoNothing = interface end -type IDoSomething = +type IDoSomething = interface abstract DoStuff : unit -> unit end @@ -13,7 +13,7 @@ type IDoSomething = type Foo() = interface IDoNothing interface IDoSomething with - member this.DoStuff() = () + member this.DoStuff() = () type Bar() = interface IDoSomething with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ImplementGenIFaceTwice02_5.0.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ImplementGenIFaceTwice02_5.0.fs index 86acf7b2926..3bc53e0b751 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ImplementGenIFaceTwice02_5.0.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ImplementGenIFaceTwice02_5.0.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations type IFoo<'a> = interface abstract DoStuff : unit -> string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritDotNetInterface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritDotNetInterface.fs index 2d808209116..0e296f008c4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritDotNetInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritDotNetInterface.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:4919 // Can't define an interface that inherits from IComparable diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritFromIComparable01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritFromIComparable01.fs index 8b3c8690f53..b06dfab7866 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritFromIComparable01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritFromIComparable01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:4852 // Verify there is no bad code generation (i.e. pass peverify test) // when defining a type (interface) that inherits from System.IComparable diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/Inheritance_OverrideInterface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/Inheritance_OverrideInterface.fs index e1d05457214..68de474902a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/Inheritance_OverrideInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/Inheritance_OverrideInterface.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // It should be possible to override interface implementations @@ -6,7 +6,7 @@ type MyInt = int [] type kg type IB<'a> = - interface + interface abstract X : unit -> int end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritedInterface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritedInterface.fs index 061b9fe0557..5ba426c94da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritedInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InheritedInterface.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Verify you can use inheritance with interfaces @@ -12,7 +12,7 @@ type IThing = type FSharpLanguage() = interface IThing with member this.GetAge() = 3 - member this.Name = "The F# Programming Language" + member this.Name = "The F# Programming Language" let test = new FSharpLanguage() let ia = test :> IAge diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InterfaceMember_NameCollisions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InterfaceMember_NameCollisions.fs index ba560d0b300..2079c135557 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InterfaceMember_NameCollisions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/InterfaceMember_NameCollisions.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // There should be no method-name duplication // we need to ensure there are no collisions between (for example) @@ -16,30 +16,30 @@ type GlobalType() = class end type ``IB`` = - interface + interface abstract X : unit -> int end type IB<'a> = - interface + interface abstract X : unit -> int end -type C() = +type C() = interface ``IB`` with member x.X() = 1 interface IB with member x.X() = 2 - + module M = - + let c = C() let x1 = (c :> ``IB``).X() let x2 = (c :> IB).X() if x1 <> 1 then failwithf "expected 1, but got %i" x1 - + if x2 <> 2 then failwithf "expected 2, but got %i" x2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst01.5.0.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst01.5.0.fs index 762f164bd9f..df263eef31f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst01.5.0.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst01.5.0.fs @@ -1,10 +1,10 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations type IA<'a> = - interface + interface //abstract X : unit -> 'a end -type C() = +type C() = interface IA interface IA diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst02.fs index a69d62aff4b..faad5810564 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst02.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:5540 // It is forbidden to implement an interface at multiple instantiations //Duplicate or redundant interface$ //Duplicate or redundant interface$ type IA<'a> = - interface + interface //abstract X : unit -> 'a end -type C<'a>() = +type C<'a>() = interface IA interface IA<'a> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst03.fs index c420de39e11..e6b884eaaf3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:5540 // See also FSHARP1.0:5597 // It is forbidden to implement an interface at multiple instantiations @@ -9,17 +9,17 @@ //No abstract or interface member was found that corresponds to this override$ type IB<'a> = - interface + interface abstract X : 'a -> char end -type C<'a>() = - interface IB +type C<'a>() = + interface IB with member m.X(x) = 'a' - - interface IB + + interface IB with member m.X(c) = 'a' - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst04.5.0.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst04.5.0.fs index 85769553a57..ac6f28f90b8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst04.5.0.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst04.5.0.fs @@ -1,15 +1,15 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations type IA<'a, 'b> = - interface + interface abstract X : 'a -> 'b end -type C<'a>() = +type C<'a>() = interface IA with member m.X(x) = 'a' - + interface IA with member m.X(c) = 10 - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst05.fs index 205d9defef5..053f2ec9f81 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst05.fs @@ -1,17 +1,17 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:5540 // It is forbidden to implement an interface at multiple instantiations //Duplicate or redundant interface$ //Duplicate or redundant interface$ type IB<'a> = - interface + interface //abstract X : unit -> 'a end -type C<'a,'b>() = - interface IB<'a> - - interface IB<'b> - - +type C<'a,'b>() = + interface IB<'a> + + interface IB<'b> + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst06.fs index 53d943f2c9b..09b94ee25ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/MultipleInst06.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Aliased types should correctly unify // These errors could be improved, but verify that it errors out at all. @@ -13,7 +13,7 @@ type MyInt = int type IB<'a> = - interface + interface abstract X : unit -> int end @@ -22,6 +22,6 @@ type C() = member x.X() = 1 interface IB with member x.X() = 2 - + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ObjImplementsInterface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ObjImplementsInterface.fs index 0d511591194..4710d424c94 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ObjImplementsInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ObjImplementsInterface.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression for FSharp 1.0:1794 @@ -6,12 +6,12 @@ type public IA = abstract value : int -//create instance IA AND override ToString -let x = +//create instance IA AND override ToString +let x = { new System.Object() with member i.ToString() = "anonymous" interface IA with - member i.value = 0 + member i.value = 0 } //since the type is anonymous, I can't find a programmatic way to verify that 'x' is a 'IA'. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ObjImplementsInterfaceGenWithConstraint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ObjImplementsInterfaceGenWithConstraint.fs index f91a5cd4d1e..c7fb1a13b84 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ObjImplementsInterfaceGenWithConstraint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ObjImplementsInterfaceGenWithConstraint.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0:4943 // interface implementations in object expressions leave object this type under constrained (was: unverifiable code when implementing an interface) // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface001.fs index 6113712a332..0c350e90d16 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface001.fs @@ -1,29 +1,29 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Verify basic inheritance //Interface - empty type I_000<'a> = interface - end + end -//Interface with inherits-decl +//Interface with inherits-decl type I_001<'a> = interface inherit I_000<'a> end -//Interface with type-defn-members +//Interface with type-defn-members type I_002<'a> = interface abstract Me: unit -> 'a - end - -//Interface with inherits-decl & type-defn-members + end + +//Interface with inherits-decl & type-defn-members type I_003<'a> = interface inherit I_001<'a> abstract Home: 'a -> 'a - end + end {new I_003 with member x.Home(i) = i }.Home({new I_002 with member x.Me() = 0}.Me()) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface001e.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface001e.fs index a31a1739876..14a32d5bf6f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface001e.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface001e.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Verify that the inherited type must be an interface //The type 'C_000' is not an interface type$ - -type I_000 = + +type I_000 = abstract Mem : unit -> int - + type C_000 = class interface I_000 with member x.Mem() = 0 @@ -13,4 +13,4 @@ type C_000 = type I_001<'a> = interface inherit C_000 - end + end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface002.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface002.fs index ef01649d53f..95e5264daf0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface002.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface002.fs @@ -1,13 +1,13 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Verify properties - + //Interface with properties type I_004<'a> = interface abstract Prop : 'a with get - end + end {new I_004 with member x.Prop = 0 }.Prop |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface002e.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface002e.fs index 05cb8ec30c2..aa300cd7dc5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface002e.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface002e.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations -// Verify that there may be no circular references between inherits declarations based on the named types of the inherited interface types. +// #Regression #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// Verify that there may be no circular references between inherits declarations based on the named types of the inherited interface types. //This type definition involves an immediate cyclic reference through a struct field or inheritance relation //This type definition involves an immediate cyclic reference through a struct field or inheritance relation //This type definition involves an immediate cyclic reference through a struct field or inheritance relation -type I_000 = - interface +type I_000 = + interface inherit I_001 abstract Mem : unit -> int end @@ -13,7 +13,7 @@ type I_000 = and I_001 = interface inherit I_002 - end + end and I_002 = interface diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface003.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface003.fs index 922fe0ec03f..fbda56be95e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface003.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/interface003.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations +// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations // Regression test for FSHARP1.0: // type I<'t> = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/DoStaticLetDo.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/DoStaticLetDo.fs index ca82e488b22..2e7b9354889 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/DoStaticLetDo.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/DoStaticLetDo.fs @@ -1,24 +1,24 @@ -// #Conformance #ObjectOrientedTypes #Structs +// #Conformance #ObjectOrientedTypes #Structs namespace NS - module M = + module M = let mutable r = 0 [] - type S(y:int) = + type S(y:int) = static let mutable v = 3 static do v <- v + 1 // do r <- r + 1 // this is not allowed anymore! static member V = v member x.M = y - - module Test = + + module Test = open M let mutable res = true - + if not ((r = 0) && (S.V = 4) && (r = 0) )then // ctor not called, then cctor is called printf "Lib.DoStaticLetDo1 failed\n" res <- false - + let a = S() if not ((r = 0) && (S.V = 4) && (a.M = 0)) then // nothing called diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_AbstractClassStruct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_AbstractClassStruct.fs index f701f1b0b76..cd9aa009074 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_AbstractClassStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_AbstractClassStruct.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify error when both AbstractClassAttribute and StructAttribute are on the same type. @@ -8,12 +8,12 @@ type StructPoint = val mutable m_x : float val mutable m_y : float - + new (x : float, y : float) = { m_x = x; m_y = y } - + member this.X with get() = this.m_x and set x = this.m_x <- x - member this.Y with get() = this.m_y + member this.Y with get() = this.m_y and set x = this.m_y <- x exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_CyclicInheritance01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_CyclicInheritance01.fs index a9469f691af..4f2452dfb2b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_CyclicInheritance01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_CyclicInheritance01.fs @@ -1,32 +1,32 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:1452, Complete checks for structs -// Also, +// Also, //This type definition involves an immediate cyclic reference through a struct field or inheritance relation //This type definition involves an immediate cyclic reference through a struct field or inheritance relation //This type definition involves an immediate cyclic reference through a struct field or inheritance relation //This type definition involves an immediate cyclic reference through an abbreviation module BadStructTest2 = begin - type BadStruct1 = + type BadStruct1 = struct val x : BadStruct2 - end + end and BadStruct2 = struct val x : BadStruct1 - end + end end module BadStructTest3 = begin - type One<'a> = + type One<'a> = struct val x : 'a - end + end type BadStruct = struct val x : One - end + end type BadAbbreviation = One end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_ImplicitCTorUse01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_ImplicitCTorUse01.fs index 7acb998e10e..fd76f98ec98 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_ImplicitCTorUse01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_ImplicitCTorUse01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:5304 //The default, zero-initializing constructor of a struct type may only be used if all the fields of the struct type admit default initialization$ -type U2(v:list) = struct end +type U2(v:list) = struct end let x = U2() // expect an error here because "list" does not admit a default value diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_ImplicitCTorUse02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_ImplicitCTorUse02.fs index a24c24367df..9081caf79d4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_ImplicitCTorUse02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_ImplicitCTorUse02.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:5304 //The default, zero-initializing constructor of a struct type may only be used if all the fields of the struct type admit default initialization$ [] -type U2(v:list) = +type U2(v:list) = member x.P = U2() // expect an error here because "list" does not admit a default value diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_InvalidRecursiveGeneric01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_InvalidRecursiveGeneric01.fs index 9324d3e4902..f885af9eaf4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_InvalidRecursiveGeneric01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_InvalidRecursiveGeneric01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify proper error for illegal recursive / generic structs // Regression for FSB 3417 @@ -10,11 +10,11 @@ type BadType4 = [] val mutable X : BadBox4 end -and BadBox4<'T> = +and BadBox4<'T> = struct val v : 'T end - + let _ = BadType4() exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_InvalidRecursiveGeneric02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_InvalidRecursiveGeneric02.fs index f90ab777f41..20503bad6f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_InvalidRecursiveGeneric02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_InvalidRecursiveGeneric02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify proper error for illegal recursive / generic structs // Regression for FSB 3417 @@ -10,12 +10,12 @@ type BadType4 = [] val mutable X : Naught4> end -and BadBox4<'T> = +and BadBox4<'T> = struct val v : 'T end and Naught4<'a> = 'a - + let _ = BadType4() exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoAbstractMembers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoAbstractMembers.fs index 1df38cc1ebe..8ea5b8572fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoAbstractMembers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoAbstractMembers.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs //Struct types cannot contain abstract members$ // See FSHARP1.0:5493 [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoDefaultCtor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoDefaultCtor.fs index 389ca0907cc..fc5d5b7c992 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoDefaultCtor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoDefaultCtor.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify error when trying to create a default constructor for structs //Implicit object constructors for structs must take at least one argument$ //This construct is deprecated: Structs cannot contain 'do' bindings because the default constructor for structs would not execute these bindings$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoLetBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoLetBindings.fs index e40e9e11f20..3299c68d80b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoLetBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_NoLetBindings.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:3779 and FSHARP1.0:5492 //Structs cannot contain value definitions because the default constructor for structs will not execute these bindings\. Consider adding additional arguments to the primary constructor for the type\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Nullness01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Nullness01.fs index d61b98c5a4f..2d491216fe4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Nullness01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Nullness01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify error struct contains a field which cannot be null. //The default, zero-initializing constructor of a struct type may only be used if all the fields of the struct type admit default initialization$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Nullness02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Nullness02.fs index 071d345cef7..05d3cb31f27 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Nullness02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Nullness02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify error struct contains a field which cannot be null. // Verify this is chained correctly. //The default, zero-initializing constructor of a struct type may only be used if all the fields of the struct type admit default initialization diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Overload_Equals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Overload_Equals.fs index 48675a9b12b..4c0a280375a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Overload_Equals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Overload_Equals.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT +// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of Equals() //Duplicate method\. The method 'Equals' has the same name and signature as another method in type 'S3'\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Overload_GetHashCode.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Overload_GetHashCode.fs index 59c90979e53..3f078943196 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Overload_GetHashCode.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Overload_GetHashCode.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT +// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of GetHashCode() //Duplicate method\. The method 'GetHashCode' has the same name and signature as another method in type 'S2'\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02.fs index bb0ee2f9dcb..edb3e50bafe 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:5405 // We should not generate bad code. Instead, we should give an error //Duplicate definition of field 'x'$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02b.fs index eac9452c02c..c3ac1162e6f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression for 4643: // infinite loop in typechecker - caused by recursive struct check via self typed static field //Static 'val' fields in types must be mutable, private and marked with the '\[\]' attribute\. They are initialized to the 'null' or 'zero' value for their type\. Consider also using a 'static let mutable' binding in a class type\.$ @@ -10,8 +10,8 @@ type RIP(x:int) = [] -type arg_unused_is_RIP(x:RIP) = - struct +type arg_unused_is_RIP(x:RIP) = + struct end [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructConstruction03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructConstruction03.fs index 0ee07b3415e..ebff023bb32 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructConstruction03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructConstruction03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:3143 //This type definition involves an immediate cyclic reference through a struct field or inheritance relation$ //This declaration element is not permitted in an augmentation$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructInheritance01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructInheritance01.fs index ad4152f8c0a..b9944cc0027 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructInheritance01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructInheritance01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify error when trying to inherit from a struct type // Regression test for FSHARP1.0:2803 //Cannot inherit a sealed type @@ -12,7 +12,7 @@ type StructType = struct end -type InheritFromStruct(x, y) = +type InheritFromStruct(x, y) = inherit StructType(x, y) override this.ToString() = "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructInheritance01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructInheritance01b.fs index 38184a2ac82..a2594a9eadd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructInheritance01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructInheritance01b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify error when trying to inherit from a struct type // Regression test for FSHARP1.0:2803 //FS0191: Cannot inherit from interface type @@ -13,7 +13,7 @@ type StructType = struct end -type InheritFromStruct(x, y) = +type InheritFromStruct(x, y) = inherit StructType(x, y) override this.ToString() = "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructWithNoFields01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructWithNoFields01.fs index 1cd52c0f8ea..9864c40810c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructWithNoFields01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_StructWithNoFields01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs -// Regression test for FSHARP1.0:3051, 3144 +// #Regression #Conformance #ObjectOrientedTypes #Structs +// Regression test for FSHARP1.0:3051, 3144 //Implicit object constructors for structs must take at least one argument module TestModule [] type S() = - interface System.Collections.Generic.IEnumerable with + interface System.Collections.Generic.IEnumerable with member x.GetEnumerator() = failwith "" - interface System.Collections.IEnumerable with + interface System.Collections.IEnumerable with member x.GetEnumerator() = failwith "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/EqualAndBoxing01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/EqualAndBoxing01.fs index bf390d88095..336568470c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/EqualAndBoxing01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/EqualAndBoxing01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:5535 // Struct type diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/ExplicitCtor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/ExplicitCtor.fs index 4cfebd39204..27385aac3a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/ExplicitCtor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/ExplicitCtor.fs @@ -1,13 +1,13 @@ -// #Conformance #ObjectOrientedTypes #Structs +// #Conformance #ObjectOrientedTypes #Structs namespace NS - module M = + module M = type S1 (i : int) = struct new (i : string, j : int) = S1(j) member x.m = i end - + type S2 = struct val mutable m : int @@ -15,10 +15,10 @@ namespace NS end - module Test = + module Test = open M let mutable res = true - + let mutable a = new S1("Hello",5) let b = S2(6) @@ -30,5 +30,5 @@ namespace NS printf "Lib.MutableFields failed\n" res <- false - + (if (res) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/GenericStruct01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/GenericStruct01.fs index c3607cb5a0c..4b4bf28656d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/GenericStruct01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/GenericStruct01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Structs +// #Conformance #ObjectOrientedTypes #Structs @@ -8,11 +8,11 @@ [] type GenStruct<'a> = val Val : int - + let f () = let aux = GenStruct<'a>() aux - + let x : GenStruct = f() if x.Val <> 0 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/IndexerProperties01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/IndexerProperties01.fs index 532b6d1caff..95123aadb92 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/IndexerProperties01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/IndexerProperties01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // FSB 1281, Indexed Item property on structs with get and set gives System.AccessViolationException in fsi @@ -9,13 +9,13 @@ open System type Dodad = val mutable m_intArray : int[] val mutable m_stringArray : string[] - - new (startingInts, startingStrings) = {m_intArray = startingInts; + + new (startingInts, startingStrings) = {m_intArray = startingInts; m_stringArray = startingStrings} member this.Item with get (idx : int) = this.m_intArray.[idx] and set (idx : int) (x:int) = this.m_intArray.[idx] <- x - + member this.StrItem with get (idx : string) = this.m_stringArray.[Int32.Parse(idx)] and set (idx : string) (x:string) = this.m_stringArray.[Int32.Parse(idx)] <- x @@ -28,8 +28,8 @@ if test.StrItem("0") <> "a" then exit 1 if test.StrItem("1") <> "b" then exit 1 // Test indexer's setter and getter -test.[0] <- -1 -test.[1] <- -2 +test.[0] <- -1 +test.[1] <- -2 if test.[0] <> -1 then exit 1 if test.[1] <> -2 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/MutableFields.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/MutableFields.fs index ea0af7c7c6d..515878c856b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/MutableFields.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/MutableFields.fs @@ -1,13 +1,13 @@ -// #Conformance #ObjectOrientedTypes #Structs +// #Conformance #ObjectOrientedTypes #Structs namespace NS - module M = + module M = type S1 (i : int) = struct [] val mutable m : int end - + type S2 = struct val mutable m : int @@ -18,10 +18,10 @@ namespace NS member x.M = i end - module Test = + module Test = open M let mutable res = true - + let mutable a = new S1(0) let b = S2() let c = S3() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/NoClashMemberIFaceMember.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/NoClashMemberIFaceMember.fs index 07d9342e851..3d21958a6e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/NoClashMemberIFaceMember.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/NoClashMemberIFaceMember.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:4666 // Structs should be allowed to implement interfaces with methods same name as field -type IFoo = +type IFoo = abstract Bar: int8 // <- Bar is member in interface - -[] + +[] type Foo (value: int8) = member this.Bar = value - interface IFoo with + interface IFoo with member this.Bar = this.Bar + 10y // <- no problem here! let o = Foo(1y) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_Equals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_Equals.fs index 398f407add6..6f05f7ac942 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_Equals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_Equals.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT +// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of Equals() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_GetHashCode.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_GetHashCode.fs index aca1cc87f7b..da60e168728 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_GetHashCode.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_GetHashCode.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT +// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of GetHashCode() @@ -6,7 +6,7 @@ type S2 = member this.GetHashCode(s:char) = 1 //member this.GetHashCode() = 1. - member this.GetHashCode(?s:char) = 1 + member this.GetHashCode(?s:char) = 1 #if INTERACTIVE ;; diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_ToString.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_ToString.fs index 8a5ad46511f..714293270e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_ToString.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Overload_ToString.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT +// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of ToString() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Regressions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Regressions01.fs index b35df2449d6..dbd7af1b145 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Regressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Regressions01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSB 4654, generic structs may not have explicit layout type MultiMap<'k,'v> (x: int) = struct diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Regressions02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Regressions02.fs index 38b4acce52b..0c83d09b665 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Regressions02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/Regressions02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression for 4643: // infinite loop in typechecker - caused by recursive struct check via self typed static field @@ -10,8 +10,8 @@ type RIP(x:int) = [] -type arg_unused_is_RIP(x:RIP) = - struct +type arg_unused_is_RIP(x:RIP) = + struct end [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructAttribute01.fs index ac4e8634c83..b864745625c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructAttribute01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructAttribute01.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #Structs +// #Conformance #ObjectOrientedTypes #Structs // Verify the struct attribute works as expected [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructAttribute02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructAttribute02.fs index 7cdf48fa5f0..504b9bafc67 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructAttribute02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructAttribute02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Verify errors associated with putting the struct attribute on non structs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructConstruction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructConstruction01.fs index 71c1048cdbb..65a8dd660c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructConstruction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructConstruction01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // FS1 1337: "new" is still required for the default struct constructor diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructConstruction02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructConstruction02.fs index 06ffd3c63a7..cc1e1621ac9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructConstruction02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructConstruction02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // FSB 1768, Allow the definition of immutable structs using the implicit construction syntax diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructInstantiation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructInstantiation01.fs index 081bb95a196..440fdde3e3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructInstantiation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructInstantiation01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Bug 1337: "new" is still required for the default struct constructor diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructWithNoFields01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructWithNoFields01.fs index ae191b89c89..5d252dcadb4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructWithNoFields01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/StructTypes/StructWithNoFields01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs +// #Regression #Conformance #ObjectOrientedTypes #Structs // Regression test for FSHARP1.0:3051 // module TestModule [] type S(x:int) = - interface System.Collections.Generic.IEnumerable with + interface System.Collections.Generic.IEnumerable with member x.GetEnumerator() = failwith "" - interface System.Collections.IEnumerable with + interface System.Collections.IEnumerable with member x.GetEnumerator() = failwith "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/BasicExtensions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/BasicExtensions.fs index 4d2869fb961..dc35c55faf4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/BasicExtensions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/BasicExtensions.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions // Verify error for invalid type extensions diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_CantExtendTypeAbbrev.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_CantExtendTypeAbbrev.fs index 2883306a70a..f022c1c2016 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_CantExtendTypeAbbrev.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_CantExtendTypeAbbrev.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Verify you can't add type extensions to a type abbreviation //Type abbreviations cannot have augmentations$ //Type abbreviations cannot have members$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ConflictingMembers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ConflictingMembers.fs index 77d9e9d452d..4f9c95738eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ConflictingMembers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ConflictingMembers.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Verify that No two intrinsic extensions may contain conflicting members // See also FSHARP1.0:4925 (this test will have to be updated once that bug is resolved) //Duplicate method\. The method 'get_DoStuff' has the same name and signature as another method in type 'K.Foo' namespace NS - module K = + module K = // Define Foo type Foo() = class static member DoStuff = 1 end - + type Foo with static member DoStuff = 2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtendVirtualMethods01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtendVirtualMethods01.fs index 1e9d034a43b..4ad27116a3d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtendVirtualMethods01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtendVirtualMethods01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // It's error if the augmentation is of a type from a different assembly @@ -10,7 +10,7 @@ type System.String with override this.ToString() = "Overridden" printfn "\"foo\".ToString() = %s" ("foo".ToString()) - + if "foo".ToString() <> "foo" then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtensionInNamespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtensionInNamespace01.fs index 642ce3025fa..628175fddb8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtensionInNamespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtensionInNamespace01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Verify error associated with placing type extensions // inside namespaces. (They must only be placed in modules.) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtensionOperator01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtensionOperator01.fs index e038022643b..dfbef3ef3b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtensionOperator01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ExtensionOperator01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Regression for FSHARP1.0:3592 // Can't use extension methods to define operators //Extension members cannot provide operator overloads\. Consider defining the operator as part of the type definition instead\. @@ -21,7 +21,7 @@ module TestExtensions = type System.Exception with static member (+) (e1: Exception, e2: Exception) = new Exception(e1.Message + " " + e2.Message) - + let e1 = Exception() let e2 = Exception() let r = e1 + e2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions01.fs index 1f785863e86..bf9d0940114 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Verify error for invalid type extensions @@ -9,7 +9,7 @@ type Foo = end // You can't add 'val' fields in type extension -type Foo with +type Foo with val m_field : string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions02.fs index a5a0893d3ca..8d2351f2c94 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Verify error for invalid type extensions @@ -9,7 +9,7 @@ type Foo = end // You can't add 'val' fields in type extension -type Foo with +type Foo with let m_field : string = "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions03.fs index d5f71733ead..684a6267fa0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions03.fs @@ -1,12 +1,12 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions //Invalid type extension type System.String with member this.TwiceLength = this.Length * 2 - + type System.String = member this.TwiceLength = this.Length * 2 - + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions04.fs index 481003071bb..85dacdd0c51 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidExtensions04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Regression test for FSharp1.0:5249 // Title: Compiler exception and type-checker crash when using type extension. @@ -13,5 +13,5 @@ module Test = type Test.T with member x.Bar = T() -module Test1 = +module Test1 = type System.DateTime with member x.FooBaz = DateTime.Now diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidForwardRef01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidForwardRef01.fs index fd974baa081..76380a37673 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidForwardRef01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_InvalidForwardRef01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Regression test for FSHARP1.0:575 - Augmentations lead to unsoundnesses in the treatment of constraints. Available instances should be lexically scoped diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ProtectedMemberInExtensionMember01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ProtectedMemberInExtensionMember01.fs index a16023a33d6..cfc84ae3d6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ProtectedMemberInExtensionMember01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/E_ProtectedMemberInExtensionMember01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions #NoMono +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions #NoMono // Regression test for FSHARP1.0:5053 // Trying to access a protected member in an extension member should give an error // (and not just fail at runtime!) //The member or object constructor 'SetWaitNotificationRequired' is not accessible\. Private members may only be accessed from within the declaring type\. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions\.$ module Extensions = - type System.Threading.SynchronizationContext with + type System.Threading.SynchronizationContext with member x.Test() = x.SetWaitNotificationRequired() // SetWaitNotificationRequired is protected diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendHierarchy01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendHierarchy01.fs index 32a943e9c8a..365e6469f72 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendHierarchy01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendHierarchy01.fs @@ -1,14 +1,14 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions // Verify type extensions extend the full hierarchy of a type // Verify that if you extend an interface a class implements, the class is extended -type System.Collections.Generic.IEnumerable<'a> with +type System.Collections.Generic.IEnumerable<'a> with member x.SeqLength = Seq.length x - + let aString = "abc" -if aString.SeqLength <> aString.Length then +if aString.SeqLength <> aString.Length then exit 1 let aList = [1; 2; 3] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendHierarchy02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendHierarchy02.fs index 9be4230406a..bd2c77bcb87 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendHierarchy02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendHierarchy02.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions // Verify type extensions extend the full hierarchy of a type diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendViaOverloading01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendViaOverloading01.fs index dfcd21fa110..c3e003e655f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendViaOverloading01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendViaOverloading01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Regression test for FSharp1.0:4939 @@ -6,34 +6,34 @@ module Test -type System.Object with +type System.Object with member x.Equals(a:int,b:int) = (a = b) member x.Equals(a:int) = true member x.Equals(a:obj) = false // NOTE : this one will always be ignored. It is uncallable -let mutable res = - not ("3".Equals(3,4)) && // expect: false +let mutable res = + not ("3".Equals(3,4)) && // expect: false "3".Equals(3,3) && // expect: true "3".Equals("3") && // expect: true --> calls System.Object.Equals(obj) "3".Equals(2) && // expect: true --> calls extension member override on "int" "3".Equals(box "3") // expect: true --> since extension member is uncallable -type T = +type T = class val mutable public X : int public new (i : int) = { X = i } - + member this.Incr (i : int) = this.X <- this.X + i static member CreateOne () = new T(0) end - + type System.Convert with static member ToInt32(o : T) = o.X res <- res && (System.Convert.ToInt32(new T(5)) = 5) - + type T with member this.Incr(d : float) = this.Incr((int d)) static member CreateOne (s : string) = new T(s.Length) @@ -42,6 +42,6 @@ let tmp = new T(10) res <- res && tmp.Incr(5) = tmp.Incr(5.2) && T.CreateOne().X = T.CreateOne("").X - + if res <> true then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendViaOverloading02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendViaOverloading02.fs index b488732ab59..47ef5ab3be9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendViaOverloading02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendViaOverloading02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // Regression test for FSharp1.0:4973 @@ -7,11 +7,11 @@ open System.Collections.Generic type IEnumerable<'a> with - member x.map f = + member x.map f = x |> Seq.map f type 'a ``[]`` with - member x.map f = + member x.map f = x |> Array.map f let a = [| 1; 2; 3 |] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendWithOperator01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendWithOperator01.fs index 1c8033d9b64..f641e45bede 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendWithOperator01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtendWithOperator01.fs @@ -1,11 +1,11 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions // Verify ability to add a type extension for an operator // Note that C# and VB do NOT support this. -type System.Int32 with - member x.GetSlice(idx1,idx2) = +type System.Int32 with + member x.GetSlice(idx1,idx2) = let idx1 = defaultArg idx1 0 let idx2 = defaultArg idx2 10 idx2 - idx1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtensionInNamespace02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtensionInNamespace02.fs index 2199246357e..ba10c60dde0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtensionInNamespace02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/ExtensionInNamespace02.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions // Verify it is legitimate to put an extension method in a namespace // as long as the type is in the same file and same namespace where the // they is defined (and, yes, we have to put it in a module) @@ -12,7 +12,7 @@ namespace N module M = type T with member this.ExtensionMethod() = 42 - + module MM = open M (if (new T()).ExtensionMethod() = 42 then exit 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/MultipleExtensions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/MultipleExtensions.fs index 4ec08a031a9..0631cddde83 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/MultipleExtensions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/MultipleExtensions.fs @@ -1,8 +1,8 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions //verify that you can extend a type multiple times namespace NS - module M = + module M = // Define Foo type Foo() = @@ -24,26 +24,26 @@ namespace NS static member DoStuff2 = 2 type Foo<'a> with member x.DoStuff2 = x.DoStuff1 + 11 - - module N = + + module N = open M let mutable res = true let a = new Foo () - + if not (Foo.DoStuff1 = 1) then printf "Foo.DoStuff1 failed\n" res <- false - + if not (Foo.DoStuff2 = 2) then printf "Foo.DoStuff2 failed\n" res <- false - + if not (a.DoStuff1 = 11) then printf "Foo.DoStuff1 failed\n" res <- false - + if not (a.DoStuff2 = 22) then printf "Foo.DoStuff2 failed\n" res <- false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/NonConflictingIntrinsicMembers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/NonConflictingIntrinsicMembers.fs index 56345b1eb02..14a7cd4d010 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/NonConflictingIntrinsicMembers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/NonConflictingIntrinsicMembers.fs @@ -1,5 +1,5 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions -// This test used to be about "verifying that No two intrinsic extensions may contain +// #Conformance #ObjectOrientedTypes #TypeExtensions +// This test used to be about "verifying that No two intrinsic extensions may contain // conflicting members. // After recent changes, DoStuff are no longed intrinsic members; they are instead // extension methods... so this code compiles just fine. @@ -7,25 +7,25 @@ namespace NS - module K = + module K = // Define Foo type Foo() = class end - module L = + module L = open K // Extend Foo type Foo with static member DoStuff = 1 - module M = + module M = open K // Extend Foo type Foo with static member DoStuff = 2 - module N = + module N = exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/UnqualifiedName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/UnqualifiedName.fs index 9d49a9f314b..1c036b26ffa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/UnqualifiedName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/UnqualifiedName.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions // Verify type extensions on non-fully qualified names diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/E_typeext_int002.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/E_typeext_int002.fs index bce637f9be4..4bd7cbe8542 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/E_typeext_int002.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/E_typeext_int002.fs @@ -1,10 +1,10 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions namespace NS - module M = + module M = type Lib with - - // members: property, method, abstract, implementing dispatch slots, overloaded. + + // members: property, method, abstract, implementing dispatch slots, overloaded. override x.M i = i - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib001.fs index e0ff65c0e2b..16e54f137d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib001.fs @@ -1,4 +1,4 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions namespace NS type Lib() = @@ -10,13 +10,13 @@ namespace NS member x.Name () = "Lib" member x.DefProp = 1 end - + type LibGen<'a>() = class [] - val mutable instanceField : 'a + val mutable instanceField : 'a [] static val mutable private staticField : 'a - member x.Name () = "LibGen" + member x.Name () = "LibGen" member x.DefProp = Unchecked.defaultof<'a> end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib002.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib002.fs index 4970806bd11..02a42fb15b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib002.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib002.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions +// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions // verify that over-riding a virtual method of a type defined in another assembly gives an error. //Method overrides and interface implementations are not permitted here diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib003.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib003.fs index 5ed8bf8a1f1..03818f528bf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib003.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib003.fs @@ -1,14 +1,14 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions namespace NS - type IM = + type IM = interface abstract M : int -> int end - + type Lib() = class interface IM with member x.M i = 0 end - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib004.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib004.fs index c874f6e7c81..6fdc91ebbfd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib004.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib004.fs @@ -1,8 +1,8 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions namespace NS type Lib() = class member x.M i:int = 0 end - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib005.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib005.fs index 6103f954186..de435759f59 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib005.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib005.fs @@ -1,8 +1,8 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions namespace NS type Lib() = class member x.M i:int = 1 end - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int001.fs index 14d1e19d21f..0ebe75b61fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int001.fs @@ -1,38 +1,38 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions namespace NS - module M = + module M = type Lib with - + // Extension Methods member x.ExtensionMember () = 1 static member StaticExtensionMember() =1 - + // Extension Properties member x.ExtensionProperty001 = 1 member x.ExtensionProperty002 with get() = 2 member x.ExtensionProperty003 with get() = 3 member x.ExtensionProperty003 with set(i:int) = () - member x.ExtensionProperty004 + member x.ExtensionProperty004 with get () = x.instanceField and set (inp : int) = (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "NS.Lib")).GetField("instanceField").SetValue(x,inp) - member x.ExtensionIndexer001 + member x.ExtensionIndexer001 with get (i:int, j:int) = 1 and set (i:int, j:int, value:int) = () - + static member StaticExtensionProperty001 = 11 static member StaticExtensionProperty002 with get() = 12 static member StaticExtensionProperty003 with get() = 13 static member StaticExtensionProperty003 with set(i:int) = () -// static member StaticExtensionProperty004 +// static member StaticExtensionProperty004 // with get () = Lib.staticField // and set (inp : int) = (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "NS.Lib")).GetField("staticField").SetValue(new obj(),inp) - static member StaticExtensionIndexer001 + static member StaticExtensionIndexer001 with get (i:int, j:int) = 1 and set (i:int, j:int, value:int) = () - module MLong = + module MLong = type NS.Lib with member x.ExtensionPropertyLong = 0 @@ -41,74 +41,74 @@ namespace NS // Extension Methods member x.ExtensionMember () = Unchecked.defaultof<'a> static member StaticExtensionMember() =1 - + // Extension Properties member x.ExtensionProperty001 = 1 member x.ExtensionProperty002 with get() = 2 member x.ExtensionProperty003 with get() = 3 member x.ExtensionProperty003 with set(i:int) = () - member x.ExtensionProperty004 + member x.ExtensionProperty004 with get () = x.instanceField and set (inp : int) = (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "NS.Lib")).GetField("instanceField").SetValue(x,inp) - member x.ExtensionIndexer001 + member x.ExtensionIndexer001 with get (i:int, j:int) = 1 and set (i:int, j:int, value:int) = () - + static member StaticExtensionProperty001 = 11 static member StaticExtensionProperty002 with get() = 12 static member StaticExtensionProperty003 with get() = 13 static member StaticExtensionProperty003 with set(i:int) = () -/// static member StaticExtensionProperty004 +/// static member StaticExtensionProperty004 /// with get () = Lib.staticField /// and set (inp : int) = (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "NS.Lib")).GetField("staticField").SetValue(new obj(),inp) - static member StaticExtensionIndexer001 + static member StaticExtensionIndexer001 with get (i:int, j:int) = 1 and set (i:int, j:int, value:int) = () - + module F = open M open MLong let mutable res = true - + let a = new Lib() if not (a.ExtensionProperty001 = 1) then printf "Lib.ExtensionProperty001 failed\n" res <- false - + if not (a.ExtensionProperty002 = 2) then printf "Lib.ExtensionProperty002 failed\n" res <- false - + if not (a.ExtensionProperty003 = 3) then printf "Lib.ExtensionProperty003 failed\n" res <- false - + /// a.ExtensionProperty004 <- 4 /// if not (a.ExtensionProperty004 = 4) then /// printf "Lib.ExtensionProperty004 failed\n" /// res <- false - + if not (a.ExtensionPropertyLong = 0) then printf "Lib.ExtensionMemberLong failed\n" res <- false - + if not (Lib.StaticExtensionProperty001 = 11) then printf "Lib.StaticExtensionProperty001 failed\n" res <- false - + if not (Lib.StaticExtensionProperty002 = 12) then printf "Lib.StaticExtensionProperty002 failed\n" res <- false - + if not (Lib.StaticExtensionProperty003 = 13) then printf "Lib.StaticExtensionProperty003 failed\n" res <- false - + /// Lib.StaticExtensionProperty004 <- 5 /// if not (Lib.StaticExtensionProperty004 = 5) then /// printf "Lib.StaticExtensionProperty004 failed\n" /// res <- false - + (if (res) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int003.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int003.fs index 2cc94fb0be6..3ee14fa67e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int003.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int003.fs @@ -1,16 +1,16 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions -// verify that hiding an interface implementation is allowed +// #Conformance #ObjectOrientedTypes #TypeExtensions +// verify that hiding an interface implementation is allowed namespace NS - module M = + module M = type Lib with member x.M i = i - - + + module F = open M let mutable res = true - + let a = new Lib() if not (a.M 1 = 1) then printf "Lib.TypeExt_int003.fs failed\n" @@ -20,5 +20,5 @@ namespace NS if not (b.M 1 = 0) then printf "Lib.TypeExt_int003.fs failed\n" res <- false - + (if (res) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int004.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int004.fs index e52d50f1d4d..6134bc1d62a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int004.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int004.fs @@ -1,16 +1,16 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions // verify that hiding a member is allowed. namespace NS - module M = + module M = type Lib with member x.M i = i - - + + module F = open M let mutable res = true - + let a = new Lib() if not (a.M 1 = 1) then printf "Lib.TypeExt_int004.fs failed\n" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int005.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int005.fs index fe7125263ab..cd3c032ab37 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int005.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int005.fs @@ -1,17 +1,17 @@ -// #Conformance #ObjectOrientedTypes #TypeExtensions +// #Conformance #ObjectOrientedTypes #TypeExtensions // verify that overloading a member is allowed. namespace NS - module M = + module M = type Lib with member x.M(i,j) = i + j - - + + module F = open M let mutable res = true - + let a = new Lib() if not (a.M (2, 3) + (a.M 1) = 3) then printf "Lib.TypeExt_int004.fs failed\n" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class001.fs index fe796e05124..f82f9d97cda 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class001.fs @@ -1,7 +1,7 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of Type Kind Attributes -module TypeInference +module TypeInference //[] //type TK_C_000 = @@ -9,14 +9,14 @@ module TypeInference [] type TK_C_001 = class - end - + end + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_001")).IsClass -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class001e.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class001e.fs index 724a9768c80..5104f36b87a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class001e.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class001e.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeInference +// #Regression #Conformance #ObjectOrientedTypes #TypeInference // attribute must match struct-end //The kind of the type specified by its attributes does not match the kind implied by its definition //The kind of the type specified by its attributes does not match the kind implied by its definition -module TypeInference +module TypeInference [] type TK_C_000 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class002.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class002.fs index a735c2b46ab..232b7f59d19 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class002.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class002.fs @@ -1,18 +1,18 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of Type Kind Attributes -module TypeInference +module TypeInference [] type TK_C_001 = class end - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_001")).IsClass -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class003.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class003.fs index 445dba4a888..acbd9c66919 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class003.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class003.fs @@ -1,18 +1,18 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of class/end -module TypeInference +module TypeInference type TK_C_002 = class end - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_002")).IsClass -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class004.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class004.fs index b849db1383b..f206fe2922c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class004.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class004.fs @@ -1,23 +1,23 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeInference +// #Regression #Conformance #ObjectOrientedTypes #TypeInference // Verify type kind inference based on type members -module TypeInference +module TypeInference // val binding / explicit field -type TK_C_003 = +type TK_C_003 = val a : obj // object constructor -type TK_C_004 = +type TK_C_004 = new() = {} // explicit object constructor + implicit constructor -type TK_C_005() = +type TK_C_005() = new(s:string) = new TK_C_005() // implicit constructor type TK_C_006() = class end - + // let binding type TK_C_007(o:obj) = let m = 0 @@ -34,8 +34,8 @@ type TK_C_009(o:obj) = // do binding type TK_C_010(o:obj) = static do System.Console.WriteLine() - -// non-abstract instance member + +// non-abstract instance member type TK_C_011 = member x.m(b:bool) = 0 @@ -43,25 +43,25 @@ type TK_C_011 = type TK_C_012 = static member m(c:char) = 0 -// non-abstract override member -type TK_C_013 = +// non-abstract override member +type TK_C_013 = override m.ToString()= "TK_C_006" - -// inherits decl -type TK_C_014() = + +// inherits decl +type TK_C_014() = inherit TK_C_006() // inherit interface + concrete element // 2594 & 1978 -type TK_I_003 = +type TK_I_003 = abstract M: unit -> string type TK_C_015() = interface TK_I_003 with member x.M() = "M" - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_003")).IsClass a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_004")).IsClass @@ -76,9 +76,9 @@ try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_013")).IsClass a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_014")).IsClass a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_015")).IsClass -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class005.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class005.fs index 0aeca259a2a..48ad3e9bbac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class005.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_class005.fs @@ -1,27 +1,27 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeInference +// #Regression #Conformance #ObjectOrientedTypes #TypeInference // Verify type kind inference based on type members -module TypeInference +module TypeInference // val binding / explicit field [] -type TK_C_003 = +type TK_C_003 = val a : obj // object constructor [] -type TK_C_004 = +type TK_C_004 = new() = {} // explicit object constructor + implicit constructor [] -type TK_C_005() = +type TK_C_005() = new(s:string) = new TK_C_005() // implicit constructor [] type TK_C_006() = class end - + // let binding [] type TK_C_007(o:obj) = @@ -42,8 +42,8 @@ type TK_C_009(o:obj) = [] type TK_C_010(o:obj) = static do System.Console.WriteLine() - -// non-abstract instance member + +// non-abstract instance member [] type TK_C_011 = member x.m(b:bool) = 0 @@ -53,18 +53,18 @@ type TK_C_011 = type TK_C_012 = static member m(c:char) = 0 -// non-abstract override member +// non-abstract override member [] -type TK_C_013 = +type TK_C_013 = override m.ToString()= "TK_C_006" - -// inherits decl + +// inherits decl [] -type TK_C_014() = +type TK_C_014() = inherit TK_C_006() // inherit interface + concrete element // 2594 & 1978 -type TK_I_003 = +type TK_I_003 = abstract M: unit -> string [] @@ -72,9 +72,9 @@ type TK_C_015() = interface TK_I_003 with member x.M() = "M" - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_003")).IsClass a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_004")).IsClass a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_005")).IsClass @@ -88,9 +88,9 @@ try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_013")).IsClass a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_014")).IsClass a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_C_015")).IsClass -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface001.fs index a142a3d44d9..69e63d15178 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface001.fs @@ -1,24 +1,24 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of Type Kind Attributes -module TypeInference +module TypeInference [] type TK_I_000 = interface end - + //[] //type TK_I_001 = let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_I_000")).IsInterface -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface001e.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface001e.fs index eaca7822806..d6975c28671 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface001e.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface001e.fs @@ -1,15 +1,15 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeInference +// #Regression #Conformance #ObjectOrientedTypes #TypeInference // attribute must match interface-end decl //The kind of the type specified by its attributes does not match the kind implied by its definition //The kind of the type specified by its attributes does not match the kind implied by its definition -module TypeInference +module TypeInference [] type TK_I_000E = class end - + [] type TK_I_001E = struct diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface002.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface002.fs index f469783fa7a..0ba7a176c2b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface002.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface002.fs @@ -1,19 +1,19 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of Type Kind Attributes -module TypeInference +module TypeInference [] type TK_I_001 = interface end let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_I_001")).IsInterface -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if a then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface002e.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface002e.fs index 05074e12def..3e27bf113d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface002e.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface002e.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeInference +// #Regression #Conformance #ObjectOrientedTypes #TypeInference // attribute must match inferred type //The kind of the type specified by its attributes does not match the kind implied by its definition //Structs, interfaces, enums and delegates cannot inherit from other types @@ -8,7 +8,7 @@ //Cannot inherit from interface type\. Use interface \.\.\. with instead // An interface -type TK_I_003 = interface +type TK_I_003 = interface end @@ -16,17 +16,17 @@ type TK_I_003 = interface type TK_I_004a = TK_I_003 [] -type TK_I_004b = +type TK_I_004b = inherit TK_I_003 - -// Another interface + +// Another interface type TK_I_005 = abstract M : unit -> unit [] type TK_I_006a = TK_I_005 - + [] -type TK_I_006b = +type TK_I_006b = inherit TK_I_005 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003.fs index 3103ac46156..db058ef4571 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003.fs @@ -1,20 +1,20 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of interface/end -module TypeInference +module TypeInference type TK_I_002 = interface end - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_I_002")).IsInterface -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if a then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs index e56e6266453..b8d542f9fe8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeInference +// #Regression #Conformance #ObjectOrientedTypes #TypeInference // attribute must match inferred type @@ -10,13 +10,13 @@ [] type TK_C_000 = abstract M : int -> int - + [] type TK_I_005 = abstract M : unit -> unit [] -type TK_I_007 = +type TK_I_007 = inherit TK_C_000 - + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface004.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface004.fs index a7df7507621..cc283955b94 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface004.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface004.fs @@ -1,37 +1,37 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify inference based on type members -module TypeInference +module TypeInference type TK_I_003 = interface end type TK_I_004 = inherit TK_I_003 - + type TK_I_005 = abstract M : unit -> unit - -type TK_I_006 = + +type TK_I_006 = inherit TK_I_005 // this is a negative testcase //[] //type TK_C_000 = // abstract M : int -> int -//type TK_I_007 = +//type TK_I_007 = // inherit TK_C_000 - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_I_003")).IsInterface a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_I_004")).IsInterface a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_I_005")).IsInterface a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_I_006")).IsInterface -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct001.fs index b5e94e326b9..fd6073dc8fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct001.fs @@ -1,7 +1,7 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of Type Kind Attributes -module TypeInference +module TypeInference [] @@ -9,22 +9,22 @@ type TK_S_000 = struct val StructsMustContainAtLeastOneField: int end - + [] type TK_S_001 = val StructsMustContainAtLeastOneField: int - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_S_000")).IsValueType a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_S_001")).IsValueType -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct001e.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct001e.fs index caadbfda813..65bebbc903e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct001e.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct001e.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeInference +// #Regression #Conformance #ObjectOrientedTypes #TypeInference // attribute must match struct-end //kind.*does not match @@ -10,20 +10,20 @@ //infer_interface001e.fs(22,6): error FS0191: The kind of the type specified by //its attributes does not match the kind implied by its definition. -module TypeInference +module TypeInference [] type TK_S_000 = class end - + [] type TK_S_001 = interface end - - + + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct002.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct002.fs index 54045216000..2880f2df10d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct002.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct002.fs @@ -1,21 +1,21 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of Type Kind Attributes -module TypeInference +module TypeInference [] type TK_S_001 = val StructsMustContainAtLeastOneField: int - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_S_001")).IsValueType -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct002e.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct002e.fs index 10fc350f9f4..31e536ecfb4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct002e.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct002e.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #TypeInference +// #Regression #Conformance #ObjectOrientedTypes #TypeInference // attribute must match inferred type-kind //kind.*does not match @@ -15,7 +15,7 @@ type TK_S_001 = struct val StructsMustContainAtLeastOneField: int end - + [] [] type TK_S_002 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct003.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct003.fs index e90a53231cb..f42f44e013c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct003.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_struct003.fs @@ -1,21 +1,21 @@ -// #Conformance #ObjectOrientedTypes #TypeInference +// #Conformance #ObjectOrientedTypes #TypeInference // Verify the use of struct/end -module TypeInference +module TypeInference type TK_S_002 = struct val StructsMustContainAtLeastOneField: int end - + let mutable a = false -try +try a <- (System.Reflection.Assembly.GetExecutingAssembly().GetTypes() |> Array.find (fun t -> t.FullName = "TypeInference+TK_S_002")).IsValueType -with - | _ as e -> +with + | _ as e -> printfn "%A" e a <- false - + (if (a) then 0 else 1) |> exit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/OverloadResolutionPriority/ORPTestRunner.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/OverloadResolutionPriority/ORPTestRunner.fs index cf2cc06896e..b7a1dd1fcdf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/OverloadResolutionPriority/ORPTestRunner.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/OverloadResolutionPriority/ORPTestRunner.fs @@ -16,20 +16,20 @@ let test (name: string) (expected: string) (actual: string) = let testBasicPriority () = test "Higher priority wins over lower" "priority-2" (BasicPriority.Invoke("test")) - + test "Negative priority deprioritizes" "current" (NegativePriority.Legacy("test")) - + test "Multiple negative priority levels" "new" (NegativePriority.Obsolete(42)) - + test "Priority overrides concreteness" "generic-high-priority" (PriorityVsConcreteness.Process(42)) - + test "Default priority is 0" "mixed-priority" (DefaultPriority.Mixed("test")) // Per-declaring-type Extension Tests let testExtensions () = test "Extension type B priority" "TypeB-priority2" (ExtensionTypeB.ExtMethod("hello", 42)) - + let x = 42 test "Per-type extension priority" "ModuleB-int-priority2" (x.Transform()) @@ -37,9 +37,9 @@ let testExtensions () = let testSamePriorityTiebreakers () = test "Same priority - int wins by concreteness" "int" (SamePriorityTiebreaker.Process(42)) - + test "Same priority - string wins by concreteness" "string" (SamePriorityTiebreaker.Process("hello")) - + test "Same priority - int[] wins by concreteness" "int-array" (SamePriorityArrayTypes.Handle([|1; 2; 3|])) // Inheritance Tests @@ -47,7 +47,7 @@ let testSamePriorityTiebreakers () = let testInheritance () = let derived = DerivedClassWithNewMethods() test "Derived new method highest priority" "DerivedNew-int-priority2" (derived.Method(42)) - + let derivedBase = DerivedClass() test "Base priority respected in derived" "Derived-string" (derivedBase.Method("test")) @@ -56,7 +56,7 @@ let testInheritance () = let testInstanceMethods () = let obj = InstanceOnlyClass() test "Instance method priority" "object-priority2" (obj.Call("hello")) - + let target = TargetClass() test "Extension adds new overload" "Extension-int-priority2" (target.DoWork(42)) @@ -70,7 +70,7 @@ let testExplicitVsImplicit () = let testComplexGenerics () = test "Complex generics - fully generic wins" "fully-generic-priority2" (ComplexGenerics.Process(1, 2)) - + test "Complex generics - partial match" "fully-generic-priority2" (ComplexGenerics.Process("hello", 42)) // F# Code USING the ORP attribute (defining overloads with ORP) @@ -78,16 +78,16 @@ let testComplexGenerics () = type FSharpWithORP = [] static member Greet(o: obj) = "fsharp-obj-priority2" - + [] static member Greet(s: string) = "fsharp-string-priority0" - + static member Greet(i: int) = "fsharp-int-default" type FSharpGenericPriority = [] static member Process<'T>(x: 'T) = "fsharp-generic-priority1" - + [] static member Process(x: int) = "fsharp-int-priority0" @@ -96,15 +96,15 @@ module FSharpExtensions = type System.String with [] member this.FsExtend(x: obj) = "fsharp-ext-obj-priority1" - + [] member this.FsExtend(x: int) = "fsharp-ext-int-priority0" let testFSharpUsingORP () = test "F# ORP - obj wins by priority" "fsharp-obj-priority2" (FSharpWithORP.Greet("hello")) - + test "F# ORP - generic wins by priority" "fsharp-generic-priority1" (FSharpGenericPriority.Process(42)) - + test "F# extension ORP - obj wins by priority" "fsharp-ext-obj-priority1" ("test".FsExtend(42)) // Virtual Base ORPA Inheritance Tests @@ -129,43 +129,43 @@ let testVirtualBaseOrpa () = let main _ = printfn "Running OverloadResolutionPriority tests..." printfn "" - + printfn "=== Basic Priority Tests ===" testBasicPriority () printfn "" - + printfn "=== Extension Tests ===" testExtensions () printfn "" - + printfn "=== Same Priority Tiebreaker Tests ===" testSamePriorityTiebreakers () printfn "" - + printfn "=== Inheritance Tests ===" testInheritance () printfn "" - + printfn "=== Instance Method Tests ===" testInstanceMethods () printfn "" - + printfn "=== Explicit vs Implicit Zero Tests ===" testExplicitVsImplicit () printfn "" - + printfn "=== Complex Generics Tests ===" testComplexGenerics () printfn "" - + printfn "=== F# Using ORP Attribute Tests ===" testFSharpUsingORP () printfn "" - + printfn "=== Virtual Base ORPA Tests ===" testVirtualBaseOrpa () printfn "" - + printfn "========================================" if failures = 0 then printfn "All tests passed!" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs index b92c1e57c29..e22ad69c481 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs @@ -16,7 +16,7 @@ module And = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/And) [] let ``And - andPattern02_fs - --test:ErrorRanges`` compilation = @@ -26,7 +26,7 @@ module And = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/And) [] let ``And - andPattern03_fs - --test:ErrorRanges`` compilation = @@ -36,7 +36,7 @@ module And = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + [] let ``And - andPattern04_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs index d5e22da3cc0..8105029a4cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #PatternMatchingGuards +// #Regression #Conformance #PatternMatching #PatternMatchingGuards @@ -7,5 +7,5 @@ let test input = match input with | (1, _) & (_, 1) -> 1 | (x, _) & (_, x) -> 2 - + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern01.fs index 0f813e6e44e..43fd8b71f52 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #PatternMatchingGuards +// #Conformance #PatternMatching #PatternMatchingGuards // Verify that and patterns must match both sides diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern02.fs index 5d9f888acb3..bc2e2c77c75 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern02.fs @@ -1,11 +1,11 @@ -// #Conformance #PatternMatching #PatternMatchingGuards +// #Conformance #PatternMatching #PatternMatchingGuards // Verify multiple pattern parts can introduce new identifiers type Foo = | A of int | B of string * int - + let (|ToString|) x = match x with A x | B(_,x) -> x.ToString() let test v = @@ -13,7 +13,7 @@ let test v = | A(x) & ToString (vToStr) when x = vToStr.Length -> true | B(str, value) & ToString (vToStr) when str = vToStr -> true | _ -> false - + if test (A(1)) <> true then exit 1 if test (B("123", 123)) <> true then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern03.fs index 7bd7fa66eac..11a6503cb82 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern03.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #PatternMatchingGuards +// #Conformance #PatternMatching #PatternMatchingGuards open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern04.fs index ee196ba07e4..e3b40b1adff 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern04.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #PatternMatchingGuards +// #Conformance #PatternMatching #PatternMatchingGuards open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs index 190b12d316d..08c540e9f13 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs @@ -16,7 +16,7 @@ module Array = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Array) [] let ``Array - arrayMatch02_fs - --test:ErrorRanges`` compilation = @@ -26,7 +26,7 @@ module Array = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Array) [] let ``Array - arrayMatch03_fs - --test:ErrorRanges`` compilation = @@ -36,7 +36,7 @@ module Array = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Array) [] let ``Array - TrailingSemi01_fs - --test:ErrorRanges`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/TrailingSemi01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/TrailingSemi01.fs index fe528b16f3c..7860ccf50ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/TrailingSemi01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/TrailingSemi01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Arrays +// #Regression #Conformance #PatternMatching #Arrays // Verify ability to match a list, array, or record with trailing semicolon @@ -18,11 +18,11 @@ if List.length list2 <> 4 then exit 1 // ---------------------------------------- let array1 = [| 1;2;3;4; |] -let array2 = [| +let array2 = [| 5; 6; 7; - 8; + 8; |] if Array.length array1 <> 4 then exit 1 @@ -57,7 +57,7 @@ let isList2 x = match x with | [5; 6; 7; 8;] -> true | _ -> false - + if not (isList1 list1) then exit 1 if not (isList2 list2) then exit 1 @@ -76,7 +76,7 @@ let isArray2 x = match x with | [| 5; 6; 7; 8; |] -> true | _ -> false - + if not (isArray1 array1) then exit 1 if not (isArray2 array2) then exit 1 @@ -90,12 +90,12 @@ let isRecord1 x = } -> true | _ -> false -let isRecord2 x = +let isRecord2 x = match x with | { label1 = 2; label2 = 3; } -> true | _ -> false - - + + if not (isRecord1 record1) then exit 1 if not (isRecord2 record2) then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch01.fs index 3d7adc83ac6..47e734dd72a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Arrays +// #Conformance #PatternMatching #Arrays // Verify ability to match against arrays diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch02.fs index dd7c3724d65..cc6d4410965 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Arrays +// #Conformance #PatternMatching #Arrays // Verify ability to match against empty arrays diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch03.fs index 0c5c3052dfe..d42281f8785 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch03.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Arrays +// #Conformance #PatternMatching #Arrays // Verify ability to match against null arrays diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs index 20001300465..244a62245e0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs @@ -16,7 +16,7 @@ module As = |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/As) [] let ``Simple - asPattern02_fs - --test:ErrorRanges`` compilation = @@ -26,7 +26,7 @@ module As = |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + [] let ``As patterns``() = Fsx """ @@ -40,7 +40,7 @@ module As = |> withLangVersion80 |> compileExeAndRun |> shouldSucceed - + [] [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern01.fs index 742db570f81..ae560fe8f10 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching let t1 = (1, 2) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern02.fs index 834c47b0a6f..76d868f5a93 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern02.fs @@ -1,13 +1,13 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Verify 'as pattern' construct -let test x = +let test x = match x with - | (1, _) | (_, 2) as result - -> if fst result <> 1 && - snd result <> 2 then + | (1, _) | (_, 2) as result + -> if fst result <> 1 && + snd result <> 2 then false else true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs index 6292d3b78fa..c528e0089f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs @@ -16,7 +16,7 @@ module ConsList = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/ConsList) [] let ``ConsList - E_consOnNonList_fs - --test:ErrorRanges`` compilation = @@ -36,7 +36,7 @@ but here has type but here has type ''a list' " ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/ConsList) [] let ``ConsList - E_consPattern01_fs - --test:ErrorRanges`` compilation = @@ -50,7 +50,7 @@ but here has type 'int' but here has type ''a list' ") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/ConsList) [] let ``ConsList - OutsideMatch01_fs - --test:ErrorRanges`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs index e0506e3f3af..fb39f4860e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs @@ -3,12 +3,12 @@ // Verify that a '[]' is only valid at the end of a list in a cons pattern // This is OK. Type inference will pick up that this x is a generic list of lists. -let test x = +let test x = match x with | firstele :: secondele :: thirdele :: fourthele -> 0//firstele + secondele | firstele :: [] :: thirdele -> 0//first + thirdele | _ -> 0 - + let test2 (x : int list) = match x with | fst :: snd :: tail -> fst + snd diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/incompleteMatchesLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/incompleteMatchesLiteral01.fs index 2397eeee743..b2057268ada 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/incompleteMatchesLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/incompleteMatchesLiteral01.fs @@ -3,7 +3,7 @@ let One = 1m [] let Two = 2m -let test() = +let test() = match 3m with | 0m -> false | One | Two -> false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/literal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/literal01.fs index 273817b3db1..a13485cca27 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/literal01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/literal01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Pattern match decimal literals diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs index e385b278597..2ed02b24e3c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests // Verify ability to specify an integer array in a dynamic type test diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs index 79fa9270343..eb943d844f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs @@ -117,7 +117,7 @@ involves an indeterminate type based on information prior to this program point. |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) [] let ``DynamicTypeTest - Regression02_fs - --test:ErrorRanges`` compilation = @@ -198,4 +198,3 @@ involves an indeterminate type based on information prior to this program point. |> withDiagnostics [ (Warning 26, Line 8, Col 7, Line 8, Col 12, "This rule will never be matched") ] - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs index 1e67a33ff1b..dde668e8c59 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #TypeTests +// #Regression #Conformance #PatternMatching #TypeTests // Verify error associated with doing a dynamic type @@ -7,7 +7,7 @@ // Error, x has type 'a and cannot be used in a dynamic type test. -let f x = +let f x = match x with | :? obj as o -> true | _ -> false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTest03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTest03.fs index 1099c5b6045..de7dcf61ab7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTest03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTest03.fs @@ -1,7 +1,7 @@ type A() = class end type B1() = inherit A() - + let stuff(x: obj) = match x with | :? A -> 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs index a9ed5014e6e..15cc4667e84 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #PatternMatching #TypeTests +// #Regression #Conformance #PatternMatching #TypeTests -// Verify error when using a dynamic type test on +// Verify error when using a dynamic type test on // type without any proper sub types. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs index 7c3c7bc0d8e..5ee0e605e31 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests // type Foo () = class end @@ -13,7 +13,7 @@ let test1() = | false, :? Bar -> 1 // Shouldn't match, true <> false | _, :? Foo -> 2 // Should return 2 | _ -> 3 // Unexplored - + let test2() = match instOfBox, true with | :? Bar, false -> 1 // Shouldn't match, false <> true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs index 1b7aa18f973..dba655852e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests // Verify you can use a dynamic type test against unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs index eda733bb314..fe9bfc78c1b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs @@ -1,17 +1,17 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests // Perform multiple dynamic type tests at once let printCode x y = match box x, box y with - | (:? int as ix), (:? int as iy) + | (:? int as ix), (:? int as iy) -> sprintf "%d-%d" ix iy - | (:? string as sx), (:? string as sy) + | (:? string as sx), (:? string as sy) -> sprintf "%s-%s" sx sy - | (:? int as ix), (:? string as sy) + | (:? int as ix), (:? string as sy) -> sprintf "%d-%s" ix sy - | (:? string as sx), (:? int as iy) + | (:? string as sx), (:? int as iy) -> sprintf "%s-%d" sx iy | _ -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs index eb720acbfe7..cb68680fb97 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #TypeTests +// #Regression #Conformance #PatternMatching #TypeTests // FSB 1488, Implement redundancy checking for dynamic type test patterns @@ -6,16 +6,16 @@ -let _ = - match box "3" with - | :? string -> 1 +let _ = + match box "3" with + | :? string -> 1 | :? string -> 1 // check this rule is marked as 'never be matched' | _ -> 2 - -let _ = - match box "3" with - | :? System.IComparable -> 1 + +let _ = + match box "3" with + | :? System.IComparable -> 1 | :? string -> 1 // check this rule is marked as 'never be matched' | _ -> 2 - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs index c1ec3b8938f..ce2d6b91575 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #TypeTests +// #Regression #Conformance #PatternMatching #TypeTests // Verify warning for when dynamic type test will always hold. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs index e64258441ca..afcb0f2797e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests // Verify result of dynamic type test on sealed type. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs index 8e338452254..1b31620f1ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests open System @@ -7,7 +7,7 @@ open System let testException (ex : obj) = let orgType = ex.GetType().ToString() match ex with - | :? System.NotSupportedException as dynamicType -> + | :? System.NotSupportedException as dynamicType -> let typeStr = dynamicType.GetType().ToString() if typeStr <> orgType then false @@ -20,7 +20,7 @@ let testException (ex : obj) = else true | _ -> false - + if testException (new ArgumentException("") :> obj) <> true then exit 1 if testException (new NotSupportedException("") :> obj) <> true then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs index 9cd92eaeecf..1eaa6454bda 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests open System @@ -12,20 +12,20 @@ type Ellipse() = inherit Shape() override this.VirtMember() = "ellipse" member this.StaticMember() = "ellipse" - + type Circle() = inherit Shape() override this.VirtMember() = "circle" member this.StaticMember() = "circle" -let test1 (x:obj) = +let test1 (x:obj) = match x with | :? Circle -> 1 | :? Ellipse -> 2 | :? Shape -> 3 | _ -> 4 -let test2 (x:obj) = +let test2 (x:obj) = match x with | :? Shape -> 1 | :? Ellipse -> 2 @@ -35,11 +35,11 @@ let test2 (x:obj) = if test1 (new Circle() :> obj) <> 1 then exit 1 if test1 (new Ellipse() :> obj) <> 2 then exit 1 if test1 (new Shape() :> obj) <> 3 then exit 1 -if test1 ("foo" :> obj) <> 4 then exit 1 +if test1 ("foo" :> obj) <> 4 then exit 1 if test2 (new Circle() :> obj) <> 1 then exit 1 if test2 (new Ellipse() :> obj) <> 1 then exit 1 if test2 (new Shape() :> obj) <> 1 then exit 1 -if test2 ("foo" :> obj) <> 4 then exit 1 +if test2 ("foo" :> obj) <> 4 then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs index 6b643d04d97..34f4b0e5dd1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #TypeTests +// #Regression #Conformance #PatternMatching #TypeTests // FSB 1034, Downcasting for interface types // This test verifies that dynamic type test patterns work on objects which cannot // statically be checked if they implement the interface. (For example, A implements IFoo and IBar @@ -16,15 +16,15 @@ type IAges = interface type Car(modelYear : int) = let mutable m_miles = 0 let Odometer = m_miles - + interface IAge with member this.Age = 2008 - modelYear interface IAges with member this.GrowOlder x = m_miles <- m_miles + x - + type Person(yearBorn : int) = let mutable m_yearsOld = 2008 - yearBorn - + interface IAge with member this.Age = m_yearsOld @@ -48,7 +48,7 @@ let totalAge (iAgeList : IAge list) = iAgeList |> List.map (fun iage -> iage.Age let rec ageOneYear (l:IAge list) = match l with | (:? IAges as agingThing) :: tl -> agingThing.GrowOlder 1 - ageOneYear tl + ageOneYear tl | hd :: tl -> ageOneYear tl | [] -> () @@ -60,4 +60,4 @@ ageOneYear myStuff if totalAge myStuff <> 31 then exit 2 exit 0 - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs index ba3f23f7adb..9364251d38f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests let mutable testPassed = false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs index 13dd808e4aa..7cd522e19da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #TypeTests +// #Conformance #PatternMatching #TypeTests let listOfWhat (x : 'a list) = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs index 6c200dc3b4b..35d0569ac90 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Regression test for FSHARP1.0:2034 module TestModule -let f x = +let f x = match x with // warning FS0025: Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s) | 1 -> 7 | 2 -> 49 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs index 7aba44ae432..1c66d5c7297 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs @@ -15,7 +15,7 @@ module Expression = |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck - |> shouldFail + |> shouldFail |> withSingleDiagnostic (Warning 25, Line 7, Col 11, Line 7, Col 12, "Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) @@ -61,7 +61,7 @@ module Expression = |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck - |> shouldFail + |> shouldFail |> withDiagnostics [ (Warning 25, Line 14, Col 10, Line 14, Col 18, "Incomplete pattern matches on this expression. For example, the value '\"a\"' may indicate a case not covered by the pattern(s).") (Warning 25, Line 18, Col 10, Line 18, Col 18, "Incomplete pattern matches on this expression. For example, the value '0.0' may indicate a case not covered by the pattern(s).") @@ -79,7 +79,7 @@ module Expression = |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck - |> shouldFail + |> shouldFail |> withDiagnostics [ (Warning 104, Line 14, Col 10, Line 14, Col 18, "Enums may take values outside known cases. For example, the value 'enum (2)' may indicate a case not covered by the pattern(s).") (Warning 25, Line 18, Col 10, Line 18, Col 18, "Incomplete pattern matches on this expression. For example, the value 'T.Y' may indicate a case not covered by the pattern(s).") @@ -97,7 +97,7 @@ module Expression = |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck - |> shouldFail + |> shouldFail |> withDiagnostics [ (Warning 25, Line 11, Col 9, Line 11, Col 10, "Incomplete pattern matches on this expression. For example, the value '1' may indicate a case not covered by the pattern(s). However, a pattern rule with a 'when' clause might successfully match this value.") ] @@ -131,7 +131,7 @@ module Expression = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) [] let ``Expression - whenGuardss02_fs - --test:ErrorRanges`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs index 920200ca911..d460d8e0159 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Regression test for DevDiv:198999 ("Warning messages for incomplete matches involving enum types are wrong") // Not really regression tests for the bug, but these 2 cases cover code that was touched // @@ -14,7 +14,7 @@ let h1 = | :? System.NotFiniteNumberException -> () // Unterminated try-with in a computation expr -let a = +let a = async { try () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs index 0a9a8c17b4e..d1ebe4f4835 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Regression test for DevDiv:198999 ("Warning messages for incomplete matches involving enum types are wrong") //Incomplete pattern matches on this expression\. For example, the value '"a"' may indicate a case not covered by the pattern\(s\)\.$ //Incomplete pattern matches on this expression\. For example, the value '0\.0' may indicate a case not covered by the pattern\(s\)\.$ @@ -10,7 +10,7 @@ module M type T = | X = 0 | Y = 1 - + let f1 = function | "X" -> T.X | "Y" -> T.Y diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs index f93dab37adb..4a7143f7290 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Regression test for DevDiv:198999 ("Warning messages for incomplete matches involving enum types are wrong") //Enums may take values outside known cases\. For example, the value 'enum \(2\)' may indicate a case not covered by the pattern\(s\)\.$ //Incomplete pattern matches on this expression\. For example, the value 'T.Y' may indicate a case not covered by the pattern\(s\)\.$ @@ -10,10 +10,10 @@ module M type T = | X = 0 | Y = 1 - + let g1 = function - | T.X -> "X" - | T.Y -> "y" + | T.X -> "X" + | T.Y -> "y" let g2 = function | T.X -> 1. @@ -28,5 +28,5 @@ let g5 = function | T.X -> [1 ; 2] let g6 = function - | T.X -> [|1 ; 2|] + | T.X -> [|1 ; 2|] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs index 11541227240..e278c217692 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching module TestModule // Regression testcase for FSharp 1.0: 2070 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs index aba02e5d1ee..2c1eb18fac1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Verify the first vertical bar in a pattern match is optional. @@ -10,7 +10,7 @@ let test2 x = "0" -> 0 | "1" -> 1 | _ -> -1 - + if (test1 "0") <> (test2 "0") then exit 1 if (test1 "1") <> (test2 "1") then exit 1 if (test1 "2") <> (test2 "2") then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns02.fs index f033db4f86c..45bb89726bf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Verify ability to match just a single identifier diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards01.fs index a1fd1cb057c..c43a97cde8f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards01.fs @@ -1,20 +1,20 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching -// Test that when guards only execute once the match value has +// Test that when guards only execute once the match value has // matched the pattern associated with the rule. let mutable m_flag = 0 let flagSet() = m_flag = 1 let resetFlag() = m_flag <- 0 -let testMatch x = +let testMatch x = match x with | 1 when (m_flag <- 1; true) -> 1 | 2 when (m_flag <- 1; false) -> 2 | _ -> 0 - - + + // 0 should hit the wildcard, and testMatch should return 0 resetFlag() if testMatch 0 <> 0 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards02.fs index 14611b11a1b..a07e9f79432 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards02.fs @@ -1,9 +1,9 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Verify that if the when guard fails, that pattern is not matched. -let complexXOR x y = +let complexXOR x y = match x with | true when not y -> true | false when y -> true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss01.fs index a1fd1cb057c..c43a97cde8f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss01.fs @@ -1,20 +1,20 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching -// Test that when guards only execute once the match value has +// Test that when guards only execute once the match value has // matched the pattern associated with the rule. let mutable m_flag = 0 let flagSet() = m_flag = 1 let resetFlag() = m_flag <- 0 -let testMatch x = +let testMatch x = match x with | 1 when (m_flag <- 1; true) -> 1 | 2 when (m_flag <- 1; false) -> 2 | _ -> 0 - - + + // 0 should hit the wildcard, and testMatch should return 0 resetFlag() if testMatch 0 <> 0 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss02.fs index 14611b11a1b..a07e9f79432 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss02.fs @@ -1,9 +1,9 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Verify that if the when guard fails, that pattern is not matched. -let complexXOR x y = +let complexXOR x y = match x with | true when not y -> true | false when y -> true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs index a33f0d712b7..41929d7cea0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify active patterns can be used outside of a match statement // This is really needed to make sure the test runs fine on non-ENU boxes! diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs index 2203d8a686d..03d0db6a675 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify active patterns outside of match statement diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs index 40d9a92b90d..9da5000dda2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs @@ -1,13 +1,13 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:5590 // Note that the real test is E_ActivePatternUnconstrained01.fs // This ones shows just one way to make the code compile again -let (|A1|A2|A3|) (inp:int) : Choice = +let (|A1|A2|A3|) (inp:int) : Choice = printfn "hello" printfn "hello" A1 -let f2 x = match x with A1 -> 1 | A2 -> 2 | A3 -> 3 +let f2 x = match x with A1 -> 1 | A2 -> 2 | A3 -> 3 f2 3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs index 033e0420565..34844d8dda0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify ability to treat active patterns like higher-order functions diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs index 9d323f7b4e0..b0126771ca7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for https://github.com/Microsoft/visualfsharp/issues/5745 //Active patterns do not have fields. This syntax is invalid\. open System.Text.RegularExpressions @@ -6,7 +6,7 @@ open System.Text.RegularExpressions let (|USZipPlus4Code|_|) s = let m = Regex.Match(s, @"^(\d{5})\-(\d{4})$") if m.Success then - USZipPlus4Code(x=m.Groups.[1].Value, + USZipPlus4Code(x=m.Groups.[1].Value, y=m.Groups.[2].Value) |> Some else diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFunction.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFunction.fs index e9d1703943b..8849c6d3547 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFunction.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFunction.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:5590 //Active pattern '|A|B|' is not a function$ //Active pattern '|C|' is not a function$ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs index 86e8689d061..30e2a88fb6d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:5590 // This code used to compile, but fail peverification // Now, it just does not compile anymore telling the user to annotated it a bit. //The result of this expression has type 'int' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ //Active pattern '\|A1\|A2\|A3\|' has a result type containing type variables that are not determined by the input\. The common cause is a when a result case is not mentioned, e\.g\. 'let \(\|A\|B\|\) \(x:int\) = A x'\. This can be fixed with a type constraint, e\.g\. 'let \(\|A\|B\|\) \(x:int\) : Choice = A x'$ -let (|A1|A2|A3|) (inp:int) : Choice = +let (|A1|A2|A3|) (inp:int) : Choice = printfn "hello" printfn "hello" A1 -let f2 x = match x with A1 -> 1 | A2 -> 2 | A3 -> 3 +let f2 x = match x with A1 -> 1 | A2 -> 2 | A3 -> 3 f2 3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs index c20b4fa442a..438eac88d5c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Verify error if Active Patterns do not start with an upper case letter diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs index 8fe994b2f3d..c1d9a7b0e3a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Verify error if Active Patterns used with named parameters diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec01.fs index 7269796810b..d752686cb72 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This expression was expected to have type. 'Choice<'a,'b>' .but here has type. 'string' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec02.fs index c135beefc1a..8f887c937c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This is not a valid name for an active pattern let rec (|Foo2|Bar2|_|) (a:int) x = "BAD DOG!" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec03.fs index e39c8fb59bd..566fab2cd31 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This is not a valid name for an active pattern -let rec (|Foo2b|Bar2b|Baz2b|_|) (a:int) x = "BAD DOG!" +let rec (|Foo2b|Bar2b|Baz2b|_|) (a:int) x = "BAD DOG!" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec04.fs index 5ed84d6a36e..22d30689742 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This expression was expected to have type. ''a option' .but here has type. 'string' let rec (|Foo3|_|) (a:int) x = "BAD DOG!" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam01.fs index 25f75485341..9c4d21bdf99 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This expression was expected to have type. 'Choice<'a,'b>' .but here has type. 'string' let (|Foo|Bar|) x = "BAD DOG!" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam02.fs index 1ed1e40e379..c785de43d7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This is not a valid name for an active pattern let (|Foo2|Bar2|_|) x = "BAD DOG!" // expect: invalid name for an active pattern diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam03.fs index 4387147760d..37e0119af56 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This is not a valid name for an active pattern let (|Foo2b|Bar2b|Baz2b|_|) x = "BAD DOG!" // expect: type string doesn't match type 'choice' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam04.fs index 0553d6f6892..b7aee6aae78 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This expression was expected to have type. ''a option' .but here has type. 'string' let (|Foo3|_|) x = "BAD DOG!" // expect: type string doesn't match type 'option' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param01.fs index 067d07a46aa..afcdbef491a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This expression was expected to have type. 'Choice<'a,'b>' .but here has type. 'string' let (|Foo|Bar|) (a:int) x = "BAD DOG!" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param02.fs index 74ced64a2ed..8a08f805f45 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This is not a valid name for an active pattern let (|Foo2|Bar2|_|) (a:int) x = "BAD DOG!" // expect: invalid name for an active pattern diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param03.fs index 372bde3ce8c..06696717540 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This is not a valid name for an active pattern let (|Foo2b|Bar2b|Baz2b|_|) (a:int) x = "BAD DOG!" // expect: type string doesn't match type 'choice' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param04.fs index 4467425d462..93e4c12b729 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 //This expression was expected to have type. ''a option' .but here has type. 'string' let (|Foo3|_|) (a:int) x = "BAD DOG!" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs index ca65356eff9..c746e37aeba 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Verify error when defining an Active Pattern with more than seven 'values' // This is regression test for FSHARP1.0:3562 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs index 6eeb14906b9..805fc678976 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs @@ -1,24 +1,24 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Regression test for FSHARP1.0:4621 // Multi case partial active patterns are not allowed //The pattern discriminator 'Sentence' is not defined -let (|Sentence|Word|Punctuation|WhiteSpace|_|) (input : string) = - if input.Trim() = "" then +let (|Sentence|Word|Punctuation|WhiteSpace|_|) (input : string) = + if input.Trim() = "" then Some(WhiteSpace()) - elif input.IndexOf(" ") <> -1 then + elif input.IndexOf(" ") <> -1 then Some(Sentence (input.Split([|" "|], System.StringSplitOptions.RemoveEmptyEntries))) else match input with | "." | ";" | "," | ":" | "?" | "!" -> Some(Punctuation(input.ToCharArray().[0])) | _ -> Some(Word (input)) - + let test str = match str with | Sentence words -> words.Length // All words in sentence | Word word -> word.Length // Characters in word - | WhiteSpace -> 0 + | WhiteSpace -> 0 | Punctuation _ -> -1 | _ -> failwith "Should not happen" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs index f976faafcbe..364c42662e5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // Verify error cases for restrictions on active pattern parameters. @@ -11,7 +11,7 @@ let rec (|MCAP|MCAP2|) (times : int) (ip : string) = | 0 -> MCAP (ip + "!") | 1 -> MCAP2(ip + ".") | x -> (|MCAP|MCAP2|) (times - 1) (ip + "-") - + let _ = match "" with MCAP 0 "!" -> () | _ -> exit 1 exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs index a20ca0f6fd8..4de10ecce77 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // FSHARP1.0:5590 (see also FSHARP1.0:1104, which is where this source came from) //Incomplete pattern matches on this expression\.$ //Incomplete pattern matches on this expression\.$ @@ -12,20 +12,20 @@ open System.Reflection open Microsoft.FSharp.Reflection open Microsoft.FSharp.Quotations - + let (|MapDeclaringType|_|) (mi:#MemberInfo) : Option = failwith "" let (|CastToMemberInfo|) (mi:#MemberInfo) = (mi :> MemberInfo) let (|MethodCall|_|) (e:Expr) : Option = failwith "" let (|CtorCall|_|) (e:Expr) : Option = failwith "" -// Error when multicase active patterns result type doesn't correspond to input value +// Error when multicase active patterns result type doesn't correspond to input value let (|ClientExternalTypeUse|WillFail|) e = match e with | (MethodCall(MapDeclaringType(_, CastToMemberInfo(_)), _)) | (CtorCall(MapDeclaringType(_, CastToMemberInfo(_)), _)) -> failwith "" -// Error above doesn't apply for single case active patterns +// Error above doesn't apply for single case active patterns let (|ClientExternalTypeUse|_|) e = match e with | (MethodCall(MapDeclaringType(_, CastToMemberInfo(_)), _)) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs index 5d42029d628..450afd99e06 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Test ability to specify multiple active patterns in the same pattern match @@ -32,7 +32,7 @@ let (|Z|_|) x = if x = 'Z' then Some() else None let isLetter x = match x with - | A | B | C | D | E + | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs index ba48761e5f3..c6c6d5dcd4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs @@ -148,12 +148,12 @@ module Named = [] let ``Named - discUnion01_fs - --test:ErrorRanges`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] let ``Named - _DiscUnion01_fs - --test:ErrorRanges`` compilation = @@ -168,7 +168,7 @@ module Named = [] let ``Named - E_ActivePatternHasNoFields_fs - --test:ErrorRanges`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -299,7 +299,7 @@ but here has type [] let ``Named - E_ActivePatternUnconstrained01_fs - --test:ErrorRanges`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -309,7 +309,7 @@ but here has type (Warning 20, Line 14, Col 1, Line 14, Col 5, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") (Error 1210, Line 7, Col 6, Line 7, Col 16, "Active pattern '|A1|A2|A3|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice = A x'") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] let ``Named - E_Error_LetRec01_fs - --test:ErrorRanges`` compilation = @@ -390,7 +390,7 @@ but here has type [] let ``Named - E_Error_NonParam02_fs - --test:ErrorRanges`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -402,7 +402,7 @@ but here has type but here has type 'string' ") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] let ``Named - E_Error_NonParam03_fs - --test:ErrorRanges`` compilation = @@ -621,7 +621,7 @@ but here has type [] let ``Named - RecursiveActivePats_fs - --test:ErrorRanges`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral01.fs index 477aa4f779b..ed3a93a91f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Match against an enum const defined in another assembly @@ -12,10 +12,10 @@ let isWeekend day = -> false | DayOfWeek.Friday -> false | _ -> failwith "Invalid value" - - + + if isWeekend DayOfWeek.Saturday <> true then exit 1 exit 0 - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral02.fs index 2ad80f5ece6..91e635ec1e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify [] values can be used with active patterns @@ -11,19 +11,19 @@ let (|ToInt|) (input : string) = System.Int32.Parse(input) // Match the result of the active pattern against a literal value. let test1() = match " 101 " with - | ToInt OneHundred + | ToInt OneHundred -> // If it didn't match the literal, this would capture new // value 'OneHundred' and this would fire. exit 1 | _ -> () - + match " 100 " with | ToInt OneHundred -> () | _ -> exit 1 - + () - + // Run the test test1() @@ -36,20 +36,20 @@ let (|ConcatedWith|) (x : string) (y : string) (input : string) = let BarLiteral = "bar" [] -let BazLiteral = "baz" - +let BazLiteral = "baz" + let test2() = let barValue = "bar" let bazValue = "baz" - + match "foo" with | ConcatedWith barValue BazLiteral "foobarbaz" -> () | ConcatedWith barValue BazLiteral result -> printfn "%s" result; exit 1 - + match "foo" with | ConcatedWith BarLiteral bazValue "foobarbaz" -> () | ConcatedWith barValue BazLiteral result -> printfn "%s" result; exit 1 - + () // Run the etest diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParameterizedPartialActivePattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParameterizedPartialActivePattern01.fs index 9e6f43d2416..63a0dc0c3aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParameterizedPartialActivePattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParameterizedPartialActivePattern01.fs @@ -1,21 +1,21 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns -// Verify parameterized partial active patterns which return unit don't force you to +// #Regression #Conformance #PatternMatching #ActivePatterns +// Verify parameterized partial active patterns which return unit don't force you to // bind the result. // FSB 3502 let (|DivisibleByTwo|_|) x = - if x % 2 = 0 + if x % 2 = 0 then Some() else None let (|DivisibleByX|_|) x y = - if y % x = 0 + if y % x = 0 then Some() else None // Without this fix, you'd have to bind the result of 'DivisibleByX' so you'd write DivisibleByX 3 (), which is lame. -let divisibleBy x = +let divisibleBy x = match x with | DivisibleByTwo & DivisibleByX 3 & DivisibleByX 4 -> [2; 3; 4] | DivisibleByTwo & DivisibleByX 4 -> [2; 4] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs index bbdbf5ff11e..db2b51935b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // FSB 1103, bad code generation for active patterns from fswebtools example @@ -17,13 +17,13 @@ let (|MapDeclaringType|_|) (mi:#MemberInfo) : Option = Some(mi :> MemberInfo) let (|MethodCall|_|) (e:Expr) : Option = failwith "" let (|CtorCall|_|) (e:Expr) : Option = failwith "" - + let f e = match e with - | (MethodCall(MapDeclaringType(_), _)) + | (MethodCall(MapDeclaringType(_), _)) | (CtorCall(CastToMemberInfo(_), _)) -> failwith "" - + // Original bug was problem with PEVerify exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs index 3209496222f..63da0687874 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #ActivePatterns +// #Regression #Conformance #PatternMatching #ActivePatterns // FSHARP1.0:1104 // Bug's title: *** WARNING: basic block at end of method ends without a leave, branch, return or throw. Adding throw // Note: repro was updated with type annotation after fix for FSHARP1.0:5590 @@ -10,15 +10,15 @@ open System.Reflection open Microsoft.FSharp.Reflection open Microsoft.FSharp.Quotations - + let (|MapDeclaringType|_|) (mi:#MemberInfo) : Option = failwith "" let (|CastToMemberInfo|) (mi:#MemberInfo) = (mi :> MemberInfo) let (|MethodCall|_|) (e:Expr) : Option = failwith "" let (|CtorCall|_|) (e:Expr) : Option = failwith "" - + let (|ClientExternalTypeUse|_|) (e:Expr) : option= match e with - | (MethodCall(MapDeclaringType(_, CastToMemberInfo(_)), _)) + | (MethodCall(MapDeclaringType(_, CastToMemberInfo(_)), _)) | (CtorCall(MapDeclaringType(_, CastToMemberInfo(_)), _)) -> failwith "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/RecursiveActivePats.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/RecursiveActivePats.fs index 13e3bab584e..c1530d036ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/RecursiveActivePats.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/RecursiveActivePats.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Single Case @@ -6,13 +6,13 @@ let rec (|SCAP|) (x : obj) = match x with | :? string as sx -> sx + "-TERM" | x -> (|SCAP|) (x.ToString() + "-AP") - + if (|SCAP|) 5 <> "5-AP-TERM" then exit 1 -let _ = +let _ = match "foo" with | SCAP "foo-TERM" -> () | _ -> exit 1 - + // Multi-Case let rec (|MCAP|MCAP2|) (ip : string) = match ip with @@ -21,7 +21,7 @@ let rec (|MCAP|MCAP2|) (ip : string) = | "test1" -> (|MCAP|MCAP2|) "..." | "test2" -> (|MCAP|MCAP2|) "!!!" | _ -> failwith "" - + let _ = match "test1" with MCAP "..." -> () | _ -> exit 1 let _ = match "test2" with MCAP2 ("!!!", "!!!") -> () | _ -> exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns01.fs index 808b2aac2d2..20f109ac35d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Single case active pattern diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns02.fs index ae4abe80031..6cb118fd743 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Multi-case active pattern diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns03.fs index fa014a98c27..75158377ce7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns03.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Single case partial active pattern @@ -11,7 +11,7 @@ let isDayOfWeek x = match x with | DayOfWeek -> true | _ -> false - + if isDayOfWeek("red") <> false then exit 1 if isDayOfWeek("Fri") <> true then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns05.fs index 05a4e1ec337..15b772b1801 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns05.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns06.fs index 225eee776dd..a375229c8bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns06.fs @@ -1,3 +1,3 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns07.fs index 32197bf6e1a..ad1708b0ef0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns07.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify parameters into active patterns can be anything (as constrained by the pat-param grammar production) @@ -6,7 +6,7 @@ module OtherModule = type Foo = A of int | B of int let identifier = 42 -module ActivePatternTests = +module ActivePatternTests = // Null let (|StrLen1|) (param : obj) (input : string) = input.Length @@ -22,27 +22,27 @@ module ActivePatternTests = // Long-ident let (|StrLen4|) (param : OtherModule.Foo) (input : string) = let OtherModule.A(value)|OtherModule.B(value) = param in input.Length + value let test4 = match "foo" with StrLen4 (OtherModule.A(10)) 13 -> true | _ -> false - + // List type let (|StringLen5|) param (input : string) = (List.length param) + input.Length let test5 = match "foo" with StringLen5 [(1,1);(2,2)] 5 -> true | _ -> false - + // Tuple type let (|StringLen6|) (ip1,ip2,ip3) (input : string) = input.Length + ip1 + ip2 + ip3 let test6 = match "foo" with StringLen6 (1,2,3) 9 -> true | _ -> false - + // Type constraint // Not valid code //let (|StringLen7|) (param : obj) (input : string) = input.Length + param.ToString().Length //let test7 = match "foo" with StringLen7 ("bar" :> obj) 6 -> true | _ -> false - + let (|StringLen8|) (param : 'a list) (input : string) = input.Length + List.length param let test8 = match "foo" with StringLen8 ([] : int list) 3 -> true | _ -> false // Actual test open ActivePatternTests - + if not (test1 && test2 && test3 && test4 && test5 && test6 && (*test7 &&*) test8) then exit 1 - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns08.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns08.fs index 9883f378695..b5bc852ca8a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns08.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns08.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify able to mix active patterns with 'regular' patterns. @@ -7,7 +7,7 @@ let (|Odd|Even|) x = if x % 2 = 0 then Even else Odd let (|MultipleOf2|_|) x = if x % 2 = 0 then Some () else None let (|MultipleOfN|_|) (n:int) (x:int) = if x % n = 0 then Some () else None -let test x = +let test x = match x with | MultipleOfN 33 () -> 0 | Odd & MultipleOfN 5 () -> 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns09.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns09.fs index d87cd8e03e3..e9044576342 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns09.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns09.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify AND on active patterns with exceptions diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns10.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns10.fs index 2497edd8f22..a9a84adcb59 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns10.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns10.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify AND on incomplete active patterns with exceptions diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion01.fs index e0e50d34ace..8900f167dca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify ability to use wildcards when matching discriminated unions diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion02.fs index 39eb9d30fd0..920a947941d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #ActivePatterns +// #Conformance #PatternMatching #ActivePatterns // Verify ability to use a constant when matching discriminated unions @@ -6,17 +6,17 @@ type Foo = | A of int | B of string * int - + let test x = match x with | A(42) -> -42 | A(x) -> x | B("FSharp", _) -> "FSharp".Length * -1 | B(str, _) -> str.Length - + if test (A(10)) <> 10 then exit 1 if test (B("aaa",1)) <> 3 then exit 1 - + if test (A(42)) <> -42 then exit 1 if test (B("FSharp",2)) <> -6 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs index 1b453adfe41..fd43c72fc5b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Verify error when trying to match type against null if it doesn't support that diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs index 46fac3505cc..5e291a440e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs @@ -17,7 +17,7 @@ module Null = |> typecheck |> shouldFail |> withSingleDiagnostic (Error 43, Line 14, Col 7, Line 14, Col 11, "The type 'Foo' does not have 'null' as a proper value") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Null) [] let ``Null - matchNull01_fs - --test:ErrorRanges`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/matchNull01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/matchNull01.fs index 0795ffdcc0b..55c0b9a6517 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/matchNull01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/matchNull01.fs @@ -1,9 +1,9 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Verify ability to match against null -let isNull x = +let isNull x = match x with | null -> true | _ -> false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs index 2a48bf46849..0aa93dd01fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Records +// #Regression #Conformance #PatternMatching #Records // Verify error if two record types in a pattern match don't match // Verify error if type of a record field is incorrect. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs index 36010aa645e..fd432170eb8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Records +// #Regression #Conformance #PatternMatching #Records // Verify error if type of a record field is incorrect. @@ -8,5 +8,5 @@ let testMatch x = match x with | { X = 0; Y = 0} -> true | _ -> false - + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_SyntaxError01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_SyntaxError01.fs index 55931311be6..c7876ebb493 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_SyntaxError01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_SyntaxError01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #PatternMatching #Records +// #Regression #Conformance #PatternMatching #Records // Verify syntax error //Unexpected symbol '}' in pattern\. Expected '\.', '=' or other token\.$ type RecordType = { Value : int } -let test x = +let test x = match x with | { Value} -> true | _ -> false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs index 807025b3879..ce5dc248989 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs @@ -57,7 +57,7 @@ module Record = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) [] let ``Record - recordPatterns02_fs - --test:ErrorRanges`` compilation = @@ -67,7 +67,7 @@ module Record = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) [] let ``Record - structRecordPatterns01_fs - --test:ErrorRanges`` compilation = @@ -77,7 +77,7 @@ module Record = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) [] let ``Record - structRecordPatterns02_fs - --test:ErrorRanges`` compilation = @@ -87,4 +87,3 @@ module Record = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns01.fs index cb1ee83c9db..b185cf65cba 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Records +// #Conformance #PatternMatching #Records // Test ability to match records even if a subset of tags are specified. @@ -7,17 +7,17 @@ type Type = Plant | Animal | Mineral type Thing = {Name : string; Age : int; Type : Type} // Single part -let isAnimal thing = - match thing with - | {Type=Animal} -> true +let isAnimal thing = + match thing with + | {Type=Animal} -> true | _ -> false - + // Multi part let isSteve thing = match thing with | {Name = "Steve"; Age = 2} -> true | _ -> false - + let animal = {Name = "Steve"; Age = 2; Type = Animal} let plant = {Name = "Sunflower"; Age = 5; Type = Plant} diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns02.fs index dd74f2eeef6..dafdd7b97a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Records +// #Conformance #PatternMatching #Records // Verify ability to have nested patterns in record types @@ -12,7 +12,7 @@ let isYoung thing = | _ -> false let isMatch thing (thingName : string option) (thingAge : int option) = - // We can't extract the option value in a match and use it in the same statement, + // We can't extract the option value in a match and use it in the same statement, // so we first break open the optional values. let name = match thingName with Some(name) -> name | None -> "" let age = match thingAge with Some(age) -> age | None -> 0 @@ -31,7 +31,7 @@ let rock = {Name = "Gold"; Age = 500000; Type = Mineral} if isYoung animal <> true then exit 1 if isYoung rock <> false then exit 1 -if isMatch animal (Some("Steve")) (Some(2)) <> true then exit 1 +if isMatch animal (Some("Steve")) (Some(2)) <> true then exit 1 if isMatch animal (Some("Steve")) None <> true then exit 1 if isMatch animal (Some("NotSteve")) None <> false then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns01.fs index 1f2923b44e7..c66c38c9842 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Records +// #Conformance #PatternMatching #Records // Test ability to match records even if a subset of tags are specified. @@ -7,17 +7,17 @@ type Type = Plant | Animal | Mineral [] type Thing = {Name : string; Age : int; Type : Type} // Single part -let isAnimal thing = - match thing with - | {Type=Animal} -> true +let isAnimal thing = + match thing with + | {Type=Animal} -> true | _ -> false - + // Multi part let isSteve thing = match thing with | {Name = "Steve"; Age = 2} -> true | _ -> false - + let animal = {Name = "Steve"; Age = 2; Type = Animal} let plant = {Name = "Sunflower"; Age = 5; Type = Plant} diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns02.fs index 640e6bfb070..2c9ecb869a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Records +// #Conformance #PatternMatching #Records // Verify ability to have nested patterns in record types @@ -12,7 +12,7 @@ let isYoung thing = | _ -> false let isMatch thing (thingName : string option) (thingAge : int option) = - // We can't extract the option value in a match and use it in the same statement, + // We can't extract the option value in a match and use it in the same statement, // so we first break open the optional values. let name = match thingName with Some(name) -> name | None -> "" let age = match thingAge with Some(age) -> age | None -> 0 @@ -31,7 +31,7 @@ let rock = {Name = "Gold"; Age = 500000; Type = Mineral} if isYoung animal <> true then exit 1 if isYoung rock <> false then exit 1 -if isMatch animal (Some("Steve")) (Some(2)) <> true then exit 1 +if isMatch animal (Some("Steve")) (Some(2)) <> true then exit 1 if isMatch animal (Some("Steve")) None <> true then exit 1 if isMatch animal (Some("NotSteve")) None <> false then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/CodeGenReg01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/CodeGenReg01.fs index 04aea1eb7cc..8b57d94af24 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/CodeGenReg01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/CodeGenReg01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // FSB 1750, Bad codegen in Pattern Matching @@ -12,18 +12,18 @@ let f p x = with | 1 -> 0 | _ -> 1 - + let rec loop x = if x = 0 then 1 else loop (x - 1) let g p x = - let test = + let test = match x with - | 1 when (try p x finally ()) -> 3 + | 1 when (try p x finally ()) -> 3 | _ -> 5 loop test - + let h p x = - let test = + let test = match x with | 1 when (for x = 1 to 100 do printf "" done; true) -> 3 | _ -> 5 @@ -31,8 +31,8 @@ let h p x = let (|E|O|) x = if x % 2 = 0 then E else O -let i p x = - let test = +let i p x = + let test = match x with | E when match x with | E -> true @@ -44,6 +44,6 @@ let i p x = -> 3 | _ -> 5 loop test - + // This test should just compile and PEVerify exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs index 240fab94b0b..581c8ce3ed7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs index 9032442b72c..8e0b9ba195f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching @@ -10,7 +10,7 @@ let test1() = let _ = match x with | ident1 as ident2 -> () - + if ident1 <> 1 then failwith "ident1 shouldn't be in scope!" if ident2 <> 2 then failwith "ident2 shouldn't be in scope!" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_constPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_constPattern01.fs index 8f28e7883f2..f76ec3c0ea9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_constPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_constPattern01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching //FS0025: Incomplete pattern matches on this expression. The value '7' will not be matched @@ -12,5 +12,5 @@ let isWeekend day = -> false | DayOfWeek.Saturday | DayOfWeek.Sunday -> true - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_namedLiberal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_namedLiberal01.fs index 2f3ba740856..003d3bbac05 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_namedLiberal01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_namedLiberal01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Match warning when covering all defined values of an enum //Enums may take values outside known cases. @@ -8,16 +8,16 @@ open System let isWeekend day = match day with - | DayOfWeek.Sunday | DayOfWeek.Saturday + | DayOfWeek.Sunday | DayOfWeek.Saturday -> true | DayOfWeek.Monday | DayOfWeek.Tuesday | DayOfWeek.Wednesday | DayOfWeek.Thursday - | DayOfWeek.Friday + | DayOfWeek.Friday -> false - - + + if isWeekend DayOfWeek.Saturday <> true then exit 1 exit 0 - - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/MatchFailureExn01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/MatchFailureExn01.fs index cf4c5f8d445..86af7e5b599 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/MatchFailureExn01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/MatchFailureExn01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Verify a match failure exception is thrown if a match is not found. @@ -12,10 +12,10 @@ let VerifyThrows f x = | :? MatchFailureException -> true | _ -> false - if result = true + if result = true then () else exit 1 - + // Test 1 let test1 = (fun () -> let 1 = 2 in let x = 1 in x) VerifyThrows test1 () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs index 12a14060c2c..024401fb1c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs @@ -18,7 +18,7 @@ module Simple = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 25, Line 92, Col 13, Line 92, Col 14, "Incomplete pattern matches on this expression. For example, the value 'Result (_)' may indicate a case not covered by the pattern(s).") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) [] let ``Simple - W_Incomplete02_fs - --test:ErrorRanges`` compilation = @@ -236,7 +236,7 @@ module Simple = |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) [] let ``Simple - simplePatterns11_fs - --test:ErrorRanges`` compilation = @@ -247,7 +247,7 @@ module Simple = |> compile |> shouldFail |> withSingleDiagnostic (Warning 26, Line 10, Col 7, Line 10, Col 8, "This rule will never be matched") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) [] let ``Simple - simplePatterns12_fs - --test:ErrorRanges`` compilation = @@ -277,7 +277,7 @@ module Simple = |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) [] let ``Simple - simplePatterns15_fs - --test:ErrorRanges`` compilation = @@ -318,7 +318,7 @@ module Simple = |> withOptions ["--test:ErrorRanges";] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/AsPatterns) [] let ``Simple - simplePatterns19_fs - --test:ErrorRanges`` compilation = @@ -360,7 +360,7 @@ module Simple = |> shouldSucceed [] - let ``Enum incompleteness check should not hide an issue with outer DU pattern matching with nowarn:104 `` () = + let ``Enum incompleteness check should not hide an issue with outer DU pattern matching with nowarn:104 `` () = Fsx """ type E = A = 0 @@ -374,13 +374,13 @@ let flub ex = flub (ExB 3) """ - |> withNoWarn 104 + |> withNoWarn 104 |> typecheck |> shouldFail |> withDiagnostics [Warning 25, Line 9, Col 11, Line 9, Col 13, "Incomplete pattern matches on this expression. For example, the value 'ExB (_)' may indicate a case not covered by the pattern(s)."] [] - let ``Enum incompleteness check in nested scenarios should report all warnings`` () = + let ``Enum incompleteness check in nested scenarios should report all warnings`` () = Fsx """ type E = | FieldA = 1 @@ -393,10 +393,9 @@ type U = match CaseA with | CaseB E.FieldA -> () | CaseB E.FieldB -> () - """ + """ |> typecheck |> shouldFail |> withDiagnostics [ Warning 104, Line 10, Col 7, Line 10, Col 12, "Enums may take values outside known cases. For example, the value 'CaseB (enum (0))' may indicate a case not covered by the pattern(s)." Warning 25, Line 10, Col 7, Line 10, Col 12, "Incomplete pattern matches on this expression. For example, the value 'CaseA' may indicate a case not covered by the pattern(s)."] - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture01.fs index 839d756a6d7..6da2eff7eb9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Test some of the semantics of value capture @@ -13,7 +13,7 @@ let test1() = | 0 when (i <- 1; false) -> 0 | 1 -> 1 | _ -> -i - + if test1() <> -1 then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture02.fs index 7dee47c8671..7f967e3ff4d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching open System.Collections.Generic @@ -10,10 +10,10 @@ let test1() = let x = new List() x.Add(1) x.RemoveAt(0) - if x.Count <> 0 then exit 1 + if x.Count <> 0 then exit 1 match x with - | _ as newBoundValue + | _ as newBoundValue -> if newBoundValue <> x then exit 1 if not <| newBoundValue.Equals(x) then exit 1 () @@ -26,7 +26,7 @@ let test2() = i <- 1 if i = newBoundValue then exit 1 () - + test1() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCapitalIdent.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCapitalIdent.fs index 0420505057d..87a46bfce86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCapitalIdent.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCapitalIdent.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Verify warning when capturing values with capital identifier // FSB 3954 -let test x = function - | Foo :: [] -> 1 - | Bar :: _ :: [] -> 2 +let test x = function + | Foo :: [] -> 1 + | Bar :: _ :: [] -> 2 | _ -> 3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs index 409b153d11c..9f0bc6954c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Regression testcase for FSharp 1.0:2070 @@ -7,21 +7,21 @@ module M = - + type Id = string - + type Field = { Name:string; mutable Type:Type; mutable Parent:TypeDecl; - IsSpec:bool; + IsSpec:bool; } - - and TypeDecl = + + and TypeDecl = | Struct of Id * list | Union of Id * list | MathType of Id - + and Type = | Void | Integer @@ -33,31 +33,31 @@ module M = | Tptr | Map of Type * Type - - type VarKind = + + type VarKind = | Parameter | Local | Global | QuantBound - - type Variable = { - Name:Id; - Type:Type; - Kind:VarKind; + + type Variable = { + Name:Id; + Type:Type; + Kind:VarKind; } - + type Token = { File: string; Line:int; Column:int; Remarks:string; } - + type ExprCommon = { Token:Token; Type:Type; } - + type Function = { Token:Token; IsSpec:bool; @@ -69,10 +69,10 @@ module M = Invariants:list; Writes:list; Reads:list; - } - + } + and Expr = - | Ref of ExprCommon * Variable + | Ref of ExprCommon * Variable | Prim of ExprCommon * string * list | Call of ExprCommon * Function * list | IntLiteral of ExprCommon * string @@ -86,15 +86,15 @@ module M = | VolatileRead of ExprCommon * Expr * Expr | Old of ExprCommon * Expr | Macro of ExprCommon * string * list - - type Expr with + + type Expr with member x.Common = match x with | Ref (e, _) | Prim (e, _, _) | Call (e, _, _) | IntLiteral (e, _) - | BoolLiteral (e, _) + | BoolLiteral (e, _) | Deref (e, _) | Addr (e, _) | Dot (e, _, _) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs index dca83d379ae..0daceff6957 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching +// #Regression #Conformance #PatternMatching // Regression test for FSharp1.0:4920 // Title: Can't have a quotation with an incomplete pattern match // Regression test for FSharp1.0:4904 @@ -11,19 +11,19 @@ let foo x = <@@ - match x with + match x with | 1 -> 1 - | 2 -> 2 + | 2 -> 2 @@> -let g = - <@ +let g = + <@ let f ( int : int ) = function | 1 -> 0 | 2 -> 1 f @> - + let h = <@@ match 10 with @@ -31,5 +31,5 @@ let h = | 1 -> 20 | 10 -> 10 @@> - + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns01.fs index 0d08f1cc4b7..ce924848b6f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Test guarded patterns @@ -12,4 +12,4 @@ let success = if success then exit 0 exit 1 - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns02.fs index 5356747b419..08eb3b6a13e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns02.fs @@ -1,9 +1,9 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Test constant pattern matches let x = 42 -let _ = +let _ = match x with | 41 -> exit 1 | 43 -> exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns03.fs index 0dfd7036fb1..2b5cb816851 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns03.fs @@ -1,10 +1,10 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Match pattern with 'named pattern' type Foo() = static member StaticProperty = 42 - + let testNamedPattern x = match x with | x as someNewIdentifier when x = 42 @@ -18,5 +18,5 @@ let testNamedPattern x = if testNamedPattern 42 <> true then exit 1 if testNamedPattern 0 <> true then exit 1 if testNamedPattern (-1) <> false then exit 1 - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns04.fs index aad547a6cfb..29529f0bafd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns04.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Test guarded patterns @@ -11,4 +11,4 @@ let success = if success then exit 0 exit 1 - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns05.fs index e657aad17b3..84b7d4119d9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns05.fs @@ -1,22 +1,22 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching -type Alphabet = - | A | B | C | D | E +type Alphabet = + | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z - + let isVowel letter = match letter with | A | E | I - | O | U + | O | U -> true | Y -> true // Only sometimes | _ -> false - + if isVowel A <> true then exit 1 if isVowel E <> true then exit 1 if isVowel I <> true then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns06.fs index 3393529964d..582cab9b7b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns06.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching let (|MulTwo|_|) x = if x % 2 = 0 then Some() else None diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns07.fs index 0c58abc6b71..6b4ec7794f3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns07.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Contains sequence [6; 20; 82] @@ -12,9 +12,9 @@ let rec containsSeq list = | 6 :: 20 :: 82 :: tl -> true // Recurse | _ :: tail -> containsSeq tail - + if containsSeq [1 .. 100] = true then exit 1 if containsSeq [1; 2; 3; 6; 20; 82; 1; 1] = false then exit 1 exit 0 - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns08.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns08.fs index ca519046b83..644e3a5ccc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns08.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns08.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching let rec listLength list = @@ -8,7 +8,7 @@ let rec listLength list = | [_; _] -> 2 | [_; _; _] -> 3 | hd :: tl -> 1 + listLength tl - + if listLength [] <> 0 then exit 1 if listLength [1] <> 1 then exit 1 if listLength [1..2] <> 2 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns09.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns09.fs index b35a244323e..43d1d86d215 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns09.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns09.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching let sumArray array = @@ -9,7 +9,7 @@ let sumArray array = | [|x; y; z|] -> x + y + z | [|w; x; y; z|] -> w + x + y + z | _ -> failwith "too large" - + if sumArray [| |] <> 0 then exit 1 if sumArray [|1|] <> 1 then exit 1 if sumArray [|1;2|] <> 3 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns10.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns10.fs index 30f511ba3e9..f06995f37ac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns10.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns10.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching let f x y = @@ -6,7 +6,7 @@ let f x y = | (0), (0) -> false | (1), (0) -> true | _, _ -> false - + let r1 = f 0 0 let r2 = f 1 0 let r3 = f 0 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs index 8197528cac5..f7319d07a32 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching let sumEvenValues (tuple:int*int) = @@ -8,7 +8,7 @@ let sumEvenValues (tuple:int*int) = | _, y when y % 2 = 0 -> y | _, _ -> 0 | _ -> 0 - + if sumEvenValues (2, 2) <> 4 then exit 1 if sumEvenValues (1, 5) <> 0 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns12.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns12.fs index ae1f7cb9569..00f03f5c7bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns12.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns12.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching type Person = { Name : string; Age : int } @@ -7,7 +7,7 @@ type Classification = | Child | Adult | Senior - + let getClass person = match person with | { Name = _; Age = age} when age < 12 -> Child diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs index 84f0d87d1dc..46a6944b560 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching module SomeModule = @@ -13,8 +13,8 @@ module MainModule = | SomeModule.DU.A x -> x | SomeModule.DU.B x -> x.Length | SomeModule.DU.C -> 0 - - if getCount (SomeModule.DU.A(42)) <> 42 then exit 1 + + if getCount (SomeModule.DU.A(42)) <> 42 then exit 1 if getCount (SomeModule.DU.B("cat")) <> 3 then exit 1 - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns14.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns14.fs index a5fa5a20a11..987e1425704 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns14.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns14.fs @@ -1,10 +1,10 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching -let result = +let result = match 42 with | _ -> true if result <> true then exit 1 -exit 0 +exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns15.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns15.fs index ced319005dc..e7ed356fce6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns15.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns15.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching open System @@ -9,7 +9,7 @@ let abbreviate (ex:#obj) = | :? ArgumentException -> "ae" | :? Exception -> "e" | _ -> "" - + if abbreviate (new NotImplementedException "") <> "nyi" then exit 1 if abbreviate (new ArgumentException "") <> "ae" then exit 1 if abbreviate (new Exception "") <> "e" then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns16.fs index 9f6f8cca216..22897ab15c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns16.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching open System @@ -18,7 +18,7 @@ let abbreviate (ex:#obj) = exit 1 "e" | _ -> "" - + if abbreviate (new NotImplementedException "") <> "nyi" then exit 1 if abbreviate (new ArgumentException "") <> "ae" then exit 1 if abbreviate (new Exception "") <> "e" then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns17.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns17.fs index 10550cd36f0..1ce3c518dd2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns17.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns17.fs @@ -1,15 +1,15 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching open System let nullValue = Type.GetType("this type does not exist") -let result = +let result = match nullValue with | null -> true | _ -> false -if nullValue <> null then exit 1 +if nullValue <> null then exit 1 if null <> nullValue then exit 1 // This actually is a pattern match if result <> true then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns18.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns18.fs index c931b3e78db..17034b50175 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns18.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns18.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Pattern match a short unicode literal @@ -12,7 +12,7 @@ type Suit = let spade, club, heart, diamond = '\u2660', '\u2663', '\u2665', '\u2666' let getSuit c = - match c with + match c with | '\u2660' -> Some(Spade) | '\u2663' -> Some(Club) | '\u2665' -> Some(Heart) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns19.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns19.fs index a71ab40965f..9545fa51aef 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns19.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns19.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Pattern match long unicode literals diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns20.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns20.fs index 19768360735..62d69d71600 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns20.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns20.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Pattern match short unicode literals in strings diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs index 85047d15f73..44b46079d80 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs index f2af455f93c..9b6cbd8b5ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Constants +// #Regression #Conformance #PatternMatching #Constants // Verify error when trying to use range constants diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs index 37e3e52fb00..0e18c667480 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Constants +// #Regression #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: BigInt diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs index a5af55a5c4f..22e2569615c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Constants +// #Regression #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: BigNum diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs index c4afce75ee1..eb04bf1ba94 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Verify ability to pattern match against a fully qualified constant or literal @@ -6,9 +6,9 @@ module Test = module A = - module B = - module C = - module D = + module B = + module C = + module D = type DU = | A of int | B of string @@ -26,7 +26,7 @@ module Test = | _ -> 0 - if test (A.B.C.D.A(5)) <> 1 then exit 1 + if test (A.B.C.D.A(5)) <> 1 then exit 1 if test (A.B.C.D.B(A.B.C.D.literalValue)) <> 2 then exit 1 if test (A.B.C.D.C) <> 0 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs index bb0dd21e6e7..4795b0bff9d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Constants +// #Regression #Conformance #PatternMatching #Constants // Test ability to match a const literal value @@ -9,21 +9,21 @@ [] let intLiteral = 42 -if (match 42 with +if (match 42 with | intLiteral -> true | _ -> false) <> true then exit 1 [] let strLiteral = "foobaz" -if (match "foobaz" with +if (match "foobaz" with | strLiteral -> true | _ -> false) <> true then exit 1 [] let boolLiteral = false -if (match false with +if (match false with | boolLiteral -> true | true -> false) <> true then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs index 59c63eb1b2c..f129dedec5b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs @@ -1,8 +1,8 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants -// Verify the ability to match against NaN. Note that -// this should +// Verify the ability to match against NaN. Note that +// this should let rec TestIsNaN x = match box x with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs index c9dca126573..66af09ff642 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs @@ -16,7 +16,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - E_NoRangeConst01_fs - --test:ErrorRanges`` compilation = @@ -27,7 +27,7 @@ module SimpleConstant = |> typecheck |> shouldFail |> withSingleDiagnostic (Error 10, Line 9, Col 9, Line 9, Col 11, "Unexpected symbol '..' in pattern matching. Expected '->' or other token.") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - E_type_bigint_fs - --test:ErrorRanges`` compilation = @@ -41,7 +41,7 @@ module SimpleConstant = (Error 720, Line 9, Col 7, Line 9, Col 9, "Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when = ' at the end of the match clause.") (Error 720, Line 10, Col 7, Line 10, Col 10, "Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when = ' at the end of the match clause.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - E_type_bignum40_fs - --test:ErrorRanges`` compilation = @@ -56,7 +56,7 @@ module SimpleConstant = (Error 720, Line 11, Col 7, Line 11, Col 9, "Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when = ' at the end of the match clause.") (Error 784, Line 14, Col 17, Line 14, Col 19, "This numeric literal requires that a module 'NumericLiteralN' defining functions FromZero, FromOne, FromInt32, FromInt64 and FromString be in scope") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - FullyQualify01_fs - --test:ErrorRanges`` compilation = @@ -66,7 +66,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - matchConst01_fs - --test:ErrorRanges`` compilation = @@ -76,7 +76,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - matchConst02_fs - --test:ErrorRanges`` compilation = @@ -86,7 +86,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - matchConst03_fs - --test:ErrorRanges`` compilation = @@ -96,7 +96,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - matchConst04_fs - --test:ErrorRanges`` compilation = @@ -106,7 +106,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - MatchLiteral01_fs - --test:ErrorRanges`` compilation = @@ -124,7 +124,7 @@ module SimpleConstant = (Warning 3190, Line 27, Col 7, Line 27, Col 18, "Lowercase literal 'boolLiteral' is being shadowed by a new pattern with the same name. Only uppercase and module-prefixed literals can be used as named patterns.") (Warning 26, Line 28, Col 7, Line 28, Col 11, "This rule will never be matched") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - MatchNaN_fs - --test:ErrorRanges`` compilation = @@ -139,7 +139,7 @@ module SimpleConstant = (Warning 26, Line 14, Col 7, Line 14, Col 24, "This rule will never be matched") (Warning 26, Line 20, Col 7, Line 20, Col 24, "This rule will never be matched") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_bigint_fs - --test:ErrorRanges`` compilation = @@ -149,7 +149,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_bool_fs - --test:ErrorRanges`` compilation = @@ -160,7 +160,7 @@ module SimpleConstant = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 26, Line 10, Col 7, Line 10, Col 8, "This rule will never be matched") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_byte_fs - --test:ErrorRanges`` compilation = @@ -170,7 +170,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_byteArr_fs - --test:ErrorRanges`` compilation = @@ -180,7 +180,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_char_fs - --test:ErrorRanges`` compilation = @@ -190,7 +190,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_double_fs - --test:ErrorRanges`` compilation = @@ -200,7 +200,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_float32_fs - --test:ErrorRanges`` compilation = @@ -210,7 +210,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_int_fs - --test:ErrorRanges`` compilation = @@ -220,7 +220,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_int16_fs - --test:ErrorRanges`` compilation = @@ -230,7 +230,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_int64_fs - --test:ErrorRanges`` compilation = @@ -240,7 +240,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_nativenint_fs - --test:ErrorRanges`` compilation = @@ -249,7 +249,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_sbyte_fs - --test:ErrorRanges`` compilation = @@ -258,7 +258,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_string_fs - --test:ErrorRanges`` compilation = @@ -268,7 +268,7 @@ module SimpleConstant = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 26, Line 10, Col 7, Line 10, Col 17, "This rule will never be matched") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_uint16_fs - --test:ErrorRanges`` compilation = @@ -277,7 +277,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_uint32_fs - --test:ErrorRanges`` compilation = @@ -286,7 +286,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_uint64_fs - --test:ErrorRanges`` compilation = @@ -295,7 +295,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_unativenint_fs - --test:ErrorRanges`` compilation = @@ -304,7 +304,7 @@ module SimpleConstant = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) [] let ``SimpleConstant - type_unit_fs - --test:ErrorRanges`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst01.fs index 9af9084bce7..d87777db783 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants let isZero x = @@ -7,7 +7,7 @@ let isZero x = | x when x < 0 -> false | x when x > 0 -> false | _ -> failwith "Shouldn't ever happen" - + if isZero (-1) <> false then exit 1 if isZero 0 <> true then exit 1 if isZero 1 <> false then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst02.fs index 73fcbb294ca..5039a3a40c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst02.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants let isBob x = @@ -7,7 +7,7 @@ let isBob x = | s when s < "Bob" -> false | t when t > "Bob" -> false | _ -> failwith "Shouldn't ever happen" - + if isBob "Alan" <> false then exit 1 if isBob "Bob" <> true then exit 1 if isBob "Carl" <> false then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst03.fs index 8a38b9b6c92..a5fc62f5c5a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst03.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Match floating point numbers diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst04.fs index 92c1df01b1b..e78fba12fe5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst04.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Match against an enum @@ -7,15 +7,15 @@ open System let isWeekend day = match day with - | DayOfWeek.Sunday | DayOfWeek.Saturday + | DayOfWeek.Sunday | DayOfWeek.Saturday -> true | DayOfWeek.Monday | DayOfWeek.Tuesday | DayOfWeek.Wednesday | DayOfWeek.Thursday - | DayOfWeek.Friday + | DayOfWeek.Friday -> false | _ -> false - - + + if isWeekend DayOfWeek.Saturday <> true then exit 1 // This is why a catch all pattern must be there... diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bigint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bigint.fs index 4794a34ae86..968169249e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bigint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bigint.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: BigInt diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bool.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bool.fs index 7926fa987c4..5356af2a8b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bool.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bool.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: Bool diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byte.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byte.fs index 0cfb3e9ae66..87a38cb7cfe 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byte.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byte.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: byte diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs index 560cbe6e823..64eac1f2989 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Constants +// #Regression #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: byte[] // This is a regression test for FSHARP1.0:2036 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_char.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_char.fs index 90f5ed02f81..27cc0b6fdf0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_char.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_char.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: char diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_double.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_double.fs index b974331af6a..05409f96fb4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_double.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_double.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: double diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_float32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_float32.fs index ae13323774b..ec4c7263029 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_float32.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_float32.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: double diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int.fs index f90c21a1151..acc7db3976f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int16.fs index c28546a8457..eb70dc71e17 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int16.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Constant expressions // This is the example quoted from the specs // Verification: @@ -8,5 +8,5 @@ let v = 17s // int16 let check(x:int16) = true - + exit (if check(v) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int64.fs index 32e81101885..16bff8cfb98 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int64.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int64.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: int64 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs index fe81786f086..d40b6f5b0da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: nativeint diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs index f19e9f291c7..5918f2d2cc4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: sbyte diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_string.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_string.fs index 40dea58ffe6..48e7fe7e0e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_string.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_string.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint16.fs index f1913f4baf7..53f38d8d623 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint16.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: uint16 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint32.fs index 5dec89ef0db..5956a073d3e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint32.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint32.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: uint32 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint64.fs index 067e102350a..ef322425010 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint64.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint64.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: uint64 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs index 2c9d972b9b4..bf32633a545 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: unativeint diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unit.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unit.fs index 9fd1c8a41f3..ed6e909df09 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unit.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unit.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Constants +// #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/SimpleTuples01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/SimpleTuples01.fs index abefcf4efcb..ffa9028b983 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/SimpleTuples01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/SimpleTuples01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Tuples +// #Conformance #PatternMatching #Tuples let tupleStartsWithOne x = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/Tuple.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/Tuple.fs index 10d286cd3e3..bb73cd6b45f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/Tuple.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/Tuple.fs @@ -15,7 +15,7 @@ module Tuple = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) [] let ``Tuple - tuples01_fs - --test:ErrorRanges`` compilation = @@ -56,7 +56,7 @@ module Tuple = Error 410, Line 6, Col 12, Line 6, Col 14, "The type 'T' is less accessible than the value, member or type 'val internal t': T' it is used in." Error 410, Line 6, Col 9, Line 6, Col 10, "The type 'T' is less accessible than the value, member or type 'val internal t: T' it is used in." ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) [] let ``Tuple - W_IncompleteMatches01_fs - --test:ErrorRanges`` compilation = @@ -66,7 +66,7 @@ module Tuple = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 25, Line 8, Col 5, Line 8, Col 13, "Incomplete pattern matches on this expression. For example, the value '(0,1)' may indicate a case not covered by the pattern(s).") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) [] let ``Tuple - W_RedundantPattern01_fs - --test:ErrorRanges`` compilation = @@ -76,7 +76,7 @@ module Tuple = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 26, Line 11, Col 7, Line 11, Col 14, "This rule will never be matched") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) [] let ``Tuple - W_RedundantPattern02_fs - --test:ErrorRanges`` compilation = @@ -86,4 +86,3 @@ module Tuple = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 26, Line 12, Col 28, Line 12, Col 29, "This rule will never be matched") - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs index 777824b3d90..7d02f4cf870 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #PatternMatching #Tuples +// #Regression #Conformance #PatternMatching #Tuples // Verify warnings for incomplete pattern matches -let test() = +let test() = function | 1, _ | 2, _ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs index ca9577725bf..9094f359d7b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Tuples +// #Regression #Conformance #PatternMatching #Tuples // Verify warning with redundant pattern @@ -6,7 +6,7 @@ let redPat () = function - | 1, _, _ + | 1, _, _ -> true | 1, _, _ -> true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs index a09199958a8..80aee6d56ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Tuples +// #Regression #Conformance #PatternMatching #Tuples // Verify warning if all DU tags are matched with and @@ -7,8 +7,8 @@ type DU = A | B | C of int -let test = - function | A -> 1 | B -> 2 | C(0) -> 3 +let test = + function | A -> 1 | B -> 2 | C(0) -> 3 | C(x) -> x | _ -> failwith "Bummer" let _ = test A diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/tuples01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/tuples01.fs index 052b7df2dab..581b36834f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/tuples01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/tuples01.fs @@ -1,11 +1,11 @@ -// #Conformance #PatternMatching #Tuples +// #Conformance #PatternMatching #Tuples // Match nested tuples let monsterTuple = ("0", "1", ("2", "2.1", "2.2"), "3", ("4", ("4.1", "4.1.1"), "4.2")) -let result = +let result = match monsterTuple with | (_, _, (_, _, _), _, (_, (_, _), _)) -> true @@ -16,4 +16,4 @@ let result = // MatchNotFoundException if result <> true then exit 1 -exit 0 +exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typeconstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typeconstraint01.fs index 8e5a7ef7bc0..a85dc1e39e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typeconstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typeconstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #TypeConstraints +// #Regression #Conformance #PatternMatching #TypeConstraints // Regression test for FSHARP1.0:1525 // type constraints on pattern matching are deprecated and are now errors (used to be warnings) // As of Beta2, we are not even giving the deprecation error. @@ -7,7 +7,7 @@ type A() = class end - + type B() = class inherit A() end @@ -16,6 +16,6 @@ type C() = class inherit B() end -let test1 (x:#A) = +let test1 (x:#A) = match x with | (o :> B) -> o.GetHashCode() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs index f14f51dd9b1..0698a1611ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs @@ -19,4 +19,3 @@ module TypeConstraint = (Error 10, Line 21, Col 8, Line 21, Col 10, "Unexpected symbol ':>' in pattern. Expected ')' or other token.") (Error 583, Line 21, Col 5, Line 21, Col 6, "Unmatched '('") ] - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs index f2cf17b6630..11199fdd7f1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Unions +// #Regression #Conformance #PatternMatching #Unions // Verify error if two pattern match clauses match diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs index da5a20bc064..0fccfe2bfdc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Unions +// #Regression #Conformance #PatternMatching #Unions // Verify error if not all union pattern rules capture the diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern01.fs index 6e5b267299b..344ff580f53 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern01.fs @@ -2,7 +2,7 @@ type Stuff = | A of string * int | B of string * int | C -let x v = +let x v = match v with | A(a, b) -> () | B(a, b) -> () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern02.fs index 93f7ecca66b..53394083fbe 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern02.fs @@ -2,7 +2,7 @@ type Stuff = | A of string * int | B of string * int | C -let x v = +let x v = match v with | A(a, b) -> () | B(a, b) -> () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern03.fs index 4290c4dbfa4..dd1a9d8ef14 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern03.fs @@ -2,8 +2,8 @@ type Stuff = | A | B | C - -let x v = + +let x v = match v with | A -> "" | A -> false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern04.fs index 6dc430875d5..7f9265f0246 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern04.fs @@ -1,4 +1,4 @@ -let v = +let v = match None with | Some x -> "" | Some _ -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern05.fs index 0df48c4bcf6..ef34ddc318f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern05.fs @@ -2,7 +2,7 @@ type Stuff = | A | B | C -let x v = +let x v = match v with | A -> "" | A as foo as foo1 -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern06.fs index 7896556863d..08a03bb4a19 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern06.fs @@ -2,7 +2,7 @@ type Stuff = | A | B | C -let x v = +let x v = match v with | A -> "" | A as foo -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern07.fs index 6c9f4aeb32e..54d179670f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern07.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern07.fs @@ -2,7 +2,7 @@ type Stuff = | A | B | C -let x v z = +let x v z = match v with | A -> "" | A as foo when z > 5 -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern08.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern08.fs index 72cba557bca..e9bd8b7a530 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern08.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern08.fs @@ -2,7 +2,7 @@ type Stuff = | A | B | C -let x v = +let x v = match v with | A -> "" | A -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern09.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern09.fs index fa9218c1bb8..bd99b3a464e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern09.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern09.fs @@ -2,7 +2,7 @@ type Stuff = | A | B | C -let x v = +let x v = match v with | A -> "" | A as foo as foo1 as foo3 as foo4 -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern10.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern10.fs index 7ba47234c3d..fd51cde0254 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern10.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern10.fs @@ -2,7 +2,7 @@ type Stuff = | A | B | C -let x v = +let x v = match v with | A -> "" | A as foo as foo1 as foo3 as foo4 when foo = A -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern11.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern11.fs index 1b701b4ae96..a2e4d681da1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern11.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionPattern11.fs @@ -2,7 +2,7 @@ type Stuff = | A of a: string * b: int | B | C -let x v = +let x v = match v with | A(s, i) -> "" | A(b=i) as foo as foo1 as foo3 as foo4 when i = 0 -> "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/Union.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/Union.fs index 18117c0e7f6..a15e16985a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/Union.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/Union.fs @@ -19,7 +19,7 @@ module Union = (Error 18, Line 10, Col 7, Line 10, Col 28, "The two sides of this 'or' pattern bind different sets of variables") (Error 18, Line 10, Col 7, Line 10, Col 40, "The two sides of this 'or' pattern bind different sets of variables") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) [] let ``Union - E_NotAllCaptureSameVal01_fs - --test:ErrorRanges`` compilation = @@ -29,7 +29,7 @@ module Union = |> typecheck |> shouldFail |> withSingleDiagnostic (Error 18, Line 10, Col 7, Line 10, Col 31, "The two sides of this 'or' pattern bind different sets of variables") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) [] let ``Union - E_UnionCapturesDiffType01_fs - --test:ErrorRanges`` compilation = @@ -42,7 +42,7 @@ module Union = 'int' but here has type 'float' ") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) [] let ``Union - unionPattern01_fs - --test:ErrorRanges`` compilation = @@ -51,7 +51,7 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) [] let ``Union - unionPattern02_fs - --test:ErrorRanges`` compilation = @@ -60,7 +60,7 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) [] let ``Union - unionPattern03_fs - --test:ErrorRanges`` compilation = @@ -73,7 +73,7 @@ but here has type (Warning 26, Line 12, Col 7, Line 12, Col 12, "This rule will never be matched") (Warning 26, Line 21, Col 7, Line 21, Col 12, "This rule will never be matched") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) [] let ``Union - unionPattern04_fs - --test:ErrorRanges`` compilation = @@ -82,7 +82,7 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + [] let ``Union - E_UnionPattern1_fs - --test:ErrorRanges`` compilation = compilation @@ -94,7 +94,7 @@ but here has type (Warning 25, Line 6, Col 9, Line 6, Col 10, "Incomplete pattern matches on this expression. For example, the value 'C' may indicate a case not covered by the pattern(s).") (Warning 26, Line 9, Col 5, Line 9, Col 22, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern2_fs - --test:ErrorRanges`` compilation = compilation @@ -106,7 +106,7 @@ but here has type (Warning 25, Line 6, Col 9, Line 6, Col 10, "Incomplete pattern matches on this expression. For example, the value 'C' may indicate a case not covered by the pattern(s).") (Warning 26, Line 9, Col 5, Line 9, Col 27, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern3_fs - --test:ErrorRanges`` compilation = compilation @@ -119,7 +119,7 @@ but here has type (Warning 25, Line 7, Col 11, Line 7, Col 12, "Incomplete pattern matches on this expression. For example, the value 'B' may indicate a case not covered by the pattern(s).") (Warning 26, Line 9, Col 7, Line 9, Col 8, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern4_fs - --test:ErrorRanges`` compilation = compilation @@ -130,7 +130,7 @@ but here has type |> withDiagnostics [ (Warning 26, Line 4, Col 7, Line 4, Col 13, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern5_fs - --test:ErrorRanges`` compilation = compilation @@ -141,7 +141,7 @@ but here has type |> withDiagnostics [ (Warning 26, Line 8, Col 7, Line 8, Col 23, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern6_fs - --test:ErrorRanges`` compilation = compilation @@ -153,7 +153,7 @@ but here has type (Warning 25, Line 6, Col 11, Line 6, Col 12, "Incomplete pattern matches on this expression. For example, the value 'B' may indicate a case not covered by the pattern(s).") (Warning 26, Line 8, Col 7, Line 8, Col 15, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern7_fs - --test:ErrorRanges`` compilation = compilation @@ -165,7 +165,7 @@ but here has type (Warning 25, Line 6, Col 11, Line 6, Col 12, "Incomplete pattern matches on this expression. For example, the value 'B' may indicate a case not covered by the pattern(s).") (Warning 26, Line 8, Col 7, Line 8, Col 26, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern8_fs - --test:ErrorRanges`` compilation = compilation @@ -177,7 +177,7 @@ but here has type (Warning 25, Line 6, Col 11, Line 6, Col 12, "Incomplete pattern matches on this expression. For example, the value 'B' may indicate a case not covered by the pattern(s).") (Warning 26, Line 8, Col 7, Line 8, Col 8, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern9_fs - --test:ErrorRanges`` compilation = compilation @@ -188,7 +188,7 @@ but here has type |> withDiagnostics [ (Warning 26, Line 8, Col 7, Line 8, Col 39, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern10_fs - --test:ErrorRanges`` compilation = compilation @@ -199,7 +199,7 @@ but here has type |> withDiagnostics [ (Warning 26, Line 8, Col 7, Line 8, Col 52, "This rule will never be matched") ] - + [] let ``Union - E_UnionPattern11_fs - --test:ErrorRanges`` compilation = compilation @@ -210,7 +210,7 @@ but here has type |> withDiagnostics [ (Warning 26, Line 8, Col 7, Line 8, Col 55, "This rule will never be matched") ] - + [] let ``Union - UpperUnionCasePattern01_fs LangVersion90 - --test:ErrorRanges`` compilation = compilation @@ -261,7 +261,7 @@ but here has type (Warning 49, Line 55, Col 14, Line 55, Col 17, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name."); (Warning 49, Line 56, Col 14, Line 56, Col 17, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.") ] - + [] let ``Union - UpperUnionCasePattern02_fs - --test:ErrorRanges`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/UpperUnionCasePattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/UpperUnionCasePattern01.fs index 15c5827a2bf..a2daef45dc6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/UpperUnionCasePattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/UpperUnionCasePattern01.fs @@ -1,22 +1,22 @@ -let a = - match 1 with +let a = + match 1 with | US -> "US" | UK -> "UK" | U -> "U" -let b = - match 2 with +let b = + match 2 with | Us -> "Us" | Uk -> "Uk" | U -> "u" let c = - match 1 with + match 1 with | USA -> "USA" | CAN -> "CAN" let d = - match 2 with + match 2 with | Usa -> "Usa" try () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/UpperUnionCasePattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/UpperUnionCasePattern02.fs index c04bae9035f..c9fbb716d5d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/UpperUnionCasePattern02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/UpperUnionCasePattern02.fs @@ -13,15 +13,15 @@ let test4 = function UndefinedCase -> 1 let test5 () = try failwith "test" with | UndefinedException -> 1 - + let test6 () = - try failwith "test" + try failwith "test" with UndefinedException -> 1 let test7 () = - try failwith "test" + try failwith "test" with UndefinedException as Foo -> 1 let test8 () = - try failwith "test" + try failwith "test" with | UndefinedException as Foo -> 1 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern01.fs index e730d6b98f0..e4146088f7a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern01.fs @@ -1,14 +1,14 @@ -// #Conformance #PatternMatching #Unions +// #Conformance #PatternMatching #Unions -type Foo = +type Foo = | A of int * string | B of string * int - -let test x = + +let test x = match x with | A (x, "cheese") - | B (_, x) when x > 0 + | B (_, x) when x > 0 -> x | _ -> 0 @@ -17,5 +17,5 @@ if test (A(100, "cheese")) <> 100 then exit 1 if test (B("", -100)) <> 0 then exit 1 if test (B("", 42)) <> 42 then exit 1 - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs index ea94f9dd457..334b618b184 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs @@ -1,11 +1,11 @@ -// #Conformance #PatternMatching #Unions +// #Conformance #PatternMatching #Unions // Test a match statement with just one 'match thingy' type Foo = A | B of string | C of int -let test x = - match x with +let test x = + match x with | A | B _ | C (_) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs index a35dd22a66a..2bba91b4bbb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching #Unions +// #Conformance #PatternMatching #Unions // Test that when there are two potential matches, they are matched in the order they are defined. @@ -23,11 +23,11 @@ let test2 x = if test1 A <> 1 then exit 1 if test1 B <> 1 then exit 1 if test1 C <> 2 then exit 1 -if test1 D <> 3 then exit 1 +if test1 D <> 3 then exit 1 if test2 A <> 1 then exit 1 if test2 B <> 1 then exit 1 if test2 C <> 2 then exit 1 -if test2 D <> 3 then exit 1 +if test2 D <> 3 then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern04.fs index 133bc07264f..1fa837fd8ac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #PatternMatching #Unions +// #Regression #Conformance #PatternMatching #Unions // Regression test for FSHARP1.0:3914 - Invalid value when returning a pattern match-bound parameter in the enclosure of a lambda (does that make sense?) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs index dc8508be685..b7afb9100e9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs @@ -1,4 +1,4 @@ -// #Conformance #PatternMatching +// #Conformance #PatternMatching // Verify that the shape of data matched against a wildcard diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/AssemblyConfiguration_001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/AssemblyConfiguration_001.fs index 1fa622a631a..1acebfe0fad 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/AssemblyConfiguration_001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/AssemblyConfiguration_001.fs @@ -1,4 +1,4 @@ -// #Regression #Attributes #Assemblies +// #Regression #Attributes #Assemblies // AssemblyAttributes // See FSHARP1.0:832,1674,1675 and 2290 // Attribute under test: AssemblyConfiguration diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/AssemblyVersion_002.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/AssemblyVersion_002.fs index b8d76eb35bb..a924a3a5e48 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/AssemblyVersion_002.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/AssemblyVersion_002.fs @@ -1,4 +1,4 @@ -// #Regression #Attributes #Assemblies +// #Regression #Attributes #Assemblies // Verify ability to put wildcards in assembly version open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/SpecialAttributesAndTypes/CallerInfo.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/SpecialAttributesAndTypes/CallerInfo.fs index f52621505ce..1f508abb39d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/SpecialAttributesAndTypes/CallerInfo.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/SpecialAttributesAndTypes/CallerInfo.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module CallerInfo = - let private csharpLib = + let private csharpLib = CSharp """ using System; using System.Reflection; @@ -541,7 +541,7 @@ module Program = |> compileAndRun |> shouldSucceed - // Note: ViaInteractive.fsx tests are not migrated because they require FSI - // execution with platform-specific path checks that don't translate well + // Note: ViaInteractive.fsx tests are not migrated because they require FSI + // execution with platform-specific path checks that don't translate well // to in-memory compilation. The CallerInfo functionality is already covered // by the other tests above. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Stress/StressTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Stress/StressTests.fs index 9d5bb51945f..2dccd927a9c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Stress/StressTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Stress/StressTests.fs @@ -25,12 +25,12 @@ module StressTests = let sb = StringBuilder() sb.AppendLine("// Stress test for FSharp1.0#2766 - Internal error on parser when given unbalanced and deeply nested parens") |> ignore sb.AppendLine("let x = (1 + ") |> ignore - + for i in 0..depth-1 do for _ in 0..i do sb.Append(" ") |> ignore sb.AppendLine("(1 +") |> ignore - + sb.ToString() /// Test that parser handles deeply nested parens (expected to fail with parse error) @@ -38,7 +38,7 @@ module StressTests = let ``Stress - CodeGeneratorFor2766 - deeply nested unbalanced parens`` () = // Generate code with depth of 100 (reduced from 500 for test speed) let generatedCode = generateDeeplyNestedParens 100 - + FSharp generatedCode |> asExe |> compile @@ -50,7 +50,7 @@ module StressTests = [] let ``Stress - CodeGeneratorFor2766 - nested parens depth 50`` () = let generatedCode = generateDeeplyNestedParens 50 - + FSharp generatedCode |> asExe |> compile @@ -68,16 +68,16 @@ module StressTests = sb.AppendLine("let f () = ") |> ignore sb.AppendLine(" let i = 0") |> ignore sb.AppendLine(" let nestedFunction() = 0") |> ignore - + for i in 0..count-1 do - let exprBody = + let exprBody = match i % 20 with | 0 -> " printfn \"Hello, World\"" | 1 -> " 1 + 3 * (int 4.3) |> ignore" | 2 -> " let nestedFunction() = i + nestedFunction()" | _ -> " do ()" sb.AppendLine(exprBody) |> ignore - + sb.AppendLine(" 0") |> ignore sb.AppendLine("") |> ignore sb.AppendLine("[]") |> ignore @@ -88,7 +88,7 @@ module StressTests = [] let ``Stress - SeqExprCapacity - 500 sequential expressions`` () = let generatedCode = generateSeqExprCapacity 500 - + FSharp generatedCode |> asExe |> compile @@ -98,7 +98,7 @@ module StressTests = [] let ``Stress - SeqExprCapacity - 1000 sequential expressions`` () = let generatedCode = generateSeqExprCapacity 1000 - + FSharp generatedCode |> asExe |> compile @@ -108,7 +108,7 @@ module StressTests = [] let ``Stress - SeqExprCapacity - run 200 sequential expressions`` () = let generatedCode = generateSeqExprCapacity 200 - + FSharp generatedCode |> asExe |> compileAndRun @@ -123,15 +123,15 @@ module StressTests = let ``Stress - deeply nested let bindings`` () = let sb = StringBuilder() sb.AppendLine("let f () =") |> ignore - + for i in 0..99 do sb.AppendLine($" let x{i} = {i}") |> ignore - + sb.AppendLine(" x99") |> ignore sb.AppendLine("") |> ignore sb.AppendLine("[]") |> ignore sb.AppendLine("let main _ = f()") |> ignore - + FSharp (sb.ToString()) |> asExe |> compileAndRun @@ -144,14 +144,14 @@ module StressTests = sb.AppendLine("[]") |> ignore sb.AppendLine("let main _ =") |> ignore sb.AppendLine(" let x = 0") |> ignore - + for i in 0..49 do sb.AppendLine($" match x with") |> ignore sb.AppendLine($" | {i} -> {i}") |> ignore sb.AppendLine($" | _ ->") |> ignore - + sb.AppendLine(" 0") |> ignore - + FSharp (sb.ToString()) |> asExe |> compile @@ -164,13 +164,13 @@ module StressTests = sb.AppendLine("[]") |> ignore sb.AppendLine("let main _ =") |> ignore sb.AppendLine(" let x = 0") |> ignore - + for i in 0..99 do sb.AppendLine($" if x = {i} then {i}") |> ignore sb.AppendLine($" else") |> ignore - + sb.AppendLine(" 0") |> ignore - + FSharp (sb.ToString()) |> asExe |> compile @@ -180,16 +180,16 @@ module StressTests = [] let ``Stress - many type definitions`` () = let sb = StringBuilder() - + for i in 0..49 do sb.AppendLine($"type T{i} = {{ Value{i}: int }}") |> ignore - + sb.AppendLine("") |> ignore sb.AppendLine("[]") |> ignore sb.AppendLine("let main _ =") |> ignore sb.AppendLine(" let t = { Value0 = 0 }") |> ignore sb.AppendLine(" t.Value0") |> ignore - + FSharp (sb.ToString()) |> asExe |> compileAndRun @@ -200,10 +200,10 @@ module StressTests = let ``Stress - many discriminated union cases`` () = let sb = StringBuilder() sb.AppendLine("type LargeUnion =") |> ignore - + for i in 0..99 do sb.AppendLine($" | Case{i}") |> ignore - + sb.AppendLine("") |> ignore sb.AppendLine("[]") |> ignore sb.AppendLine("let main _ =") |> ignore @@ -211,7 +211,7 @@ module StressTests = sb.AppendLine(" match u with") |> ignore sb.AppendLine(" | Case0 -> 0") |> ignore sb.AppendLine(" | _ -> 1") |> ignore - + FSharp (sb.ToString()) |> asExe |> compileAndRun diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/NegativeCases/Class_NG_TurnToStruct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/NegativeCases/Class_NG_TurnToStruct.fs index 514d0c9361b..3397e253495 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/NegativeCases/Class_NG_TurnToStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/NegativeCases/Class_NG_TurnToStruct.fs @@ -1,4 +1,4 @@ let f = new TurnsToStruct() -let rv = f.getValue() +let rv = f.getValue() exit rv diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/NegativeCases/Struct_NG_TurnToClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/NegativeCases/Struct_NG_TurnToClass.fs index 8ae6bb3861b..8b6cf0315d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/NegativeCases/Struct_NG_TurnToClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/NegativeCases/Struct_NG_TurnToClass.fs @@ -1,4 +1,4 @@ let f = new TurnsToClass() -let rv = f.getValue() +let rv = f.getValue() exit rv diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs index dce13c8da38..dc9edbd1807 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs @@ -58,7 +58,7 @@ module AnonRecd = """ |> compile |> shouldSucceed - + [] let ``Anonymous Record with typeof -v9`` () = FSharp """ @@ -75,8 +75,8 @@ module AnonRecd = |> withDiagnostics [ (Error 3350, Line 4, Col 27, Line 4, Col 30, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") (Error 3350, Line 6, Col 28, Line 6, Col 31, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") - ] - + ] + [] let ``Anonymous Record with typeof`` () = FSharp """ @@ -88,8 +88,8 @@ module AnonRecd = let d = {| a=typeof |} """ |> compile - |> shouldSucceed - + |> shouldSucceed + [] let ``Anonymous Record with typedefof -v9`` () = FSharp """ @@ -107,7 +107,7 @@ module AnonRecd = (Error 3350, Line 4, Col 35, Line 4, Col 38, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") (Error 3350, Line 6, Col 36, Line 6, Col 39, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") ] - + [] let ``Anonymous Record with typedefof`` () = FSharp """ @@ -119,8 +119,8 @@ module AnonRecd = let d = {| a=typedefof<_ option> |} """ |> compile - |> shouldSucceed - + |> shouldSucceed + [] let ``Anonymous Record with nameof -v9`` () = FSharp """ @@ -138,7 +138,7 @@ module AnonRecd = (Error 3350, Line 4, Col 30, Line 4, Col 33, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") (Error 3350, Line 6, Col 31, Line 6, Col 34, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") ] - + [] let ``Anonymous Record with nameof`` () = FSharp """ @@ -151,7 +151,7 @@ module AnonRecd = """ |> compile |> shouldSucceed - + [] let ``Anonymous Record missing single field`` () = Fsx """ @@ -162,7 +162,7 @@ let x () : {| A: int; B: string |} = {| A = 123 |} |> withDiagnostics [ (Error 1, Line 2, Col 40, Line 2, Col 53, "This anonymous record is missing field 'B'.") ] - + [] let ``Anonymous Record missing multiple fields`` () = Fsx """ @@ -173,7 +173,7 @@ let x () : {| A: int; B: string; C: int |} = {| A = 123 |} |> withDiagnostics [ (Error 1, Line 2, Col 48, Line 2, Col 61, "This anonymous record is missing fields 'B', 'C'.") ] - + [] let ``Anonymous Record with extra field`` () = Fsx """ @@ -184,7 +184,7 @@ let x () : {| A: int; B: string |} = {| A = 123; B = ""; C = 1 |} |> withDiagnostics [ (Error 1, Line 2, Col 40, Line 2, Col 68, "This anonymous record has an extra field. Remove field 'C'.") ] - + [] let ``Anonymous Record with extra fields`` () = Fsx """ @@ -195,7 +195,7 @@ let x () : {| A: int |} = {| A = 123 ; B = ""; C = 1 |} |> withDiagnostics [ (Error 1, Line 2, Col 29, Line 2, Col 58, "This anonymous record has extra fields. Remove fields 'B', 'C'.") ] - + [] let ``Using the wrong anon record with single field`` () = Fsx """ @@ -206,7 +206,7 @@ let x() = ({| b = 2 |} = {| a = 2 |} ) |> withDiagnostics [ (Error 1, Line 2, Col 26, Line 2, Col 37, "This anonymous record should have field 'b' but here has field 'a'.") ] - + [] let ``Using the wrong anon record with single field 2`` () = Fsx """ @@ -217,7 +217,7 @@ let x() = ({| b = 2 |} = {| a = 2; c = "" |} ) |> withDiagnostics [ (Error 1, Line 2, Col 26, Line 2, Col 45, "This anonymous record should have field 'b' but here has fields 'a', 'c'.") ] - + [] let ``Using the wrong anon record with multiple fields`` () = Fsx """ @@ -228,7 +228,7 @@ let x() = ({| b = 2; c = 3 |} = {| a = 2 |} ) |> withDiagnostics [ (Error 1, Line 2, Col 33, Line 2, Col 44, "This anonymous record should have fields 'b', 'c'; but here has field 'a'.") ] - + [] let ``Using the wrong anon record with multiple fields 2`` () = Fsx """ @@ -239,7 +239,7 @@ let x() = ({| b = 2; c = 3 |} = {| a = 2; d = "" |} ) |> withDiagnostics [ (Error 1, Line 2, Col 33, Line 2, Col 52, "This anonymous record should have fields 'b', 'c'; but here has fields 'a', 'd'.") ] - + [] let ``Two anon records with no fields`` () = Fsx """ @@ -295,7 +295,7 @@ type ErrorResponse = Error 10, Line 10, Col 17, Line 10, Col 21, "Incomplete structured construct at or before this point in field declaration. Expected identifier or other token." Error 3244, Line 10, Col 14, Line 11, Col 36, "Invalid anonymous record type" ] - + [] let ``Anonymous Record type annotation with fields defined in a record`` () = Fsx """ @@ -309,7 +309,7 @@ let t3 (t1: {| gu: string; ff: int |}) = { t1 with ff = 3 } (Error 3578, Line 4, Col 42, Line 4, Col 43, "This expression is an anonymous record, use {|...|} instead of {...}.") (Error 3578, Line 4, Col 59, Line 4, Col 60, "This expression is an anonymous record, use {|...|} instead of {...}.") ] - + [] let ``This expression was expected to have an anonymous Record but has a record`` () = Fsx """ @@ -321,7 +321,7 @@ let t3 (t1: {| gu: string; ff: int |}) = { t1 with ff = 3 } (Error 3578, Line 2, Col 42, Line 2, Col 43, "This expression is an anonymous record, use {|...|} instead of {...}.") (Error 3578, Line 2, Col 59, Line 2, Col 60, "This expression is an anonymous record, use {|...|} instead of {...}.") ] - + [] let ``This expression was expected to have an struct anonymous Record but has a record`` () = Fsx """ @@ -333,7 +333,7 @@ let t3 (t1: struct {| gu: string; ff: int |}) = { t1 with ff = 3 } (Error 3578, Line 2, Col 49, Line 2, Col 50, "This expression is an anonymous record, use {|...|} instead of {...}.") (Error 3578, Line 2, Col 66, Line 2, Col 67, "This expression is an anonymous record, use {|...|} instead of {...}.") ] - + [] let ``This expression was expected to have an anonymous with various properties Record but has a record`` () = Fsx """ @@ -345,7 +345,7 @@ let f (r: {| A: int; C: int |}) = { r with A = 1; B = 2; C = 3 } (Error 3578, Line 2, Col 35, Line 2, Col 36, "This expression is an anonymous record, use {|...|} instead of {...}.") (Error 3578, Line 2, Col 64, Line 2, Col 65, "This expression is an anonymous record, use {|...|} instead of {...}.") ] - + [] let ``Nested anonymous records where outer label = concatenated inner labels (see secondary issue reported in 6411)`` () = FSharp """ @@ -366,7 +366,7 @@ let x(f: {| A: int; A: int |}) = () |> withDiagnostics [ (Error 3523, Line 2, Col 13, Line 2, Col 14, "The field 'A' appears multiple times in this anonymous record type.") ] - + [] let ``Anonymous Records field appears multiple times in this anonymous record definition 2`` () = Fsx """ @@ -378,7 +378,7 @@ let x(f: {| A: int; A: int; A:int |}) = () (Error 3523, Line 2, Col 13, Line 2, Col 14, "The field 'A' appears multiple times in this anonymous record type.") (Error 3523, Line 2, Col 21, Line 2, Col 22, "The field 'A' appears multiple times in this anonymous record type.") ] - + [] let ``Anonymous Records field appears multiple times in this anonymous record declaration 3`` () = Fsx """ @@ -390,7 +390,7 @@ let f(x:{| A: int; B: int; A:string; B: int |}) = () (Error 3523, Line 2, Col 12, Line 2, Col 13, "The field 'A' appears multiple times in this anonymous record type.") (Error 3523, Line 2, Col 20, Line 2, Col 21, "The field 'B' appears multiple times in this anonymous record type.") ] - + [] let ``Anonymous Records field appears multiple times in this anonymous record declaration 4`` () = Fsx """ @@ -401,7 +401,7 @@ let f(x:{| A: int; C: string; A: int; B: int |}) = () |> withDiagnostics [ (Error 3523, Line 2, Col 12, Line 2, Col 13, "The field 'A' appears multiple times in this anonymous record type.") ] - + [] let ``Anonymous Records field appears multiple times in this anonymous record declaration 5`` () = Fsx """ @@ -413,7 +413,7 @@ let f(x:{| A: int; C: string; A: int; B: int; A: int |}) = () (Error 3523, Line 2, Col 12, Line 2, Col 13, "The field 'A' appears multiple times in this anonymous record type.") (Error 3523, Line 2, Col 31, Line 2, Col 32, "The field 'A' appears multiple times in this anonymous record type.") ] - + [] let ``Anonymous Records field with in double backticks appears multiple times in this anonymous record declaration`` () = Fsx """ @@ -437,7 +437,7 @@ let foo: {| A: int; C: string; A: int; B: int; A: int |} = failwith "foo" (Error 3523, Line 2, Col 13, Line 2, Col 14, "The field 'A' appears multiple times in this anonymous record type.") (Error 3523, Line 2, Col 32, Line 2, Col 33, "The field 'A' appears multiple times in this anonymous record type.") ] - + [] let ``Anonymous Records field appears multiple times in this record expression`` () = Fsx """ @@ -460,7 +460,7 @@ let v = {| A = 1; A = 2; A = 3 |} Error 3522, Line 2, Col 19, Line 2, Col 24, "The field 'A' appears multiple times in this record expression." Error 3522, Line 2, Col 26, Line 2, Col 31, "The field 'A' appears multiple times in this record expression." ] - + [] let ``Anonymous Records field appears multiple times in this record expression 3`` () = Fsx """ @@ -472,7 +472,7 @@ let v = {| A = 0; B = 2; A = 5; B = 6 |} Error 3522, Line 2, Col 26, Line 2, Col 31, "The field 'A' appears multiple times in this record expression." Error 3522, Line 2, Col 33, Line 2, Col 38, "The field 'B' appears multiple times in this record expression." ] - + [] let ``Anonymous Records field appears multiple times in this record expression 4`` () = Fsx """ @@ -495,7 +495,7 @@ let v = {| A = 0; C = ""; A = 1; B = 2; A = 5 |} Error 3522, Line 2, Col 27, Line 2, Col 32, "The field 'A' appears multiple times in this record expression." Error 3522, Line 2, Col 41, Line 2, Col 46, "The field 'A' appears multiple times in this record expression." ] - + [] let ``Anonymous Records field appears multiple times in this record expression 6`` () = Fsx """ @@ -507,7 +507,7 @@ let v = {| ``A`` = 0; B = 5; A = ""; B = 0 |} Error 3522, Line 2, Col 30, Line 2, Col 36, "The field 'A' appears multiple times in this record expression." Error 3522, Line 2, Col 38, Line 2, Col 43, "The field 'B' appears multiple times in this record expression." ] - + [] let ``Anonymous records with typed quotations should parse correctly``() = Fsx """ @@ -576,7 +576,7 @@ let nested2 : {| A: {| B: Expr |}; C: Expr |} = """ |> compile |> shouldSucceed - + [] let ``Version 9: Anonymous records with typed quotations should parse correctly``() = Fsx """ @@ -606,7 +606,7 @@ let (@>=) = (@) (Error 3350, Line 7, Col 80, Line 7, Col 82, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") (Error 3350, Line 10, Col 47, Line 10, Col 48, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") (Error 3350, Line 12, Col 48, Line 12, Col 49, "Feature 'Support for better anonymous record parsing' is not available in F# 9.0. Please use language version 10.0 or greater.") - + ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/BigRecord01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/BigRecord01.fs index 80f5f0b1a02..a5d0ebacde6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/BigRecord01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/BigRecord01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Regression for 6346, used to stackoverflow with this many fields (still do with 300+) type BigRecord = { diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/DuckTypingRecords01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/DuckTypingRecords01.fs index 999e13bd3dd..e77be0f0f28 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/DuckTypingRecords01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/DuckTypingRecords01.fs @@ -1,13 +1,13 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Dev11: 293290, previously record fields didn't satisfy static member constraints type A = { Age: int; Name: string } type B = { name: string } with member this.Name = this.name - + let inline name (x:^T) = (^T : (member Name : string) x) - + let a = { Age = 29; Name = "Steffen" } let b = { name = "Gary" } - + let r = name a if r <> "Steffen" then failwith "Failed" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_InheritRecord01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_InheritRecord01.fs index 13487c0c734..bda065a1fb8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_InheritRecord01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_InheritRecord01.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Verify error when inheriting from a record // Regression of FSB 4662 type Record = {x:int; y:int} -type Sub<'t> = +type Sub<'t> = inherit Record diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordCloning01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordCloning01.fs index da7d9cb5ca7..710d903169d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordCloning01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordCloning01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Verify error when trying to clone a non-record type diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull01.fs index 396aa164d85..15a0757508b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Verify records cannot have null as a proper value diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull02.fs index bc7b84fdee6..4c5ba1e36b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull02.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records @@ -10,11 +10,11 @@ type RecordType = { X : int } let test1 = (box { X = 1} :?> RecordType) // Will fail, the dynamic type cast will throw -let testPassed = +let testPassed = try let _ = (box null :?> RecordType) false - with + with :? System.NullReferenceException -> true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01.fs index e2992b968d3..96a4962dfdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Verify appropriate error with ambiguous record inference // Regression test for FSHARP1.0:2780 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01b.fs index e4e813a36ad..e7a7c7d0b35 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Verify appropriate error with ambiguous record inference // Same as 01, but with generic types // Regression test for FSHARP1.0:2780 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference02.fs index ccb37810eb9..9f7b1f7dbc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Verify error when type inference cannot pin down record type diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/EqualAndBoxing01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/EqualAndBoxing01.fs index 5aef3f326b3..c31003d37e0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/EqualAndBoxing01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/EqualAndBoxing01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Regression test for FSHARP1.0:5535 // Record type type R = { A : int; B : char } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FieldBindingAfterWith01a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FieldBindingAfterWith01a.fs index 559bf58d556..6a7fb15d2ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FieldBindingAfterWith01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FieldBindingAfterWith01a.fs @@ -1,21 +1,21 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Regression test for FSHARP1.0:5488 // field bindings coming after 'with' need semicolons // Short identifier form // module TestModule -type R = { a : int; b : int } +type R = { a : int; b : int } let r = { a = 1; b = 2 } let v1 = { r with a = 1 - b = 3 } - + b = 3 } + let v1b = { r with a = 1 - b = 3 } - + b = 3 } + let v2 = { r with a = let x = 1 x + x; diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FieldBindingAfterWith01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FieldBindingAfterWith01b.fs index 3794d3c9143..a38b6f54f2b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FieldBindingAfterWith01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FieldBindingAfterWith01b.fs @@ -1,20 +1,20 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Regression test for FSHARP1.0:5488 // field bindings coming after 'with' need semicolons // Long identifier form // module TestModule -type R = { a : int; b : int } +type R = { a : int; b : int } let r = { a = 1; b = 2 } let v1' = { r with R.a = 1 - R.b = 3 } - + R.b = 3 } + let v1b' = { r with R.a = 1 - R.b = 3 } - + R.b = 3 } + let v2' = { r with R.a = let x = 1 x + x; diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FullyQualify01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FullyQualify01.fs index 1aee0464365..9b42c751d40 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FullyQualify01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/FullyQualify01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify the ability to fully qualify record fields @@ -6,14 +6,14 @@ module Test = module A = - module B = + module B = module C = module D = type Person = { Name : string; Age : int } type Car = { Name : string; Age : int; Miles : int } - open A.B.C.D - + open A.B.C.D + let aCar = { A.B.C.D.Car.Name = "Mitsubishi"; Age = 4; Miles = 20000 } let aPerson = { A.B.C.D.Person.Name = "Chris"; Age = -831 } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/ImplicitEquals01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/ImplicitEquals01.fs index 76800d790bd..ab6f7bc6cc6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/ImplicitEquals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/ImplicitEquals01.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Implicitly implemented Equals should not throw // Regression test for FSHARP1.0:1633 // Records -type R = { A : string } -type S = { B : int } +type R = { A : string } +type S = { B : int } let r = { A = "Hello" } let s = { B = 10 } -let e = +let e = try let _ = r.Equals(r) // compare to itself let _ = r.Equals({A = "World"}) // compare to another record (same type) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/NoClashMemberIFaceMember.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/NoClashMemberIFaceMember.fs index 1ca6dd0c9e0..c983ae04e66 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/NoClashMemberIFaceMember.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/NoClashMemberIFaceMember.fs @@ -1,13 +1,13 @@ -// #Regression #Conformance #TypesAndModules #Records +// #Regression #Conformance #TypesAndModules #Records // Regression test for FSHARP1.0:4666 // Records should be allowed to implement interfaces with member same name as field -type IFoo = +type IFoo = abstract Bar: int8 // <- Bar is member in interface type Foo = - { Bar: int8 } - interface IFoo with + { Bar: int8 } + interface IFoo with member this.Bar = this.Bar + 10y // <- no problem here! let o = { Bar = 1y } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_Equals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_Equals.fs index 1780ec0f282..4a35626a7c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_Equals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_Equals.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records #ReqNOMT +// #Regression #Conformance #TypesAndModules #Records #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of Equals() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_GetHashCode.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_GetHashCode.fs index 37ca14dec54..f7fd5822f86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_GetHashCode.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_GetHashCode.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #Records #ReqNOMT +// #Regression #Conformance #TypesAndModules #Records #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of GetHashCode() type R = { x: int } member this.GetHashCode(s:char) = 1 //member this.GetHashCode() = 1. - member this.GetHashCode(?s:char) = 1 + member this.GetHashCode(?s:char) = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_ToString.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_ToString.fs index 9ff59fa0a71..abc243253f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_ToString.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Overload_ToString.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Records #ReqNOMT +// #Regression #Conformance #TypesAndModules #Records #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of ToString() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning01.fs index d40aaaf7a5f..af4c7636c53 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify the ability to clone records using a simplified syntax diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning02.fs index 7c62155e52d..76d3ff6d356 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning02.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify ability to clone records when they are returned from an arbitrary expression diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning03.fs index f22f05c54e3..266353462da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning03.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify ability to clone a record with mutable fields diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs index b81fc4da01d..2d546b984e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs @@ -443,7 +443,7 @@ module RecordTypes = |> withDiagnostics [ Error 668, Line 4, Col 25, Line 4, Col 32, "The field 'B' appears multiple times in this record expression or pattern" ] - + [] let ``Records field appears multiple times in this record expressions 2``() = FSharp """ @@ -457,7 +457,7 @@ module RecordTypes = Error 668, Line 4, Col 25, Line 4, Col 32, "The field 'B' appears multiple times in this record expression or pattern" Error 668, Line 4, Col 34, Line 4, Col 41, "The field 'B' appears multiple times in this record expression or pattern" ] - + [] let ``Records field appears multiple times in this record expressions 3``() = FSharp """ @@ -471,7 +471,7 @@ module RecordTypes = Error 668, Line 4, Col 30, Line 4, Col 35, "The field 'A' appears multiple times in this record expression or pattern" Error 668, Line 4, Col 37, Line 4, Col 42, "The field 'B' appears multiple times in this record expression or pattern" ] - + [] let ``Records field appears multiple times in this record expressions 4``() = FSharp """ @@ -484,7 +484,7 @@ module RecordTypes = |> withDiagnostics [ Error 668, Line 4, Col 31, Line 4, Col 36, "The field 'A' appears multiple times in this record expression or pattern" ] - + [] let ``Records field appears multiple times in this record expressions 5``() = FSharp """ @@ -498,7 +498,7 @@ module RecordTypes = Error 668, Line 4, Col 31, Line 4, Col 36, "The field 'A' appears multiple times in this record expression or pattern" Error 668, Line 4, Col 45, Line 4, Col 50, "The field 'A' appears multiple times in this record expression or pattern" ] - + [] let ``Records field appears multiple times in this record expressions 6``() = FSharp """ @@ -512,7 +512,7 @@ module RecordTypes = Error 668, Line 4, Col 34, Line 4, Col 39, "The field 'A' appears multiple times in this record expression or pattern" Error 668, Line 4, Col 41, Line 4, Col 46, "The field 'B' appears multiple times in this record expression or pattern" ] - + [] let ``Records field appears multiple times in this record expressions 7``() = FSharp """ @@ -527,7 +527,7 @@ module RecordTypes = |> withDiagnostics [ (Error 668, Line 5, Col 9, Line 5, Col 10, "The field 'A' appears multiple times in this record expression or pattern") ] - + [] let ``Records field appears multiple times in this record expressions 8``() = FSharp """ @@ -543,7 +543,7 @@ module RecordTypes = (Error 668, Line 5, Col 9, Line 5, Col 10, "The field 'A' appears multiple times in this record expression or pattern") (Error 668, Line 5, Col 16, Line 5, Col 17, "The field 'A' appears multiple times in this record expression or pattern") ] - + [] let ``Records field appears multiple times in this record expressions 9``() = FSharp """ @@ -559,7 +559,7 @@ module RecordTypes = (Error 668, Line 5, Col 9, Line 5, Col 10, "The field 'A' appears multiple times in this record expression or pattern") (Error 668, Line 5, Col 16, Line 5, Col 17, "The field 'B' appears multiple times in this record expression or pattern") ] - + [] let ``Records field appears multiple times in this record expressions 10``() = FSharp """ @@ -575,7 +575,7 @@ module RecordTypes = (Error 668, Line 5, Col 9, Line 5, Col 10, "The field 'A' appears multiple times in this record expression or pattern") (Error 668, Line 5, Col 24, Line 5, Col 25, "The field 'A' appears multiple times in this record expression or pattern") ] - + [] let ``Records field appears multiple times in this record expressions 11``() = FSharp """ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning01.fs index ae0d7f961cc..2add610e1bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify the ability to clone records using a simplified syntax diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning02.fs index b64ef13a099..9e95ef3aa5e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning02.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify ability to clone records when they are returned from an arbitrary expression diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning03.fs index a0b497cdda4..8f399545579 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning03.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify ability to clone a record with mutable fields diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Syntax01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Syntax01.fs index ff1804d300d..8b4ad05c23b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Syntax01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Syntax01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify syntax associated with defining and creating records @@ -15,8 +15,8 @@ and Rec2 = { // Mixed and Rec3 = { A3 : int; B3 : string } - - + + let test1 = { A1 = 1; B1 = "1" } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/TypeInference01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/TypeInference01.fs index 16e6a800d1c..ab8b0b795b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/TypeInference01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/TypeInference01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Test type inference for records diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/TypeInference02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/TypeInference02.fs index 90611cff126..9907fde9824 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/TypeInference02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/TypeInference02.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Records +// #Conformance #TypesAndModules #Records // Verify no errors for type inference with ambiguous types @@ -17,7 +17,7 @@ let test2 () = let temp : Blue = { A = ' '; B = 42 } (funcExpectsBlue temp) -let test3 () = +let test3 () = // This shouldn't be ambig, since only one record has a C field let g = { A = '1'; B = 0; C = "abc" } g.C diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/E_Inheritance.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/E_Inheritance.fs index 4407d0dafed..243607ee532 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/E_Inheritance.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/E_Inheritance.fs @@ -1,7 +1,7 @@ type TK_I_005 = abstract M : unit -> unit - + [] -type TK_I_006b = +type TK_I_006b = inherit TK_I_005 - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_Equals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_Equals.fs index 25db75c5fe3..b9503d9a93e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_Equals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_Equals.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT +// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of Equals() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_GetHashCode.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_GetHashCode.fs index c5a55c76b02..61f26f398f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_GetHashCode.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_GetHashCode.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT +// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of GetHashCode() @@ -6,4 +6,4 @@ type S2 = member this.GetHashCode(s:char) = 1 //member this.GetHashCode() = 1. - member this.GetHashCode(?s:char) = 1 + member this.GetHashCode(?s:char) = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_ToString.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_ToString.fs index 732a8f5879b..d5f44a07f34 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_ToString.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/Overload_ToString.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT +// #Regression #Conformance #ObjectOrientedTypes #Structs #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of ToString() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethod2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethod2.fs index 1933c5e0917..06cf45a8f16 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethod2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethod2.fs @@ -1,4 +1,4 @@ -// #inline #FSharpQA #Conformance #TypeConstraints +// #inline #FSharpQA #Conformance #TypeConstraints //This member, function or value declaration may not be declared 'inline' //This member, function or value declaration may not be declared 'inline' //This member, function or value declaration may not be declared 'inline' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethods1.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethods1.fs index 08febca56c1..119ba0b5df0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethods1.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethods1.fs @@ -1,12 +1,12 @@ -// #inline #FSharpQA #Conformance #TypeConstraints +// #inline #FSharpQA #Conformance #TypeConstraints //This member, function or value declaration may not be declared 'inline' //This member, function or value declaration may not be declared 'inline' [] -type Bad10 = +type Bad10 = abstract inline X : int [] -type Bad11 = +type Bad11 = abstract inline X : int -> int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/ExtensionConstraints/testFiles/MiniFSharpPlusExtensionSRTP.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/ExtensionConstraints/testFiles/MiniFSharpPlusExtensionSRTP.fs index bb69e536e6b..6bff10b675d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/ExtensionConstraints/testFiles/MiniFSharpPlusExtensionSRTP.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/ExtensionConstraints/testFiles/MiniFSharpPlusExtensionSRTP.fs @@ -62,14 +62,14 @@ module MiniFSharpPlus = let union = HashSet<'T> (max source1.Count source2.Count) for item in source1 do union.Add item |> ignore for item in source2 do union.Add item |> ignore - union + union /// Additional operations on Exception [] module Exception = open System open System.Runtime.ExceptionServices - + /// Combines exceptions from 2 exceptions into a single AggregateException. /// Exceptions already present in the first argument won't be added. let add (exn1: exn) (exn2: exn) = @@ -146,7 +146,7 @@ module MiniFSharpPlus = let x2: 't2 = if true then Unchecked.defaultof<_> else (^t : (member Item2: 't2) x) let x1: 't1 = if true then Unchecked.defaultof<_> else (^t : (member Item1: 't1) x) Tuple<'t1,'t2,'t3,'t4,'t5,'t6,'t7,'tr> (Zero.Invoke (), Zero.Invoke (), Zero.Invoke (), Zero.Invoke (), Zero.Invoke (), Zero.Invoke (), Zero.Invoke (), Zero.Invoke ()) |> retype : 't - + and ValueTuple<'t> with static member inline get_Zer0 () = ValueTuple<'T> (Zero.Invoke ()) : ValueTuple<'T> and struct ('t1 * 't2) with static member inline get_Zer0 () = struct (Zero.Invoke (), Zero.Invoke ()) @@ -158,7 +158,7 @@ module MiniFSharpPlus = [] module Semigroup = type Plus = class end - + module Default3 = type Plus with static member inline ``+`` (x: 'Plus, y: 'Plus) = printfn "Default3"; (^Plus : (static member (<|>) : _*_ -> _) x, y) : ^Plus module Default2 = type Plus with static member inline ``+`` (x: 'Plus, y: 'Plus) = printfn "Default2"; x + y : ^Plus @@ -179,7 +179,7 @@ module MiniFSharpPlus = type Exception with static member (++) (x: exn , y: exn ) = Exception.add x y :> exn type Plus with static member inline ``+`` (x: 'Plus, y: 'Plus) = printfn "Default1"; x ++ y : ^Plus - and Plus with + and Plus with static member inline Invoke (x: 'Plus) (y: 'Plus) : 'Plus = let inline call (mthd : ^M, input1 : ^I, input2 : ^I) = ((^M or ^I) : (static member ``+`` : _*_ -> _) input1, input2) call (Unchecked.defaultof, x, y) @@ -268,7 +268,7 @@ module MiniFSharpPlus = type List<'t> with static member Return (x: 'T) : list<'T> = [x] type 't``[]`` with static member Return (x: 'T) : 'T[] = [|x|] - + type Option<'t> with [] static member Return (x: 'T) : option<'T> = Some x @@ -283,7 +283,7 @@ module MiniFSharpPlus = type Return with [] static member inline Invoke x : '``Pointed<'T>`` = (^``Pointed<'T>`` : (static member Return : _ -> _) x) - + [] module Monad = type Bind = class end @@ -299,8 +299,8 @@ module MiniFSharpPlus = type Microsoft.FSharp.Core.FSharpFunc<'r, 'a> with static member (>>=) (m: 'R -> 'T, k: 'T -> 'R -> 'U) : 'R -> 'U = fun r -> let a = m r in k a r type Bind with static member inline Invoke (x: '``Monad<'T>``) (f: 'T -> '``Monad<'U>``) : '``Monad<'U>`` = (^``Monad<'T>`` : (static member (>>=) : _*_ -> _) x, f) - - + + [] module Applicative = type Apply = class end @@ -395,7 +395,7 @@ module MiniFSharpPlus = // type 't``[]`` with static member inline Traverse (x: 't``[]``, f) = let cons head tail = Map.Invoke (fun h t -> Array.append [|h|] t) head tail in Array.foldBack cons x (Return.Invoke [||]) type Option<'t> with static member inline Traverse (t: option<'``Functor<'T>``>, f) = match t with Some x -> Map.Invoke Some (f x) | _ -> Return.Invoke None type ValueOption<'t> with static member inline Traverse (t: ValueOption<'``Functor<'T>``>, f) = match t with ValueSome x -> Map.Invoke ValueSome (f x) | _ -> Return.Invoke ValueNone - + type Traverse with static member inline Invoke (x: '``Traversable<'T>``) (f: 'T -> '``Applicative<'U>``) : '``Applicative>`` = ((^``Traversable<'T>`` or Traverse) : (static member Traverse : _*_ -> _) x, f) @@ -423,7 +423,7 @@ module MiniFSharpPlus = type Option<'t> with static member inline Sequence (t: option<'``Applicative<'T>``>) = match t with Some x -> Map.Invoke Some x | _ -> Return.Invoke None type ValueOption<'t> with static member inline Sequence (t: voption<'``Applicative<'T>``>) = match t with ValueSome x -> Map.Invoke ValueSome x | _ -> Return.Invoke ValueNone - + type Sequence with static member inline Invoke (x: '``Traversable<'Applicative<'T>>``) : '``Applicative>`` = ((^``Traversable<'Applicative<'T>>`` or Sequence) : (static member Sequence : _ -> _) x) @@ -496,10 +496,10 @@ module SimpleFSharpPlus = let inline (<*>) f x : ^``Applicative<'U>`` = Apply.Invoke f x // ((^``Applicative<'T -> 'U>``) : (static member (<*>) : ^``Applicative<'T -> 'U>`` * ^``Applicative<'T>`` -> ^``Applicative<'U>``) (f, x)) let inline (>>=) x f : ^``Monad<'U>`` = Bind.Invoke x f // ((^``Monad<'T>``) : (static member (>>=) : ^``Monad<'T>`` * ('T -> ^``Monad<'U>``) -> ^``Monad<'U>``) (x, f)) - + let inline traverse f x = Traverse.Invoke x f let inline sequence x = Sequence.Invoke x - + let inline (|>>>) x f : ^``Functor>`` = ((^``Functor>``) : (static member (|>>>) : ^``Functor>`` * ('T -> 'U) -> ^``Functor>``) (x, f)) let inline (|>>>>) x f : ^``Functor>>`` = ((^``Functor>>``) : (static member (|>>>>) : ^``Functor>>`` * ('T -> 'U) -> ^``Functor>>``) (x, f)) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs index 7b4a9037813..e7f4e8222ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs @@ -361,7 +361,7 @@ let main _ = #if !NETCOREAPP [] - #else + #else [] [] [] @@ -1131,12 +1131,12 @@ module StaticAbstractBug = |> compile |> shouldFail |> withDiagnostics [ - (Error 855, Line 14, Col 18, Line 14, Col 23, "No abstract or interface member was found that corresponds to this override"); - (Error 859, Line 15, Col 21, Line 15, Col 29, "No abstract property was found that corresponds to this override"); - (Error 859, Line 17, Col 21, Line 17, Col 30, "No abstract property was found that corresponds to this override"); + (Error 855, Line 14, Col 18, Line 14, Col 23, "No abstract or interface member was found that corresponds to this override"); + (Error 859, Line 15, Col 21, Line 15, Col 29, "No abstract property was found that corresponds to this override"); + (Error 859, Line 17, Col 21, Line 17, Col 30, "No abstract property was found that corresponds to this override"); (Error 859, Line 18, Col 21, Line 18, Col 30, "No abstract property was found that corresponds to this override") ] - + [] // RealSig [] // Regular [] @@ -1323,7 +1323,7 @@ let execute = IPrintable.Say("hello") |> withLangVersion80 |> typecheck |> shouldSucceed - + [] // RealSig [] // Regular [] @@ -1600,7 +1600,7 @@ Note that all interface members must be implemented and listed under an appropri ] // Tests for IWSAM type argument validation (issue #19184) - + [] let ``Error when interface with unimplemented static abstract is used as type argument to constrained generic`` () = Fsx """ @@ -3640,7 +3640,7 @@ if totalMass <> 10.0 then failwith (sprintf "Expected 10.0 but got %A" t [] let ``Extension operator SRTP resolves correctly under optimization`` () = - // Regression test: this exercises the optimizer's OptimizeTraitCall → + // Regression test: this exercises the optimizer's OptimizeTraitCall → // CodegenWitnessExprForTraitConstraint → GenWitnessExpr code path. // The optimizer resolves trait calls before IlxGen, so bugs in // GenWitnessExpr expression construction only manifest with --optimize+. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/testFiles/CheckNewSyntax.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/testFiles/CheckNewSyntax.fs index 882973f9d2e..b0b82c1f7cd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/testFiles/CheckNewSyntax.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/testFiles/CheckNewSyntax.fs @@ -2,7 +2,7 @@ open Types module CheckNewSyntax = - type MyType() = + type MyType() = static member val StaticProperty = 0 with get, set static member StaticMethod0 () = 5 static member StaticMethod1 x = x + 5 @@ -44,7 +44,7 @@ module CheckNewSyntax = //let inline f_set_StaticProperty2<'T when 'T : (static member StaticProperty: int with set) >() = 'T.StaticProperty <- 3 //let inline f_set_Length2<'T when 'T : (member Length: int with set) >(x: 'T) = x.Length <- 3 //let inline f_Item2<'T when 'T : (member Item: int -> string with get) >(x: 'T) = x[3] - + if f_StaticMethod0() <> 5 then failwith "Unexpected result" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/testFiles/CheckSelfConstrainedSRTP.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/testFiles/CheckSelfConstrainedSRTP.fs index c96e1481cdc..1c6525beae3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/testFiles/CheckSelfConstrainedSRTP.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/testFiles/CheckSelfConstrainedSRTP.fs @@ -14,5 +14,5 @@ module CheckSelfConstrainedSRTP = for x in xs do sum <- sum + x 'T.DivideByInt(sum, xs.Length) - + printfn "" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldMemberClash.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldMemberClash.fs index 7b43a27e8b2..7304c3601b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldMemberClash.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldMemberClash.fs @@ -13,7 +13,7 @@ type MyDU = member this.Item2 = 3 member this.V3 = 'x' -type MyDU2 = +type MyDU2 = | Case1 of int with member this.Item = "" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldNameUsedMulti.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldNameUsedMulti.fs index 1fbc0c34c84..d6b774a75a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldNameUsedMulti.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldNameUsedMulti.fs @@ -1,10 +1,10 @@ -// #Conformance #TypesAndModules #Unions +// #Conformance #TypesAndModules #Unions // Make sure we properly detect field names specified multiple times -type MyDU = +type MyDU = | Case1 of V1 : int * V2 : string let x = Case1(V1 = 1, V1 = "") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_InheritUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_InheritUnion.fs index 8be1f4950d9..33d0420ac36 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_InheritUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_InheritUnion.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Unions +// #Regression #Conformance #TypesAndModules #Unions // Verify error when inherit from union types diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_LowercaseDT.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_LowercaseDT.fs index 7d8fdc317a2..03e21520a02 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_LowercaseDT.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_LowercaseDT.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Unions +// #Regression #Conformance #TypesAndModules #Unions // FS1: 325, Case sensitivity reported by Eugene diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Overload_Equals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Overload_Equals.fs index e77bba49ec9..3176f9c1eba 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Overload_Equals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Overload_Equals.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Unions +// #Regression #Conformance #TypesAndModules #Unions // Regression test for FSHARP1.0:5223 // Overloading of Equals() // Overloads differ for the return type only (from the one implemented by default) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Overload_GetHashCode.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Overload_GetHashCode.fs index 1676a8db90d..590df250fc2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Overload_GetHashCode.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Overload_GetHashCode.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Unions +// #Regression #Conformance #TypesAndModules #Unions // Regression test for FSHARP1.0:5223 // Overloading of GetHashCode() // Overloads differ for the return type only (from the one implemented by default) @@ -6,4 +6,4 @@ type DU = | A member this.GetHashCode() = 1. - + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionConstructorBadFieldName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionConstructorBadFieldName.fs index ae106f28858..12b3ad85485 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionConstructorBadFieldName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionConstructorBadFieldName.fs @@ -1,10 +1,10 @@ -// #Conformance #TypesAndModules #Unions +// #Conformance #TypesAndModules #Unions // Make sure we properly detect bogus named field in constructors -type MyDU = +type MyDU = | Case1 of V1 : int * V2 : string let x = Case1(1, V3 = "") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldConflictingName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldConflictingName.fs index a9b9710a94d..7a96d971748 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldConflictingName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldConflictingName.fs @@ -1,10 +1,10 @@ -// #Conformance #TypesAndModules #Unions +// #Conformance #TypesAndModules #Unions // Make sure we properly detect field naming collisions -type MyDU = +type MyDU = | Case1 of Item2 : int * string -type MyDU2 = +type MyDU2 = | Case1 of A : int * A : string * A : int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTag.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTag.fs index 747932062ac..3b6ecf49d36 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTag.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTag.fs @@ -1,7 +1,7 @@ -// #Conformance #TypesAndModules #Unions +// #Conformance #TypesAndModules #Unions // Regression test for Bug 6308 -type BigUnion1 = +type BigUnion1 = | Case0 | Tags of bool | Case11 of bool diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTagNoDefault.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTagNoDefault.fs index 4cc6816ef3a..2f9ac9b5f87 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTagNoDefault.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTagNoDefault.fs @@ -1,8 +1,8 @@ -// #Conformance #TypesAndModules #Unions -// RegressionTest for bug 6308 +// #Conformance #TypesAndModules #Unions +// RegressionTest for bug 6308 //The union case named 'Tags' conflicts with the generated type 'Tags' [] -type BigUnion2 = +type BigUnion2 = | Case0 | Tags of bool | Case11 of bool diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTag.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTag.fs index a6e6ec24a88..36ab9865d00 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTag.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTag.fs @@ -1,10 +1,10 @@ -// #Conformance #TypesAndModules #Unions -// RegressionTest for bug 6308 +// #Conformance #TypesAndModules #Unions +// RegressionTest for bug 6308 //The union case named 'Tags' conflicts with the generated type 'Tags' //The member 'Tag' cannot be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module [] -type BigUnion2 = +type BigUnion2 = | Case0 | Tags of bool | Case11 of bool diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagNoDefault.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagNoDefault.fs index c662f61244d..e7943678a00 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagNoDefault.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagNoDefault.fs @@ -1,9 +1,9 @@ -// #Conformance #TypesAndModules #Unions -// RegressionTest for bug 6308 +// #Conformance #TypesAndModules #Unions +// RegressionTest for bug 6308 //The member 'Tag' cannot be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module [] -type BigUnion2 = +type BigUnion2 = | Case0 | Case11 of bool | Case22 of bool diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTags.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTags.fs index 983154ac285..f02097d7f5d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTags.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTags.fs @@ -1,9 +1,9 @@ -// #Conformance #TypesAndModules #Unions -// RegressionTest for bug 6308 +// #Conformance #TypesAndModules #Unions +// RegressionTest for bug 6308 //The member 'Tags' cannot be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module [] -type BigUnion2 = +type BigUnion2 = | Case0 | Case11 of bool | Case22 of bool diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagsNoDefault.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagsNoDefault.fs index 326d73f5bc0..a04caf03891 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagsNoDefault.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagsNoDefault.fs @@ -1,9 +1,9 @@ -// #Conformance #TypesAndModules #Unions -// RegressionTest for bug 6308 +// #Conformance #TypesAndModules #Unions +// RegressionTest for bug 6308 //The member 'Tags' cannot be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module [] -type BigUnion2 = +type BigUnion2 = | Case0 | Case11 of bool | Case22 of bool diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionsNotNull01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionsNotNull01.fs index 7fa963fbebd..9625d093acb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionsNotNull01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionsNotNull01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Unions +// #Regression #Conformance #TypesAndModules #Unions // Verify that null is not a proper value for a Discriminated Union diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/EqualAndBoxing01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/EqualAndBoxing01.fs index 58c9953cd3f..f1790305461 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/EqualAndBoxing01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/EqualAndBoxing01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Unions +// #Regression #Conformance #TypesAndModules #Unions // Regression test for FSHARP1.0:5535 // Union type type U = A | B of int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ImplicitEquals001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ImplicitEquals001.fs index 7c5c03200f1..d0fa14c1182 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ImplicitEquals001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ImplicitEquals001.fs @@ -1,18 +1,18 @@ -// #Regression #Conformance #TypesAndModules #Unions +// #Regression #Conformance #TypesAndModules #Unions // Implicitly implemented Equals should not throw // Regression test for FSHARP1.0:1633 // Unions -type M = +type M = | A of string let a = A("Hello") -let e = +let e = try let _ = a.Equals(a) // compare to itself - let _ = a.Equals("") // compare to another string + let _ = a.Equals("") // compare to another string let _ = a.Equals(10) // compare to a different type [==> should not throw!] 0 with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_Equals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_Equals.fs index 4568508b3ad..507bbe0e084 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_Equals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_Equals.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Unions #ReqNOMT +// #Regression #Conformance #TypesAndModules #Unions #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of Equals() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_GetHashCode.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_GetHashCode.fs index b040db5c9e5..d1bb38a1ecb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_GetHashCode.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_GetHashCode.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #TypesAndModules #Unions #ReqNOMT +// #Regression #Conformance #TypesAndModules #Unions #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of GetHashCode() type DU = | A member this.GetHashCode(s:char) = 1 //member this.GetHashCode() = 1. - member this.GetHashCode(?s:char) = 1 + member this.GetHashCode(?s:char) = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_ToString.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_ToString.fs index 76bc09590d6..a8fcb1c5c64 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_ToString.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Overload_ToString.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypesAndModules #Unions #ReqNOMT +// #Regression #Conformance #TypesAndModules #Unions #ReqNOMT // Regression test for FSHARP1.0:5223 // Overloading of ToString() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ReflectionOnUnionTypes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ReflectionOnUnionTypes01.fs index 66d250bc079..547622b0985 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ReflectionOnUnionTypes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ReflectionOnUnionTypes01.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #TypesAndModules #Unions +// #Regression #Conformance #TypesAndModules #Unions // Regression test for FSHARP1.0:4331 // Either provide F# reflection access to attributes on union cases, or remove the ability in the language to apply this -type X = +type X = | [] A | [] B of int let uci = Microsoft.FSharp.Reflection.FSharpType.GetUnionCases (typeof) -let res = +let res = uci.[0].GetCustomAttributes(typeof).Length = 1 && uci.[1].GetCustomAttributes(typeof).Length = 1 && uci.[0].GetCustomAttributes().Length >= 1 && diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index 17f931c8c7f..443b4d2f0e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -4,7 +4,7 @@ open Xunit open FSharp.Test.Compiler module UnionStructTypes = - + [] let ``Union struct can share fields with equal name and type`` () = Fsx """ @@ -67,11 +67,11 @@ do equalityMustKeepWorking() let main _args = printf "BasicThreeLongs=%i;GenericOfInt=%i;GenericOfString=%i;MixWithBool=%i;MixWithString=%i;Erasure=%i" structUnionSize genericSizeForInt genericSizeForString sizeForMixingWithBool sizeForMixingWithString sizeForSharingAfterErasure 0 - """ + """ |> asExe |> compile |> shouldSucceed - |> run + |> run |> verifyOutput "BasicThreeLongs=32;GenericOfInt=16;GenericOfString=32;MixWithBool=24;MixWithString=24;Erasure=16" [] @@ -85,7 +85,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 2`` () = Fsx """ @@ -97,7 +97,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 3`` () = Fsx """ @@ -123,7 +123,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 5`` () = Fsx """ @@ -149,7 +149,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 7`` () = Fsx """ @@ -161,7 +161,7 @@ type NotATree = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 8`` () = Fsx """ @@ -173,7 +173,7 @@ type NotATree = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 9`` () = Fsx """ @@ -185,7 +185,7 @@ type NotATree = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 10 - v7`` () = Fsx """ @@ -202,8 +202,8 @@ type StructUnion = |> withDiagnostics [ Error 3204, Line 5, Col 12, Line 5, Col 15, "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'." Error 3204, Line 6, Col 12, Line 6, Col 18, "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'." - Error 3204, Line 7, Col 12, Line 7, Col 18, "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'." ] - + Error 3204, Line 7, Col 12, Line 7, Col 18, "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'." ] + [] let ``If a union type has more than one case and is a struct, field must be given unique name 11 - preview`` () = Fsx """ @@ -216,7 +216,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 12`` () = Fsx """ @@ -233,8 +233,8 @@ type StructUnion = |> withDiagnostics [ Error 3204, Line 5, Col 12, Line 5, Col 15, "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'." Error 3204, Line 7, Col 12, Line 7, Col 18, "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'." ] - - + + [] let ``If a union type has more than one case and is a struct, field must be given unique name 13`` () = Fsx """ @@ -259,8 +259,8 @@ type StructUnion = | C of c: string """ |> typecheck - |> shouldSucceed - + |> shouldSucceed + [] let ``If a union type has more than one case and is a struct, field must be given unique name 15 - v7`` () = Fsx """ @@ -275,8 +275,8 @@ type StructUnion = |> shouldFail |> withDiagnostics [ Error 3204, Line 5, Col 12, Line 5, Col 16, "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'." - Error 3204, Line 6, Col 12, Line 6, Col 18, "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'." ] - + Error 3204, Line 6, Col 12, Line 6, Col 18, "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'." ] + [] let ``If a union type has more than one case and is a struct, field must be given unique name 16 - preview`` () = Fsx """ @@ -292,7 +292,7 @@ type StructUnion = Error 3585, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields." Error 3585, Line 6, Col 12, Line 6, Col 16, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields." ] - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 17 - preview`` () = Fsx """ @@ -304,7 +304,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 18 - v7`` () = Fsx """ @@ -321,7 +321,7 @@ type StructUnion = Error 3204, Line 5, Col 12, Line 5, Col 16, "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'." Error 3204, Line 6, Col 12, Line 6, Col 16, "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'." ] - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 19 - v7`` () = Fsx """ @@ -338,7 +338,7 @@ type StructUnion = (Error 3204, Line 5, Col 12, Line 5, Col 16, "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'.") (Error 3204, Line 6, Col 12, Line 6, Col 18, "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'.") ] - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 20 - preview`` () = Fsx """ @@ -352,8 +352,8 @@ type StructUnion = |> shouldFail |> withDiagnostics [ Error 3585, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields." - Error 3585, Line 6, Col 12, Line 6, Col 18, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields."] - + Error 3585, Line 6, Col 12, Line 6, Col 18, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields."] + [] let ``If a union type has more than one case and is a struct, field must be given unique name 21 - preview`` () = Fsx """ @@ -365,7 +365,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 22`` () = Fsx """ @@ -377,7 +377,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 23`` () = Fsx """ @@ -406,7 +406,7 @@ type StructUnion = (Error 3585, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields."); (Error 3585, Line 5, Col 27, Line 5, Col 31, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields.") ] - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 25`` () = Fsx """ @@ -434,7 +434,7 @@ type StructUnion = A of a: int | B of b:string """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 27`` () = Fsx """ @@ -458,7 +458,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 29`` () = Fsx """ @@ -470,7 +470,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 30`` () = Fsx """ @@ -482,7 +482,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 31`` () = Fsx """ @@ -494,7 +494,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 32`` () = Fsx """ @@ -518,7 +518,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 34 - preview`` () = Fsx """ @@ -531,7 +531,7 @@ type StructUnion = A of int | B of string |> withDiagnostics [ Error 3585, Line 4, Col 25, Line 4, Col 28, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields." Error 3585, Line 4, Col 36, Line 4, Col 42, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields." ] - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 35`` () = Fsx """ @@ -543,7 +543,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 36 - preview`` () = Fsx """ @@ -557,7 +557,7 @@ type StructUnion = |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 37 - preview`` () = Fsx """ @@ -570,7 +570,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 38 - preview`` () = Fsx """ @@ -583,7 +583,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 39 - preview`` () = Fsx """ @@ -609,7 +609,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 41`` () = Fsx """ @@ -635,7 +635,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 43 - preview`` () = Fsx """ @@ -646,9 +646,9 @@ type StructUnion = | B of string * b: string | C of c: string * string * c3: int """ - |> typecheck + |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name 44`` () = Fsx """ @@ -661,7 +661,7 @@ type StructUnion = """ |> typecheck |> shouldSucceed - + [] let ``If a union type has more than one case and is a struct, field must be given unique name involves an immediate cyclic reference`` () = Fsx """ @@ -700,7 +700,7 @@ type StructUnion = A of X:int | B of Y:StructUnion |> withSingleDiagnostic (Error 954, Line 4, Col 18, Line 4, Col 29, "This type definition involves an immediate cyclic reference through a struct field or inheritance relation") let createMassiveStructDuProgram countOfCases = - let codeSb = + let codeSb = System.Text.StringBuilder(""" module Foo [] @@ -708,14 +708,14 @@ type StructUnion = """ ) let basicTypes = [|"";"";"int";"string";"byte";"System.Uri";"int[]";"option";"voption";"System.Uri[]"|] - + for i=1 to countOfCases do let t = basicTypes[i%basicTypes.Length] - if t = "" then + if t = "" then codeSb.AppendLine($" | Case{i}") |> ignore else codeSb.AppendLine($" | Case{i} of field1_{i}:{t} * field2_{i}:{t}") |> ignore - + codeSb.AppendLine($""" [] let main _argv = @@ -723,7 +723,7 @@ let main _argv = 0""") |> ignore Fs (codeSb.ToString()) - + [] [] @@ -768,7 +768,7 @@ type GenericStructDu<'T> = EmptyFirst | SingleVal of f:'T | DoubleVal of f2:'T * """ |> compile |> shouldSucceed - + [] let ``Error when declaring an abstract member in union struct type`` () = Fsx """ @@ -777,7 +777,7 @@ type U = | A | B abstract M : unit -> unit """ - |> typecheck + |> typecheck |> shouldFail |> withSingleDiagnostic (Error 912, Line 5, Col 3, Line 5, Col 28, "This declaration element is not permitted in an augmentation") @@ -899,7 +899,7 @@ type MySharedStructDu = } """ ] [] - let ``Custom ValueOption keeps working`` () = + let ``Custom ValueOption keeps working`` () = Fsx """ module XX open System @@ -927,7 +927,7 @@ let main args = |> verifyOutput "MyValueSome 42" [] - let sysDiagnostics = + let sysDiagnostics = #if NETCOREAPP "[runtime]System.Diagnostics" #else diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs index 49c5b41d7cc..57a79383e8b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs @@ -721,7 +721,7 @@ if (sprintf "%%A" ABC.ab) <> "[A; B]" then failwith (sprintf "Failed: printing ' |> asExe |> compileAndRun |> shouldSucceed - + [] let ``Error when declaring an abstract member in union type`` () = Fsx """ @@ -729,11 +729,11 @@ type U = | A | B abstract M : unit -> unit """ - |> typecheck + |> typecheck |> shouldFail |> withSingleDiagnostic (Error 912, Line 4, Col 3, Line 4, Col 28, "This declaration element is not permitted in an augmentation") - - + + [] let ``Error when property has same name as DU case`` () = Fsx """ @@ -757,13 +757,13 @@ type MyId = | IdC x -> Some x | _ -> None """ - |> typecheck + |> typecheck |> shouldFail |> withDiagnostics [ (Error 23, Line 7, Col 17, Line 7, Col 20, "The member 'IdA' cannot be defined because the name 'IdA' clashes with the union case 'IdA' in this type or module") (Error 23, Line 17, Col 17, Line 17, Col 20, "The member 'IdC' cannot be defined because the name 'IdC' clashes with the union case 'IdC' in this type or module") ] - + [] let ``Union field appears multiple times in union declaration`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionsNotNull02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionsNotNull02.fs index 890b3361fb6..e1cc0a214cb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionsNotNull02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionsNotNull02.fs @@ -1,4 +1,4 @@ -// #Conformance #TypesAndModules #Unions +// #Conformance #TypesAndModules #Unions // Verify additional checks when using a dynamic type cast to ensure @@ -13,7 +13,7 @@ type DUType = let test1 = (box C :?> DUType) // Dynamic type test should throw a null ref exception -let testPassed = +let testPassed = try let _ = (box null :?> DUType) false diff --git a/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/neg_invalid_constructor.fs b/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/neg_invalid_constructor.fs index 02be510295d..d62a9c42ccc 100644 --- a/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/neg_invalid_constructor.fs +++ b/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/neg_invalid_constructor.fs @@ -1,7 +1,7 @@ -type ImmutableStack<'a> private(items: 'a list) = - +type ImmutableStack<'a> private(items: 'a list) = + member this.Push item = ImmutableStack(item::items) member this.Pop = match items with | [] -> failwith "No elements in stack" | x::xs -> x,ImmutableStack(xs) - + // Notice type annotation is commented out, which results in an error new(col (*: seq<'a>*)) = ImmutableStack(List.ofSeq col) diff --git a/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs b/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs index 5d44d059cf7..28719b23ede 100644 --- a/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs @@ -68,7 +68,7 @@ module Baz = { Kind = ImportDefinitionKind.ImportNamespace; Name = "System.IO" } ] ] - VerifySequencePoints [ + VerifySequencePoints [ Line 6, Col 21, Line 6, Col 49 Line 8, Col 26, Line 8, Col 32 Line 16, Col 20, Line 16, Col 22 diff --git a/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs b/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs index ec6f6760825..40d2212f4bf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs +++ b/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs @@ -93,7 +93,7 @@ let t3 (x: RecTy) (a: AnotherNestedRecTy) = { x with D.C.c = { a with A = 3; B = (Warning 3560, Line 9, Col 27, Line 9, Col 66, "This copy-and-update record expression changes all fields of record type 'Test.NestedRecTy'. Consider using the record construction syntax instead.") (Warning 3560, Line 15, Col 62, Line 15, Col 85, "This copy-and-update record expression changes all fields of record type 'Test.AnotherNestedRecTy'. Consider using the record construction syntax instead.") ] - + [] let ``Error when implementing interface with auto property in record type``() = FSharp """ @@ -112,7 +112,7 @@ type FooImpl = |> compile |> shouldFail |> withSingleDiagnostic (Error 912, Line 9, Col 5, Line 9, Col 36, "This declaration element is not permitted in an augmentation") - + [] let ``Error when declaring an abstract member in record type`` () = Fsx """ @@ -120,6 +120,6 @@ type R = { a : int; b : string } abstract M : unit -> unit """ - |> typecheck + |> typecheck |> shouldFail |> withSingleDiagnostic (Error 912, Line 4, Col 3, Line 4, Col 28, "This declaration element is not permitted in an augmentation") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/InlineWithPrivateValues01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/InlineWithPrivateValues01.fs index 32c59c126d4..e0b1802b532 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/InlineWithPrivateValues01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/InlineWithPrivateValues01.fs @@ -1,4 +1,4 @@ -// #Regression #CodeGen #Optimizations #Assemblies +// #Regression #CodeGen #Optimizations #Assemblies // Regression for Dev10:850602 // Previously a premature optimization was causing the call to isContaining to access private data of the record type in an invalid way // It caused illegal IL and FieldAccessExceptions at runtime diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/TypeLib01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/TypeLib01.fs index 65461bd7216..8ca4269c0ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/TypeLib01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/TypeLib01.fs @@ -1,15 +1,15 @@ -// #Regression #CodeGen #Optimizations #Assemblies +// #Regression #CodeGen #Optimizations #Assemblies // Record type with method accessing private data for regressions for Dev10:850602 module A [] -type VectorFloat(x:float,y:float,z:float) = +type VectorFloat(x:float,y:float,z:float) = member a.X = x -type OctantBoundary = - { Min : VectorFloat; +type OctantBoundary = + { Min : VectorFloat; Max : VectorFloat } - -let inline isContaining (b:OctantBoundary) = - b.Min.X + +let inline isContaining (b:OctantBoundary) = + b.Min.X diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/TypeLib02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/TypeLib02.fs index bc71f8f71c2..9aa1a8b9006 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/TypeLib02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/TypeLib02.fs @@ -1,15 +1,15 @@ -// #Regression #CodeGen #Optimizations #Assemblies +// #Regression #CodeGen #Optimizations #Assemblies // Reference type with method accessing private data for regressions for Dev10:850602 module A -type VectorFloat(x:float,y:float,z:float) = +type VectorFloat(x:float,y:float,z:float) = member a.X = x [] -type OctantBoundary = - { Min : VectorFloat; +type OctantBoundary = + { Min : VectorFloat; Max : VectorFloat } - -let inline isContaining (b:OctantBoundary) = - b.Min.X + +let inline isContaining (b:OctantBoundary) = + b.Min.X diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib01.fs index 1c59463f94d..18c8af85244 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib01.fs @@ -1,4 +1,4 @@ -// #CodeGen #Optimizations #Assemblies +// #CodeGen #Optimizations #Assemblies namespace N module L1 = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib02.fs index 7ab98375c56..fdbf7bec731 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib02.fs @@ -1,7 +1,7 @@ -// #CodeGen #Optimizations #Assemblies +// #CodeGen #Optimizations #Assemblies namespace N module L2 = - type T() = + type T() = let f(x) = x + 1 member this.F(x) = f(x) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib03.fs index b5e81950769..300997ddd86 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib03.fs @@ -1,10 +1,10 @@ -// #CodeGen #Optimizations #Assemblies +// #CodeGen #Optimizations #Assemblies namespace N module L3 = type internal T1 = { rf1 : int } type internal T3 = | C3 - type internal T4 = | C4 of int + type internal T4 = | C4 of int let internal x1 = { rf1 = 1 } // type is is internal let f1 (x:obj) = unbox x = x1 // f1 rhs contains internals @@ -16,7 +16,7 @@ module L3 = let mutable internal a6 = true let f6() = a6 // f6 rhs contains internals - + exception internal E of int let k1() = typeof diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib04.fs index 9134ee34e22..cd5c9ae224e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/lib04.fs @@ -1,4 +1,4 @@ -// #CodeGen #Optimizations #Assemblies +// #CodeGen #Optimizations #Assemblies namespace N module L4 = @@ -20,4 +20,4 @@ module L4 = let s1() = sizeof> let s2() = sizeof> let s3() = sizeof> - + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test01.fs index a4d15f52153..41ba9668fd4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test01.fs @@ -1,6 +1,6 @@ -// #Regression #CodeGen #Optimizations #Assemblies +// #Regression #CodeGen #Optimizations #Assemblies // Do not inline of anything that uses �protected� things -// Do not inline of anything that uses explicitly internal values/types/methods/properties/values/union-cases/record-fields/exceptions. This includes +// Do not inline of anything that uses explicitly internal values/types/methods/properties/values/union-cases/record-fields/exceptions. This includes // - generic things instantiated at internal types // - typeof/sizeof etc. on internal types // Do not inline of anything that uses implicitly internal values such as �let f() = ...� in a class diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test02.fs index 5528a442087..6ea0a6f2186 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test02.fs @@ -1,6 +1,6 @@ -// #Regression #CodeGen #Optimizations #Assemblies +// #Regression #CodeGen #Optimizations #Assemblies // Do not inline of anything that uses �protected� things -// Do not inline of anything that uses explicitly internal values/types/methods/properties/values/union-cases/record-fields/exceptions. This includes +// Do not inline of anything that uses explicitly internal values/types/methods/properties/values/union-cases/record-fields/exceptions. This includes // - generic things instantiated at internal types // - typeof/sizeof etc. on internal types // Do not inline of anything that uses implicitly internal values such as �let f() = ...� in a class diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test03.fs index 87abf71634a..be8350efe51 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test03.fs @@ -1,6 +1,6 @@ -// #Regression #CodeGen #Optimizations #Assemblies +// #Regression #CodeGen #Optimizations #Assemblies // Do not inline of anything that uses �protected� things -// Do not inline of anything that uses explicitly internal values/types/methods/properties/values/union-cases/record-fields/exceptions. This includes +// Do not inline of anything that uses explicitly internal values/types/methods/properties/values/union-cases/record-fields/exceptions. This includes // - generic things instantiated at internal types // - typeof/sizeof etc. on internal types // Do not inline of anything that uses implicitly internal values such as �let f() = ...� in a class diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test04.fs index 2097ec4fd54..a926e8120e5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AssemblyBoundary/test04.fs @@ -1,6 +1,6 @@ -// #Regression #CodeGen #Optimizations #Assemblies +// #Regression #CodeGen #Optimizations #Assemblies // Do not inline of anything that uses �protected� things -// Do not inline of anything that uses explicitly internal values/types/methods/properties/values/union-cases/record-fields/exceptions. This includes +// Do not inline of anything that uses explicitly internal values/types/methods/properties/values/union-cases/record-fields/exceptions. This includes // - generic things instantiated at internal types // - typeof/sizeof etc. on internal types // Do not inline of anything that uses implicitly internal values such as �let f() = ...� in a class diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs index 695815a7168..fafbd882e49 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Async +// #NoMono #NoMT #CodeGen #EmittedIL #Async module AsyncExpressionSteppingTest1 // Regression test for FSHARP1.0:4058 -module AsyncExpressionSteppingTest1 = +module AsyncExpressionSteppingTest1 = - let f1 () = + let f1 () = async { printfn "hello" printfn "stuck in the middle" printfn "goodbye"} diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs index 68ff28401fe..6f05016864f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs @@ -6,6 +6,6 @@ module AsyncExpressionSteppingTest2 = async { while x.Value < 4 do x.Value <- x.Value + 1 printfn "hello" } - + let _ = f2() |> Async.RunSynchronously diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs index 8cd8bf03acb..2c5d2fc407d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs @@ -1,10 +1,10 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Async +// #NoMono #NoMT #CodeGen #EmittedIL #Async module AsyncExpressionSteppingTest3 // Regression test for FSHARP1.0:4058 -module AsyncExpressionSteppingTest3 = - let f3 () = - async { let x = ref 0 +module AsyncExpressionSteppingTest3 = + let f3 () = + async { let x = ref 0 x.Value <- x.Value + 1 - let y = ref 0 + let y = ref 0 y.Value <- y.Value + 1 let z = x.Value + x.Value return z } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs index 42bef7b6e83..240354c60d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs @@ -1,10 +1,10 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Async +// #NoMono #NoMT #CodeGen #EmittedIL #Async module AsyncExpressionSteppingTest4 // Regression test for FSHARP1.0:4058 -module AsyncExpressionSteppingTest4 = - let f4 () = - async { let x = ref 0 - try - let y = ref 0 +module AsyncExpressionSteppingTest4 = + let f4 () = + async { let x = ref 0 + try + let y = ref 0 y.Value <- y.Value let z = x.Value + y.Value return z diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs index 3dc21b1403b..e4f3e978d37 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Async +// #NoMono #NoMT #CodeGen #EmittedIL #Async module AsyncExpressionSteppingTest5 // Regression test for FSHARP1.0:4058 -module AsyncExpressionSteppingTest5 = +module AsyncExpressionSteppingTest5 = let es = [3;4;5] - let f7 () = + let f7 () = async { for x in es do printfn "hello" printfn "hello 2" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs index 5cb8d015466..16c230c90c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs @@ -1,19 +1,19 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Async +// #NoMono #NoMT #CodeGen #EmittedIL #Async module AsyncExpressionSteppingTest6 // Regression test for FSHARP1.0:4058 -module AsyncExpressionSteppingTest6 = - let f2 () = - async { let x = ref 0 +module AsyncExpressionSteppingTest6 = + let f2 () = + async { let x = ref 0 x.Value <- x.Value + 1 - let y = ref 0 + let y = ref 0 y.Value <- y.Value + 1 let z = x.Value + y.Value return z } - let f3 () = + let f3 () = async { let! x1 = f2() let! x2 = f2() let! x3 = f2() - let y = ref 0 + let y = ref 0 y.Value <- y.Value + 1 let! x4 = f2() let z = x1 + y.Value + x4 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs index 89345a07f42..c0d706f9441 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs @@ -25,7 +25,7 @@ module CCtorDUWithMember = |> getCompilation |> asFs |> withAdditionalSourceFile (SourceFromPath (__SOURCE_DIRECTORY__ ++ "CCtorDUWithMember01.fs")) - |> verifyCompilation + |> verifyCompilation [] let ``CCtorDUWithMember02a_fs`` compilation = @@ -49,7 +49,7 @@ module CCtorDUWithMember = |> getCompilation |> asFs |> withAdditionalSourceFile (SourceFromPath (__SOURCE_DIRECTORY__ ++ "CCtorDUWithMember04.fs")) - |> verifyCompilation + |> verifyCompilation [] // RealSig [] // Regular diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs index 5e1a5a64006..ea07bc1a06e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs @@ -1,7 +1,7 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Unions +// #NoMono #NoMT #CodeGen #EmittedIL #Unions module CCtorDUWithMember01a -type C = - | A +type C = + | A | B member x.P = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs index 71e2df833cc..983e8eb2c44 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Unions +// #NoMono #NoMT #CodeGen #EmittedIL #Unions module CCtorDUWithMember02a printfn "hello1" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs index 20517cac94f..07d426f3883 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Unions +// #NoMono #NoMT #CodeGen #EmittedIL #Unions module CCtorDUWithMember03a let mutable x = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04.fs index 41bce046054..8ca6dd611ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Unions +// #NoMono #NoMT #CodeGen #EmittedIL #Unions module Program printfn "File1.x = %A" CCtorDUWithMember04a.x diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs index 24dfbc8ca0f..02569676a63 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Unions +// #NoMono #NoMT #CodeGen #EmittedIL #Unions module CCtorDUWithMember04a let x = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Closures.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Closures.fs index 898656a55d0..e967e0b955a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Closures.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Closures.fs @@ -184,7 +184,7 @@ and callee y = if y > 0 then caller y else 0 let paramPattern = System.Text.RegularExpressions.Regex(@"(\w+[\w@]*)\s+\w+") for m in ctorPattern.Matches(actualIL) do let paramStr = m.Groups.[1].Value - let paramNames = + let paramNames = [ for p in paramPattern.Matches(paramStr) -> p.Groups.[1].Value ] |> List.filter (fun n -> n <> "class" && n <> "int32" && n <> "object" && n <> "string" && n <> "valuetype" && n <> "void" && n <> "bool") let distinct = paramNames |> List.distinct diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Observations.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Observations.fs index 4eb3dc57b98..6aacb0084d9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Observations.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Observations.fs @@ -22,7 +22,7 @@ let main _ = 0 |> withPlatform ExecutionPlatform.X64 |> compile |> shouldSucceed - |> withPeReader (fun rdr -> + |> withPeReader (fun rdr -> let characteristics = rdr.PEHeaders.CoffHeader.Characteristics if not (characteristics.HasFlag(System.Reflection.PortableExecutable.Characteristics.LargeAddressAware)) then failwith $"x64 binary should have LargeAddressAware flag. Found: {characteristics}" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute.fs index e11f8108c00..59e3e51775d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute.fs @@ -42,7 +42,7 @@ module CompiledNameAttribute = let ``CompiledNameAttribute04_RealInternalSignatureOn_fs`` compilation = compilation |> getCompilation - |> verifyCompilation + |> verifyCompilation [] let ``CompiledNameAttribute05_fs`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs index 06a73b511d7..300a9503fb5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Attributes +// #NoMono #NoMT #CodeGen #EmittedIL #Attributes // EXPECTED behavior: compile to an assembly where "f" has custom attribute Microsoft.FSharp.Core.CompilationSourceNameAttribute with value "f" module Program diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs index 07a882ab4eb..f773a96b904 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Attributes +// #NoMono #NoMT #CodeGen #EmittedIL #Attributes // EXPECTED behavior: compile to an assembly where "Method" has custom attribute Microsoft.FSharp.Core.CompilationSourceNameAttribute with value "Method" module Program diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs index 74758e3dbdd..e24115cdd39 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Attributes +// #NoMono #NoMT #CodeGen #EmittedIL #Attributes // EXPECTED behavior: compile to an assembly where "f" has custom attribute Microsoft.FSharp.Core.CompilationSourceNameAttribute with value "f" module Program diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04.fs index 24c007eee73..11d2e37bda0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Attributes +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Attributes // Regression test for FSharp1.0:4740 // Title: Expose currying information in F# compiled form @@ -14,17 +14,17 @@ open System.Runtime.InteropServices let f1 x y = x + y -let f2 x = x +let f2 x = x [] -type C() = +type C() = member this.P = 1 - member this.M1 x y = x + y + member this.M1 x y = x + y [] - member this.M2 x = x + member this.M2 x = x abstract A1 : int -> int -> int - abstract A2 : int -> int + abstract A2 : int -> int type IInterface = @@ -34,7 +34,7 @@ type IInterface = end -type S = +type S = struct [] member this.M1 x = x diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs index 3503a35f05c..f16939ea5ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs @@ -1,12 +1,12 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions // Regression test for FSHARP1.0:4972 // Debug ranges for computation expressions module Program open Library -let res1 = - eventually { - return 1 - } +let res1 = + eventually { + return 1 + } res1 |> Eventually.force diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs index a91c3760a6d..d4e730f480c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs @@ -1,11 +1,11 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions // Regression test for FSHARP1.0:4972 // Debug ranges for computation expressions module Program open Library -let res2 = - eventually { +let res2 = + eventually { let x = (printfn "hello"; "hello".Length) return x + x } res2 |> Eventually.force diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs index be4e644fee1..a50901e61c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs @@ -1,23 +1,23 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions // Regression test for FSHARP1.0:4972 // Debug ranges for computation expressions module Program open Library -let res2 = - eventually { +let res2 = + eventually { let x = (printfn "hello"; "hello".Length) return x + x } res2 |> Eventually.force -let res3 = - eventually { +let res3 = + eventually { let! x = res2 - let! x = - eventually { + let! x = + eventually { let x = (printfn "hello"; "hello".Length) - return 1 - } - return 1 + return 1 + } + return 1 } res3 |> Eventually.force diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs index ef7562113fb..5e1323ca63a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs @@ -1,14 +1,14 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions +// #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions module Program open Library -let res4 = - eventually { - try +let res4 = + eventually { + try let x = (printfn "hello"; "hello".Length) failwith "fail" - return x - with _ -> + return x + with _ -> let x = (printfn "hello"; "hello".Length) return x } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs index 98b389ab87a..4a9b0304847 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs @@ -1,14 +1,14 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions // Regression test for FSHARP1.0:4972 // Debug ranges for computation expressions module Program open Library -let res5 = - eventually { +let res5 = + eventually { let x = (printfn "hello"; "hello".Length) use x = { new System.IDisposable with member x.Dispose() = () } let x = (printfn "hello"; "hello".Length) - return 1 + return 1 } res5 |> Eventually.force diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs index 6b1a39f5ae5..c553d21c6b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs @@ -1,19 +1,19 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions // Regression test for FSHARP1.0:4972 // Debug ranges for computation expressions module Program open Library -let res6 = - eventually { +let res6 = + eventually { let mutable x = 1 - while x > 0 do + while x > 0 do printfn "hello" printfn "hello" printfn "hello" printfn "hello" printfn "hello" x <- x - 1 - return 1 + return 1 } res6 |> Eventually.force |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs index aa1bf720e49..0dbd957544d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs @@ -1,13 +1,13 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions // Regression test for FSHARP1.0:4972 // Debug ranges for computation expressions module Program open Library -let res7 = - eventually { +let res7 = + eventually { let mutable x = 1 - for v in [0 .. 3] do + for v in [0 .. 3] do x <- x - v return x } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExprLibrary.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExprLibrary.fs index 4b1c9bd1304..03027bff0fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExprLibrary.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExprLibrary.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #ComputationExpressions // This is an aux library ("eventually" monad used in the compiler) // It is used by the ComputationExpr* tests // See regression test for FSHARP1.0:4972 @@ -6,8 +6,8 @@ namespace Library -type Eventually<'T> = - | Done of 'T +type Eventually<'T> = + | Done of 'T | NotYetDone of (unit -> Eventually<'T>) type ResultOrException<'tresult> = @@ -15,77 +15,77 @@ type ResultOrException<'tresult> = | Exception of System.Exception [] -module Eventually = - let rec box e = - match e with - | Done x -> Done (Operators.box x) +module Eventually = + let rec box e = + match e with + | Done x -> Done (Operators.box x) | NotYetDone (work) -> NotYetDone (fun () -> box (work())) - let rec force e = - match e with - | Done x -> x + let rec force e = + match e with + | Done x -> x | NotYetDone (work) -> force (work()) - let repeatedlyProgressUntilDoneOrTimeShareOver timeShareInMilliseconds runner e = - let sw = new System.Diagnostics.Stopwatch() - let rec runTimeShare e = - runner (fun () -> + let repeatedlyProgressUntilDoneOrTimeShareOver timeShareInMilliseconds runner e = + let sw = new System.Diagnostics.Stopwatch() + let rec runTimeShare e = + runner (fun () -> sw.Reset() - sw.Start(); - let rec loop(e) = - match e with + sw.Start(); + let rec loop(e) = + match e with | Done _ -> e - | NotYetDone (work) -> - if sw.ElapsedMilliseconds > timeShareInMilliseconds then + | NotYetDone (work) -> + if sw.ElapsedMilliseconds > timeShareInMilliseconds then sw.Stop(); - NotYetDone(fun () -> runTimeShare e) - else + NotYetDone(fun () -> runTimeShare e) + else loop(work()) loop(e)) runTimeShare e - let rec bind k e = - match e with - | Done x -> k x + let rec bind k e = + match e with + | Done x -> k x | NotYetDone work -> NotYetDone (fun () -> bind k (work())) - let fold f acc seq = + let fold f acc seq = (Done acc,seq) ||> Seq.fold (fun acc x -> acc |> bind (fun acc -> f acc x)) - - let rec catch e = - match e with + + let rec catch e = + match e with | Done x -> Done(Result x) - | NotYetDone work -> - NotYetDone (fun () -> - let res = try Result(work()) with | e -> Exception e - match res with + | NotYetDone work -> + NotYetDone (fun () -> + let res = try Result(work()) with | e -> Exception e + match res with | Result cont -> catch cont | Exception e -> Done(Exception e)) - + let delay f = NotYetDone (fun () -> f()) - let tryFinally e compensation = - catch (e) + let tryFinally e compensation = + catch (e) |> bind (fun res -> compensation(); - match res with + match res with | Result v -> Eventually.Done v | Exception e -> raise e) - let tryWith e handler = - catch e + let tryWith e handler = + catch e |> bind (function Result v -> Done v | Exception e -> handler e) - let rec doWhile f e = + let rec doWhile f e = if f() then e |> bind (fun () -> doWhile f e) else Eventually.Done () - - let doFor (xs: seq<_>) f = + + let doFor (xs: seq<_>) f = let rec loop (ie:System.Collections.Generic.IEnumerator<_>) = if ie.MoveNext() then f ie.Current |> bind (fun () -> loop ie) else Eventually.Done () let ie = xs.GetEnumerator() tryFinally (delay (fun () -> loop ie)) (fun _ -> ie.Dispose()) -type EventuallyBuilder() = +type EventuallyBuilder() = member x.Bind(e,k) = Eventually.bind k e member x.Return(v) = Eventually.Done v member x.ReturnFrom(e:Eventually<_>) = e diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs index f4fefd871a3..c3362f3b6b8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs @@ -55,25 +55,25 @@ module ComputationExpressions = let ``ComputationExpr04_fs`` compilation = compilation |> getCompilation - |> verifyCompilation + |> verifyCompilation [] let ``ComputationExpr05_fs`` compilation = compilation |> getCompilation - |> verifyCompilation + |> verifyCompilation [] let ``ComputationExpr06_fs`` compilation = compilation |> getCompilation - |> verifyCompilation + |> verifyCompilation [] let ``ComputationExpr07_fs`` compilation = compilation |> getCompilation - |> verifyCompilation + |> verifyCompilation [] let ``CustomCollectionBuilderComputationExpr_fs_OptimizeOff`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs index 6c4f01442ee..64bb8b0924d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs @@ -15,7 +15,7 @@ module ComputedCollections = |> verifyILBaseline [] - let Int32RangeArrays_fs compilation = + let Int32RangeArrays_fs compilation = compilation |> getCompilation |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.fs index 2f6ff63d2a2..99bdd7d69d9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.fs @@ -1,6 +1,6 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not -// Array of array +// Array of array module Program let F<'T when 'T :> System.IDisposable>(x : 'T[][]) = x.[0].[0].Dispose() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.fs index 82f6e5c9b51..406cbe5a298 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Array of array - use an F# interface (IEvent<'a> for example) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs index 693ccf9749b..f32924c76f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Array of array - use an F# interface (IEvent<'a> for example) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs index 6048e758cfd..69214fcdef8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Single dimensional array diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs index e4c97b7f995..95952ba0a3f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Single dimensional array - use an F# interface (IEvent<'a> for example) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs index d04c864455f..3d640d3b16f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Single dimensional array - use an F# interface (IEvent<'a> for example) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs index cd44055a502..07621c4184d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Multi-dimensional array diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs index 8d6dd2ee8d1..a2f4e6079e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Multi-dimensional array - use an F# interface (IEvent<'a> for example) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs index 077633dc7dc..fa0b0267bb3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Multi-dimensional array - use an F# interface (IEvent<'a> for example) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.fs index ad1ea5ea6a9..e88d739189d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Non-array diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.fs index e0ace1ac393..2dc3f62e76d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Non-array - use an F# interface (IEvent<'a> for example) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs index 82842076f61..18c29450d49 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // Non-array - use an F# interface (IEvent<'a> for example) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.fs index c2ddc85980e..87fd1cab481 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not // ToString diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/FixedBindings.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/FixedBindings.fs index 5e4d306208e..cbf76e27a73 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/FixedBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/FixedBindings.fs @@ -10,7 +10,7 @@ open FSharp.Test.Compiler module FixedBindings = [] - let ``Pin naked array`` () = + let ``Pin naked array`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedArray.fs") |> withLangVersionPreview |> withNoWarn 9 @@ -55,7 +55,7 @@ module FixedBindings = } """ ] [] - let ``Pin address of record field`` () = + let ``Pin address of record field`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinAddressOfRecordField.fs") |> withLangVersionPreview |> withNoWarn 9 @@ -84,7 +84,7 @@ module FixedBindings = } """ ] [] - let ``Pin address of explicit field on this`` () = + let ``Pin address of explicit field on this`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinAddressOfExplicitFieldOnThis.fs") |> withLangVersionPreview |> withNoWarn 9 @@ -113,7 +113,7 @@ module FixedBindings = IL_0015: ldobj [System.Runtime]System.Int32 IL_001a: ret } """ ] - + [] let ``Pin address of array element`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinAddressOfArrayElement.fs") @@ -144,7 +144,7 @@ module FixedBindings = IL_0016: ldobj [runtime]System.Char IL_001b: ret } """ ] - + module ExtendedFixedBindings = [] [] @@ -152,14 +152,14 @@ module ExtendedFixedBindings = let runtimeSupportsStringGetPinnableReference = typeof.GetMethods() |> Seq.exists (fun m -> m.Name = "GetPinnableReference") - + // Sanity check precondition: if .Net Framework were to ever get GetPinnableReference, we'll know here #if NETCOREAPP3_0_OR_GREATER Assert.True(runtimeSupportsStringGetPinnableReference) #else Assert.False(runtimeSupportsStringGetPinnableReference) #endif - + FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedString.fs") |> withLangVersion langVersion |> withNoWarn 9 @@ -227,7 +227,7 @@ module ExtendedFixedBindings = IL_001c: ldobj [runtime]System.Char IL_0021: ret } """ ]) - + [] let ``Pin int byref of parameter`` langVersion = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinIntByrefOfParameter.fs") @@ -256,9 +256,9 @@ module ExtendedFixedBindings = IL_0010: ldobj [runtime]System.Int32 IL_0015: ret } """ ] - + [] - let ``Pin int byref of local variable`` langVersion = + let ``Pin int byref of local variable`` langVersion = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinIntByrefOfLocalVariable.fs") |> withLangVersion langVersion |> withNoWarn 9 @@ -300,7 +300,7 @@ module ExtendedFixedBindings = IL_0027: ret } """ ] - + #if NETCOREAPP [] let ``Pin Span via manual GetPinnableReference call`` langVersion = @@ -394,9 +394,9 @@ module ExtendedFixedBindings = IL_001b: ret } """ ] #endif - + [] - let ``Pin type with method GetPinnableReference : unit -> byref`` langVersion = + let ``Pin type with method GetPinnableReference : unit -> byref`` langVersion = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinTypeWithGetPinnableReferenceReturningByref.fs") |> withLangVersion langVersion |> withNoWarn 9 @@ -430,9 +430,9 @@ module ExtendedFixedBindings = IL_001b: ldobj [runtime]System.Int32 IL_0020: ret } """ ] - + [] - let ``Pin type with method GetPinnableReference : unit -> inref`` langVersion = + let ``Pin type with method GetPinnableReference : unit -> inref`` langVersion = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinTypeWithGetPinnableReferenceReturningInref.fs") |> withLangVersion langVersion |> withNoWarn 9 @@ -501,12 +501,12 @@ module ExtendedFixedBindings = IL_001b: ret } """ ] #endif - + [] let ``Pin C# type with method GetPinnableReference : unit -> byref`` langVersion = let csLib = CSharpFromPath (__SOURCE_DIRECTORY__ ++ "PinCSharpTypeWithGetPinnableReferenceReturningByref.cs") |> withName "CsLib" - + FsFromPath (__SOURCE_DIRECTORY__ ++ "PinCSharpTypeWithGetPinnableReferenceReturningByref.fs") |> withLangVersion langVersion |> withReferences [csLib] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfArrayElement.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfArrayElement.fs index b6eb61aea92..aa99c67d865 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfArrayElement.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfArrayElement.fs @@ -4,7 +4,7 @@ open Microsoft.FSharp.NativeInterop let pinIt (arr: char[]) = use ptr = fixed &arr[0] NativePtr.get ptr 0 - + let x = [|'a';'b';'c'|] let y = pinIt x if y <> 'a' then failwithf "y did not equal first element of x" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfExplicitFieldOnThis.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfExplicitFieldOnThis.fs index 7320c742cad..0ceb25a2cb9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfExplicitFieldOnThis.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfExplicitFieldOnThis.fs @@ -4,13 +4,13 @@ open Microsoft.FSharp.NativeInterop type Point = val mutable X: int val mutable Y: int - + new(x: int, y: int) = { X = x; Y = y } - + member this.PinIt() = use ptr = fixed &this.X NativePtr.get ptr 0 - + let p = Point(10,20) let xCopy = p.PinIt() if xCopy <> p.X then failwith "xCopy was not equal to X" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfRecordField.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfRecordField.fs index 1aad39790a7..37843793f3d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfRecordField.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinAddressOfRecordField.fs @@ -6,7 +6,7 @@ type Point = { mutable X: int; mutable Y: int } let pinIt (thing: Point) = use ptr = fixed &thing.X NativePtr.get ptr 0 - + let p = { X = 10; Y = 20 } let xCopy = pinIt p if xCopy <> p.X then failwith "xCopy was not equal to X" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinCSharpTypeWithGetPinnableReferenceReturningByref.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinCSharpTypeWithGetPinnableReferenceReturningByref.fs index d56c5cff860..2961e631a3e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinCSharpTypeWithGetPinnableReferenceReturningByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinCSharpTypeWithGetPinnableReferenceReturningByref.fs @@ -5,7 +5,7 @@ open System let pinIt (thing: PinnableReference) = use ptr = fixed thing NativePtr.get ptr 0 - + [] let main _ = let x = PinnableReference(42) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinGenericReadOnlySpan.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinGenericReadOnlySpan.fs index d63f946ba10..c9291801a12 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinGenericReadOnlySpan.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinGenericReadOnlySpan.fs @@ -5,7 +5,7 @@ open System let pinIt (thing: ReadOnlySpan<'a>) = use ptr = fixed thing NativePtr.get ptr 0 - + [] let main _ = let span = ReadOnlySpan("The quick brown fox jumped over the lazy dog".ToCharArray()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinIntByrefOfLocalVariable.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinIntByrefOfLocalVariable.fs index ce08ac07fe6..2a45b699d7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinIntByrefOfLocalVariable.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinIntByrefOfLocalVariable.fs @@ -11,5 +11,5 @@ let pinIt (x: int) = use ptr = fixed &thing let thingCopy = NativePtr.get ptr 0 if thingCopy <> thing then fail () - + pinIt 100 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinIntByrefOfParameter.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinIntByrefOfParameter.fs index 419ab9dc950..0d10d3737c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinIntByrefOfParameter.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinIntByrefOfParameter.fs @@ -4,7 +4,7 @@ open Microsoft.FSharp.NativeInterop let pinIt (thing: byref) = use ptr = fixed &thing NativePtr.get ptr 0 - + let mutable x = 42 let xCopy = pinIt &x -if x <> xCopy then failwith "xCopy was not the same as x" \ No newline at end of file +if x <> xCopy then failwith "xCopy was not the same as x" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinSpan.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinSpan.fs index 9d0d5e95adc..14202ef9210 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinSpan.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinSpan.fs @@ -5,7 +5,7 @@ open System let pinIt (thing: Span) = use ptr = fixed thing NativePtr.get ptr 0 - + [] let main _ = let span = Span("The quick brown fox jumped over the lazy dog".ToCharArray()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinSpanWithManualGetPinnableReferenceCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinSpanWithManualGetPinnableReferenceCall.fs index f3054550b64..ad173ecefa6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinSpanWithManualGetPinnableReferenceCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinSpanWithManualGetPinnableReferenceCall.fs @@ -5,7 +5,7 @@ open System let pinIt (thing: Span) = use ptr = fixed &thing.GetPinnableReference() NativePtr.get ptr 0 - + [] let main _ = let span = Span("The quick brown fox jumped over the lazy dog".ToCharArray()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinStructTypeWithGetPinnableReferenceReturningByref.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinStructTypeWithGetPinnableReferenceReturningByref.fs index 87f636881c5..9eda9fb9dcb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinStructTypeWithGetPinnableReferenceReturningByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinStructTypeWithGetPinnableReferenceReturningByref.fs @@ -6,7 +6,7 @@ open System [] type ArrayElementRef<'T> = private { Values: 'T[]; Index: int } - + static member Create(values: 'T[], index) = if index > values.Length then raise (ArgumentOutOfRangeException(nameof(index), "")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithCSharpStyleExtensionGetPinnableReferenceReturningByref.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithCSharpStyleExtensionGetPinnableReferenceReturningByref.fs index e5256ecedd8..188609759cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithCSharpStyleExtensionGetPinnableReferenceReturningByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithCSharpStyleExtensionGetPinnableReferenceReturningByref.fs @@ -7,12 +7,12 @@ type RefField<'T> = { mutable _value: 'T } [] type RefFieldExtensions = [] - static member GetPinnableReference(refField: RefField<'T>) : byref<'T> = &refField._value + static member GetPinnableReference(refField: RefField<'T>) : byref<'T> = &refField._value let pinIt (thing: RefField<'T>) = use ptr = fixed thing NativePtr.get ptr 0 - + [] let main _ = let mutable x = 42 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithFSharpStyleExtensionGetPinnableReferenceReturningByref.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithFSharpStyleExtensionGetPinnableReferenceReturningByref.fs index b54bebeeef8..63b270251b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithFSharpStyleExtensionGetPinnableReferenceReturningByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithFSharpStyleExtensionGetPinnableReferenceReturningByref.fs @@ -10,7 +10,7 @@ type RefField<'T> with let pinIt (thing: RefField<'T>) = use ptr = fixed thing NativePtr.get ptr 0 - + [] let main _ = let mutable x = 42 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithGetPinnableReferenceReturningByref.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithGetPinnableReferenceReturningByref.fs index b276ae2672e..7cbaa6d5827 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithGetPinnableReferenceReturningByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithGetPinnableReferenceReturningByref.fs @@ -12,7 +12,7 @@ type RefField<'T>(_value) = let pinIt (thing: RefField) = use ptr = fixed thing NativePtr.get ptr 0 - + [] let main _ = let x = RefField(42) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithGetPinnableReferenceReturningInref.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithGetPinnableReferenceReturningInref.fs index 43b580e574e..17f7fb2c3ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithGetPinnableReferenceReturningInref.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/FixedBindings/PinTypeWithGetPinnableReferenceReturningInref.fs @@ -12,7 +12,7 @@ type ReadonlyRefField<'T>(_value) = let pinIt (thing: ReadonlyRefField) = use ptr = fixed thing NativePtr.get ptr 0 - + [] let main _ = let x = ReadonlyRefField(42) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs index ad9a9e104b5..f60d36d1a36 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs @@ -1,8 +1,8 @@ -// #Regression #CodeGen #Optimizations #ControlFlow #NoMono #ReqNOMT +// #Regression #CodeGen #Optimizations #ControlFlow #NoMono #ReqNOMT // Regression test for FSHARP1.0:3982 // Compiler should turn 'foreach' loops over arrays into 'for' loops module ForEachOnArray01 -let test3(arr: int[]) = +let test3(arr: int[]) = let mutable z = 0 for x in arr do z <- z + x diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs index 942d99c3234..09eb7073a41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs @@ -32,16 +32,16 @@ let test5() = printfn "%A" x // more complex enumerable expression -let test6() = +let test6() = for i in ( [1;2;3;4] |> List.map (fun x -> x + 1) ) do printfn "%O" i - -// multiline body -let test7() = + +// multiline body +let test7() = for i in ( [1;2;3;4] |> List.map (fun x -> diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop01.fs index 8d7d270e2c8..059b9e43a72 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for TFS#712639 // Incorrect span or overlapping debugging spans // The test will start failing once the bug is actually fixed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop02.fs index 04882e0ec2c..a29f2a2b36a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop02.fs @@ -1,7 +1,7 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for TFS#712639 // Incorrect span or overlapping debugging spans // The test will start failing once the bug is actually fixed for wi = 1 to 3 do printfn "%A" wi - + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop03.fs index 9ce6ae8b25d..6caaea78f9f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop03.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSharp1.0:4785 // Title: Search the IEnumerator pattern first @@ -6,7 +6,7 @@ let ra = new ResizeArray(100) for i = 0 to 100 do ra.Add(i) -let test1() = +let test1() = let mutable z = 0 for i = 0 to 10000000 do for x in ra do diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs index 54c5dd3c27c..355d0f1e2b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs @@ -1,11 +1,11 @@ -// #Regression #CodeGen #Optimizations #ControlFlow #NoMono #ReqNOMT +// #Regression #CodeGen #Optimizations #ControlFlow #NoMono #ReqNOMT // Regression test for FSHARP1.0:5408 // For-loop emitted with unnecessary tuple module NoAllocationOfTuple01 let loop n = - let a = Array.zeroCreate n + let a = Array.zeroCreate n let mutable i = -1 for j = 1 to n do - i <- i + 1 + i <- i + 1 a.[ i ] <- j // creates an unnecessary temporary tuple a diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs index 9288143b4de..e74f1099e9a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs @@ -1,4 +1,4 @@ -// #Regression #CodeGen #Optimizations #ControlFlow +// #Regression #CodeGen #Optimizations #ControlFlow // Regression test for FSHARP1.0:5306 // Bad codegen while optimizing for-loops with non-trivial branching and binding in end // diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs index 9f976b52b52..db85661c5db 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs @@ -1,4 +1,4 @@ -// #Regression #CodeGen #Optimizations #ControlFlow +// #Regression #CodeGen #Optimizations #ControlFlow // Regression test for FSHARP1.0:5306 // Bad codegen while optimizing for-loops with non-trivial branching and binding in end // diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs index 25e457f4509..463e4fd6a49 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs @@ -1,4 +1,4 @@ -// #Regression #CodeGen #Optimizations #ControlFlow +// #Regression #CodeGen #Optimizations #ControlFlow // Regression test for FSHARP1.0:5306 // Bad codegen while optimizing for-loops with non-trivial branching and binding in end // diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs index 57bf33efac2..c7952ba4089 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs @@ -1,4 +1,4 @@ -// #Regression #CodeGen #Optimizations #ControlFlow +// #Regression #CodeGen #Optimizations #ControlFlow // Regression test for FSHARP1.0:5306 // Bad codegen while optimizing for-loops with non-trivial branching and binding in end // diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs index 1c3e67958e4..c0f784db706 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs @@ -1,4 +1,4 @@ -// #Regression #CodeGen #Optimizations #ControlFlow +// #Regression #CodeGen #Optimizations #ControlFlow // Regression test for FSHARP1.0:5306 // Bad codegen while optimizing for-loops with non-trivial branching and binding in end // diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs index 68f256b2add..547391eec7d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs @@ -1,7 +1,7 @@ -// #Regression #CodeGen #Optimizations #ControlFlow #NoMono #ReqNOMT +// #Regression #CodeGen #Optimizations #ControlFlow #NoMono #ReqNOMT // // Regression test for FSHARP1.0:4461 module ZeroToArrLength01 -let f1(arr:int[]) = - for i = 0 to arr.Length - 1 do +let f1(arr:int[]) = + for i = 0 to arr.Length - 1 do arr.[i] <- i diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs index 96ec6ca9cad..39dbd864142 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs @@ -1,7 +1,7 @@ -// #Regression #CodeGen #Optimizations #ControlFlow #NoMono #ReqNOMT +// #Regression #CodeGen #Optimizations #ControlFlow #NoMono #ReqNOMT // // Regression test for FSHARP1.0:4461 module ZeroToArrLength02 -let f1(arr:int[]) = - for i = 0 to Array.length arr - 1 do +let f1(arr:int[]) = + for i = 0 to Array.length arr - 1 do arr.[i] <- i diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs index 60d1f482602..cbf0f62dc80 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs @@ -1,7 +1,7 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:5646 -let squaresOfOneToTen() = +let squaresOfOneToTen() = [ for x in 0 .. 2 do yield x * x ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs index 9486dc543cc..372d7a94f98 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs @@ -1,7 +1,7 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:5646 -let squaresOfOneToTenB() = +let squaresOfOneToTenB() = [ for x in 0 .. 2 do printfn "hello" yield x * x ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs index b031cc5ed8e..a6afee837e5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:5646 let squaresOfOneToTenC() = [ for x in 0 .. 10 -> x * x ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs index 446e373977c..d54da1c942a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:5646 let squaresOfOneToTenD = [ for x in 0 .. 10 -> x * x ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs index d3a9e06a113..f9c492b1c8c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs @@ -42,7 +42,7 @@ type Value = |> asLibrary |> withName "module1" - let mainModule = + let mainModule = FSharpWithFileName "Program.fs" $""" open Module1 @@ -62,7 +62,7 @@ Value.Zero = Value.Create 0 |> ignore""" [] // RealSig, public WrapType, public visibility in IL [] let ``Generated typed Equals`` (realsig, typeScope, targetVisibility) = - let library = + let library = FSharpWithFileName "Program.fs" $""" module Module1 = @@ -113,7 +113,7 @@ module Module1 = [] let ``Record with various scoped fields`` (realsig, fieldScope) = - let mainModule = + let mainModule = FSharpWithFileName "Program.fs" $$""" module Module1 = @@ -176,7 +176,7 @@ module Module1 = [] // private module - RealSig, public WrapType, public visibility in IL [] let ``scoped main and scoped type Equals`` (realsig, moduleScope, argScope, targetVisibility) = - let mainModule = + let mainModule = FSharpWithFileName "Program.fs" $""" module {moduleScope} IPartialEqualityComparer = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs index be9ecfff785..f18550d16c1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs @@ -249,14 +249,14 @@ module GenericComparison = compilation |> getCompilation |> verifyCompilation - + // SOURCE=Equals11.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals11.dll" # Equals11.fs - [] let ``Equals11_fsx`` compilation = compilation |> getCompilation |> verifyCompilation - + // SOURCE=Equals12.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals12.dll" # Equals12.fs - [] let ``Equals12_fsx`` compilation = @@ -270,14 +270,14 @@ module GenericComparison = compilation |> getCompilation |> verifyCompilation - + // SOURCE=Equals14.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals14.dll" # Equals14.fs - [] let ``Equals14_fsx`` compilation = compilation |> getCompilation |> verifyCompilation - + // SOURCE=Equals15.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals15.dll" # Equals15.fs - [] let ``Equals15_fsx`` compilation = @@ -291,14 +291,14 @@ module GenericComparison = compilation |> getCompilation |> verifyCompilation - + // SOURCE=Equals17.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals17.dll" # Equals17.fs - [] let ``Equals17_fsx`` compilation = compilation |> getCompilation |> verifyCompilation - + // SOURCE=Equals18.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals18.dll" # Equals18.fs - [] let ``Equals18_fsx`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison01.fs index 72838b27681..aaf80c2122c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison01.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let f1 (x:int) (y:int) = (x <= y) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison02.fs index 07d339dced4..b5b79da9e1d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison02.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let f2 (x:int) (y:int) = (x >= y) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison03.fs index 015ba4bcdf4..e97969de028 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison03.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let f3 (x:int) (y:int) = (x < y) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison04.fs index 63142c6ad98..0296e5d84b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison04.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let f4 (x:int) (y:int) = (x > y) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison05.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison05.fs index 05a98b72262..714fec9aa87 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison05.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison05.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let f5 (x:int) (y:int) (z:'a) (w:'a) = if (x > y) then z else w diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/EmptyStringPattern.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/EmptyStringPattern.fs index ad0c2967690..64f03fd10e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/EmptyStringPattern.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/EmptyStringPattern.fs @@ -23,6 +23,6 @@ let inline testBundledEmptyAndNull (s: string) = // Usage functions to show inlining in action let useClassifyString s = classifyString s -let useTestEmptyStringOnly s = testEmptyStringOnly s +let useTestEmptyStringOnly s = testEmptyStringOnly s let useBundledNullAndEmpty s = testBundledNullAndEmpty s let useBundledEmptyAndNull s = testBundledEmptyAndNull s diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs index 455b569c200..34fe8e4481d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs @@ -1,17 +1,17 @@ -// #NoMono #CodeGen #Optimizations +// #NoMono #CodeGen #Optimizations module Match01 -type Test1 = - | X11 of int - | X12 of int - | X13 of int - | X14 of int +type Test1 = + | X11 of int + | X12 of int + | X13 of int + | X14 of int -let select1 x = - match x with +let select1 x = + match x with | X11 x1 -> x1 - | X12 _ -> 2 - | X13 _ -> 3 + | X12 _ -> 2 + | X13 _ -> 3 | X14 _ -> 4 // select1 is not supposed to be inlined here diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match02.fs index ff915db8802..44f07d11a59 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match02.fs @@ -1,14 +1,14 @@ -// #NoMono #CodeGen #Optimizations +// #NoMono #CodeGen #Optimizations module Match02 [] -type S = +type S = static member inline (+)(_, _ : S) = 0 static member inline (*)(_, _ : S) = 1 static member inline (+)(_ : S, _) = 2 static member inline (*)(_ : S, _) = 3 -let testmethod () = +let testmethod () = let a = (1,2) + S() // should be inlined - 0 let b = (fun x -> x + 1) + S()// should be inlined 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs index d3e41ff4788..cacb09de08f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs @@ -1,39 +1,39 @@ -// #NoMono #CodeGen #Optimizations +// #NoMono #CodeGen #Optimizations module StructUnion01 [] type U = U of int * int -let g1 (U(a,b)) = a + b +let g1 (U(a,b)) = a + b -let g2 u = +let g2 u = let (U(a,b)) = u - a + b + a + b -let g3 (x:U) = - match x with - | U(3,a) -> a - | U(a,b) -> a + b +let g3 (x:U) = + match x with + | U(3,a) -> a + | U(a,b) -> a + b -let g4 (x:U) (y: U) = - match x,y with +let g4 (x:U) (y: U) = + match x,y with | U(3,a), U(5,b) -> a + b | U(a,b), U(c,d) -> a + b + c + d -let f1 (x:U byref) = - let (U(a,b)) = x - a + b +let f1 (x:U byref) = + let (U(a,b)) = x + a + b -let f2 (x:U byref) = - match x with - | U(a,b) -> a + b +let f2 (x:U byref) = + match x with + | U(a,b) -> a + b -let f3 (x:U byref) = - match x with - | U(3,a) -> a - | U(a,b) -> a + b +let f3 (x:U byref) = + match x with + | U(3,a) -> a + | U(a,b) -> a + b -let f4 (x:U byref) (y: U byref) = - match x,y with +let f4 (x:U byref) (y: U byref) = + match x,y with | U(3,a), U(5,b) -> a + b | U(a,b), U(c,d) -> a + b + c + d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs index 79a348e1e26..9247c21ce79 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs @@ -31,7 +31,7 @@ module ListExpressionStepping = |> getCompilation |> verifyCompilation - // SOURCE=ListExpressionSteppingTest3.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ListExpressionSteppingTest3.exe" # ListExpressionSteppingTest3.fs + // SOURCE=ListExpressionSteppingTest3.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ListExpressionSteppingTest3.exe" # ListExpressionSteppingTest3.fs [] let ``ListExpressionStepping03_RealInternalSignatureOn_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs index a3bbb454983..5787022fe5f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs @@ -1,8 +1,8 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists // Regression test for FSHARP1.0:4058 module ListExpressionSteppingTest1 -module ListExpressionSteppingTest1 = - let f0 () = +module ListExpressionSteppingTest1 = + let f0 () = [ yield 1 ] let _ = f0() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs index b8bc07e5119..e952d3f2a1d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs @@ -1,8 +1,8 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists // Regression test for FSHARP1.0:4058 module ListExpressionSteppingTest2 -module ListExpressionSteppingTest2 = - let f1 () = +module ListExpressionSteppingTest2 = + let f1 () = [ printfn "hello" yield 1 printfn "goodbye" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs index 54aa23146fc..e2fc9dc8f1a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs @@ -1,10 +1,10 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists // Regression test for FSHARP1.0:4058 module ListExpressionSteppingTest3 -module ListExpressionSteppingTest3 = - let f2 () = - let mutable x = 0 - [ while x < 4 do +module ListExpressionSteppingTest3 = + let f2 () = + let mutable x = 0 + [ while x < 4 do x <- x + 1 printfn "hello" yield x ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs index c9c88fbd1b0..d2f712265e9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs @@ -1,11 +1,11 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists // Regression test for FSHARP1.0:4058 module ListExpressionSteppingTest4 -module ListExpressionSteppingTest4 = - let f3 () = - [ let mutable x = 0 +module ListExpressionSteppingTest4 = + let f3 () = + [ let mutable x = 0 x <- x + 1 - let mutable y = 0 + let mutable y = 0 y <- y + 1 yield x let z = x + y diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs index 3c4df22fa62..29ea5ccc484 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs @@ -1,16 +1,16 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists // Regression test for FSHARP1.0:4058 module ListExpressionSteppingTest5 -module ListExpressionSteppingTest5 = - let f4 () = - [ let mutable x = 0 - try - let mutable y = 0 +module ListExpressionSteppingTest5 = + let f4 () = + [ let mutable x = 0 + try + let mutable y = 0 y <- y + 1 yield x let z = x + y - yield z - finally + yield z + finally x <- x + 1 printfn "done" ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs index ee50e966869..8a61f9656c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs @@ -1,12 +1,12 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Lists // Regression test for FSHARP1.0:4058 module ListExpressionSteppingTest6 -module ListExpressionSteppingTest6 = +module ListExpressionSteppingTest6 = let es = [1;2;3] - let f7 () = + let f7 () = [ for x in es do printfn "hello" - yield x + yield x for x in es do printfn "goodbye" yield x ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs index 7f949913cab..0c4e437999b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs @@ -37,7 +37,7 @@ module MethodImplAttribute = compilation |> getCompilation |> verifyCompilation - + [] let ``NoInlining_fs with inline keyword => should warn in preview version`` compilation = compilation @@ -45,7 +45,7 @@ module MethodImplAttribute = |> withLangVersion80 |> typecheck |> withSingleDiagnostic (Warning 3151, Line 3, Col 12, Line 3, Col 19, "This member, function or value declaration may not be declared 'inline'") - + // SOURCE=MethodImplAttribute.AggressiveInlining.fs SCFLAGS="-a -g --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd MethodImplAttribute.AggressiveInlining.dll" # MethodImplAttribute.AggressiveInlining.fs [] let ``AggressiveInlining_fs`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs index 74ad9e7c857..0260965d933 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs @@ -2,9 +2,9 @@ let main argv = let mutable x = 1 - + let a = {| A = 1; B = 1 |} x <- x + 1 - 0 + 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs index 7fcadda4ede..05e58ae3853 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs @@ -1,10 +1,10 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:3309 -// +// // Make sure that argument names are preserved in some/all compiler closures -// +// // Correct IL: -// .method public strict virtual instance int32 +// .method public strict virtual instance int32 // Invoke(class M/C i_want_to_see_this_identifier@7) cil managed <=== correct! // { // // Code size 9 (0x9) @@ -16,7 +16,7 @@ // // // Incorrect IL: -// .method public strict virtual instance int32 +// .method public strict virtual instance int32 // Invoke(class M/C arg0) cil managed <=== incorrect "arg0" is not what we want // { // // Code size 9 (0x9) @@ -36,8 +36,8 @@ module M member x.F(o:obj) = x.GetHashCode() let I (i_want_to_see_this_identifier:C) = i_want_to_see_this_identifier.F() - + type T() = member x.F = I - + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs index 21d38f3bb8d..48f8e611537 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSharp1.0:5645 // Title: Action proposed changes from review of compiled names diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs index 9a0f15d2a5d..0065e7b6699 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module M let f<[]'T>(x:'T) = x diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs index d7285d7884d..d81bc826b3e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:3083 // Implementation of decimal constants diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs index 7aec9204b16..6f215583c16 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs @@ -1,8 +1,8 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:1792 let static_initializer = 10 - + [] -let main (argsz:string []) = +let main (argsz:string []) = exit(if(static_initializer=10) then 0 else 1) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs index 68fabf80a51..ce4a3a16266 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs @@ -1,7 +1,7 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:5543 // Inefficiency on .Equals() // This test has nothing to do with debugging spans, etc... // It's a pure IL verification -type U = | A +type U = | A | B of int diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs index fb6fd4ca377..c4d50757482 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs @@ -1,9 +1,9 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSharp1.0:6389 - Nullary union cases improperly constrain generic type parameters type Weirdo = | C let f C = 0 // parameter name is C -let g () = +let g () = let C = 1 let f C = C // what is parameter name here? Do we even care? () diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GenericTypeStaticField.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GenericTypeStaticField.fs index e38c268a067..d6423487a4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GenericTypeStaticField.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GenericTypeStaticField.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL type Foo<'a>() = static let theInstance = new Foo<'a>() static member Instance = theInstance - + type Bar<'a,'b>() = static let theInstance = new Bar<'a,'b>() static member Instance = theInstance diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs index f81c02acfa2..eb21471c5ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs @@ -1,7 +1,7 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module IfThenElse01 // Regression test for F#4519 module M = - let m () = + let m () = let f5 (x:int) (y:int) (z:'a) (w:'a) = if (x > y) then z else w f5 10 10 'a' 'b' m() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs index ca4ad97f092..eb7e1ac6a84 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:5155 // Stepping through if/then/else which is then stored into a local mistakenly steps into "else" branch @@ -9,4 +9,4 @@ let F(y) = let y2 = if System.DateTime.Now.Year < 2000 then 1 else 2 x1,y1,x2,y2 -F(1) |> ignore +F(1) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs index f6dcced5ee6..a19a0748be7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:1881 // Make sure that when targeting NetFx4.0, we follow the new pattern: @@ -11,7 +11,7 @@ // } // finally // { -// if (lockTaken) +// if (lockTaken) // Monitor.Exit(obj); // } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Marshal.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Marshal.fs index e6842b9b756..5628e008cd0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Marshal.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Marshal.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL open System.Runtime.InteropServices type Reader = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline.fs index 6b651913ae2..7c5f3dbfc16 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression for FSHARP1.0:5782 (Methods with MethodImplAttribute(MethodImplOptions.NoInlining) should not be inlined) // compile with optimizations turned on: this will force an attempt to inline g() open System.Runtime.CompilerServices diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs index 6074a704773..bf659024efa 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression for FSHARP1.0:5782 (Methods with MethodImplAttribute(MethodImplOptions.NoInlining) should not be inlined) // compile with optimizations turned on: this will force an attempt to inline g() open System.Runtime.CompilerServices diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs index 859e9411782..b53a869e081 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs @@ -1,9 +1,9 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:2644 (a module may start with an expression) // Verify that we can compile a module with an expression in it // -module M = +module M = printfn "hello" let x = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs index 729eb08d4e0..0ca0e0efb3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs @@ -1,7 +1,7 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for DEV11:11983 // Title: Calling Dispose with use/using on a Struct results in boxing because of explicit interfaces let f1 (x:System.Collections.Generic.List<'T>) = - for a in x do + for a in x do () diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NonEscapingArguments02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NonEscapingArguments02.fs index dc50b30310a..a6df72929cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NonEscapingArguments02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NonEscapingArguments02.fs @@ -1,7 +1,7 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:3143 module NonEscapingArguments02 -type ListSizeCounter<'t>(somelist: 't list) = - let size = List.length somelist +type ListSizeCounter<'t>(somelist: 't list) = + let size = List.length somelist member this.Size = size diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs index 46a9e78e895..2269bde9127 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs @@ -1,7 +1,7 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL -let q = Seq.forall (fun s -> +let q = Seq.forall (fun s -> if not true then () true ) [ 1 ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs index aaecc513ea7..14f1fad0e12 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSharp1.0:5057 // Title: Inefficient access of mutable field of struct diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs index 83fdc826755..e6987762708 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs @@ -10,9 +10,9 @@ type Repro = let mutable h = 0 for i=0 to length-1 do h <- 26*h - h + h } -let test() = +let test() = let t = Repro(42) t.hash \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs index 83fdc826755..e6987762708 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs @@ -10,9 +10,9 @@ type Repro = let mutable h = 0 for i=0 to length-1 do h <- 26*h - h + h } -let test() = +let test() = let t = Repro(42) t.hash \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs index 352cec74bfb..a0b877c9e07 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4560 // Handling of structs as array elements // For functional tests, see fsharp\core\array @@ -14,9 +14,9 @@ a.[0].Set 27 // This is the incorrect code that used to be generated // // L_0000: call valuetype Mmm/T[] Mmm::get_a() -// L_0005: ldc.i4.0 +// L_0005: ldc.i4.0 // L_0006: ldelem.any Mmm/T -// L_000b: stloc.0 +// L_000b: stloc.0 // L_000c: ldloca.s t // L_000e: ldfld int32 Mmm/T::i@ // L_0013: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs index 53c4fe04035..5b2ca211dfa 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL // Verify that the deprecated command line option "--no-generate-filter-blocks" is honored try () diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs index 2e52933d1fe..ed7eaf4e553 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs @@ -3,7 +3,7 @@ module rec MyTestModule type MaybeString = string | null type MaybeMyCustomType = (MyCustomType | null) -type MyCustomType (x: MaybeString, y: string) = +type MyCustomType (x: MaybeString, y: string) = static let mutable uglyGlobalMutableString : string = "" static let mutable uglyGlobalMutableNullableString : MaybeString = null diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs index 06c0b1f3031..6ab686355d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs @@ -1,12 +1,12 @@ module MyLibrary let strictlyNotNull (x:obj) = () -let myGenericFunction1 (p:_|null) = +let myGenericFunction1 (p:_|null) = match p with | null -> () | p -> strictlyNotNull p -let myGenericFunction2 p = +let myGenericFunction2 p = match p with | Null -> () | NonNull p -> strictlyNotNull p diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs index cf72987cafb..3ed5650fcd1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs @@ -1,7 +1,7 @@ module TestModule [] -type MyStructOption<'T when 'T: not null> = +type MyStructOption<'T when 'T: not null> = | MyStructNone | MyStructSome of nestedGenericField : list> * notNullField2 : string * canBeNullField : (string | null) * notNullField1 : 'T diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs index fd4f853d43b..be971e9a3be 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs @@ -2,7 +2,7 @@ module TestModule [] [] -type MyNullableOption<'T when 'T:null> = +type MyNullableOption<'T when 'T:null> = | MyNone | MySome of value:'T @@ -13,7 +13,7 @@ let mapPossiblyNullable f myOpt = [] [] -type MyOptionWhichCannotHaveNullInTheInside<'T when 'T:not null> = +type MyOptionWhichCannotHaveNullInTheInside<'T when 'T:not null> = | MyNotNullNone | MyNotNullSome of value:'T @@ -25,6 +25,6 @@ let mapNotNullableContents f myOpt = [] [] -type NonGenericNullAsTrueValue = +type NonGenericNullAsTrueValue = | MyNone | MySome of nullableString:(string|null) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs index e4dcfbcb43b..02c588f5737 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs @@ -25,118 +25,118 @@ module NullnessMetadata = |> verifyILBaseline [] - let ``Nullable attr for module bindings`` compilation = + let ``Nullable attr for module bindings`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for module functions`` compilation = + let ``Nullable attr for module functions`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for module functions optimize`` compilation = + let ``Nullable attr for module functions optimize`` compilation = compilation |> getCompilation |> verifyCompilation Optimize [] - let ``Nullable attr for curriedFunc optimize`` compilation = + let ``Nullable attr for curriedFunc optimize`` compilation = compilation |> getCompilation |> verifyCompilation Optimize [] - let ``Nullable attr for anon records`` compilation = + let ``Nullable attr for anon records`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for records with generics`` compilation = + let ``Nullable attr for records with generics`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for plain records`` compilation = + let ``Nullable attr for plain records`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for exception types`` compilation = + let ``Nullable attr for exception types`` compilation = compilation |> getCompilation |> withLangVersion10 // ExceptionFieldSerializationSupport (11.0) changes exception IL; pin to pre-11 (nullness stays on, gated at 9.0) |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for ref DUs`` compilation = + let ``Nullable attr for ref DUs`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for struct DUs`` compilation = + let ``Nullable attr for struct DUs`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for custom type`` compilation = + let ``Nullable attr for custom type`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable attr for Option clones`` compilation = + let ``Nullable attr for Option clones`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Generic struct DU`` compilation = + let ``Generic struct DU`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Nullable inheritance`` compilation = + let ``Nullable inheritance`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``Custom pipe`` compilation = + let ``Custom pipe`` compilation = compilation |> getCompilation |> verifyCompilation DoNotOptimize [] - let ``SupportsNull`` compilation = + let ``SupportsNull`` compilation = compilation |> getCompilation |> withNoWarn 52 |> verifyCompilation DoNotOptimize [] - let ``GenericCode`` compilation = + let ``GenericCode`` compilation = compilation |> getCompilation |> withNoWarn 52 |> verifyCompilation DoNotOptimize [] - let ``Override missing in signature`` () = + let ``Override missing in signature`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "HasSignatureWithMissingOverride.fsi") |> withAdditionalSourceFile (SourceFromPath (__SOURCE_DIRECTORY__ ++ "HasSignatureWithMissingOverride.fs")) |> withNoWarn 52 |> addOptions DoNotOptimize |> compile - |> verifyILContains + |> verifyILContains [".method public hidebysig virtual instance string ToString() cil managed" ".method public hidebysig virtual instance int32 GetHashCode() cil managed" "hidebysig virtual instance bool Equals(object obj) cil managed" @@ -144,14 +144,14 @@ module NullnessMetadata = |> shouldSucceed [] - let ``Downcasting and typetests`` compilation = + let ``Downcasting and typetests`` compilation = compilation |> getCompilation |> withNoWarn 52 |> verifyCompilation DoNotOptimize [] - let ``Downcasting and typetests optimized`` compilation = + let ``Downcasting and typetests optimized`` compilation = compilation |> withNoWarn 52 |> verifyCompilation Optimize @@ -160,27 +160,27 @@ module NullnessMetadata = module Interop = open System.IO - let fsharpLibCreator = - FSharp - >> asLibrary - >> withName "MyFSharpLib" + let fsharpLibCreator = + FSharp + >> asLibrary + >> withName "MyFSharpLib" >> withOptions ["--checknulls"] - let csharpLibCompile fsLibReference = - CSharp - >> withReferences [fsLibReference] + let csharpLibCompile fsLibReference = + CSharp + >> withReferences [fsLibReference] >> withCSharpLanguageVersion CSharpLanguageVersion.Preview >> asLibrary >> withName "CsharpAppConsumingNullness" >> compile - let FsharpFromFile filename = + let FsharpFromFile filename = Path.Combine(__SOURCE_DIRECTORY__, filename) |> File.ReadAllText |> fsharpLibCreator [] - let ``Csharp understands option like type using UseNullAsTrueValue`` () = + let ``Csharp understands option like type using UseNullAsTrueValue`` () = let csharpCode = """ using System; using static TestModule; @@ -209,11 +209,11 @@ public class C { } }""" csharpCode - |> csharpLibCompile (FsharpFromFile "NullAsTrueValue.fs") + |> csharpLibCompile (FsharpFromFile "NullAsTrueValue.fs") |> withDiagnostics [ Warning 8602, Line 12, Col 27, Line 12, Col 37, "Dereference of a possibly null reference."] [] - let ``Csharp understands Fsharp-produced struct unions via IsXXX flow analysis`` () = + let ``Csharp understands Fsharp-produced struct unions via IsXXX flow analysis`` () = let csharpCode = """ #nullable enable public class C { @@ -239,7 +239,7 @@ public class C { } }""" csharpCode - |> csharpLibCompile (FsharpFromFile "StructDU.fs") + |> csharpLibCompile (FsharpFromFile "StructDU.fs") |> withDiagnostics [ Warning 8600, Line 6, Col 35, Line 6, Col 57, "Converting null literal or possible null value to non-nullable type." Warning 8600, Line 14, Col 78, Line 14, Col 97, "Converting null literal or possible null value to non-nullable type." @@ -247,7 +247,7 @@ public class C { Warning 8625, Line 18, Col 62, Line 18, Col 66, "Cannot convert null literal to non-nullable reference type."] [] - let ``Csharp code understands Fsharp-produced generics`` () = + let ``Csharp code understands Fsharp-produced generics`` () = let fsharpcode = """ module MyFSharpLib let stringTupleInOut(x:struct(string * string|null)) = x""" @@ -261,7 +261,7 @@ public class C { } }""" csharpCode - |> csharpLibCompile fsLib + |> csharpLibCompile fsLib |> withDiagnostics [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs index 0fff3c6c6e0..5499d96c64f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs @@ -3,7 +3,7 @@ module MyTestModule let maybeString : string | null = null [] -type MyRecord<'X,'Y,'Z when 'Y:null and 'Z:not null> = +type MyRecord<'X,'Y,'Z when 'Y:null and 'Z:not null> = { JustInt : int NullInt : System.Nullable @@ -22,6 +22,6 @@ let createAnInstance () = GenericNormalField = 42 GenericNullableField = maybeString GenericNotNullField = ""} - + let stringOfInst() : string = createAnInstance().ToString() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs index 5e61b755808..4963a8ab677 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs @@ -1,7 +1,7 @@ module MyTestModule [] -type MyDu = +type MyDu = | JustLabel | JustInt of int | MaybeString of nullableString:(string | null) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs index 4b89ae408df..c379451777e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs @@ -2,12 +2,12 @@ module MyTestModule [] [] -type MyStructDU = +type MyStructDU = | A | B of nonNullableString:string // Tricky as the field WILL be null for tags other than B | C of nullableString:(string | null) // The field behind this is always nullable - with override this.ToString() = + with override this.ToString() = match this with | A -> "A" | B _ -> "B" @@ -15,7 +15,7 @@ type MyStructDU = let printMyDu(x:MyStructDU) : string = x.ToString() -let getVal x = +let getVal x = match x with | C text -> text | _ -> failwith "fail" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs index fd107853ce4..55f56c931c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs @@ -34,11 +34,11 @@ let iAcceptNullExplicitAnnotation(arg: 'T when 'T:null) = 0 -let fullyInferredTestCase arg1 arg2 = +let fullyInferredTestCase arg1 arg2 = System.Console.Write(iAcceptNullPartiallyInferredFromUnderscore arg1) let maybeNull = iCanProduceNullSometimes arg2 maybeNull -let structShouldBeAllowedHere arg = +let structShouldBeAllowedHere arg = let boxed : obj | null = box arg iAcceptNullPartiallyInferredFromUnderscore boxed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs index c38af9943e1..49821a0b468 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs @@ -7,7 +7,7 @@ open System.Linq // Count - Simple let factorsOf300 = [2;2;3;5;5] -let uniqueFactors = +let uniqueFactors = query { for n in factorsOf300 do distinct @@ -16,7 +16,7 @@ let uniqueFactors = // Sum - Simple let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] -let numSum = +let numSum = query { for n in numbers do sumBy n @@ -25,7 +25,7 @@ let numSum = // Sum - Projection let words = ["cherry"; "apple"; "blueberry"] -let totalChars = +let totalChars = query { for w in words do sumBy (w.Length) @@ -100,9 +100,9 @@ let numbers2 = [5.1; 4.1; 1.1; 3.1; 9.1; 8.1; 6.1; 7.1; 2.1; 0.1] let averageNum = query { for n in numbers2 do averageBy n } // Average - Projection -let averageLength = - query { - for w in words do +let averageLength = + query { + for w in words do let wl = w.Length |> float averageBy wl } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs index ba19e6c722f..4ea980d1576 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs @@ -17,7 +17,7 @@ let products12 = // First - Condition let strings = [ "zero"; "one"; "two"; "three"; "four"; "five"; "six"; "seven"; "eight"; "nine" ] -let startsWithO = +let startsWithO = query { for s in strings do where (s.[0] = 'o') @@ -47,7 +47,7 @@ let firstNumOrDefault = // ElementAt let numbers2 = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] -let fourthLowNum = +let fourthLowNum = query { for n in numbers2 do where (n > 5) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs index 5391f1b5b1d..45e3bc64c91 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs @@ -10,7 +10,7 @@ let digits = [ "zero"; "one"; "two"; "three"; "four"; "five"; "six"; "seven"; "e let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] let numberGroups = - query { + query { for n in numbers do groupValBy n (n % 5) into g select (g.Key, g.ToArray()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs index f8e78ed5080..b2a753a6d18 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs @@ -15,7 +15,7 @@ let sortedWords = // OrderBy - Simple 2 let sortedWords2 = query { - for w in words do + for w in words do sortBy (w.Length) } |> Seq.toList diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs index 2c7185c5a74..40bfd633e3f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs @@ -24,7 +24,7 @@ let WAOrders = } |> Seq.toArray // Skip - simple -let allButFirst4Numbers = +let allButFirst4Numbers = query { for n in numbers do skip 4 @@ -47,7 +47,7 @@ let firstNumbersLessThan6 = } |> Seq.toList // SkipWhile - simple -let allButFirst3Numbers = +let allButFirst3Numbers = query { for n in numbers do skipWhile (n % 3 <> 0) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs index 7222df2fb3a..ed2c3ba208f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs @@ -6,7 +6,7 @@ open System.Linq let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] -// Select - Simple 1 +// Select - Simple 1 let numsPlusOne = query { for n in numbers do @@ -55,7 +55,7 @@ let productInfos = // Select - Filtered let digits = strings -let lowNums = +let lowNums = query { for n in numbers do where (n < 5) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs index f734befa3fc..621a9996441 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs @@ -8,7 +8,7 @@ open System.Linq // Distinct - 1 let factorsOf300 = [2;2;3;5;5] -let uniqueFactors = +let uniqueFactors = query { for n in factorsOf300 do distinct @@ -27,7 +27,7 @@ let categoryNames = // Union - 2 let customers = getCustomerList() -let productFirstChars = +let productFirstChars = query { for p in products do select p.ProductName.[0] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs index 27dfc22e760..318a867108c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs @@ -7,7 +7,7 @@ open System.Linq let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ] - + // Where - Simple 1 let lowNums = query { @@ -50,6 +50,6 @@ let shortDigits = query { for d in digits do select d - } - |> Seq.mapi (fun i d -> if d.Length < i then Some(d) else None) + } + |> Seq.mapi (fun i d -> if d.Length < i then Some(d) else None) |> Seq.choose id diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Utils.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Utils.fs index b8fba331561..f7998c0372c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Utils.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Utils.fs @@ -24,7 +24,7 @@ type Product() = let getProductList() = [ Product(ProductID = 1, ProductName = "Chai", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 39 ); - Product(ProductID = 2, ProductName = "Chang", Category = "Beverages", UnitPrice = 19.0000M, UnitsInStock = 17 ); + Product(ProductID = 2, ProductName = "Chang", Category = "Beverages", UnitPrice = 19.0000M, UnitsInStock = 17 ); Product(ProductID = 3, ProductName = "Aniseed Syrup", Category = "Condiments", UnitPrice = 10.0000M, UnitsInStock = 13 ); Product(ProductID = 4, ProductName = "Chef Anton's Cajun Seasoning", Category = "Condiments", UnitPrice = 22.0000M, UnitsInStock = 53 ); Product(ProductID = 5, ProductName = "Chef Anton's Gumbo Mix", Category = "Condiments", UnitPrice = 21.3500M, UnitsInStock = 0 ); @@ -34,77 +34,77 @@ let getProductList() = Product(ProductID = 9, ProductName = "Mishi Kobe Niku", Category = "Meat/Poultry", UnitPrice = 97.0000M, UnitsInStock = 29 ); Product(ProductID = 10, ProductName = "Ikura", Category = "Seafood", UnitPrice = 31.0000M, UnitsInStock = 31 ); Product(ProductID = 11, ProductName = "Queso Cabrales", Category = "Dairy Products", UnitPrice = 21.0000M, UnitsInStock = 22 ); - Product(ProductID = 12, ProductName = "Queso Manchego La Pastora", Category = "Dairy Products", UnitPrice = 38.0000M, UnitsInStock = 86 ); - Product(ProductID = 13, ProductName = "Konbu", Category = "Seafood", UnitPrice = 6.0000M, UnitsInStock = 24 ); - Product(ProductID = 14, ProductName = "Tofu", Category = "Produce", UnitPrice = 23.2500M, UnitsInStock = 35 ); - Product(ProductID = 15, ProductName = "Genen Shouyu", Category = "Condiments", UnitPrice = 15.5000M, UnitsInStock = 39 ); - Product(ProductID = 16, ProductName = "Pavlova", Category = "Confections", UnitPrice = 17.4500M, UnitsInStock = 29 ); - Product(ProductID = 17, ProductName = "Alice Mutton", Category = "Meat/Poultry", UnitPrice = 39.0000M, UnitsInStock = 0 ); - Product(ProductID = 18, ProductName = "Carnarvon Tigers", Category = "Seafood", UnitPrice = 62.5000M, UnitsInStock = 42 ); - Product(ProductID = 19, ProductName = "Teatime Chocolate Biscuits", Category = "Confections", UnitPrice = 9.2000M, UnitsInStock = 25 ); - Product(ProductID = 20, ProductName = "Sir Rodney's Marmalade", Category = "Confections", UnitPrice = 81.0000M, UnitsInStock = 40 ); - Product(ProductID = 21, ProductName = "Sir Rodney's Scones", Category = "Confections", UnitPrice = 10.0000M, UnitsInStock = 3 ); - Product(ProductID = 22, ProductName = "Gustaf's Knäckebröd", Category = "Grains/Cereals", UnitPrice = 21.0000M, UnitsInStock = 104 ); - Product(ProductID = 23, ProductName = "Tunnbröd", Category = "Grains/Cereals", UnitPrice = 9.0000M, UnitsInStock = 61 ); - Product(ProductID = 24, ProductName = "Guaraná Fantástica", Category = "Beverages", UnitPrice = 4.5000M, UnitsInStock = 20 ); - Product(ProductID = 25, ProductName = "NuNuCa Nuß-Nougat-Creme", Category = "Confections", UnitPrice = 14.0000M, UnitsInStock = 76 ); - Product(ProductID = 26, ProductName = "Gumbär Gummibärchen", Category = "Confections", UnitPrice = 31.2300M, UnitsInStock = 15 ); - Product(ProductID = 27, ProductName = "Schoggi Schokolade", Category = "Confections", UnitPrice = 43.9000M, UnitsInStock = 49 ); - Product(ProductID = 28, ProductName = "Rössle Sauerkraut", Category = "Produce", UnitPrice = 45.6000M, UnitsInStock = 26 ); - Product(ProductID = 29, ProductName = "Thüringer Rostbratwurst", Category = "Meat/Poultry", UnitPrice = 123.7900M, UnitsInStock = 0 ); - Product(ProductID = 30, ProductName = "Nord-Ost Matjeshering", Category = "Seafood", UnitPrice = 25.8900M, UnitsInStock = 10 ); - Product(ProductID = 31, ProductName = "Gorgonzola Telino", Category = "Dairy Products", UnitPrice = 12.5000M, UnitsInStock = 0 ); - Product(ProductID = 32, ProductName = "Mascarpone Fabioli", Category = "Dairy Products", UnitPrice = 32.0000M, UnitsInStock = 9 ); - Product(ProductID = 33, ProductName = "Geitost", Category = "Dairy Products", UnitPrice = 2.5000M, UnitsInStock = 112 ); - Product(ProductID = 34, ProductName = "Sasquatch Ale", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 111 ); - Product(ProductID = 35, ProductName = "Steeleye Stout", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 20 ); - Product(ProductID = 36, ProductName = "Inlagd Sill", Category = "Seafood", UnitPrice = 19.0000M, UnitsInStock = 112 ); - Product(ProductID = 37, ProductName = "Gravad lax", Category = "Seafood", UnitPrice = 26.0000M, UnitsInStock = 11 ); - Product(ProductID = 38, ProductName = "Côte de Blaye", Category = "Beverages", UnitPrice = 263.5000M, UnitsInStock = 17 ); - Product(ProductID = 39, ProductName = "Chartreuse verte", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 69 ); - Product(ProductID = 40, ProductName = "Boston Crab Meat", Category = "Seafood", UnitPrice = 18.4000M, UnitsInStock = 123 ); - Product(ProductID = 41, ProductName = "Jack's New England Clam Chowder", Category = "Seafood", UnitPrice = 9.6500M, UnitsInStock = 85 ); - Product(ProductID = 42, ProductName = "Singaporean Hokkien Fried Mee", Category = "Grains/Cereals", UnitPrice = 14.0000M, UnitsInStock = 26 ); - Product(ProductID = 43, ProductName = "Ipoh Coffee", Category = "Beverages", UnitPrice = 46.0000M, UnitsInStock = 17 ); - Product(ProductID = 44, ProductName = "Gula Malacca", Category = "Condiments", UnitPrice = 19.4500M, UnitsInStock = 27 ); - Product(ProductID = 45, ProductName = "Rogede sild", Category = "Seafood", UnitPrice = 9.5000M, UnitsInStock = 5 ); - Product(ProductID = 46, ProductName = "Spegesild", Category = "Seafood", UnitPrice = 12.0000M, UnitsInStock = 95 ); - Product(ProductID = 47, ProductName = "Zaanse koeken", Category = "Confections", UnitPrice = 9.5000M, UnitsInStock = 36 ); - Product(ProductID = 48, ProductName = "Chocolade", Category = "Confections", UnitPrice = 12.7500M, UnitsInStock = 15 ); - Product(ProductID = 49, ProductName = "Maxilaku", Category = "Confections", UnitPrice = 20.0000M, UnitsInStock = 10 ); - Product(ProductID = 50, ProductName = "Valkoinen suklaa", Category = "Confections", UnitPrice = 16.2500M, UnitsInStock = 65 ); - Product(ProductID = 51, ProductName = "Manjimup Dried Apples", Category = "Produce", UnitPrice = 53.0000M, UnitsInStock = 20 ); - Product(ProductID = 52, ProductName = "Filo Mix", Category = "Grains/Cereals", UnitPrice = 7.0000M, UnitsInStock = 38 ); - Product(ProductID = 53, ProductName = "Perth Pasties", Category = "Meat/Poultry", UnitPrice = 32.8000M, UnitsInStock = 0 ); - Product(ProductID = 54, ProductName = "Tourtière", Category = "Meat/Poultry", UnitPrice = 7.4500M, UnitsInStock = 21 ); - Product(ProductID = 55, ProductName = "Pâté chinois", Category = "Meat/Poultry", UnitPrice = 24.0000M, UnitsInStock = 115 ); - Product(ProductID = 56, ProductName = "Gnocchi di nonna Alice", Category = "Grains/Cereals", UnitPrice = 38.0000M, UnitsInStock = 21 ); - Product(ProductID = 57, ProductName = "Ravioli Angelo", Category = "Grains/Cereals", UnitPrice = 19.5000M, UnitsInStock = 36 ); - Product(ProductID = 58, ProductName = "Escargots de Bourgogne", Category = "Seafood", UnitPrice = 13.2500M, UnitsInStock = 62 ); - Product(ProductID = 59, ProductName = "Raclette Courdavault", Category = "Dairy Products", UnitPrice = 55.0000M, UnitsInStock = 79 ); - Product(ProductID = 60, ProductName = "Camembert Pierrot", Category = "Dairy Products", UnitPrice = 34.0000M, UnitsInStock = 19 ); - Product(ProductID = 61, ProductName = "Sirop d'érable", Category = "Condiments", UnitPrice = 28.5000M, UnitsInStock = 113 ); - Product(ProductID = 62, ProductName = "Tarte au sucre", Category = "Confections", UnitPrice = 49.3000M, UnitsInStock = 17 ); - Product(ProductID = 63, ProductName = "Vegie-spread", Category = "Condiments", UnitPrice = 43.9000M, UnitsInStock = 24 ); - Product(ProductID = 64, ProductName = "Wimmers gute Semmelknödel", Category = "Grains/Cereals", UnitPrice = 33.2500M, UnitsInStock = 22 ); - Product(ProductID = 65, ProductName = "Louisiana Fiery Hot Pepper Sauce", Category = "Condiments", UnitPrice = 21.0500M, UnitsInStock = 76 ); - Product(ProductID = 66, ProductName = "Louisiana Hot Spiced Okra", Category = "Condiments", UnitPrice = 17.0000M, UnitsInStock = 4 ); - Product(ProductID = 67, ProductName = "Laughing Lumberjack Lager", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 52 ); - Product(ProductID = 68, ProductName = "Scottish Longbreads", Category = "Confections", UnitPrice = 12.5000M, UnitsInStock = 6 ); - Product(ProductID = 69, ProductName = "Gudbrandsdalsost", Category = "Dairy Products", UnitPrice = 36.0000M, UnitsInStock = 26 ); - Product(ProductID = 70, ProductName = "Outback Lager", Category = "Beverages", UnitPrice = 15.0000M, UnitsInStock = 15 ); - Product(ProductID = 71, ProductName = "Flotemysost", Category = "Dairy Products", UnitPrice = 21.5000M, UnitsInStock = 26 ); - Product(ProductID = 72, ProductName = "Mozzarella di Giovanni", Category = "Dairy Products", UnitPrice = 34.8000M, UnitsInStock = 14 ); - Product(ProductID = 73, ProductName = "Röd Kaviar", Category = "Seafood", UnitPrice = 15.0000M, UnitsInStock = 101 ); - Product(ProductID = 74, ProductName = "Longlife Tofu", Category = "Produce", UnitPrice = 10.0000M, UnitsInStock = 4 ); - Product(ProductID = 75, ProductName = "Rhönbräu Klosterbier", Category = "Beverages", UnitPrice = 7.7500M, UnitsInStock = 125 ); - Product(ProductID = 76, ProductName = "Lakkalikööri", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 57 ); + Product(ProductID = 12, ProductName = "Queso Manchego La Pastora", Category = "Dairy Products", UnitPrice = 38.0000M, UnitsInStock = 86 ); + Product(ProductID = 13, ProductName = "Konbu", Category = "Seafood", UnitPrice = 6.0000M, UnitsInStock = 24 ); + Product(ProductID = 14, ProductName = "Tofu", Category = "Produce", UnitPrice = 23.2500M, UnitsInStock = 35 ); + Product(ProductID = 15, ProductName = "Genen Shouyu", Category = "Condiments", UnitPrice = 15.5000M, UnitsInStock = 39 ); + Product(ProductID = 16, ProductName = "Pavlova", Category = "Confections", UnitPrice = 17.4500M, UnitsInStock = 29 ); + Product(ProductID = 17, ProductName = "Alice Mutton", Category = "Meat/Poultry", UnitPrice = 39.0000M, UnitsInStock = 0 ); + Product(ProductID = 18, ProductName = "Carnarvon Tigers", Category = "Seafood", UnitPrice = 62.5000M, UnitsInStock = 42 ); + Product(ProductID = 19, ProductName = "Teatime Chocolate Biscuits", Category = "Confections", UnitPrice = 9.2000M, UnitsInStock = 25 ); + Product(ProductID = 20, ProductName = "Sir Rodney's Marmalade", Category = "Confections", UnitPrice = 81.0000M, UnitsInStock = 40 ); + Product(ProductID = 21, ProductName = "Sir Rodney's Scones", Category = "Confections", UnitPrice = 10.0000M, UnitsInStock = 3 ); + Product(ProductID = 22, ProductName = "Gustaf's Knäckebröd", Category = "Grains/Cereals", UnitPrice = 21.0000M, UnitsInStock = 104 ); + Product(ProductID = 23, ProductName = "Tunnbröd", Category = "Grains/Cereals", UnitPrice = 9.0000M, UnitsInStock = 61 ); + Product(ProductID = 24, ProductName = "Guaraná Fantástica", Category = "Beverages", UnitPrice = 4.5000M, UnitsInStock = 20 ); + Product(ProductID = 25, ProductName = "NuNuCa Nuß-Nougat-Creme", Category = "Confections", UnitPrice = 14.0000M, UnitsInStock = 76 ); + Product(ProductID = 26, ProductName = "Gumbär Gummibärchen", Category = "Confections", UnitPrice = 31.2300M, UnitsInStock = 15 ); + Product(ProductID = 27, ProductName = "Schoggi Schokolade", Category = "Confections", UnitPrice = 43.9000M, UnitsInStock = 49 ); + Product(ProductID = 28, ProductName = "Rössle Sauerkraut", Category = "Produce", UnitPrice = 45.6000M, UnitsInStock = 26 ); + Product(ProductID = 29, ProductName = "Thüringer Rostbratwurst", Category = "Meat/Poultry", UnitPrice = 123.7900M, UnitsInStock = 0 ); + Product(ProductID = 30, ProductName = "Nord-Ost Matjeshering", Category = "Seafood", UnitPrice = 25.8900M, UnitsInStock = 10 ); + Product(ProductID = 31, ProductName = "Gorgonzola Telino", Category = "Dairy Products", UnitPrice = 12.5000M, UnitsInStock = 0 ); + Product(ProductID = 32, ProductName = "Mascarpone Fabioli", Category = "Dairy Products", UnitPrice = 32.0000M, UnitsInStock = 9 ); + Product(ProductID = 33, ProductName = "Geitost", Category = "Dairy Products", UnitPrice = 2.5000M, UnitsInStock = 112 ); + Product(ProductID = 34, ProductName = "Sasquatch Ale", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 111 ); + Product(ProductID = 35, ProductName = "Steeleye Stout", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 20 ); + Product(ProductID = 36, ProductName = "Inlagd Sill", Category = "Seafood", UnitPrice = 19.0000M, UnitsInStock = 112 ); + Product(ProductID = 37, ProductName = "Gravad lax", Category = "Seafood", UnitPrice = 26.0000M, UnitsInStock = 11 ); + Product(ProductID = 38, ProductName = "Côte de Blaye", Category = "Beverages", UnitPrice = 263.5000M, UnitsInStock = 17 ); + Product(ProductID = 39, ProductName = "Chartreuse verte", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 69 ); + Product(ProductID = 40, ProductName = "Boston Crab Meat", Category = "Seafood", UnitPrice = 18.4000M, UnitsInStock = 123 ); + Product(ProductID = 41, ProductName = "Jack's New England Clam Chowder", Category = "Seafood", UnitPrice = 9.6500M, UnitsInStock = 85 ); + Product(ProductID = 42, ProductName = "Singaporean Hokkien Fried Mee", Category = "Grains/Cereals", UnitPrice = 14.0000M, UnitsInStock = 26 ); + Product(ProductID = 43, ProductName = "Ipoh Coffee", Category = "Beverages", UnitPrice = 46.0000M, UnitsInStock = 17 ); + Product(ProductID = 44, ProductName = "Gula Malacca", Category = "Condiments", UnitPrice = 19.4500M, UnitsInStock = 27 ); + Product(ProductID = 45, ProductName = "Rogede sild", Category = "Seafood", UnitPrice = 9.5000M, UnitsInStock = 5 ); + Product(ProductID = 46, ProductName = "Spegesild", Category = "Seafood", UnitPrice = 12.0000M, UnitsInStock = 95 ); + Product(ProductID = 47, ProductName = "Zaanse koeken", Category = "Confections", UnitPrice = 9.5000M, UnitsInStock = 36 ); + Product(ProductID = 48, ProductName = "Chocolade", Category = "Confections", UnitPrice = 12.7500M, UnitsInStock = 15 ); + Product(ProductID = 49, ProductName = "Maxilaku", Category = "Confections", UnitPrice = 20.0000M, UnitsInStock = 10 ); + Product(ProductID = 50, ProductName = "Valkoinen suklaa", Category = "Confections", UnitPrice = 16.2500M, UnitsInStock = 65 ); + Product(ProductID = 51, ProductName = "Manjimup Dried Apples", Category = "Produce", UnitPrice = 53.0000M, UnitsInStock = 20 ); + Product(ProductID = 52, ProductName = "Filo Mix", Category = "Grains/Cereals", UnitPrice = 7.0000M, UnitsInStock = 38 ); + Product(ProductID = 53, ProductName = "Perth Pasties", Category = "Meat/Poultry", UnitPrice = 32.8000M, UnitsInStock = 0 ); + Product(ProductID = 54, ProductName = "Tourtière", Category = "Meat/Poultry", UnitPrice = 7.4500M, UnitsInStock = 21 ); + Product(ProductID = 55, ProductName = "Pâté chinois", Category = "Meat/Poultry", UnitPrice = 24.0000M, UnitsInStock = 115 ); + Product(ProductID = 56, ProductName = "Gnocchi di nonna Alice", Category = "Grains/Cereals", UnitPrice = 38.0000M, UnitsInStock = 21 ); + Product(ProductID = 57, ProductName = "Ravioli Angelo", Category = "Grains/Cereals", UnitPrice = 19.5000M, UnitsInStock = 36 ); + Product(ProductID = 58, ProductName = "Escargots de Bourgogne", Category = "Seafood", UnitPrice = 13.2500M, UnitsInStock = 62 ); + Product(ProductID = 59, ProductName = "Raclette Courdavault", Category = "Dairy Products", UnitPrice = 55.0000M, UnitsInStock = 79 ); + Product(ProductID = 60, ProductName = "Camembert Pierrot", Category = "Dairy Products", UnitPrice = 34.0000M, UnitsInStock = 19 ); + Product(ProductID = 61, ProductName = "Sirop d'érable", Category = "Condiments", UnitPrice = 28.5000M, UnitsInStock = 113 ); + Product(ProductID = 62, ProductName = "Tarte au sucre", Category = "Confections", UnitPrice = 49.3000M, UnitsInStock = 17 ); + Product(ProductID = 63, ProductName = "Vegie-spread", Category = "Condiments", UnitPrice = 43.9000M, UnitsInStock = 24 ); + Product(ProductID = 64, ProductName = "Wimmers gute Semmelknödel", Category = "Grains/Cereals", UnitPrice = 33.2500M, UnitsInStock = 22 ); + Product(ProductID = 65, ProductName = "Louisiana Fiery Hot Pepper Sauce", Category = "Condiments", UnitPrice = 21.0500M, UnitsInStock = 76 ); + Product(ProductID = 66, ProductName = "Louisiana Hot Spiced Okra", Category = "Condiments", UnitPrice = 17.0000M, UnitsInStock = 4 ); + Product(ProductID = 67, ProductName = "Laughing Lumberjack Lager", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 52 ); + Product(ProductID = 68, ProductName = "Scottish Longbreads", Category = "Confections", UnitPrice = 12.5000M, UnitsInStock = 6 ); + Product(ProductID = 69, ProductName = "Gudbrandsdalsost", Category = "Dairy Products", UnitPrice = 36.0000M, UnitsInStock = 26 ); + Product(ProductID = 70, ProductName = "Outback Lager", Category = "Beverages", UnitPrice = 15.0000M, UnitsInStock = 15 ); + Product(ProductID = 71, ProductName = "Flotemysost", Category = "Dairy Products", UnitPrice = 21.5000M, UnitsInStock = 26 ); + Product(ProductID = 72, ProductName = "Mozzarella di Giovanni", Category = "Dairy Products", UnitPrice = 34.8000M, UnitsInStock = 14 ); + Product(ProductID = 73, ProductName = "Röd Kaviar", Category = "Seafood", UnitPrice = 15.0000M, UnitsInStock = 101 ); + Product(ProductID = 74, ProductName = "Longlife Tofu", Category = "Produce", UnitPrice = 10.0000M, UnitsInStock = 4 ); + Product(ProductID = 75, ProductName = "Rhönbräu Klosterbier", Category = "Beverages", UnitPrice = 7.7500M, UnitsInStock = 125 ); + Product(ProductID = 76, ProductName = "Lakkalikööri", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 57 ); Product(ProductID = 77, ProductName = "Original Frankfurter grüne Soße", Category = "Condiments", UnitPrice = 13.0000M, UnitsInStock = 32 ) ] let getProductListAsRecords() = [{ ProductID = 1; ProductName = "Chai"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 39 }; - { ProductID = 2; ProductName = "Chang"; Category = "Beverages"; UnitPrice = 19.0000M; UnitsInStock = 17 }; + { ProductID = 2; ProductName = "Chang"; Category = "Beverages"; UnitPrice = 19.0000M; UnitsInStock = 17 }; { ProductID = 3; ProductName = "Aniseed Syrup"; Category = "Condiments"; UnitPrice = 10.0000M; UnitsInStock = 13 }; { ProductID = 4; ProductName = "Chef Anton's Cajun Seasoning"; Category = "Condiments"; UnitPrice = 22.0000M; UnitsInStock = 53 }; { ProductID = 5; ProductName = "Chef Anton's Gumbo Mix"; Category = "Condiments"; UnitPrice = 21.3500M; UnitsInStock = 0 }; @@ -114,71 +114,71 @@ let getProductListAsRecords() = { ProductID = 9; ProductName = "Mishi Kobe Niku"; Category = "Meat/Poultry"; UnitPrice = 97.0000M; UnitsInStock = 29 }; { ProductID = 10; ProductName = "Ikura"; Category = "Seafood"; UnitPrice = 31.0000M; UnitsInStock = 31 }; { ProductID = 11; ProductName = "Queso Cabrales"; Category = "Dairy Products"; UnitPrice = 21.0000M; UnitsInStock = 22 }; - { ProductID = 12; ProductName = "Queso Manchego La Pastora"; Category = "Dairy Products"; UnitPrice = 38.0000M; UnitsInStock = 86 }; - { ProductID = 13; ProductName = "Konbu"; Category = "Seafood"; UnitPrice = 6.0000M; UnitsInStock = 24 }; - { ProductID = 14; ProductName = "Tofu"; Category = "Produce"; UnitPrice = 23.2500M; UnitsInStock = 35 }; - { ProductID = 15; ProductName = "Genen Shouyu"; Category = "Condiments"; UnitPrice = 15.5000M; UnitsInStock = 39 }; - { ProductID = 16; ProductName = "Pavlova"; Category = "Confections"; UnitPrice = 17.4500M; UnitsInStock = 29 }; - { ProductID = 17; ProductName = "Alice Mutton"; Category = "Meat/Poultry"; UnitPrice = 39.0000M; UnitsInStock = 0 }; - { ProductID = 18; ProductName = "Carnarvon Tigers"; Category = "Seafood"; UnitPrice = 62.5000M; UnitsInStock = 42 }; - { ProductID = 19; ProductName = "Teatime Chocolate Biscuits"; Category = "Confections"; UnitPrice = 9.2000M; UnitsInStock = 25 }; - { ProductID = 20; ProductName = "Sir Rodney's Marmalade"; Category = "Confections"; UnitPrice = 81.0000M; UnitsInStock = 40 }; - { ProductID = 21; ProductName = "Sir Rodney's Scones"; Category = "Confections"; UnitPrice = 10.0000M; UnitsInStock = 3 }; - { ProductID = 22; ProductName = "Gustaf's Knäckebröd"; Category = "Grains/Cereals"; UnitPrice = 21.0000M; UnitsInStock = 104 }; - { ProductID = 23; ProductName = "Tunnbröd"; Category = "Grains/Cereals"; UnitPrice = 9.0000M; UnitsInStock = 61 }; - { ProductID = 24; ProductName = "Guaraná Fantástica"; Category = "Beverages"; UnitPrice = 4.5000M; UnitsInStock = 20 }; - { ProductID = 25; ProductName = "NuNuCa Nuß-Nougat-Creme"; Category = "Confections"; UnitPrice = 14.0000M; UnitsInStock = 76 }; - { ProductID = 26; ProductName = "Gumbär Gummibärchen"; Category = "Confections"; UnitPrice = 31.2300M; UnitsInStock = 15 }; - { ProductID = 27; ProductName = "Schoggi Schokolade"; Category = "Confections"; UnitPrice = 43.9000M; UnitsInStock = 49 }; - { ProductID = 28; ProductName = "Rössle Sauerkraut"; Category = "Produce"; UnitPrice = 45.6000M; UnitsInStock = 26 }; - { ProductID = 29; ProductName = "Thüringer Rostbratwurst"; Category = "Meat/Poultry"; UnitPrice = 123.7900M; UnitsInStock = 0 }; - { ProductID = 30; ProductName = "Nord-Ost Matjeshering"; Category = "Seafood"; UnitPrice = 25.8900M; UnitsInStock = 10 }; - { ProductID = 31; ProductName = "Gorgonzola Telino"; Category = "Dairy Products"; UnitPrice = 12.5000M; UnitsInStock = 0 }; - { ProductID = 32; ProductName = "Mascarpone Fabioli"; Category = "Dairy Products"; UnitPrice = 32.0000M; UnitsInStock = 9 }; - { ProductID = 33; ProductName = "Geitost"; Category = "Dairy Products"; UnitPrice = 2.5000M; UnitsInStock = 112 }; - { ProductID = 34; ProductName = "Sasquatch Ale"; Category = "Beverages"; UnitPrice = 14.0000M; UnitsInStock = 111 }; - { ProductID = 35; ProductName = "Steeleye Stout"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 20 }; - { ProductID = 36; ProductName = "Inlagd Sill"; Category = "Seafood"; UnitPrice = 19.0000M; UnitsInStock = 112 }; - { ProductID = 37; ProductName = "Gravad lax"; Category = "Seafood"; UnitPrice = 26.0000M; UnitsInStock = 11 }; - { ProductID = 38; ProductName = "Côte de Blaye"; Category = "Beverages"; UnitPrice = 263.5000M; UnitsInStock = 17 }; - { ProductID = 39; ProductName = "Chartreuse verte"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 69 }; - { ProductID = 40; ProductName = "Boston Crab Meat"; Category = "Seafood"; UnitPrice = 18.4000M; UnitsInStock = 123 }; - { ProductID = 41; ProductName = "Jack's New England Clam Chowder"; Category = "Seafood"; UnitPrice = 9.6500M; UnitsInStock = 85 }; - { ProductID = 42; ProductName = "Singaporean Hokkien Fried Mee"; Category = "Grains/Cereals"; UnitPrice = 14.0000M; UnitsInStock = 26 }; - { ProductID = 43; ProductName = "Ipoh Coffee"; Category = "Beverages"; UnitPrice = 46.0000M; UnitsInStock = 17 }; - { ProductID = 44; ProductName = "Gula Malacca"; Category = "Condiments"; UnitPrice = 19.4500M; UnitsInStock = 27 }; - { ProductID = 45; ProductName = "Rogede sild"; Category = "Seafood"; UnitPrice = 9.5000M; UnitsInStock = 5 }; - { ProductID = 46; ProductName = "Spegesild"; Category = "Seafood"; UnitPrice = 12.0000M; UnitsInStock = 95 }; - { ProductID = 47; ProductName = "Zaanse koeken"; Category = "Confections"; UnitPrice = 9.5000M; UnitsInStock = 36 }; - { ProductID = 48; ProductName = "Chocolade"; Category = "Confections"; UnitPrice = 12.7500M; UnitsInStock = 15 }; - { ProductID = 49; ProductName = "Maxilaku"; Category = "Confections"; UnitPrice = 20.0000M; UnitsInStock = 10 }; - { ProductID = 50; ProductName = "Valkoinen suklaa"; Category = "Confections"; UnitPrice = 16.2500M; UnitsInStock = 65 }; - { ProductID = 51; ProductName = "Manjimup Dried Apples"; Category = "Produce"; UnitPrice = 53.0000M; UnitsInStock = 20 }; - { ProductID = 52; ProductName = "Filo Mix"; Category = "Grains/Cereals"; UnitPrice = 7.0000M; UnitsInStock = 38 }; - { ProductID = 53; ProductName = "Perth Pasties"; Category = "Meat/Poultry"; UnitPrice = 32.8000M; UnitsInStock = 0 }; - { ProductID = 54; ProductName = "Tourtière"; Category = "Meat/Poultry"; UnitPrice = 7.4500M; UnitsInStock = 21 }; - { ProductID = 55; ProductName = "Pâté chinois"; Category = "Meat/Poultry"; UnitPrice = 24.0000M; UnitsInStock = 115 }; - { ProductID = 56; ProductName = "Gnocchi di nonna Alice"; Category = "Grains/Cereals"; UnitPrice = 38.0000M; UnitsInStock = 21 }; - { ProductID = 57; ProductName = "Ravioli Angelo"; Category = "Grains/Cereals"; UnitPrice = 19.5000M; UnitsInStock = 36 }; - { ProductID = 58; ProductName = "Escargots de Bourgogne"; Category = "Seafood"; UnitPrice = 13.2500M; UnitsInStock = 62 }; - { ProductID = 59; ProductName = "Raclette Courdavault"; Category = "Dairy Products"; UnitPrice = 55.0000M; UnitsInStock = 79 }; - { ProductID = 60; ProductName = "Camembert Pierrot"; Category = "Dairy Products"; UnitPrice = 34.0000M; UnitsInStock = 19 }; - { ProductID = 61; ProductName = "Sirop d'érable"; Category = "Condiments"; UnitPrice = 28.5000M; UnitsInStock = 113 }; - { ProductID = 62; ProductName = "Tarte au sucre"; Category = "Confections"; UnitPrice = 49.3000M; UnitsInStock = 17 }; - { ProductID = 63; ProductName = "Vegie-spread"; Category = "Condiments"; UnitPrice = 43.9000M; UnitsInStock = 24 }; - { ProductID = 64; ProductName = "Wimmers gute Semmelknödel"; Category = "Grains/Cereals"; UnitPrice = 33.2500M; UnitsInStock = 22 }; - { ProductID = 65; ProductName = "Louisiana Fiery Hot Pepper Sauce"; Category = "Condiments"; UnitPrice = 21.0500M; UnitsInStock = 76 }; - { ProductID = 66; ProductName = "Louisiana Hot Spiced Okra"; Category = "Condiments"; UnitPrice = 17.0000M; UnitsInStock = 4 }; - { ProductID = 67; ProductName = "Laughing Lumberjack Lager"; Category = "Beverages"; UnitPrice = 14.0000M; UnitsInStock = 52 }; - { ProductID = 68; ProductName = "Scottish Longbreads"; Category = "Confections"; UnitPrice = 12.5000M; UnitsInStock = 6 }; - { ProductID = 69; ProductName = "Gudbrandsdalsost"; Category = "Dairy Products"; UnitPrice = 36.0000M; UnitsInStock = 26 }; - { ProductID = 70; ProductName = "Outback Lager"; Category = "Beverages"; UnitPrice = 15.0000M; UnitsInStock = 15 }; - { ProductID = 71; ProductName = "Flotemysost"; Category = "Dairy Products"; UnitPrice = 21.5000M; UnitsInStock = 26 }; - { ProductID = 72; ProductName = "Mozzarella di Giovanni"; Category = "Dairy Products"; UnitPrice = 34.8000M; UnitsInStock = 14 }; - { ProductID = 73; ProductName = "Röd Kaviar"; Category = "Seafood"; UnitPrice = 15.0000M; UnitsInStock = 101 }; - { ProductID = 74; ProductName = "Longlife Tofu"; Category = "Produce"; UnitPrice = 10.0000M; UnitsInStock = 4 }; - { ProductID = 75; ProductName = "Rhönbräu Klosterbier"; Category = "Beverages"; UnitPrice = 7.7500M; UnitsInStock = 125 }; - { ProductID = 76; ProductName = "Lakkalikööri"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 57 }; + { ProductID = 12; ProductName = "Queso Manchego La Pastora"; Category = "Dairy Products"; UnitPrice = 38.0000M; UnitsInStock = 86 }; + { ProductID = 13; ProductName = "Konbu"; Category = "Seafood"; UnitPrice = 6.0000M; UnitsInStock = 24 }; + { ProductID = 14; ProductName = "Tofu"; Category = "Produce"; UnitPrice = 23.2500M; UnitsInStock = 35 }; + { ProductID = 15; ProductName = "Genen Shouyu"; Category = "Condiments"; UnitPrice = 15.5000M; UnitsInStock = 39 }; + { ProductID = 16; ProductName = "Pavlova"; Category = "Confections"; UnitPrice = 17.4500M; UnitsInStock = 29 }; + { ProductID = 17; ProductName = "Alice Mutton"; Category = "Meat/Poultry"; UnitPrice = 39.0000M; UnitsInStock = 0 }; + { ProductID = 18; ProductName = "Carnarvon Tigers"; Category = "Seafood"; UnitPrice = 62.5000M; UnitsInStock = 42 }; + { ProductID = 19; ProductName = "Teatime Chocolate Biscuits"; Category = "Confections"; UnitPrice = 9.2000M; UnitsInStock = 25 }; + { ProductID = 20; ProductName = "Sir Rodney's Marmalade"; Category = "Confections"; UnitPrice = 81.0000M; UnitsInStock = 40 }; + { ProductID = 21; ProductName = "Sir Rodney's Scones"; Category = "Confections"; UnitPrice = 10.0000M; UnitsInStock = 3 }; + { ProductID = 22; ProductName = "Gustaf's Knäckebröd"; Category = "Grains/Cereals"; UnitPrice = 21.0000M; UnitsInStock = 104 }; + { ProductID = 23; ProductName = "Tunnbröd"; Category = "Grains/Cereals"; UnitPrice = 9.0000M; UnitsInStock = 61 }; + { ProductID = 24; ProductName = "Guaraná Fantástica"; Category = "Beverages"; UnitPrice = 4.5000M; UnitsInStock = 20 }; + { ProductID = 25; ProductName = "NuNuCa Nuß-Nougat-Creme"; Category = "Confections"; UnitPrice = 14.0000M; UnitsInStock = 76 }; + { ProductID = 26; ProductName = "Gumbär Gummibärchen"; Category = "Confections"; UnitPrice = 31.2300M; UnitsInStock = 15 }; + { ProductID = 27; ProductName = "Schoggi Schokolade"; Category = "Confections"; UnitPrice = 43.9000M; UnitsInStock = 49 }; + { ProductID = 28; ProductName = "Rössle Sauerkraut"; Category = "Produce"; UnitPrice = 45.6000M; UnitsInStock = 26 }; + { ProductID = 29; ProductName = "Thüringer Rostbratwurst"; Category = "Meat/Poultry"; UnitPrice = 123.7900M; UnitsInStock = 0 }; + { ProductID = 30; ProductName = "Nord-Ost Matjeshering"; Category = "Seafood"; UnitPrice = 25.8900M; UnitsInStock = 10 }; + { ProductID = 31; ProductName = "Gorgonzola Telino"; Category = "Dairy Products"; UnitPrice = 12.5000M; UnitsInStock = 0 }; + { ProductID = 32; ProductName = "Mascarpone Fabioli"; Category = "Dairy Products"; UnitPrice = 32.0000M; UnitsInStock = 9 }; + { ProductID = 33; ProductName = "Geitost"; Category = "Dairy Products"; UnitPrice = 2.5000M; UnitsInStock = 112 }; + { ProductID = 34; ProductName = "Sasquatch Ale"; Category = "Beverages"; UnitPrice = 14.0000M; UnitsInStock = 111 }; + { ProductID = 35; ProductName = "Steeleye Stout"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 20 }; + { ProductID = 36; ProductName = "Inlagd Sill"; Category = "Seafood"; UnitPrice = 19.0000M; UnitsInStock = 112 }; + { ProductID = 37; ProductName = "Gravad lax"; Category = "Seafood"; UnitPrice = 26.0000M; UnitsInStock = 11 }; + { ProductID = 38; ProductName = "Côte de Blaye"; Category = "Beverages"; UnitPrice = 263.5000M; UnitsInStock = 17 }; + { ProductID = 39; ProductName = "Chartreuse verte"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 69 }; + { ProductID = 40; ProductName = "Boston Crab Meat"; Category = "Seafood"; UnitPrice = 18.4000M; UnitsInStock = 123 }; + { ProductID = 41; ProductName = "Jack's New England Clam Chowder"; Category = "Seafood"; UnitPrice = 9.6500M; UnitsInStock = 85 }; + { ProductID = 42; ProductName = "Singaporean Hokkien Fried Mee"; Category = "Grains/Cereals"; UnitPrice = 14.0000M; UnitsInStock = 26 }; + { ProductID = 43; ProductName = "Ipoh Coffee"; Category = "Beverages"; UnitPrice = 46.0000M; UnitsInStock = 17 }; + { ProductID = 44; ProductName = "Gula Malacca"; Category = "Condiments"; UnitPrice = 19.4500M; UnitsInStock = 27 }; + { ProductID = 45; ProductName = "Rogede sild"; Category = "Seafood"; UnitPrice = 9.5000M; UnitsInStock = 5 }; + { ProductID = 46; ProductName = "Spegesild"; Category = "Seafood"; UnitPrice = 12.0000M; UnitsInStock = 95 }; + { ProductID = 47; ProductName = "Zaanse koeken"; Category = "Confections"; UnitPrice = 9.5000M; UnitsInStock = 36 }; + { ProductID = 48; ProductName = "Chocolade"; Category = "Confections"; UnitPrice = 12.7500M; UnitsInStock = 15 }; + { ProductID = 49; ProductName = "Maxilaku"; Category = "Confections"; UnitPrice = 20.0000M; UnitsInStock = 10 }; + { ProductID = 50; ProductName = "Valkoinen suklaa"; Category = "Confections"; UnitPrice = 16.2500M; UnitsInStock = 65 }; + { ProductID = 51; ProductName = "Manjimup Dried Apples"; Category = "Produce"; UnitPrice = 53.0000M; UnitsInStock = 20 }; + { ProductID = 52; ProductName = "Filo Mix"; Category = "Grains/Cereals"; UnitPrice = 7.0000M; UnitsInStock = 38 }; + { ProductID = 53; ProductName = "Perth Pasties"; Category = "Meat/Poultry"; UnitPrice = 32.8000M; UnitsInStock = 0 }; + { ProductID = 54; ProductName = "Tourtière"; Category = "Meat/Poultry"; UnitPrice = 7.4500M; UnitsInStock = 21 }; + { ProductID = 55; ProductName = "Pâté chinois"; Category = "Meat/Poultry"; UnitPrice = 24.0000M; UnitsInStock = 115 }; + { ProductID = 56; ProductName = "Gnocchi di nonna Alice"; Category = "Grains/Cereals"; UnitPrice = 38.0000M; UnitsInStock = 21 }; + { ProductID = 57; ProductName = "Ravioli Angelo"; Category = "Grains/Cereals"; UnitPrice = 19.5000M; UnitsInStock = 36 }; + { ProductID = 58; ProductName = "Escargots de Bourgogne"; Category = "Seafood"; UnitPrice = 13.2500M; UnitsInStock = 62 }; + { ProductID = 59; ProductName = "Raclette Courdavault"; Category = "Dairy Products"; UnitPrice = 55.0000M; UnitsInStock = 79 }; + { ProductID = 60; ProductName = "Camembert Pierrot"; Category = "Dairy Products"; UnitPrice = 34.0000M; UnitsInStock = 19 }; + { ProductID = 61; ProductName = "Sirop d'érable"; Category = "Condiments"; UnitPrice = 28.5000M; UnitsInStock = 113 }; + { ProductID = 62; ProductName = "Tarte au sucre"; Category = "Confections"; UnitPrice = 49.3000M; UnitsInStock = 17 }; + { ProductID = 63; ProductName = "Vegie-spread"; Category = "Condiments"; UnitPrice = 43.9000M; UnitsInStock = 24 }; + { ProductID = 64; ProductName = "Wimmers gute Semmelknödel"; Category = "Grains/Cereals"; UnitPrice = 33.2500M; UnitsInStock = 22 }; + { ProductID = 65; ProductName = "Louisiana Fiery Hot Pepper Sauce"; Category = "Condiments"; UnitPrice = 21.0500M; UnitsInStock = 76 }; + { ProductID = 66; ProductName = "Louisiana Hot Spiced Okra"; Category = "Condiments"; UnitPrice = 17.0000M; UnitsInStock = 4 }; + { ProductID = 67; ProductName = "Laughing Lumberjack Lager"; Category = "Beverages"; UnitPrice = 14.0000M; UnitsInStock = 52 }; + { ProductID = 68; ProductName = "Scottish Longbreads"; Category = "Confections"; UnitPrice = 12.5000M; UnitsInStock = 6 }; + { ProductID = 69; ProductName = "Gudbrandsdalsost"; Category = "Dairy Products"; UnitPrice = 36.0000M; UnitsInStock = 26 }; + { ProductID = 70; ProductName = "Outback Lager"; Category = "Beverages"; UnitPrice = 15.0000M; UnitsInStock = 15 }; + { ProductID = 71; ProductName = "Flotemysost"; Category = "Dairy Products"; UnitPrice = 21.5000M; UnitsInStock = 26 }; + { ProductID = 72; ProductName = "Mozzarella di Giovanni"; Category = "Dairy Products"; UnitPrice = 34.8000M; UnitsInStock = 14 }; + { ProductID = 73; ProductName = "Röd Kaviar"; Category = "Seafood"; UnitPrice = 15.0000M; UnitsInStock = 101 }; + { ProductID = 74; ProductName = "Longlife Tofu"; Category = "Produce"; UnitPrice = 10.0000M; UnitsInStock = 4 }; + { ProductID = 75; ProductName = "Rhönbräu Klosterbier"; Category = "Beverages"; UnitPrice = 7.7500M; UnitsInStock = 125 }; + { ProductID = 76; ProductName = "Lakkalikööri"; Category = "Beverages"; UnitPrice = 18.0000M; UnitsInStock = 57 }; { ProductID = 77; ProductName = "Original Frankfurter grüne Soße"; Category = "Condiments"; UnitPrice = 13.0000M; UnitsInStock = 32 }] @@ -201,18 +201,18 @@ type Customer(customerID, companyName, address, city, region, postalCode, countr let getCustomerList() = let doc = XmlReader.Create(Environment.CurrentDirectory + "\\customers.xml") - + let xname s = XName.Get(s) - let ge (x : XElement) (s : string) = - try - let r = x.Element(XName.Get(s)).ToString() - Regex.Match(r, ">(.*)<").Groups.[1].Value - with + let ge (x : XElement) (s : string) = + try + let r = x.Element(XName.Get(s)).ToString() + Regex.Match(r, ">(.*)<").Groups.[1].Value + with | :? NullReferenceException -> "" query { for e in XDocument.Load(doc).Root.Elements(xname "customer") do let get = ge e - let orders = + let orders = query { for o in e.Elements(xname "orders").Elements(xname "order") do let date = ge o "orderdate" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs index 420da9490c1..98dff5665d6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs @@ -943,4 +943,3 @@ type private TestType () = ] |> shouldSucceed - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/nested_generic_closure.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/nested_generic_closure.fs index 4d63e54ce28..19e9fcaa665 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/nested_generic_closure.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/nested_generic_closure.fs @@ -58,7 +58,7 @@ module internal IEnumerator = interface System.IDisposable with member _.Dispose() = () - + let Empty<'T> () = (new EmptyEnumerator<'T>() :> IEnumerator<'T>) [] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs index d0b9589d64f..b3282560037 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Sequences +// #NoMono #NoMT #CodeGen #EmittedIL #Sequences module SeqExpressionSteppingTest1 // Regression test for FSHARP1.0:4058 -module SeqExpressionSteppingTest1 = +module SeqExpressionSteppingTest1 = - let f0 () = + let f0 () = seq { yield 1 } let _ = f0()|> Seq.length diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs index b78badf05dc..499f9f7c6f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs @@ -1,7 +1,7 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Sequences +// #NoMono #NoMT #CodeGen #EmittedIL #Sequences module SeqExpressionSteppingTest2 // Regression test for FSHARP1.0:4058 -module SeqExpressionSteppingTest2 = - let f1 () = +module SeqExpressionSteppingTest2 = + let f1 () = seq { printfn "hello" yield 1 printfn "goodbye" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs index c32385c071e..8aa4046c54e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs @@ -1,6 +1,6 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Sequences +// #NoMono #NoMT #CodeGen #EmittedIL #Sequences module SeqExpressionSteppingTest3 // Regression test for FSHARP1.0:4058 -module SeqExpressionSteppingTest3 = +module SeqExpressionSteppingTest3 = let f2 () = let mutable x = 0 seq { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs index 88140eb7691..4ebd84c5d23 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs @@ -1,7 +1,7 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Sequences +// #NoMono #NoMT #CodeGen #EmittedIL #Sequences module SeqExpressionSteppingTest4 // Regression test for FSHARP1.0:4058 -module SeqExpressionSteppingTest4 = - let f3 () = +module SeqExpressionSteppingTest4 = + let f3 () = seq { let mutable x = 0 x <- x + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs index cad7a56c0c5..4b34054f62d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs @@ -1,7 +1,7 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Sequences +// #NoMono #NoMT #CodeGen #EmittedIL #Sequences module SeqExpressionSteppingTest5 // Regression test for FSHARP1.0:4058 -module SeqExpressionSteppingTest5 = - let f4 () = +module SeqExpressionSteppingTest5 = + let f4 () = seq { let mutable x = 0 try diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs index 225694e0359..4e95d213f68 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs @@ -1,11 +1,11 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Sequences +// #NoMono #NoMT #CodeGen #EmittedIL #Sequences module SeqExpressionSteppingTest6 // Regression test for FSHARP1.0:4058 -module SeqExpressionSteppingTest6 = +module SeqExpressionSteppingTest6 = let es = [1;2;3] - let f7 () = + let f7 () = seq { for x in es do printfn "hello" - yield x + yield x for x in es do printfn "goodbye" yield x } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs index 2c178dd00b0..86cef731a56 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Sequences +// #NoMono #NoMT #CodeGen #EmittedIL #Sequences module SeqExpressionSteppingTest7 // Regression test for FSHARP1.0:4454 // "Stepping into sequence expression pops up a dialog trying to located an unknown file" let mutable r = 0 @@ -69,7 +69,7 @@ let testSimpleForEachIntLoopDownWithTwoStatements (start, stop) = System.Console.WriteLine("{0}", x) System.Console.WriteLine("{0}", x) -let ListExpressionSteppingTest7 () = +let ListExpressionSteppingTest7 () = [ for x in 1..4 do printfn "hello" yield x ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.fs index 152eeca7d84..38faf3e668d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Sequences #TailCalls +// #NoMono #NoMT #CodeGen #EmittedIL #Sequences #TailCalls module SeqExpressionTailCalls01 // Regression test for FSHARP1.0:4135 let rec rwalk x = seq { yield x; yield! rwalk (x+1) } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.fs index 0bac3ea71d1..e6cf94b47db 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Sequences #TailCalls +// #Regression #NoMono #NoMT #CodeGen #EmittedIL #Sequences #TailCalls // Regression test for FSHARP1.0:4135 // Same as SeqExpressionTailCalls01.fs, but with MUTUALLY RECURSIVE PAIR OF SEQUENCES module SeqExpressionTailCalls02 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SkipLocalsInit.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SkipLocalsInit.fs index 8fd82fec1f6..d6fcfa450ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SkipLocalsInit.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SkipLocalsInit.fs @@ -120,7 +120,7 @@ type X () = .locals (int32[] V_0, int32 V_1) """ - + """ .method public strict virtual instance bool Invoke(int32 x) cil managed @@ -155,7 +155,7 @@ IL_0002: initobj [runtime]System.DateTime IL_0008: ldloc.0 IL_0009: ret """ - + """ .locals (valuetype [runtime]System.Nullable`1 V_0, valuetype [runtime]System.Nullable`1 V_1, diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs index 59f22bcb140..68059a69992 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:5651 // diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs index 01177dbce16..1f36f62a00c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL -// +// #NoMono #NoMT #CodeGen #EmittedIL +// module StaticInit_ClassS01 -type C(s:System.DateTime) = - class - static let x = "1".Length +type C(s:System.DateTime) = + class + static let x = "1".Length static let f () = x + "2".Length end diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs index 5a10a3d6f82..91791d27678 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL // module StaticInit_Module01 -module M = - let x = "1".Length - module N = - let y = x + "2".Length - let z = y + "3".Length +module M = + let x = "1".Length + module N = + let y = x + "2".Length + let z = y + "3".Length diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs index e93c6e0d20f..a79d8ef783d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL // module StaticInit_Struct01 -type C(s:System.DateTime) = - struct - static let x = "1".Length +type C(s:System.DateTime) = + struct + static let x = "1".Length static let f () = x + "2".Length end diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs index a2b09aad46a..23a6c52ab09 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs @@ -1,9 +1,9 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch01 // Regression test for FSHARP1.0:4339 open System -let public funcA (n) = - match n with +let public funcA (n) = + match n with | Choice2Of2 _ -> Console.WriteLine("A") - | Choice1Of2 _ -> + | Choice1Of2 _ -> Console.WriteLine("B") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs index 456cecbed1d..856ff80b9f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs @@ -1,9 +1,9 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch02 // Regression test for FSHARP1.0:4339 open System -let public funcB (n) = - match n with - | Choice1Of2 _ -> +let public funcB (n) = + match n with + | Choice1Of2 _ -> Console.WriteLine("B") | Choice2Of2 _ -> Console.WriteLine("A") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs index 6a3bc1eaae1..9dde6b37d2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs @@ -1,9 +1,9 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch03 // Regression test for FSHARP1.0:4339 open System -let public funcC (n) = - match n with - | Choice1Of3 _ -> +let public funcC (n) = + match n with + | Choice1Of3 _ -> Console.WriteLine("A") | Choice2Of3 _ -> Console.WriteLine("B") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs index e1784c1b63a..fc953b0ec7f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs @@ -1,11 +1,11 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch04 // Regression test for FSHARP1.0:4339 open System -let public funcC2 (n) = - match n with +let public funcC2 (n) = + match n with | Choice2Of3 _ -> Console.WriteLine("B") | Choice3Of3 _ -> Console.WriteLine("C") - | Choice1Of3 _ -> + | Choice1Of3 _ -> Console.WriteLine("A") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs index 4b7d8c9d4c1..91d35b6d33c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs @@ -1,11 +1,11 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch05 // Regression test for FSHARP1.0:4339 open System -let public funcC3 (n) = - match n with +let public funcC3 (n) = + match n with | Choice3Of3 _ -> Console.WriteLine("C") | Choice2Of3 _ -> Console.WriteLine("B") - | Choice1Of3 _ -> + | Choice1Of3 _ -> Console.WriteLine("A") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs index 16f84709967..19bbdf77468 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs @@ -1,10 +1,10 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch06 // Regression test for FSHARP1.0:4339 open System type Discr = CaseA | CaseB let public funcD (n) = - match n with - | CaseB -> + match n with + | CaseB -> Console.WriteLine("B") | CaseA-> Console.WriteLine("A") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs index af3b6b7f337..5e740769615 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs @@ -1,10 +1,10 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch07 // Regression test for FSHARP1.0:4339 open System type Discr = CaseA | CaseB let public funcE (n) = - match n with + match n with | CaseA-> Console.WriteLine("A") - | CaseB -> + | CaseB -> Console.WriteLine("B") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs index a9aaadc4fa2..5a8dfeb423c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs @@ -1,7 +1,7 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch08 // Regression test for FSHARP1.0:5099 let test(x) = - let b = + let b = match x with | 0 -> 2 | _ -> 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch09.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch09.fs index 7c67a679fa9..58b2c839b1e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch09.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch09.fs @@ -1,38 +1,38 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL module SteppingMatch09 open System -let public funcA n = - match n with +let public funcA n = + match n with | 1 -> Some(10) // debug range should cover all of "Some(10)" - | 2 -> + | 2 -> None | _ -> Some( 22 ) // debug range should cover all of "Some( 22 )" // Test case from https://github.com/dotnet/fsharp/issues/105 let OuterWithGenericInner list = - let GenericInner (list: 'T list) = - match list with - | [] -> 1 + let GenericInner (list: 'T list) = + match list with + | [] -> 1 | _ -> 2 GenericInner list // Test case from https://github.com/dotnet/fsharp/issues/105 let OuterWithNonGenericInner list = - let NonGenericInner (list: int list) = - match list with - | [] -> 1 + let NonGenericInner (list: int list) = + match list with + | [] -> 1 | _ -> 2 NonGenericInner list // Test case from https://github.com/dotnet/fsharp/issues/105 let OuterWithNonGenericInnerWithCapture x list = - let NonGenericInnerWithCapture (list: int list) = - match list with - | [] -> 1 + let NonGenericInnerWithCapture (list: int list) = + match list with + | [] -> 1 | _ -> x NonGenericInnerWithCapture list diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringEncoding/StringEncoding.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringEncoding/StringEncoding.fs index da3fa57a537..b6ee6a7c8aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringEncoding/StringEncoding.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringEncoding/StringEncoding.fs @@ -8,17 +8,17 @@ open FSharp.Test.Compiler module StringEncoding = // - // What we are doing is is really making sure that strings in F# assemblies are + // What we are doing is is really making sure that strings in F# assemblies are // encoded according to the specifications (which are, essentially, "do what C# // does even if the C# is not fully ECMA compliant") - // + // // Using the Normalize(...) method is just an indirect way to test this. The direct verification // would have been something like: // - compile F# code with strings (UNICODE 0x0000 -> 0xffff) // - open assembly with binary editor // - look at the encoding // - make sure the trailing byte is set to 0/1 accordingly. - // + // // Note: to keep the execution time within a reasonable limit, we only consider the range 0x0000 - 0x0123 // (if you look at the code you'll see that nothing really interesting happens after 0xff... so the // odds of screwing up there are really small and unlikely to happen) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs index 57b3c0ae5ec..04fce5fbee1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs @@ -176,7 +176,7 @@ IL_000d: ret"""] [] let ``Interpolated string with concat converts to span implicitly`` () = - let compilation = + let compilation = FSharp $""" module InterpolatedStringByefLikes type Foo() = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructDefensiveCopy/StructDefensiveCopy.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructDefensiveCopy/StructDefensiveCopy.fs index 2b090932f78..b7772970258 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructDefensiveCopy/StructDefensiveCopy.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StructDefensiveCopy/StructDefensiveCopy.fs @@ -19,7 +19,7 @@ let doWork(kvp1:inref>) = |> shouldSucceed |> verifyIL expectedIl -#if NETSTANDARD +#if NETSTANDARD // KeyValuePair defined as a readonly struct (in C#) [] let ``Defensive copy can be skipped on read-only structs``() = @@ -37,7 +37,7 @@ let ``Defensive copy can be skipped on read-only structs``() = } """] -#else +#else // KeyValuePair just a regular struct. Notice the "ldobj" instruction [] let ``Non readonly struct needs a defensive copy``() = @@ -79,7 +79,7 @@ let doWork(dt:inref) = |> shouldSucceed |> verifyIL expectedIl -#if NETSTANDARD +#if NETSTANDARD // DateTime defined as a readonly struct (in C#) [] let ``Defensive copy can be skipped for extension methods on read-only structs``() = @@ -95,7 +95,7 @@ let ``Defensive copy can be skipped for extension methods on read-only structs`` IL_000c: ret } """] -#else +#else // DateTime just a regular struct. Notice the "ldobj" instruction [] let ``Non readonly struct needs a defensive copy when its extension method is called``() = @@ -120,11 +120,11 @@ let ``Non readonly struct needs a defensive copy when its extension method is ca #endif -#if NETSTANDARD +#if NETSTANDARD [] #endif let ``Csharp extension method on a readonly struct does not need defensive copy``() = - let csLib = + let csLib = CSharp """ using System; public static class DateTimeExtensionMethod diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnLet01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnLet01.fs index b0f59225138..5bc8f6e9a11 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnLet01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnLet01.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify the ability to put attributes on let-bindings @@ -28,5 +28,5 @@ try |> should haveAttribute "ObsoleteAttribute" with -| e -> printfn "Unhandled Exception: %s" e.Message +| e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnLet02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnLet02.fs index 6cdc374522e..6fcf2191416 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnLet02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnLet02.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify the ability to put attributes on let-bindings @@ -14,7 +14,7 @@ let (a, b) = (1,2) // This syntax is no longer allowed, attributes can only be applied to whole pattern rather than its elements separately. // Related test is placed under Conformance\DeclarationElements\LetBindings\Basic -let ([] venus, earth, [] mars) = +let ([] venus, earth, [] mars) = ("too hot","just right", "too cold") *) @@ -53,5 +53,5 @@ try *) with -| e -> printfn "Unhandled Exception: %s" e.Message +| e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnProperty.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnProperty.fs index f9e6f07bf1e..ea621a90008 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnProperty.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnProperty.fs @@ -10,8 +10,8 @@ type C(x:int) = let mutable m_value = x [] - member this.ReadWrite - with get() = m_value + member this.ReadWrite + with get() = m_value and set x = m_value <- x open CodeGenHelper @@ -23,5 +23,5 @@ try |> should haveAttribute "AttrOnProperty" with -| e -> printfn "Unhandled Exception: %s" e.Message +| e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertyGetter.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertyGetter.fs index 102ae496aec..b47b6b52999 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertyGetter.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertyGetter.fs @@ -9,19 +9,19 @@ type AttrOnGetter() = inherit System.Attribute() type C(x:int) = let mutable m_value = x - member this.ReadWrite - with [] get() = m_value + member this.ReadWrite + with [] get() = m_value and set x = m_value <- x open CodeGenHelper -try +try System.Reflection.Assembly.GetExecutingAssembly() |> getType "bug1539+C" |> getMethod "get_ReadWrite" |> should haveAttribute "AttrOnGetter" with -| e -> printfn "Unhandled Exception: %s" e.Message +| e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertyGetterSetter.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertyGetterSetter.fs index 419bb233314..63ce76b2874 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertyGetterSetter.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertyGetterSetter.fs @@ -12,13 +12,13 @@ type C(x:int) = let mutable m_value = x [] - member this.ReadWrite - with [] get() = m_value + member this.ReadWrite + with [] get() = m_value and [] set x = m_value <- x open CodeGenHelper -try +try System.Reflection.Assembly.GetExecutingAssembly() |> getType "bug1539+C" |> getProperty "ReadWrite" @@ -35,6 +35,6 @@ try |> should haveAttribute "AttrOnSetter" with -| e -> printfn "Unhandled Exception: %s" e.Message +| e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertySetter.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertySetter.fs index cd2c1d80861..c354e03b620 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertySetter.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/AttributesOnPropertySetter.fs @@ -9,18 +9,18 @@ type AttrOnSetter() = inherit System.Attribute() type C(x:int) = let mutable m_value = x - member this.ReadWrite - with get() = m_value + member this.ReadWrite + with get() = m_value and [] set x = m_value <- x open CodeGenHelper -try +try System.Reflection.Assembly.GetExecutingAssembly() |> getType "bug1539+C" |> getMethod "set_ReadWrite" |> should haveAttribute "AttrOnSetter" with -| e -> printfn "Unhandled Exception: %s" e.Message +| e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/BaseType.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/BaseType.fs index 10fbd80242e..f67c1691c4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/BaseType.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/BaseType.fs @@ -5,7 +5,7 @@ open System.Security.Permissions type T() = abstract TestBase : unit -> int - default x.TestBase() = + default x.TestBase() = #if PASS1 1 #else @@ -27,5 +27,5 @@ type T() = #else 2 #endif - + type U() = class inherit T() end \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ClassArity01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ClassArity01.fs index 0da27610b4d..79a93e620fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ClassArity01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ClassArity01.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify the generation of class function arity @@ -59,7 +59,7 @@ module Tester = |> getType "Test.AClassType" |> getMethod "Params1b" |> should takeParams [ typeof; typeof ] - + System.Reflection.Assembly.GetExecutingAssembly() |> getType "Test.AClassType" |> getMethod "Params1c" @@ -77,5 +77,5 @@ module Tester = with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/CodeGenHelper.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/CodeGenHelper.fs index 5f930996010..8c45234787c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/CodeGenHelper.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/CodeGenHelper.fs @@ -23,8 +23,8 @@ let verify f x = f x /// Gets the given type from the assembly (otherwise throws) let getType typeName (asm : Assembly) = match asm.GetType(typeName, false) with - | null -> - let allTypes = + | null -> + let allTypes = asm.GetTypes() |> Array.map (fun ty -> ty.Name) |> Array.reduce (fun x y -> sprintf "%s\r%s" x y) @@ -43,11 +43,11 @@ let getMember memberName (ty : Type) = | [||] -> failwithf "Error: Type did not contain member %s" memberName // - empty array (=not found) | [| memberInfo |] -> memberInfo // - array with 1 element (=found) | _ -> failwithf "Error: Multiple overloads. Use getMembers instead." // - array with >1 elements (=multiple overloads) - -/// Gets all of a type's PUBLIC members + +/// Gets all of a type's PUBLIC members let getMembers (ty : Type) = ty.GetMembers() -/// Gets a type's method +/// Gets a type's method let getMethod methodName (ty : Type) = match ty.GetMethod(methodName) with | null -> failwithf "Error: Type did not contain member %s" methodName @@ -76,29 +76,29 @@ let containType typeName (assembly : Assembly) = match assembly.GetType(typeName, false) with | null -> failwithf "Error: Assembly does not contain type %s" typeName | _ -> () - + /// Verify the assembly does NOT contains a type with the given name let notContainType typeName (assembly : Assembly) = match assembly.GetType(typeName, false) with | null -> () | _ -> failwithf "Error: Assembly does, in fact, contain type %s" typeName - + // Property - -/// Verify the type contains a property with the given name + +/// Verify the type contains a property with the given name let containProp propName (ty : Type) = match ty.GetProperty(propName) with | null -> failwithf "Error: Type %s does not contain property %s" ty.Name propName | _ -> () -/// Verify the type does not contain a property with the given name +/// Verify the type does not contain a property with the given name let notContainProp propName (ty : Type) = match ty.GetProperty(propName) with | null -> () | _ -> failwithf "Error: Type %s does contain property %s" ty.Name propName - + // Member - + /// Verify the type contains a method with the given name let containMember membName (ty : Type) = match ty.GetMember(membName) with @@ -115,51 +115,51 @@ let notContainMember membName (ty : Type) = let takeParams (args : Type list) (methInfo : MethodInfo) = let parameters = methInfo.GetParameters() if parameters.Length <> List.length args then - failwithf + failwithf "Error: Method [%s] doesn't have expected arity. Method takes %d params, but expected %d" methInfo.Name parameters.Length (List.length args) - + let verifyParamIsType (param : ParameterInfo) (ty : Type)= if param.ParameterType <> ty then - failwithf + failwithf "Error: Parameter is type [%s] but expected type [%s]" param.ParameterType.Name ty.Name - + args |> List.iteri (fun i ty -> verifyParamIsType (parameters.[i]) ty) /// Assert the type is a Multicast delegate with the given signature. let beDelegate parameters (returnType : Type) (delegateType : Type) = // Verify the give type is, in fact, a delegate - if delegateType.BaseType.Name <> "MulticastDelegate" then - failwithf - "Error: The given type [%s] is not a MulticastDelegate, but expected to be." + if delegateType.BaseType.Name <> "MulticastDelegate" then + failwithf + "Error: The given type [%s] is not a MulticastDelegate, but expected to be." delegateType.Name - + // Now make sure it has the right signature, get the method info for the 'Invoke' method // to verify this. let invokeMethod = getMethod "Invoke" delegateType takeParams parameters invokeMethod - + // Check the return type too... if invokeMethod.ReturnType <> returnType then - failwithf + failwithf "Error: Return types do not match. Expected [%s] but got [%s]" returnType.Name invokeMethod.ReturnType.Name () - + /// Verifies the given event uses the specified event handler let useEventHandler eventHandlerType (eventInfo : EventInfo) = if eventInfo.EventHandlerType <> eventHandlerType then - failwithf + failwithf "Error: Expected event to use handler [%s] but got [%s]" eventHandlerType.Name eventInfo.EventHandlerType.Name - () - + () + /// Verify the object contains a custom attribute with the given name. E.g. "ObsoleteAttribute" let haveAttribute attrName thingy = let containsAttrWithName attrList = @@ -168,10 +168,10 @@ let haveAttribute attrName thingy = |> Array.length > 0 let containsAttribute = match box thingy with - | :? Type as ty + | :? Type as ty -> ty.GetCustomAttributes(false) |> containsAttrWithName - | :? MethodInfo as mi + | :? MethodInfo as mi -> mi.GetCustomAttributes(false) |> containsAttrWithName | :? PropertyInfo as pi @@ -189,7 +189,7 @@ let haveAttribute attrName thingy = /// Asserts a property's return value let haveType ty (propInfo : PropertyInfo) = if propInfo.PropertyType <> ty then - failwithf + failwithf "Error: Property has type [%s] but expected[%s]" propInfo.PropertyType.Name ty.Name @@ -203,10 +203,10 @@ let doesn'tHaveAttribute attrName thingy = |> Array.length = 0 let containsAttribute = match box thingy with - | :? Type as ty + | :? Type as ty -> ty.GetCustomAttributes(false) |> doesn'tContainsAttrWithName - | :? MethodInfo as mi + | :? MethodInfo as mi -> mi.GetCustomAttributes(false) |> doesn'tContainsAttrWithName | :? PropertyInfo as pi diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Delegates01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Delegates01.fs index e2501f23db6..b1aaf7213e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Delegates01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Delegates01.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify delegates are generated correctly @@ -42,5 +42,5 @@ module Tester = with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/DiscUnionCodeGen1.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/DiscUnionCodeGen1.fs index 095c8d7596c..d5d008a2a33 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/DiscUnionCodeGen1.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/DiscUnionCodeGen1.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify the compiled structure of discriminated unions namespace Test @@ -8,7 +8,7 @@ namespace Test | Hearts | Spades | Clubs - + type Card = | ValueCard of int * Suit | Jack of Suit @@ -33,9 +33,9 @@ namespace Test let cardType = System.Reflection.Assembly.GetExecutingAssembly() |> getType "Test.Card" - + // Expected properties - [ "Tag"; "IsJoker"; "IsKing"; "IsQueen"; "IsJack"; "IsValueCard" ] + [ "Tag"; "IsJoker"; "IsKing"; "IsQueen"; "IsJack"; "IsValueCard" ] |> List.iter (fun propName -> cardType |> should containProp propName) [ "Joker" ] @@ -49,27 +49,27 @@ namespace Test let verifyProperties propNames ty = propNames |> List.iter (fun propName -> ty |> should containProp propName) () - + asm |> getType "Test.Card+Ace" |> verifyProperties [ "Item" ] - + asm |> getType "Test.Card+King" |> verifyProperties [ "Item" ] - + asm |> getType "Test.Card+Queen" |> verifyProperties [ "Item" ] - + asm |> getType "Test.Card+Jack" |> verifyProperties [ "Item" ] - + asm |> getType "Test.Card+ValueCard" - |> verifyProperties [ "Item1"; "Item2" ] - + |> verifyProperties [ "Item1"; "Item2" ] + with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/DoNotInlineX.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/DoNotInlineX.fs index ee45e7a4b8b..f53ec757a83 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/DoNotInlineX.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/DoNotInlineX.fs @@ -6,13 +6,13 @@ open System.IO let longtime = int(System.TimeSpan.FromSeconds(30.0).TotalMilliseconds) // longtime is 30 seconds -let programFiles = +let programFiles = let pf86 = Environment.GetEnvironmentVariable("ProgramFiles(x86)") if String.IsNullOrEmpty(pf86) then Environment.GetEnvironmentVariable("ProgramFiles") else pf86 let fsc = let overridePath = Environment.GetEnvironmentVariable("FSC") - if not (String.IsNullOrEmpty(overridePath)) then - overridePath + if not (String.IsNullOrEmpty(overridePath)) then + overridePath else let fsc41_SxS = Path.Combine(programFiles, @"Microsoft SDKs\F#\4.1\Framework\v4.0\fsc.exe") let fsc40_SxS = Path.Combine(programFiles, @"Microsoft SDKs\F#\4.0\Framework\v4.0\fsc.exe") @@ -26,7 +26,7 @@ let fsc = let start (p1 : string) = Process.Start(p1) -let CompileFile file args = +let CompileFile file args = let p = Process.Start(fsc, file + " " + args) p.WaitForExit() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Equality01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Equality01.fs index bbb293bd28e..dfd6b3ce9c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Equality01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Equality01.fs @@ -1,8 +1,8 @@ -// #Regression #NoMT #CodeGen #Interop +// #Regression #NoMT #CodeGen #Interop // Regression test for FSHARP1.0:4324 - Generated structural equality for structs does not take into consideration implicit fields captured as constructor parameters open System -type T (a: int, b: int) = +type T (a: int, b: int) = struct member x.a' = a member x.b' = b diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events01.fs index 82704ed2a28..9347f00e2e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events01.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify delegates are generated correctly @@ -6,29 +6,29 @@ namespace Test type ChannelChanged = delegate of obj * int -> unit - + type Television() as this = // Create an event channel changed. let channelChanged = new Event() let triggerChanelChanged channelNumber = channelChanged.Trigger(this, channelNumber) - + // When TV constructed, fire channel changed event. do triggerChanelChanged(3) - + // Static event static let defaultChannelChanged = new Event() // Setting the channel will fire our event. member this.SetChanel (x : int) = triggerChanelChanged(x) - + // By adding the [] on a property of type IEvent<_> // this will be compiled as a proper .NET event. [] member this.ChanelChangedEvent = channelChanged.Publish // Static event - [] + [] static member DefaultChannelChanged = defaultChannelChanged.Publish // -------------------------------- @@ -53,7 +53,7 @@ namespace Test |> getType "Test.Television" |> getEvent "DefaultChannelChanged" |> should useEventHandler typeof - + with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events02.fs index 028a2610d2d..fe69e3fb90a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events02.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify events can be added to interfaces @@ -6,33 +6,33 @@ namespace Test type MagicalResult = delegate of obj * string * int -> unit - + type IHaveMagicalProperties = abstract member Rub : unit -> unit abstract member DropCoinIn : unit -> unit - + [] abstract member GoodThingHappened : IEvent - + [] abstract member BadThingHappened : IEvent type MagicLamp = - + val m_goodResult : Event - - new() = { + + new() = { m_goodResult = new Event<_,_>() } - + interface IHaveMagicalProperties with member this.Rub() = this.m_goodResult.Trigger(this, ("A genie appears!", 3)) member this.DropCoinIn() = () - + [] member this.GoodThingHappened = this.m_goodResult.Publish - + // Make the event accessible, but will throw when you try to add or remove a handler [] member this.BadThingHappened = Unchecked.defaultof< IEvent > @@ -53,7 +53,7 @@ namespace Test |> getType "Test.IHaveMagicalProperties" |> getEvent "GoodThingHappened" |> should useEventHandler typeof - + with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Extensions01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Extensions01.fs index 210581086c5..e5e50f54201 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Extensions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Extensions01.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify extension methods become intrinsic if in same namespace namespace Test diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Extensions02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Extensions02.fs index 60e1bd7348c..91bc024fc9a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Extensions02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Extensions02.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify extension methods do NOT become intrinsic if in different modules module Test @@ -8,7 +8,7 @@ module Parts = member this.PropA = 1 member this.MethA(a) = a + this.PropA -module Extensions = +module Extensions = type Parts.Foo with member this.PropB = this.PropA + 1 @@ -24,7 +24,7 @@ module Tester = printfn "Testing..." try - //System.Reflection.Assembly.GetExecutingAssembly().GetTypes() + //System.Reflection.Assembly.GetExecutingAssembly().GetTypes() //|> Array.iter(fun ty -> printfn "%s" ty.FullName) // Since they are nested modules, the name is somewhat mangled. As of Beta1 there @@ -47,7 +47,7 @@ module Tester = System.Reflection.Assembly.GetExecutingAssembly() |> getType "Test+Parts+Foo" |> should notContainProp "PropB" - + with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FunctionArity01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FunctionArity01.fs index 532d4374e38..cb29b2cb02b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FunctionArity01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FunctionArity01.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify that suples are dropped when parameters to a function diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ModuleArity01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ModuleArity01.fs index 5c60e0523a9..59188dfe576 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ModuleArity01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ModuleArity01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CodeGen #Interop +// #Regression #NoMT #CodeGen #Interop // Verify the generation of module value arity // Regression test for FSHARP1.0:4762 @@ -58,7 +58,7 @@ module Tester = |> getType "Test.AModuleType" |> getMethod "Params1b" |> should takeParams [ typeof; typeof ] - + System.Reflection.Assembly.GetExecutingAssembly() |> getType "Test.AModuleType" |> getMethod "Params1c" @@ -76,6 +76,6 @@ module Tester = with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/NativePtr01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/NativePtr01.fs index 0e27f47ec45..f52606126fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/NativePtr01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/NativePtr01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CodeGen #Interop +// #Regression #NoMT #CodeGen #Interop // Regression test for FSHARP1.0:6150 // nativeptr should not turn into IntPtr when used in method signature or return value // it should be T* @@ -12,15 +12,15 @@ module M = type T() = member x.F ( p : nativeptr ) = () type R() = member x.G ( ) : nativeptr = Unchecked.defaultof> - - let res1 = System.Reflection.Assembly.GetExecutingAssembly() - |> getType "N.M+T" + + let res1 = System.Reflection.Assembly.GetExecutingAssembly() + |> getType "N.M+T" |> getMember "F" - let res2 = System.Reflection.Assembly.GetExecutingAssembly() - |> getType "N.M+R" + let res2 = System.Reflection.Assembly.GetExecutingAssembly() + |> getType "N.M+R" |> getMember "G" - + // Used to be (incorrectly) "Void F(IntPtr)" if res1.ToString() <> "Void F(Char*)" then raise (new Exception("exit 1")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ObjectExpressions01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ObjectExpressions01.fs index dc742a1cdfd..aa95c120bdf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ObjectExpressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ObjectExpressions01.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop open System @@ -12,19 +12,19 @@ let VerifyTypeIsPrivate (ty : System.Type) = () -let oe1 = - { +let oe1 = + { new System.Object() with override this.ToString() = "oe1" } - + VerifyTypeIsPrivate (oe1.GetType()) - -let oe2 = + +let oe2 = { new System.IDisposable with member this.Dispose() = () } - + VerifyTypeIsPrivate (oe2.GetType()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ReadOnlyStructFromLib.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ReadOnlyStructFromLib.fs index 1c5b4f79e08..a834c476be8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ReadOnlyStructFromLib.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/ReadOnlyStructFromLib.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CodeGen #Interop +// #Regression #NoMT #CodeGen #Interop // Regression for FSHARP1.0:5750 // Code gen issues with copy of readonly struct from a separate assembly open ReadWriteLib diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fs index 730abcdb54c..e4210170bc1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CodeGen #Interop +// #Regression #NoMT #CodeGen #Interop // Regression test for FSHARP1.0:4040 // "Signature files do not prevent compiler-generated public constructors from leaking out of discriminated unions" // Note that the corresponding .fsi file is missing the "| C of int" part of the DU @@ -9,16 +9,16 @@ namespace N type T = | C of int module M = - + open System open System.Reflection open CodeGenHelper - - let res = Assembly.GetExecutingAssembly() - |> getType "N.T" + + let res = Assembly.GetExecutingAssembly() + |> getType "N.T" |> getMembers |> Array.tryFind (fun a -> a.Name = "C") - + if not (res.IsNone) then raise (Exception($"Oops: not(res.IsNone)")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fsi b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fsi index 9758d415ed5..8aba9c10b4e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fsi @@ -1,4 +1,4 @@ -// #Regression #NoMT #CodeGen #Interop +// #Regression #NoMT #CodeGen #Interop // Regression test for FSHARP1.0:4040 // "Signature files do not prevent compiler-generated public constructors from leaking out of discriminated unions" // Note that in this case the .fsi is missing the "| C of int" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fs index eb9ab3f83b3..0754c1bb646 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CodeGen #Interop +// #Regression #NoMT #CodeGen #Interop // Regression test for FSHARP1.0:4040 // "Signature files do not prevent compiler-generated public constructors from leaking out of discriminated unions" // Note that the corresponding .fsi file is NOT missing the "| C of int" part of the DU @@ -7,22 +7,22 @@ module N type T = | C of int module M = - + open CodeGenHelper open System - // The public constructor called 'C' is now gone - let res1 = System.Reflection.Assembly.GetExecutingAssembly() - |> getType "N.T" + // The public constructor called 'C' is now gone + let res1 = System.Reflection.Assembly.GetExecutingAssembly() + |> getType "N.T" |> getMembers |> Array.tryFind (fun a -> a.Name = "C") - - if res1.IsSome then + + if res1.IsSome then raise (Exception($"Oops: - Unexpected member N.T.C!")) // Instead, there is a C#-facing method N.T.NewC for each non-nullary union case - let res2 = System.Reflection.Assembly.GetExecutingAssembly() - |> getType "N.T" + let res2 = System.Reflection.Assembly.GetExecutingAssembly() + |> getType "N.T" |> getMethods |> Array.tryFind (fun a -> a.Name = "NewC") diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fsi b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fsi index 1fe19e811e2..4f0b441bf69 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fsi +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fsi @@ -1,4 +1,4 @@ -// #Regression #NoMT #CodeGen #Interop +// #Regression #NoMT #CodeGen #Interop // Regression test for FSHARP1.0:4040 // "Signature files do not prevent compiler-generated public constructors from leaking out of discriminated unions" // Note that in this case the .fsi is NOT missing the "| C of int" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure01.fs index 66ac48c1ddd..0b4f9676d54 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure01.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify units of measure are dropped and types are just their @@ -34,26 +34,26 @@ module Tester = // Verify the opaque types for Units of Measure are not generated. System.Reflection.Assembly.GetExecutingAssembly() |> should containType "Test.widget" // see FSHARP1.0:4134 - + // Sprocket should be found since it has static methods on it System.Reflection.Assembly.GetExecutingAssembly() |> should containType "Test.sprocket" - + System.Reflection.Assembly.GetExecutingAssembly() |> getType "Test.AClass" |> getProperty "WidgetFactor" |> should haveType typeof - + System.Reflection.Assembly.GetExecutingAssembly() |> getType "Test.AClass" |> getProperty "WidgetSprocketRatio" |> should haveType typeof - + System.Reflection.Assembly.GetExecutingAssembly() |> getType "Test.AClass" |> getProperty "SprocketFactor" |> should haveType typeof - + with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure02.fs index 3f316e67842..a7d395aeb80 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure02.fs @@ -1,4 +1,4 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop // Verify units of measure are dropped and types are just their @@ -13,7 +13,7 @@ type widget type sprocket type AClass() = - member this.DoStuff (x : float, y : float) = + member this.DoStuff (x : float, y : float) = let a = decimal x let b = decimal y a * b * 0.0M @@ -33,7 +33,7 @@ module Tester = |> getType "Test.AClass" |> getMethod "DoStuff" |> should takeParams [typeof; typeof] - + with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure03.fs index e61ed12587e..72209443b4f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure03.fs @@ -1,7 +1,7 @@ -// #NoMT #CodeGen #Interop +// #NoMT #CodeGen #Interop -// Verify types which are generic WRT a unit of measure are exposed as +// Verify types which are generic WRT a unit of measure are exposed as // standard .NET types (no funny business!) namespace Test @@ -16,10 +16,10 @@ type sprocket type PointG0<[] 'a>(x : float<'a>, y : float<'a>) = member this.X = x member this.Y = y - + type PointWidget(x, y) = inherit PointG0(x, y) - + // Generic with regard to a unit of measure AND a typearg type PointG2<[] 'm, 'a, 'b>() = inherit PointG0<'m>(0.0<_>, 0.0<_>) @@ -53,7 +53,7 @@ module Tester = System.Reflection.Assembly.GetExecutingAssembly() |> getType "Test.PointG2`2" |> (fun (ty : Type) -> if not ty.IsGenericType then failwith "Error: Should be generic!") - + with - | e -> printfn "Unhandled Exception: %s" e.Message + | e -> printfn "Unhandled Exception: %s" e.Message raise (Exception($"Oops: {e}")) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction01.fs index 83b95814de2..a45b7c6bbcb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction01.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction1() = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction02.fs index 21d39e65078..5d321d531d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction02.fs @@ -1,13 +1,13 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction1() = printfn "Hello"; printfn "World"; 3+4 - + let TestFunction2() = let x = TestFunction1() printfn "Hello"; - printfn "World" - + printfn "World" + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs index 921bcd19eee..8a540931ae9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs @@ -1,15 +1,15 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction1() = printfn "Hello"; printfn "World"; 3+4 - + let TestFunction3() = - try + try let x = TestFunction1() printfn "Hello"; - with _ -> - printfn "World" + with _ -> + printfn "World" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03b.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03b.fs index f80b0f84907..2b38f832002 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03b.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03b.fs @@ -1,15 +1,15 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction1() = printfn "Hello"; printfn "World"; 3+4 - + let TestFunction3b() = - try + try let x = TestFunction1() failwith "hello" - with Failure _ -> - printfn "World" + with Failure _ -> + printfn "World" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs index fa56dcaab0c..a3f73c1600b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs @@ -1,15 +1,15 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction1() = printfn "Hello"; printfn "World"; 3+4 - + let TestFunction3c() = - try + try let x = TestFunction1() failwith "hello" - with Failure msg when msg = "hello" -> - printfn "World" + with Failure msg when msg = "hello" -> + printfn "World" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction04.fs index 7788c2a5df9..41dfbe11ad6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction04.fs @@ -1,14 +1,14 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction1() = printfn "Hello"; printfn "World"; 3+4 - + let TestFunction4() = - try + try let x = TestFunction1() printfn "Hello"; - finally + finally printfn "World" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction05.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction05.fs index 1823c5e8d9a..d87418a8adf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction05.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction05.fs @@ -1,13 +1,13 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction1() = printfn "Hello"; printfn "World"; 3+4 - + let TestFunction5() = - let x = + let x = let y = TestFunction1() printfn "Hello"; y + y diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction06.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction06.fs index 047acc75431..2f7d964b8f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction06.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction06.fs @@ -1,13 +1,13 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction1() = printfn "Hello"; printfn "World"; 3+4 - + let TestFunction6() = - let f() = + let f() = let y = TestFunction1() printfn "Hello"; y + y diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction07.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction07.fs index bdf3672bbee..2abc573eccb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction07.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction07.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction7() = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction08.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction08.fs index 0085886d188..939ad48f7b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction08.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction08.fs @@ -1,7 +1,7 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction8(x) = - if x > 3 then - x+4 + if x > 3 then + x+4 else x-4 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09.fs index dd88832914b..067041f376f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction9(x) = - match x with + match x with | 3 -> "three" | 4 -> "four" | _ -> "five" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b.fs index 49a2e6c0395..e0eb856bc44 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction9b(x) = - match x with + match x with | [1;2] -> "three" | [3;4] -> "seven" | [a;b] when a+b = 4 -> "four" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b1.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b1.fs index 49a2e6c0395..e0eb856bc44 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b1.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b1.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction9b(x) = - match x with + match x with | [1;2] -> "three" | [3;4] -> "seven" | [a;b] when a+b = 4 -> "four" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b2.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b2.fs index 49a2e6c0395..e0eb856bc44 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b2.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b2.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction9b(x) = - match x with + match x with | [1;2] -> "three" | [3;4] -> "seven" | [a;b] when a+b = 4 -> "four" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b3.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b3.fs index 49a2e6c0395..e0eb856bc44 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b3.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b3.fs @@ -1,8 +1,8 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction9b(x) = - match x with + match x with | [1;2] -> "three" | [3;4] -> "seven" | [a;b] when a+b = 4 -> "four" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4.fs index 5ed53b701ac..4fd2d976436 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4.fs @@ -1,4 +1,4 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:2484 // Note: we might see changes related to another bug // related to spans diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction10.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction10.fs index 57513d2f178..763c290a752 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction10.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction10.fs @@ -1,6 +1,6 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction10(p) = - let (x,y) = p + let (x,y) = p x+y diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction11.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction11.fs index 03936ffa245..1de2d348e64 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction11.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction11.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction11(p) = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction12.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction12.fs index c8bba75231d..07fc95835fd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction12.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction12.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction12(p) = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction13.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction13.fs index 4c1be2c9eba..88fb8f0c030 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction13.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction13.fs @@ -1,5 +1,5 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction13(x) = - [x;x+x], [] + [x;x+x], [] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction14.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction14.fs index a7ae5776658..75625aadf64 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction14.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction14.fs @@ -1,5 +1,5 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL + - let TestFunction14() = - List.map (fun f -> f 2) [(fun x -> x + 1)] + List.map (fun f -> f 2) [(fun x -> x + 1)] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction15.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction15.fs index 060f3bcecea..53de0306206 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction15.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction15.fs @@ -1,6 +1,6 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL + - let TestFunction15(inp) = let x = inp+1 [1;2;3] |> List.map (fun x -> x + 1) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs index 1e7c0d67329..fb251c6a960 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs @@ -1,6 +1,6 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL + - type U = U of int * int let TestFunction16(inp) = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs index ce20edfc98a..fd3c5b16cb2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL type R = { x:int; y:int } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs index 21c813d1325..8f08250b50b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let TestFunction18(inp) = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction19.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction19.fs index fd1650a7b8b..c2a1b2988d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction19.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction19.fs @@ -1,10 +1,10 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL -type C(x:int,y:int) = +type C(x:int,y:int) = member this.X = x member this.Y = y - + let TestFunction19(inp) = let c1 = C(inp,inp) let c2 = C(inp,inp) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction20.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction20.fs index 7f27004ab11..58431b6e40e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction20.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction20.fs @@ -1,13 +1,13 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL -type D(x:int,y:int) = +type D(x:int,y:int) = let z = x + y let f a = x + a let w = f z + z member this.X = x member this.Y = y - + let TestFunction20(inp) = let d1 = D(inp,inp) let d2 = D(inp,inp) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs index 2733acd9b91..e40a0e2803c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL type U = U of int * int diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22.fs index f864ba4dc81..ee907d4a3ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL System.Console.WriteLine() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b.fs index c361c136484..6c0283b764a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let _ = System.Console.WriteLine() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c.fs index 0025d5de529..6c9a6d0aefc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let () = System.Console.WriteLine() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d.fs index 03bf3da37a9..3115fc29a30 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL do System.Console.WriteLine() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e.fs index 2f3b34a2f2e..c8ce232d335 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL while true do System.Console.WriteLine() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f.fs index ce26726b8d7..cd867f16a74 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL match "A" with | "A" -> System.Console.WriteLine() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g.fs index c993592e40f..79b6e8c2da4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL if true then System.Console.WriteLine() else System.Console.WriteLine() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs index a14f63c0b41..6b29e536034 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs @@ -1,36 +1,36 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL let test1() = - try - System.Console.WriteLine() + try + System.Console.WriteLine() with // should not generate a filter | _ -> System.Console.WriteLine() let test2() = - try - System.Console.WriteLine() + try + System.Console.WriteLine() with // should generate a filter | :? System.ArgumentException -> System.Console.WriteLine() let test3() = - try - System.Console.WriteLine() + try + System.Console.WriteLine() with // should generate a filter | :? System.ArgumentException as a -> System.Console.WriteLine(a.Message) let test4() = - try - System.Console.WriteLine() + try + System.Console.WriteLine() with // should generate a filter | MatchFailureException ( msg, _, _) -> System.Console.WriteLine(msg) let test5() = - try - System.Console.WriteLine() + try + System.Console.WriteLine() with // should generate a filter | :? System.ArgumentException as a -> System.Console.WriteLine(a.Message) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs index 828cb3f1fe9..5c36f022e75 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs @@ -1,15 +1,15 @@ -// #Regression #NoMono #NoMT #CodeGen #EmittedIL +// #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4400 - Improve codegen to use "natural" names for let-bound fields in classes // Regression test for FSHARP1.0:432 - Name cleanup needed for TLR generated methods -type C() = +type C() = let x = System.Console.ReadLine() let g() = x let x = System.Console.ReadLine() member self.M() = x + g() -let f(x) = - let g() = +let f(x) = + let g() = printfn "Hello" printfn "Hello" g(), g() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs index c269074e388..1b721741e9f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs @@ -3,28 +3,28 @@ open FSharp.NativeInterop type Point = { mutable x : int; mutable y : int } -let pinObject() = +let pinObject() = let point = { x = 1; y = 2 } use p1 = fixed &point.x // note, fixed is a keyword and would be highlighted NativePtr.get p1 0 + NativePtr.get p1 1 - -let pinRef() = + +let pinRef() = let point = ref 17 use p1 = fixed &point.contents // note, fixed is a keyword and would be highlighted - NativePtr.read p1 + NativePtr.read p1 - -let pinArray1() = + NativePtr.read p1 + NativePtr.read p1 + +let pinArray1() = let arr = [| 0.0; 1.5; 2.3; 3.4; 4.1; 5.9 |] use p1 = fixed arr NativePtr.get p1 0 + NativePtr.get p1 1 -let pinArray2() = +let pinArray2() = let arr = [| 0.0; 1.5; 2.3; 3.4; 4.1; 5.9 |] - // You can initialize a pointer by using the address of a variable. + // You can initialize a pointer by using the address of a variable. use p = fixed &arr.[0] NativePtr.get p 0 + NativePtr.get p 1 -let pinString() = +let pinString() = let str = "Hello World" // The following assignment initializes p by using a string. use pChar = fixed str diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/StackOverflowRepro.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/StackOverflowRepro.fs index 22f501c4f85..d4b84a3d855 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/StackOverflowRepro.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/StackOverflowRepro.fs @@ -16,7 +16,7 @@ let rec viaActivePattern (a:int) = else viaActivePattern (a - 1) with - | RecoverableException e -> + | RecoverableException e -> let x = struct(a,a,a,a) let y = struct(x,a,x) y.GetHashCode() + e.GetHashCode() @@ -26,9 +26,9 @@ let rec viaActivePattern (a:int) = [] let main (args:string[]) = let iterations = 4096 - try + try viaActivePattern iterations with - | ex -> + | ex -> printf "%s" (ex.GetType().ToString()) 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryCatch.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryCatch.fs index e0841a64ff4..b2f90a8df5a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryCatch.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryCatch.fs @@ -7,7 +7,7 @@ open System.IO module TryCatch = - let setupCompilation compilation = + let setupCompilation compilation = compilation |> withOptions [ "--test:EmitFeeFeeAs100001" ] |> withNoWarn 75 //The command-line option '--generate-filter-blocks' has been deprecated diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs index f01f31797de..d46ef824d55 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs @@ -9,7 +9,7 @@ module ``TupleElimination`` = let compile cu = - cu + cu |> withCheckNulls |> compile @@ -174,7 +174,7 @@ public static int x() int num = TupleElimination.f(); now = DateTime.Now; return 2 + num; -} +} *) """ .method public static int32 x() cil managed @@ -784,7 +784,7 @@ let testFunction(a,b) = |> shouldSucceed |> verifyIL [ - // Checks the names of captured 'x' and 'y'. + // Checks the names of captured 'x' and 'y'. """ .method public strict virtual instance int32 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs index c150c1b81a1..4ca6475ac84 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs @@ -1,9 +1,9 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples type A() = class end // A code+optimization pattern, see https://github.com/dotnet/fsharp/issues/6532 -type C() = - static member inline F (?x1: A, ?x2: A) = +type C() = + static member inline F (?x1: A, ?x2: A) = let count = 0 let count = match x1 with None -> count | Some _ -> count + 1 let count = match x2 with None -> count | Some _ -> count + 1 @@ -15,7 +15,7 @@ type C() = //Expect rough equivalent of: // let d = ResizeArray<_>(0) // d -let test() = +let test() = C.F () //Expect rough equivalent of: @@ -23,7 +23,7 @@ let test() = // let d = ResizeArray<_>(1) // d.Add(x1) // d -let test2() = +let test2() = C.F (x1=A()) //Expect rough equivalent of: @@ -31,7 +31,7 @@ let test2() = // let d = ResizeArray<_>(1) // d.Add(x2) // d -let test3() = +let test3() = C.F (x2=A()) //Expect rough equivalent of: @@ -41,6 +41,6 @@ let test3() = // d.Add(x1) // d.Add(x2) // d -let test4() = +let test4() = C.F (x1=A(), x2=A()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs index d63f86e5f57..3bc4ebc781a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs index 1d758ebc791..35974d93448 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 1,2 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs index 1118dfe5028..06ffd7766c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 1,2,3 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs index 6a221dd9fb5..2f164e360a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 1,2,3,4 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs index 1793b576f84..1702d136e41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 1,2,3,4,5 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs index 07984ffb364..93e4c264718 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 1,2,3,4,5,6 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs index c8ae0d84ac7..413245d2c69 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 1,2,3,4,5,6,7 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs index 44b0db06038..55c6e00590e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 1,2,3,4,5,6,7,8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs index 741a8422343..e2ed4183522 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs @@ -15,7 +15,7 @@ let main argv = p b p l - let tt : bool*int64 = t + let tt : bool*int64 = t // Tests that a Tuple is created as needed when calling p p tt diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs index 0a82a63e403..52d5fce17ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs @@ -1,3 +1,3 @@ -// #NoMono #NoMT #CodeGen #EmittedIL #Tuples +// #NoMono #NoMT #CodeGen #EmittedIL #Tuples let _ = 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison.fs index 1097b688029..74c1e80f6c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison.fs @@ -1,4 +1,4 @@ -// #NoMono #NoMT #CodeGen #EmittedIL +// #NoMono #NoMT #CodeGen #EmittedIL // Validate we emit non-generic (=fast) code for comparison involving decimals // See DevDiv:217807 (1.0M < 2.0M should be fast, not go through generic comparison code path) let _ = 1.0M < 2.0M diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs index 6102441a113..b4ade6a5d2f 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs @@ -122,7 +122,7 @@ type X() = (Error 512, Line 4, Col 13, Line 4, Col 18, "Accessibility modifiers are not permitted on 'do' bindings, but 'Private' was given.") (Error 222, Line 2, Col 1, Line 3, Col 1, "Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration.") ] - + [] let ``No abstract or interface member was found that corresponds to this override with lang preview``() = Fsx """ @@ -156,7 +156,7 @@ type C() = (Error 855, Line 19, Col 19, Line 19, Col 21, "No abstract or interface member was found that corresponds to this override") (Error 855, Line 20, Col 19, Line 20, Col 21, "No abstract or interface member was found that corresponds to this override") ] - + [] let ``No abstract or interface member was found that corresponds to this override with lang version70``() = Fsx """ @@ -190,7 +190,7 @@ type C() = (Error 855, Line 19, Col 19, Line 19, Col 21, "No abstract or interface member was found that corresponds to this override") (Error 855, Line 20, Col 19, Line 20, Col 21, "No abstract or interface member was found that corresponds to this override") ] - + [] let ``Virtual member was found that corresponds to this override with lang version70`` () = let CSLib = @@ -219,7 +219,7 @@ type B() = |> withLangVersionPreview |> compile |> shouldSucceed - + [] let ``Virtual member was found that corresponds to this override with lang preview`` () = let CSLib = @@ -311,7 +311,7 @@ type B() = |> withDiagnostics [ (Error 855, Line 7, Col 19, Line 7, Col 21, "No abstract or interface member was found that corresponds to this override") ] - + [] let ``Virtual member was not found that corresponds to this override nested base class with lang version preview`` () = let CSLib = @@ -353,7 +353,7 @@ type C() = (Error 855, Line 7, Col 19, Line 7, Col 21, "No abstract or interface member was found that corresponds to this override") (Error 855, Line 8, Col 19, Line 8, Col 21, "No abstract or interface member was found that corresponds to this override") ] - + [] let ``Virtual member was not found that corresponds to this override nested 2 base class with lang preview`` () = let CSLib = @@ -393,7 +393,7 @@ type C() = (Error 855, Line 7, Col 19, Line 7, Col 21, "No abstract or interface member was found that corresponds to this override") (Error 855, Line 8, Col 19, Line 8, Col 21, "No abstract or interface member was found that corresponds to this override") ] - + [] let ``Virtual member was not found that corresponds to this override nested 2 base classes and mixed methods with lang preview`` () = let CSLib = @@ -546,7 +546,7 @@ type Over () = override _.M1 (s: string) = () """ - + app |> withReferences [CSLib] |> withLangVersion80 @@ -613,7 +613,7 @@ type X = |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``No separator between member and type annotation`` () = FSharp """ @@ -622,7 +622,7 @@ type X = """ |> typecheck |> shouldSucceed - + [] let ``Separator between member and type annotation`` () = FSharp """ @@ -655,7 +655,7 @@ type FooImpl = (Error 3133, Line 9, Col 9, Line 9, Col 40, "'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'."); (Error 3133, Line 10, Col 9, Line 10, Col 40, "'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'.") ] - + [] let ``No error if we try to have auto properties on types with primary constructor`` () = Fsx """ @@ -674,7 +674,7 @@ type FooImpl() = """ |> typecheck |> shouldSucceed - + [] let ``No error if we try to have auto properties on types with primary constructor with args`` () = Fsx """ @@ -692,7 +692,7 @@ type FooImpl(x) = and set(value) = () """ |> typecheck - |> shouldSucceed + |> shouldSucceed [] let ``No error if we try to have static autoprop on a type without constructor`` () = @@ -709,7 +709,7 @@ type FooImpl = """ |> typecheck |> shouldSucceed - + [] let ``Error when declaring abstract members on a class, No [] or default implementation`` () = Fsx """ @@ -722,7 +722,7 @@ type A() = (Error 365, Line 2, Col 6, Line 2, Col 7, "No implementation was given for 'abstract A.M: unit -> unit'") (Error 54, Line 2, Col 6, Line 2, Col 7, "Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[]' attribute to your type.") ] - + [] let ``Not error when declaring abstract members on a class with [] attribute.`` () = Fsx """ @@ -742,7 +742,7 @@ type A() = """ |> typecheck |> shouldSucceed - + [] let ``This 'inherit' declaration specifies the inherited type but no arguments. Consider supplying arguments, e. g. 'inherit BaseType(args)'`` () = Fsx """ @@ -757,7 +757,7 @@ type Class() = (Error 961, Line 5, Col 5, Line 5, Col 12, "This 'inherit' declaration specifies the inherited type but no arguments. Consider supplying arguments, e.g. 'inherit BaseType(args)'.") (Error 946, Line 5, Col 13, Line 5, Col 15, "Cannot inherit from interface type. Use interface ... with instead.") ] - + [] let ``This 'inherit' declaration specifies the inherited type but no arguments. Type name cannot be empty.`` () = Fsx """ @@ -788,7 +788,7 @@ type C5 = class inherit System.MulticastDelegate override x.ToString() = "" end (Error 771, Line 5, Col 25, Line 5, Col 40, "The types System.ValueType, System.Enum, System.Delegate, System.MulticastDelegate and System.Array cannot be used as super types in an object expression or class"); (Error 771, Line 6, Col 25, Line 6, Col 49, "The types System.ValueType, System.Enum, System.Delegate, System.MulticastDelegate and System.Array cannot be used as super types in an object expression or class") ] - + [] let ``Types can inherit from a single concrete type`` () = @@ -822,7 +822,7 @@ type Class() = (Error 932, Line 10, Col 13, Line 10, Col 19, "Types cannot inherit from multiple concrete types") (Error 932, Line 11, Col 13, Line 11, Col 19, "Types cannot inherit from multiple concrete types") ] - + [] let ``Types cannot inherit from multiple concrete types. Type name cannot be empty.`` () = Fsx """ @@ -850,7 +850,7 @@ type I = """ |> typecheck |> shouldSucceed - + [] let ``Class inheriting multiple base interfaces`` () = Fsx """ diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs index 7310f83dbd1..ad1cf5924d2 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs @@ -34,7 +34,7 @@ let v = d ["key"] |> shouldFail |> withErrorCode 3217 - + // https://github.com/dotnet/fsharp/issues/13697 [] let ``Issue 13697 - typeof with out of scope type in attribute should report FS0039`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ErrorOnInvalidDeclsInTypeDefinitions.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ErrorOnInvalidDeclsInTypeDefinitions.fs index a9ea57ad5b7..d55ec5071c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ErrorOnInvalidDeclsInTypeDefinitions.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ErrorOnInvalidDeclsInTypeDefinitions.fs @@ -22,7 +22,7 @@ type IFace = |> withDiagnostics [ (Error 58, Line 6, Col 5, Line 6, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") ] - + [] let ``Version10: Error when module is inside interface verbose syntax``() = Fsx """ @@ -43,7 +43,7 @@ type IFace = (Error 10, Line 7, Col 9, Line 7, Col 15, "Unexpected keyword 'module' in member definition"); (Error 10, Line 9, Col 5, Line 9, Col 8, "Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token.") ] - + [] let ``Error when module is inside interface verbose syntax``() = Fsx """ @@ -64,7 +64,7 @@ type IFace = (Error 10, Line 7, Col 9, Line 7, Col 15, "Unexpected keyword 'module' in member definition"); (Error 10, Line 9, Col 5, Line 9, Col 8, "Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token.") ] - + [] let ``No Error when module is inside interface``() = Fsx """ @@ -96,7 +96,7 @@ type C () = |> withDiagnostics [ (Error 58, Line 6, Col 5, Line 6, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") ] - + [] let ``No Error when module is inside class``() = Fsx """ @@ -110,7 +110,7 @@ type C () = |> withLangVersion90 |> typecheck |> shouldSucceed - + module ``Module inside class with constructor`` = [] @@ -197,7 +197,7 @@ type R = |> withDiagnostics [ (Error 58, Line 6, Col 5, Line 6, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") ] - + [] let ``No Error when module is inside record``() = Fsx """ @@ -231,7 +231,7 @@ type MyStruct = |> withDiagnostics [ (Error 58, Line 8, Col 5, Line 8, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") ] - + [] let ``No Error when module is inside struct``() = Fsx """ @@ -264,7 +264,7 @@ type MyDelegate = delegate of int * int -> int |> withDiagnostics [ (Error 58, Line 5, Col 5, Line 5, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") ] - + [] let ``No Error when module appears after delegate``() = Fsx """ @@ -332,7 +332,7 @@ type ClassWithStatic() = |> withDiagnostics [ (Error 58, Line 7, Col 5, Line 7, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") ] - + [] let ``No Error when module appears after static members``() = Fsx """ @@ -364,7 +364,7 @@ type A = (Error 58, Line 6, Col 5, Line 6, Col 14, "Exceptions must be defined at module level, not inside types."); (Error 10, Line 6, Col 5, Line 6, Col 14, "Unexpected keyword 'exception' in member definition") ] - + [] let ``No Error when exception is inside type``() = Fsx """ @@ -380,7 +380,7 @@ type A = |> withDiagnostics [ (Error 10, Line 6, Col 5, Line 6, Col 14, "Unexpected keyword 'exception' in member definition") ] - + module ``Open inside type`` = [] let ``Error when open declaration is inside type``() = @@ -398,7 +398,7 @@ type A = (Error 58, Line 6, Col 5, Line 6, Col 9, "'open' declarations must appear at module level, not inside types.") (Error 10, Line 6, Col 5, Line 6, Col 9, "Unexpected keyword 'open' in member definition") ] - + [] let ``No Error when open declaration is inside type``() = Fsx """ @@ -414,7 +414,7 @@ type A = |> withDiagnostics [ (Error 10, Line 6, Col 5, Line 6, Col 9, "Unexpected keyword 'open' in member definition") ] - + module ``Type inside type`` = [] let ``Error when type is nested inside another type``() = @@ -432,7 +432,7 @@ type OuterType = |> withDiagnostics [ (Error 58, Line 7, Col 5, Line 7, Col 9, "Nested type definitions are not allowed. Types must be defined at module or namespace level.") ] - + [] let ``No Error when type is nested inside another type``() = Fsx """ @@ -446,7 +446,7 @@ type OuterType = |> withLangVersion90 |> typecheck |> shouldSucceed - + module ``Multiple invalid constructs`` = [] let ``Error for all invalid nested constructs in single type``() = @@ -470,7 +470,7 @@ type MultiTest = (Error 58, Line 9, Col 5, Line 9, Col 14, "Exceptions must be defined at module level, not inside types.") (Error 58, Line 10, Col 5, Line 10, Col 9, "'open' declarations must appear at module level, not inside types.") ] - + [] let ``No Error for all invalid nested constructs in single type``() = Fsx """ @@ -508,7 +508,7 @@ type B = (Error 58, Line 7, Col 5, Line 7, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") (Error 58, Line 8, Col 5, Line 8, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") ] - + [] let ``No Error for each module inside type``() = Fsx """ @@ -523,7 +523,7 @@ type B = |> withLangVersion90 |> typecheck |> shouldSucceed - + module ``Deeply nested invalid constructs`` = [] let ``Error for invalid constructs in deeply nested context``() = @@ -548,7 +548,7 @@ module InnerModule = (Error 58, Line 10, Col 13, Line 10, Col 19, "Modules cannot be nested inside types. Define modules at module or namespace level.") (Error 58, Line 12, Col 13, Line 12, Col 22, "Exceptions must be defined at module level, not inside types.") ] - + [] let ``No Error for invalid constructs in deeply nested context``() = Fsx """ @@ -567,7 +567,7 @@ module InnerModule = |> withLangVersion90 |> typecheck |> shouldSucceed - + module ``Abstract class with invalid constructs`` = [] let ``Error for invalid constructs in abstract class``() = @@ -587,7 +587,7 @@ type AbstractBase() = (Error 58, Line 7, Col 5, Line 7, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") (Error 58, Line 8, Col 5, Line 8, Col 9, "Nested type definitions are not allowed. Types must be defined at module or namespace level.") ] - + [] let ``No Error for invalid constructs in abstract class``() = Fsx """ @@ -602,7 +602,7 @@ type AbstractBase() = |> withLangVersion90 |> typecheck |> shouldSucceed - + module ``Type augmentation with invalid constructs`` = [] let ``Error for module in type augmentation``() = @@ -624,7 +624,7 @@ type Original with (Error 10, Line 8, Col 5, Line 8, Col 11, "Unexpected keyword 'module' in type definition. Expected incomplete structured construct at or before this point, 'end' or other token.") (Error 10, Line 10, Col 1, Line 10, Col 13, "Incomplete structured construct at or before this point in implementation file") ] - + [] let ``No Error for module in type augmentation``() = Fsx """ @@ -644,7 +644,7 @@ type Original with (Error 10, Line 8, Col 5, Line 8, Col 11, "Unexpected keyword 'module' in type definition. Expected incomplete structured construct at or before this point, 'end' or other token."); (Error 10, Line 10, Col 1, Line 10, Col 13, "Incomplete structured construct at or before this point in implementation file") ] - + module ``Do binding with invalid constructs`` = [] let ``Error for invalid constructs after do binding``() = @@ -665,8 +665,8 @@ type TypeWithDo() = (Error 58, Line 7, Col 5, Line 7, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") (Error 58, Line 8, Col 5, Line 8, Col 9, "'open' declarations must appear at module level, not inside types.") ] - - + + [] let ``No Error for invalid constructs after do binding``() = Fsx """ @@ -681,7 +681,7 @@ type TypeWithDo() = |> withLangVersion90 |> typecheck |> shouldSucceed - + module ``Inherit with invalid constructs`` = [] let ``Error for invalid constructs after inherit``() = @@ -700,7 +700,7 @@ type Derived() = |> withDiagnostics [ (Error 58, Line 8, Col 5, Line 8, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.") ] - + [] let ``No Error for invalid constructs after inherit``() = Fsx """ @@ -715,7 +715,7 @@ type Derived() = |> withLangVersion90 |> typecheck |> shouldSucceed - + module ``Valid module placement`` = [] let ``No Error for modules at correct level``() = @@ -735,7 +735,7 @@ module ValidModule3 = |> withLangVersion10 |> typecheck |> shouldSucceed - + [] let ``No Error for modules at correct level 2``() = Fsx """ @@ -768,7 +768,7 @@ type ClassWithLet() = |> withLangVersion10 |> typecheck |> shouldSucceed - + [] let ``No Error for let bindings inside class 2``() = Fsx """ @@ -794,7 +794,7 @@ module B = begin end // Same column as type, not nested |> withLangVersion10 |> typecheck |> shouldSucceed - + [] let ``No Error for modules at same indentation as type 2``() = Fsx """ diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ExtendedDiagnosticDataTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ExtendedDiagnosticDataTests.fs index 5d86b6883c7..827eeaa8212 100755 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ExtendedDiagnosticDataTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ExtendedDiagnosticDataTests.fs @@ -27,7 +27,7 @@ let inline checkDiagnosticData | _ -> failwith "Expected diagnostic extended data not found" checkResults - + let inline checkExpectedActualTypesInContext diagnosticNumber expectedType actualType @@ -233,7 +233,7 @@ let y: unit -> string = x "string -> string" "Type mismatch. Expecting a\n 'unit -> string' \nbut given a\n 'string -> string' \nThe type 'string' does not match the type 'unit'" -[] +[] [] [] let ``ArgumentsInSigAndImplMismatchExtendedData 01`` useTransparentCompiler = @@ -363,7 +363,7 @@ let x = MyClass() (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(Some "FS222", obsoleteDiagnostic.DiagnosticId) Assert.Equal(None, obsoleteDiagnostic.UrlFormat)) - + [] let ``Warning - ObsoleteDiagnosticExtendedData 03`` () = FSharp """ @@ -379,7 +379,7 @@ let x = MyClass() (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(None, obsoleteDiagnostic.DiagnosticId) Assert.Equal(None, obsoleteDiagnostic.UrlFormat)) - + [] let ``Warning - ObsoleteDiagnosticExtendedData 04`` () = FSharp """ @@ -395,8 +395,8 @@ let x = MyClass() (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(Some "FS222", obsoleteDiagnostic.DiagnosticId) Assert.Equal(Some "https://example.com", obsoleteDiagnostic.UrlFormat)) - - + + [] let ``Warning - ObsoleteDiagnosticExtendedData 05`` () = let CSLib = @@ -427,7 +427,7 @@ let text = Class1.Test(); (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(Some "FS222", obsoleteDiagnostic.DiagnosticId) Assert.Equal(None, obsoleteDiagnostic.UrlFormat)) - + [] let ``Warning - ObsoleteDiagnosticExtendedData 06`` () = let CSLib = @@ -458,7 +458,7 @@ let text = Class1.Test(); (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(Some "FS222", obsoleteDiagnostic.DiagnosticId) Assert.Equal(Some "https://example.com", obsoleteDiagnostic.UrlFormat)) - + [] let ``Warning - ObsoleteDiagnosticExtendedData 07`` () = let CSLib = @@ -489,7 +489,7 @@ let text = Class1.Test(); (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(None, obsoleteDiagnostic.DiagnosticId) Assert.Equal(None, obsoleteDiagnostic.UrlFormat)) - + [] let ``Warning - ObsoleteDiagnosticExtendedData 08`` () = let CSLib = @@ -520,7 +520,7 @@ let text = Class1.Test(); (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(Some "FS222", obsoleteDiagnostic.DiagnosticId) Assert.Equal(Some "https://example.com", obsoleteDiagnostic.UrlFormat)) - + [] let ``Warning - ObsoleteDiagnosticExtendedData 09`` () = FSharp """ @@ -583,7 +583,7 @@ let x = MyClass() (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(Some "FS222", obsoleteDiagnostic.DiagnosticId) Assert.Equal(Some "https://example.com", obsoleteDiagnostic.UrlFormat)) - + [] let ``Error - ObsoleteDiagnosticExtendedData 02`` () = FSharp """ @@ -599,7 +599,7 @@ let x = MyClass() (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(Some "FS222", obsoleteDiagnostic.DiagnosticId) Assert.Equal(None, obsoleteDiagnostic.UrlFormat)) - + [] let ``Error - ObsoleteDiagnosticExtendedData 03`` () = FSharp """ @@ -615,7 +615,7 @@ let x = MyClass() (fun (obsoleteDiagnostic: ObsoleteDiagnosticExtendedData) -> Assert.Equal(None, obsoleteDiagnostic.DiagnosticId) Assert.Equal(None, obsoleteDiagnostic.UrlFormat)) - + [] let ``Error - ObsoleteDiagnosticExtendedData 04`` () = FSharp """ @@ -663,8 +663,8 @@ let text = Class1.Test(); (fun (experimental: ExperimentalExtendedData) -> Assert.Equal(Some "FS222", experimental.DiagnosticId) Assert.Equal(None, experimental.UrlFormat)) - - + + [] let ``Warning - ExperimentalExtendedData 02`` () = let CSLib = @@ -696,7 +696,7 @@ let text = Class1.Test(); (fun (experimental: ExperimentalExtendedData) -> Assert.Equal(Some "FS222", experimental.DiagnosticId) Assert.Equal(Some "https://example.com", experimental.UrlFormat)) - + [] let ``Warning - ExperimentalExtendedData 03`` () = FSharp """ diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs index 489beba45c9..d68adf44fac 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs @@ -119,8 +119,8 @@ namespace OuterRec.InnerNonRec |> withSingleDiagnostic (Warning 69, Line 9, Col 19, Line 9, Col 37, """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.""") - - + + [] let ``Type in non-rec ns should give a warning when augmented externally even when the same file has a recursive (but different) ns``() = FSharp """ @@ -151,4 +151,3 @@ type System.Random with |> withSingleDiagnostic (Error 909, Line 3, Col 15, Line 3, Col 33, """All implemented interfaces should be declared on the initial declaration of the type""") - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleTests.fs index 4774c84d8bd..ff85ad6d9e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleTests.fs @@ -23,7 +23,7 @@ module Modules = |> shouldFail |> withSingleDiagnostic (Error 536, Line 1, Col 1, Line 1, Col 7, "The 'Private' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private.") - + [] let ``Internal Module Abbreviation``() = FSharp "module internal L1 = List" @@ -46,7 +46,7 @@ module Modules = |> shouldFail |> withSingleDiagnostic (Error 535, Line 1, Col 1, Line 1, Col 32, "Ignoring attributes on module abbreviation") - + [] let ``Right Attribute Module Abbreviation``() = FSharp """module [] L1 = List""" @@ -54,7 +54,7 @@ module Modules = |> shouldFail |> withSingleDiagnostic (Error 535, Line 1, Col 1, Line 1, Col 35, "Ignoring attributes on module abbreviation") - + [] let ``Right Attribute Module Abbreviation with version 5_0 (compile)``() = FSharp """module [] L1 = List""" @@ -65,7 +65,7 @@ module Modules = Error 535, Line 1, Col 1, Line 1, Col 35, "Ignoring attributes on module abbreviation" Error 222, Line 1, Col 1, Line 1, Col 42, "Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration." ] - + [] let ``Attribute Module Abbreviation``() = FSharp """[] module [] internal L1 = List""" @@ -73,7 +73,7 @@ module Modules = |> shouldFail |> withSingleDiagnostic (Error 535, Line 1, Col 1, Line 1, Col 32, "Ignoring attributes on module abbreviation") - + [] let ``Attributes applied successfully``() = Fsx """ @@ -167,7 +167,7 @@ match typeof.DeclaringType.GetCustomAttributes false with """ |> compileExeAndRun |> shouldSucceed - + [] let ``Offside rule works for attributes inside module declarations``() = Fsx """ diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NameIsBoundMultipleTimesTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NameIsBoundMultipleTimesTests.fs index fe8887737c3..9a0be32e7f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NameIsBoundMultipleTimesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NameIsBoundMultipleTimesTests.fs @@ -16,7 +16,7 @@ let f1 a a = () |> withDiagnostics [ (Error 38, Line 2, Col 10, Line 2, Col 11, "'a' is bound twice in this pattern") ] - + [] let ``Name is bound multiple times is reported in 'as' pattern 1``() = Fsx """ @@ -27,7 +27,7 @@ let f2 (a, b as c) c = () |> withDiagnostics [ (Error 38, Line 2, Col 20, Line 2, Col 21, "'c' is bound twice in this pattern") ] - + [] let ``Name is bound multiple times is reported in 'as' pattern 2``() = Fsx """ @@ -39,7 +39,7 @@ let f4 (a, b, c as d) a c = () (Error 38, Line 2, Col 23, Line 2, Col 24, "'a' is bound twice in this pattern") (Error 38, Line 2, Col 25, Line 2, Col 26, "'c' is bound twice in this pattern") ] - + [] let ``Name is bound multiple times is reported in 'as' pattern 3``() = Fsx """ @@ -51,7 +51,7 @@ let f5 (a, b, c as d) a d = () (Error 38, Line 2, Col 23, Line 2, Col 24, "'a' is bound twice in this pattern"); (Error 38, Line 2, Col 25, Line 2, Col 26, "'d' is bound twice in this pattern") ] - + [] let ``Name is bound multiple times is reported 2`` () = Fsx """ @@ -199,7 +199,7 @@ let f7 (a, b as unitVar) unitVar = () (Error 38, Line 7, Col 26, Line 7, Col 33, "'unitVar' is bound twice in this pattern") (Error 38, Line 8, Col 26, Line 8, Col 33, "'unitVar' is bound twice in this pattern") ] - + [] let ``Name is bound multiple times in lambdas with 'as' across groups; unitVar vs () not conflated`` () = Fsx """ diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NameResolutionTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NameResolutionTests.fs index a1175f09b0d..470178ef44a 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NameResolutionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NameResolutionTests.fs @@ -202,7 +202,7 @@ module Lib = let x = thing.Name thing.City """ - + [] let MultipleRecdTypeChoiceWarningNotRaisedWithoutOverlapsLangPreview () = FSharp multipleRecdTypeChoiceWarningNotRaisedWithoutOverlapsSource @@ -244,7 +244,7 @@ module Lib = let x = thing.Name thing.City """ - + [] let MultipleRecdTypeChoiceWarningNotRaisedWithTypeAnnotationsLangPreview () = FSharp multipleRecdTypeChoiceWarningNotRaisedWithTypeAnnotationsSource diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs index d948c545dd6..f492c89c0f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs @@ -62,7 +62,7 @@ namespace N Message = "The member or function 'fact' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn successfully for rec call in binding`` () = """ @@ -81,7 +81,7 @@ namespace N r + 23 """ |> FSharp - |> withLangVersion80 + |> withLangVersion80 |> compile |> shouldFail |> withResults [ @@ -510,7 +510,7 @@ namespace N Message = "The member or function 'f' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Don't warn for valid tailcalls in rec module`` () = """ @@ -574,7 +574,7 @@ namespace N Message = "The member or function 'm2func' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn for byref parameters`` () = """ @@ -599,7 +599,7 @@ namespace N Message = "The member or function 'foo' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Don't warn for yield! in tail position`` () = """ @@ -642,7 +642,7 @@ namespace N |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Warn for calls in for and iter`` () = """ @@ -829,7 +829,7 @@ namespace N |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Warn for ColonColon with inner let-bound value to rec call`` () = """ @@ -859,7 +859,7 @@ namespace N Message = "The member or function 'addOne' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn for ColonColon with rec call`` () = """ @@ -1081,7 +1081,7 @@ namespace N Message = "The member or function 'gTryFinallyMatch' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn for rec call in if-else branch in try-with`` () = """ @@ -1112,7 +1112,7 @@ namespace N Message = "The member or function 'gTryWithIfElse' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn for rec call in match branch in try-with`` () = """ @@ -1173,7 +1173,7 @@ namespace N Message = "The member or function 'gWithRecCallInWith' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn for rec call in finally`` () = """ @@ -1204,7 +1204,7 @@ namespace N Message = "The member or function 'gWithRecCallInFinally' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn for rec call inside of match lambda with closure over local function`` () = """ @@ -1234,7 +1234,7 @@ namespace N Message = "The member or function 'f' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn for rec call inside of match lambda with closure over local function using pipe`` () = """ @@ -1291,7 +1291,7 @@ namespace N |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Don't warn for Continuation Passing Style func not using [] func in continuation lambda`` () = """ @@ -1318,7 +1318,7 @@ namespace N |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Don't warn for Continuation Passing Style func using [] func in continuation lambda 2`` () = """ @@ -1350,7 +1350,7 @@ namespace N |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Don't warn for Continuation Passing Style func using [] func in list of continuations`` () = """ @@ -1387,7 +1387,7 @@ namespace N |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Don't warn for Continuation Passing Style func using [] func in object interface expression`` () = """ @@ -1467,7 +1467,7 @@ namespace N |> withDiagnostics [ (Warning 842, Line 6, Col 11, Line 6, Col 19, "This attribute cannot be applied to property, field, return value. Valid targets are: method") (Warning 3861, Line 7, Col 13, Line 7, Col 18, "The TailCall attribute should only be applied to recursive functions.") - ] + ] [] let ``Error about attribute on recursive let-bound value`` () = @@ -1789,7 +1789,7 @@ module M = Message = "The member or function 'fooArray' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] - + [] let ``Warn successfully in Seq-mapped recursive call`` () = """ diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeEqualsMissingTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeEqualsMissingTests.fs index e0eb2e11b74..2b1139e7309 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeEqualsMissingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeEqualsMissingTests.fs @@ -16,6 +16,6 @@ open FSharp.Compiler.Diagnostics // type X | A | B // """ // FSharpDiagnosticSeverity.Error -// 10 +// 10 // (2, 8, 2, 9) // "Unexpected symbol '|' in type definition. Expected '=' or other token." diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs index 1afda49d5a0..9807200800f 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs @@ -18,7 +18,7 @@ let myVal = match x with | B -> 42""" |> typecheck - |> shouldFail + |> 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 @@ -37,7 +37,7 @@ let myVal = match x with | B (field = x; field = z) -> let y = x + z + 1 in ()""" |> typecheck - |> shouldFail + |> shouldFail |> withSingleDiagnostic (Error 3175, Line 8, Col 21, Line 8, Col 26, "Union case/exception field 'field' cannot be used more than once.") [] @@ -52,7 +52,7 @@ let myVal = match x with | B x z -> let y = x + z + 1 in ()""" |> typecheck - |> shouldFail + |> 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") @@ -70,10 +70,10 @@ let myVal = | A -> 15 | B (x, _) -> 16""" |> typecheck - |> shouldFail + |> 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") - + [] let ``Union Pattern discard not allowed for union case that takes no data with Lang preview`` () = FSharp """ @@ -89,7 +89,7 @@ let myVal = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") - + [] let ``Union Pattern discard allowed for union case that takes no data with Lang version preview`` () = FSharp """ @@ -105,7 +105,7 @@ let myVal = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") - + [] let ``Union function Pattern discard allowed for union case that takes no data with Lang version preview`` () = FSharp """ @@ -121,7 +121,7 @@ let myVal = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") - + [] let ``Union function Pattern discard not allowed for union case that takes no data with Lang version preview`` () = FSharp """ @@ -137,7 +137,7 @@ let myVal = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") - + [] let ``Pattern discard not allowed for union case that takes no data with Lang preview`` () = FSharp """ @@ -179,7 +179,7 @@ let myVal = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") - + [] let ``Pattern discard allowed for union case that takes no data with Lang version preview`` () = FSharp """ @@ -200,7 +200,7 @@ let myVal = |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") - + [] let ``Grouped Pattern discard not allowed for union case that takes no data with Lang preview`` () = FSharp """ @@ -249,7 +249,7 @@ let myVal = (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") ] - + [] let ``Multiple pattern discards not allowed for union case that takes no data with Lang preview2`` () = FSharp """ @@ -277,7 +277,7 @@ let myVal = (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") ] - + [] let ``Multiple function pattern discards is not allowed for union case that takes no data with Lang preview`` () = FSharp """ @@ -305,7 +305,7 @@ let myVal = (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") ] - + [] let ``Multiple function pattern discards is not allowed for union case that takes no data with Lang preview2`` () = FSharp """ @@ -334,7 +334,7 @@ let myVal = (Warning 3548, Line 17, Col 7, Line 17, Col 10, "Pattern discard is not allowed for union case that takes no data.") (Warning 3548, Line 18, Col 20, Line 18, Col 23, "Pattern discard is not allowed for union case that takes no data.") ] - + [] let ``Pattern named not allowed union case does not take any arguments with Lang preview`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs index d7a5fc860ca..8e4659dd39b 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs @@ -13,13 +13,13 @@ open FSharp.Test.ProjectGeneration.Helpers type Occurrence = Definition | InType | Use let deriveOccurrence (su:FSharpSymbolUse) = - if su.IsFromDefinition + if su.IsFromDefinition then Definition elif su.IsFromType then InType elif su.IsFromUse then Use - else failwith $"Unexpected type of occurrence (for this test), symbolUse = {su}" + else failwith $"Unexpected type of occurrence (for this test), symbolUse = {su}" // ============================================================================= // Test Helpers - Reduce boilerplate in single-file find-references tests @@ -97,12 +97,12 @@ let createProject() = SyntheticProject.Create(impFile()) [] let ``Finding usage of type via GetUsesOfSymbolInFile should also find it's constructors`` () = createProject().Workflow - { + { checkFile "First" (fun (typeCheckResult: FSharpCheckFileResults) -> - + let symbolUse = typeCheckResult.GetSymbolUseAtLocation(7, 11, "type MyType() =", ["MyType"]).Value - let references = - typeCheckResult.GetUsesOfSymbolInFile(symbolUse.Symbol) + let references = + typeCheckResult.GetUsesOfSymbolInFile(symbolUse.Symbol) |> Array.sortBy (fun su -> su.Range.StartLine) |> Array.map (fun su -> su.Range.StartLine, su.Range.StartColumn, su.Range.EndColumn, deriveOccurrence su) @@ -111,7 +111,7 @@ let ``Finding usage of type via GetUsesOfSymbolInFile should also find it's cons 8,25,31,InType 10,8,14,Use 11,12,18,Use - |],references) ) + |],references) ) } @@ -662,8 +662,8 @@ type internal SomeType() = (this :> IInterface1).Property1 """ - SyntheticProject.Create( - { sourceFile "First" [] with Source = source1 }, + SyntheticProject.Create( + { sourceFile "First" [] with Source = source1 }, { sourceFile "Second" [] with Source = source2 } ) let property1Locations() = [ @@ -882,65 +882,65 @@ let use1 = Thing + 1 ] module OrPatternSymbolResolution = - + /// https://github.com/dotnet/fsharp/issues/5546 /// In SynPat.Or patterns (e.g., | x | x), both bindings were incorrectly marked /// as Binding occurrences. The second (and subsequent) occurrences should be Use. [] let ``Or pattern second binding is classified as Use not Binding`` () = SyntheticProject.Create( - { sourceFile "OrPattern" [] with + { sourceFile "OrPattern" [] with ExtraSource = "let test input = match input with | x | x -> x" }) - .Workflow { + .Workflow { checkFile "OrPattern" (fun (typeCheckResult: FSharpCheckFileResults) -> // Get all symbol uses for the variable 'x' let allSymbols = typeCheckResult.GetAllUsesOfAllSymbolsInFile() - + // Find the uses of 'x' in the pattern - let xUses = - allSymbols + let xUses = + allSymbols |> Seq.filter (fun su -> su.Symbol.DisplayName = "x") |> Seq.sortBy (fun su -> su.Range.StartLine, su.Range.StartColumn) |> Seq.toArray - + // Should have 3 occurrences: first binding (Def), second binding (Use), and usage in body (Use) Assert.True(xUses.Length >= 2, $"Expected at least 2 uses of 'x', got {xUses.Length}") - + // First occurrence should be definition Assert.True(xUses.[0].IsFromDefinition, "First 'x' in Or pattern should be a definition") - + // Second occurrence should be use, not definition (#5546) Assert.True(xUses.[1].IsFromUse, "Second 'x' in Or pattern should be a use, not a definition")) } module EventHandlerSyntheticSymbols = - + /// https://github.com/dotnet/fsharp/issues/4136 /// Events with [] generate synthetic 'handler' values that should not /// appear in GetAllUsesOfAllSymbolsInFile results. [] let ``Event handler synthetic symbols are filtered from references`` () = SyntheticProject.Create( - { sourceFile "EventTest" [] with + { sourceFile "EventTest" [] with ExtraSource = "open System\ntype MyClass() =\n let event = new Event()\n []\n member this.SelectionChanged = event.Publish" }) - .Workflow { + .Workflow { checkFile "EventTest" (fun (typeCheckResult: FSharpCheckFileResults) -> let allSymbols = typeCheckResult.GetAllUsesOfAllSymbolsInFile() - + // Check that no synthetic 'handler' values are exposed - let handlerUses = - allSymbols + let handlerUses = + allSymbols |> Seq.filter (fun su -> su.Symbol.DisplayName = "handler") |> Seq.toArray - + // The synthetic 'handler' argument should be filtered out - Assert.True(handlerUses.Length = 0, + Assert.True(handlerUses.Length = 0, $"Expected no 'handler' symbols (synthetic event handler values should be filtered), got {handlerUses.Length}")) } /// https://github.com/dotnet/fsharp/issues/15290 module RecordCopyAndUpdate = - + [] let ``Find references of record type includes copy-and-update`` () = let source = """ @@ -953,7 +953,7 @@ type R = { M: Model } testFindAllRefs source "Model" (fun ranges -> expectLinesInclude [3; 5; 7] ranges expectMinRefs 3 ranges) - + [] let ``Find references of record type includes copy-and-update with nested fields`` () = let source = """ @@ -966,7 +966,7 @@ let o2 = { o with I.X = 2 } /// https://github.com/dotnet/fsharp/issues/16621 module UnionCaseTesters = - + [] let ``Find references of union case includes tester usage`` () = let source = """ @@ -1033,7 +1033,7 @@ type Shape = /// https://github.com/dotnet/fsharp/issues/14902 module AdditionalConstructors = - + [] let ``Find references of type includes all constructor usages`` () = let source = """ @@ -1060,8 +1060,8 @@ let a = MyClass() let b = MyClass(5) """ checkAllSymbols source (fun _ allUses -> - let additionalCtorDef = - allUses + let additionalCtorDef = + allUses |> Seq.tryFind (fun su -> su.IsFromDefinition && su.Range.StartLine = 4 && su.Range.StartColumn = 4) Assert.True(additionalCtorDef.IsSome, "Should find additional constructor at (4,4)") match additionalCtorDef.Value.Symbol with @@ -1070,7 +1070,7 @@ let b = MyClass(5) | _ -> Assert.Fail("Expected FSharpMemberOrFunctionOrValue")) module ExternalDllOptimization = - + /// Issue #10227: Optimize Find All References for external DLL symbols [] let ``Find references to external DLL symbol works correctly`` () = @@ -1089,7 +1089,7 @@ let copied = System.String.Copy myString let usesInFile = result.GetUsesOfSymbolInFile(symbol) Assert.True(usesInFile.Length >= 2, $"Expected at least 2 uses, found {usesInFile.Length}")) } - + [] let ``External symbol has assembly information`` () = let source = """ @@ -1147,7 +1147,7 @@ let arr = [| "a"; "b"; "c" |] let first = arr.First() """ checkAllSymbols source (fun _ allUses -> - let firstUses = + let firstUses = allUses |> Seq.filter (fun su -> su.Symbol.DisplayName = "First") |> Seq.toArray @@ -1160,7 +1160,7 @@ let first = arr.First() /// https://github.com/dotnet/fsharp/issues/5545 module SAFEBookstoreSymbols = - + [] let ``Find references of DU type inside module finds all usages in same file`` () = let source = """ @@ -1185,7 +1185,7 @@ let handleMsg (m: WishlistMsg) = expectLinesInclude [7; 11] ranges // Type def + at least one usage expectMinRefs 3 ranges) } - + [] let ``Find references of DU type in database pattern`` () = let source = """ diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/SymbolUse.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/SymbolUse.fs index aa4c8a05266..aa76f22af52 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/SymbolUse.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/SymbolUse.fs @@ -88,7 +88,7 @@ module IsPrivateToFile = // [] This is a bug - https://github.com/dotnet/fsharp/issues/14419 let ``Private function, with signature file`` () = SyntheticProject.Create( - { sourceFile "First" [] with ExtraSource = "let private f3 x = x + 1" } + { sourceFile "First" [] with ExtraSource = "let private f3 x = x + 1" } |> addSignatureFile).Workflow { checkFile "First" (fun (typeCheckResult: FSharpCheckFileResults) -> let symbolUse = typeCheckResult.GetSymbolUseAtLocation(6, 14, "let private f3 x = x + 1", ["f3"]) |> Option.defaultWith (fun () -> failwith "no symbol use found") diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/Arabic.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/Arabic.fs index 2ba71ccfc45..6f3a9be194a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/Arabic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/Arabic.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization module المطبّقة @@ -43,6 +43,6 @@ module المطبّقة ذرزسشص.ابةت(تروني) |> ignore ذرزسش.ابةت(ارالتسج) |> ignore ذرزس.ابةت(تي) |> ignore - + "ؤإئابةتثجحخدذرزسشصضطظع" |> ignore """ؤإئابةتثجحخدذرزسشصضطظع""" diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/HexCharEncode.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/HexCharEncode.fs index b995a62bdfd..a93b258eaf3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/HexCharEncode.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/HexCharEncode.fs @@ -9,11 +9,11 @@ let x1 = x[0] let x2 = x[1] let y1 = y[0] let y2 = y[1] -if (x1 <> y1) then +if (x1 <> y1) then printfn "x1 == y1 => %b" (x1 = y1) raise (new Exception("exit 1")) -if (x2 <> y2) then +if (x2 <> y2) then printfn "x2 == y2 => %b" (x2 = y2) raise (new Exception("exit 2")) diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/Hindi.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/Hindi.fs index f03a2c0a484..31e4f47cd33 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/Hindi.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/Hindi.fs @@ -1,23 +1,23 @@ -// #Globalization +// #Globalization -namespace हताहत +namespace हताहत module पिछले = // Function let फ़ैसला बस = बस + 1 // Enum - type ख़तरनाक = - | अलगाववादी = 1 + type ख़तरनाक = + | अलगाववादी = 1 | मिलती = 2 - + // DU - type ख़तरxनाक = + type ख़तरxनाक = | अलगाववादी // There's no uppercase/lowercase in Hindi, ensure that a Hindi character will suffice to start the DU case name | मिलती of ख़तरनाक | X - + // Record type घोषणा = { अलगाववादी : int; मिलती : ख़तरनाक } let r = { अलगाववादी = 4; मिलती = ख़तरनाक.मिलती } @@ -29,18 +29,18 @@ module पिछले = static member तà¥à¤•ा(में) = में * में end - // ... and corresponding object with method (static/instance) invocation + // ... and corresponding object with method (static/instance) invocation let o = new ततà¥à¤•ालिन() ततà¥à¤•ालिन.तà¥à¤•ा(3) |> ignore o.तà¥à¤•ा() |> ignore - + // Units of measure [] type मिलती [] type k2 = मिलती ^ 2 - - + + // In a string and in a comment let p = (* पिछले *) "पिछले" // पिछले is a comment let p2 = (* पिछले *) """पिछले""" // पिछले is a comment - + diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/Mongolian.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/Mongolian.fs index fa524ab743b..0aebc8d31b7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/Mongolian.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/Mongolian.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization module ᠠᠡᠢᠣᠤᠥᠦᠧᠨᠩ @@ -7,7 +7,7 @@ module ᠠᠡᠢᠣᠤᠥᠦᠧᠨᠩ | Baz of int | Zoo of int | Yap of string - + let ᠪᠫᠬᠭᠮᠯᠰᠱᠲᠳ = ᡦᡧᡨᡩᡪᡫᡬᡭᡮᡯ.Bar(1) @@ -27,7 +27,7 @@ module ᠠᠡᠢᠣᠤᠥᠦᠧᠨᠩ | ᡦᡧᡨᡩᡪᡫᡬᡭᡮᡯ.Baz(_) -> "ᠴᠵᠶᠠᠡᠷᠸᠹᠺᠻᠼᠽ" | ᡦᡧᡨᡩᡪᡫᡬᡭᡮᡯ.Zoo(_) -> "ᠾᠿᡀá¡á¡‚ᡃᡀá¡á¡‚ᡃᡄᡅᡆᡇ" | ᡦᡧᡨᡩᡪᡫᡬᡭᡮᡯ.Yap(_) -> "ᠾᠿᡀá¡á¡‚ᠾᠿᡀá¡á¡‚ᠾᠿᡀá¡á¡‚ᠾᠿᡀá¡á¡‚ᡃᡄᡅᡆᡇᡃᡄᡅᡆᡇ" - + let ᡕᡖᡗᡘᡙᡚᡒᡓᡔᡕᡖᡗᡘᡙᡚᡛ = ᡜá¡á¡žá¡Ÿá¡ á¡¡á¡¢á¡£á¡¤á¡¥(ᠪᠫᠬᠭᠮᠯᠰᠱᠲᠳ) let ᡠᡡᡢᡜá¡á¡žá¡Ÿá¡ á¡¡á¡¢á¡£á¡¤á¡¥á¡ á¡¡á¡¢ = ᡜá¡á¡žá¡Ÿá¡ á¡¡á¡¢á¡£á¡¤á¡¥(ᠴᠵᠶᠷᠸᠹᠺᠻᠼᠽ) let ᡪᡫᡬᡭᡮᡦᡧᡨᡪᡫᡬᡭᡮᡩᡪᡫᡬᡭᡮᡯ = ᡜá¡á¡žá¡Ÿá¡ á¡¡á¡¢á¡£á¡¤á¡¥(ᠾᠿᡀá¡á¡‚ᡃᡄᡅᡆᡇ) @@ -38,7 +38,7 @@ module ᠠᠡᠢᠣᠤᠥᠦᠧᠨᠩ ᡠᡡᡢᡜá¡á¡žá¡Ÿá¡ á¡¡á¡¢á¡£á¡¤á¡¥á¡ á¡¡á¡¢.ᠠᠡᠢᠣᠤᠥᠦᠧᠨᠩ(ᠴᠵᠶᠷᠸᠹᠺᠻᠼᠽ) |> ignore ᡪᡫᡬᡭᡮᡦᡧᡨᡪᡫᡬᡭᡮᡩᡪᡫᡬᡭᡮᡯ.ᠠᠡᠢᠣᠤᠥᠦᠧᠨᠩ(ᠾᠿᡀá¡á¡‚ᡃᡄᡅᡆᡇ) |> ignore ᢇᢈᢉᢊᢋᢄᢅᢆᢇᢈᢉᢊᢋᢌá¢.ᠠᠡᠢᠣᠤᠥᠦᠧᠨᠩ(ᠾᠿᡀá¡á¡‚ᠾᠿᡀá¡á¡‚ᡃᡄᡅᡆᡇᡃᡄᡅᡆ) |> ignore - + "ᢘᢙᢚᢛᢜá¢á¢žá¢Ÿá¢ á¢¡á¢›á¢œá¢á¢žá¢Ÿ" |> ignore """ᢘᢙᢚᢛᢜá¢á¢žá¢Ÿá¢ á¢¡á¢›á¢œá¢á¢žá¢Ÿ""" diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/RightToLeft.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/RightToLeft.fs index 7c535ea79e6..1d682b5abf6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/RightToLeft.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/RightToLeft.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization // Here's some right-to-left text in a comment... diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/Surrogates.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/Surrogates.fs index 0c37a1d1251..1d3aa8f1cd4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/Surrogates.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/Surrogates.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization // Surrogates: in comments diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/Tamil.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/Tamil.fs index 1771fd0e927..d12d7da980e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/Tamil.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/Tamil.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization // Note that the first two characters in the string below are not accepted by F# diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/Tibetan.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/Tibetan.fs index 64b6502ab32..b9c7bcf4b78 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/Tibetan.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/Tibetan.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization module ꃙꃚꃛꃜêƒêƒžêƒŸêƒ êƒ¡êƒ¢ @@ -7,7 +7,7 @@ module ꃙꃚꃛꃜêƒêƒžêƒŸêƒ êƒ¡êƒ¢ | Baz of int | Zoo of int | Yap of string - + let ꃣꃤꃥꃦꃧꃨꃩꃪꃫꃬ = Foo.Bar(1) @@ -19,7 +19,7 @@ module ꃙꃚꃛꃜêƒêƒžêƒŸêƒ êƒ¡êƒ¢ type ꄕꄖꄗꄘꄙꄚꄛꄜê„ꄞ(ꄟꄠꄡꄢꄣꄤꄥꄦꄧꄨ : Foo) = let ꄩꄪꄫꄬꄭꄮꄯꄰꄱꄲ = ꄟꄠꄡꄢꄣꄤꄥꄦꄧꄨ - + member ꄳꄴꄵꄶꄷꄸꄹꄺꄻꄼ.ꅇꅈꅉꅊꅋꅌê…ê…Žê…ê…(ꄽꄾꄿꅀê…ꅂꅃꅄꅅꅆ : Foo) = ꄩꄪꄫꄬꄭꄮꄯꄰꄱꄲ |> ignore match ꄽꄾꄿꅀê…ꅂꅃꅄꅅꅆ with @@ -27,7 +27,7 @@ module ꃙꃚꃛꃜêƒêƒžêƒŸêƒ êƒ¡êƒ¢ | Foo.Baz(_) -> "ꅛꅜê…ꅞꅟꅠꅡꅢꅣꅤ" | Foo.Zoo(_) -> "ꅥꅦꅧꅨꅩꅪꅫꅬꅭꅮ" | Foo.Yap(_) -> "ꅯꅰꅱꅲꅳꅴꅵꅶꅷꅸ" - + let ꅹꅺꅻꅼꅽꅾꅿꆀê†ê†‚ = ꄕꄖꄗꄘꄙꄚꄛꄜê„ꄞ(ꃣꃤꃥꃦꃧꃨꃩꃪꃫꃬ) let ꆃꆄꆅꆆꆇꆈꆉꆊꆋꆌ = ꄕꄖꄗꄘꄙꄚꄛꄜê„ꄞ(ꃭꃮꃯꃰꃱꃲꃳꃴꃵꃶ) let ê†ê†Žê†ê†ê†‘ꆒꆓꆔꆕꆖ = ꄕꄖꄗꄘꄙꄚꄛꄜê„ꄞ(ꃷꃸꃹꃺꃻꃼꃽꃾꃿꄀ) @@ -38,7 +38,7 @@ module ꃙꃚꃛꃜêƒêƒžêƒŸêƒ êƒ¡êƒ¢ ꆃꆄꆅꆆꆇꆈꆉꆊꆋꆌ.ꅇꅈꅉꅊꅋꅌê…ê…Žê…ê…(ꃭꃮꃯꃰꃱꃲꃳꃴꃵꃶ) |> ignore ê†ê†Žê†ê†ê†‘ꆒꆓꆔꆕꆖ.ꅇꅈꅉꅊꅋꅌê…ê…Žê…ê…(ꃷꃸꃹꃺꃻꃼꃽꃾꃿꄀ) |> ignore ꆗꆘꆙꆚꆛꆜê†ê†žê†Ÿê† .ꅇꅈꅉꅊꅋꅌê…ê…Žê…ê…(ê„ꄂꄃꄄꄅꄆꄇꄈꄉꄊ) |> ignore - + "ꆫꆬꆭꆮꆯꆰꆱꆲꆳꆴ" |> ignore """ꆫꆬꆭꆮꆯꆰꆱꆲꆳꆴ""" diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/TurkishI.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/TurkishI.fs index 4e91b3d2901..bb9ae4f4a7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/TurkishI.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/TurkishI.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization let İIıi = "İIıi" diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/Uighur.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/Uighur.fs index ad54864d211..3f78ed9b2dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/Uighur.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/Uighur.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization module بةتثجحخدذر @@ -7,10 +7,10 @@ module بةتثجحخدذر | Baz of int | Zoo of int | Yap of string - + type E = | ﺬﺭﺮﺯﺰﺱﺲﺳﺴﺵ = 1 | ﻲﻳﻴﻵﻶﻷﻸﻹﻺﻻ = 2 - + let زسشصضطظع = Foo.Bar(1) let نهوىيًٌÙÙŽÙ = Foo.Baz(1) @@ -24,7 +24,7 @@ module بةتثجحخدذر type ٮٯٰٱٲٳٴٵٶٷ(Ù¹ÙºÙ»Ù¼Ù½Ù¾Ù¿Ú€Ú : Foo) = let Ú‚ÚƒÚ„Ú…Ú†Ú‡ÚˆÚ‰ÚŠÚ‹ = Ù¹ÙºÙ»Ù¼Ù½Ù¾Ù¿Ú€Ú - + member ÚŒÚÚŽÚÚÚ‘Ú’Ú“Ú”Ú•.Ú Ú¡Ú¢Ú£Ú¤Ú¥Ú¦Ú§Ú¨Ú©(Ú–Ú—Ú˜Ú™ÚšÚ›ÚœÚÚžÚŸ : Foo) = Ú‚ÚƒÚ„Ú…Ú†Ú‡ÚˆÚ‰ÚŠÚ‹ |> ignore match Ú–Ú—Ú˜Ú™ÚšÚ›ÚœÚÚžÚŸ with @@ -32,7 +32,7 @@ module بةتثجحخدذر | Foo.Baz(_) -> "Ú´ÚµÚ¶Ú·Ú¸Ú¹ÚºÚ»Ú¼Ú½" | Foo.Zoo(_) -> "Ú¿Û€ÛÛ‚ÛƒÛ„Û…Û†Û‡" | Foo.Yap(_) -> "ÛˆÛ‰ÛŠÛ‹ÛŒÛÛŽÛÛÛ‘" - + let ï®ï®ï®‘ï®’ = ٮٯٰٱٲٳٴٵٶٷ(زسشصضطظع) let ﭙﭚﭛﭜï­ï­žï­Ÿï­  = ٮٯٰٱٲٳٴٵٶٷ(نهوىيًٌÙÙŽÙ) let ﭤﭥﭦﭧﭨﭩﭪ = ٮٯٰٱٲٳٴٵٶٷ( ﺬﺭﺮﺯﺰﺱﺲﺳﺴﺵ) @@ -43,7 +43,7 @@ module بةتثجحخدذر ﭙﭚﭛﭜï­ï­žï­Ÿï­ .Ú Ú¡Ú¢Ú£Ú¤Ú¥Ú¦Ú§Ú¨Ú©(نهوىيًٌÙÙŽÙ) |> ignore ﭤﭥﭦﭧﭨﭩﭪ.Ú Ú¡Ú¢Ú£Ú¤Ú¥Ú¦Ú§Ú¨Ú©( ﺬﺭﺮﺯﺰﺱﺲﺳﺴﺵ) |> ignore ﭲﭳ.Ú Ú¡Ú¢Ú£Ú¤Ú¥Ú¦Ú§Ú¨Ú©(ﺑﺒﺓﺔﺕ) |> ignore - + "ï®ï®‚ﮃﮄﮅﮆﮇﮈ" |> ignore """ï®ï®‚ﮃﮄﮅﮆﮇﮈ""" diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/Yi.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/Yi.fs index ad840f8f177..7ea877e4167 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/Yi.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/Yi.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization module ê«ê¬ê­ê® @@ -7,7 +7,7 @@ module ê«ê¬ê­ê® | Baz of int | Zoo of int | Yap of string - + let ê¸ê¹êºê» = Foo.Bar(1) @@ -26,7 +26,7 @@ module ê«ê¬ê­ê® | Foo.Baz(_) -> "ꅯꅰꅱꅲꅳꅴꅵꅶꅷꅸ" | Foo.Zoo(_) -> "ê†ê†Žê†ê†ê†‘ꆒꆓꆔꆕꆖ" | Foo.Yap(_) -> "ꃙꃚꃛꃜêƒêƒžêƒŸêƒ êƒ¡êƒ¢" - + let ꂽꂾꂿꃀêƒêƒ‚ꃃ = ꃅꃆꃇꃈꃉ(ê¸ê¹êºê») let ê‚ꂎê‚ê‚ê‚‘ê‚’ = ꃅꃆꃇꃈꃉ(ê…€ê…ꅂꅃꅄ) let ꄋꄌê„ꄎê„ê„ê„‘ê„’ê„“ = ꃅꃆꃇꃈꃉ(ꅩꅪꅫꅬꅭ) @@ -37,7 +37,7 @@ module ê«ê¬ê­ê® ê‚ꂎê‚ê‚ê‚‘ê‚’.ꄴꄵꄶꄷꄸꄹꄺꄻ(ê…€ê…ꅂꅃꅄ) |> ignore ꄋꄌê„ꄎê„ê„ê„‘ê„’ê„“.ꄴꄵꄶꄷꄸꄹꄺꄻ(ꅩꅪꅫꅬꅭ) |> ignore ꄴꄵꄶꄷꄸꄹ.ꄴꄵꄶꄷꄸꄹꄺꄻ(ꂖꂗꂘꂙꂚꂛꂜ) |> ignore - + "ꆿꇀê‡ê‡‚ꇃꇄꇅꇆꇇꇈ" |> ignore """ꆿꇀê‡ê‡‚ꇃꇄꇅꇆꇇꇈ""" diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/gb18030.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/gb18030.fs index 36c430a61cc..2da80d93c86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/gb18030.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/gb18030.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization // need to do the bare minimum to test this diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/utf16.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/utf16.fs index d15c468a831..ed41ddb9f11 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/utf16.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/utf16.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization // need to do the bare minimum to test this diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/utf8.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/utf8.fs index 54e0daa7dfb..af418e0e2fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/utf8.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/utf8.fs @@ -1,4 +1,4 @@ -// #Globalization +// #Globalization // need to do the bare minimum to test this diff --git a/tests/FSharp.Compiler.ComponentTests/Import/ImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Import/ImportTests.fs index 8c61bc082a0..114d72791bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Import/ImportTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Import/ImportTests.fs @@ -12,7 +12,7 @@ module ImportTests = // ======================================== // Basic C# Library Reference Test // ======================================== - + [] let ``Basic - F# can reference C# library`` () = let csLib = @@ -26,7 +26,7 @@ namespace MyLib } """ |> withName "csLib" - + FSharp """ module Module1 @@ -42,7 +42,7 @@ let answer = Class1.GetAnswer() // ======================================== // C# Conversion Operators Tests // ======================================== - + [] let ``Conversion operators - F# can use C# implicit and explicit conversion operators`` () = let csLib = @@ -59,7 +59,7 @@ namespace CSharpTypes } """ |> withName "csConversion" - + FSharp """ module ConversionTest @@ -73,14 +73,14 @@ let check () = ('a', 2.0, 1, 1uy) = p |> shouldSucceed |> ignore - // Note: The negative test "Conversion operators - F# error when C# type does not support conversion" + // Note: The negative test "Conversion operators - F# error when C# type does not support conversion" // was not migrated because the test framework's typecheck with C# references has limitations // that cause the C# library to not be properly linked for failure scenarios. // ======================================== // Multiple Implicit/Explicit Operators Tests // ======================================== - + [] let ``Multiple implicit operators - F# can use C# generic types with multiple op_Implicit`` () = let csLib = @@ -96,7 +96,7 @@ namespace Yadda } """ |> withName "csImplicitOps" - + FSharp """ module MultipleImplicitOperatorsFromCS01 let inline impl< ^a, ^b when ^a : (static member op_Implicit : ^a -> ^b)> arg = @@ -130,7 +130,7 @@ namespace Yadda } """ |> withName "csExplicitOps" - + FSharp """ module MultipleExplicitOperatorsFromCS01 let inline expl< ^a, ^b when ^a : (static member op_Explicit : ^a -> ^b)> arg = @@ -159,7 +159,7 @@ let b3 = new Blah() // Migrated from: tests/fsharpqa/Source/Import/em_csharp_*.fs // Regression tests for FSHARP1.0:1494 - F# can import C# extension methods // ======================================== - + [] let ``Extension methods - F# can call C# extension method on struct with void return`` () = // Migrated from em_csharp_struct_void.fs @@ -173,7 +173,7 @@ public static class ExtMethods } """ |> withName "csExtStructVoid" - + FSharp """ module M let s = S() @@ -198,7 +198,7 @@ public static class ExtMethods } """ |> withName "csExtStructNonvoid" - + FSharp """ module M let s = S() @@ -223,7 +223,7 @@ public static class ExtMethods } """ |> withName "csExtStructParams" - + FSharp """ module M let s = S() @@ -248,7 +248,7 @@ public static class ExtMethods } """ |> withName "csExtClassVoid" - + FSharp """ module M @@ -278,7 +278,7 @@ public static class ExtMethods } """ |> withName "csExtClassNonvoid" - + FSharp """ module M @@ -308,7 +308,7 @@ public static class ExtMethods } """ |> withName "csExtClassParams" - + FSharp """ module M @@ -330,7 +330,7 @@ t.M4([|1.0M; -2.0M|]) |> ignore // Migrated from: tests/fsharpqa/Source/Import/em_csharp_on_fsharp_1.fs, em_csharp_on_fsharp_2.fs // Feature test for Bug51669 - F# can import C# extension methods on F# types // ======================================== - + [] let ``Extension methods on F# types - C# extensions work on F# class type (FooA)`` () = // Migrated from em_csharp_on_fsharp_1.fs @@ -341,7 +341,7 @@ namespace BaseEmFs type FooA() = class end """ |> withName "fsBaseA" - + let csLib = CSharp """ using BaseEmFs; @@ -358,7 +358,7 @@ namespace EmLibCs """ |> withName "csEmLibCsA" |> withReferences [fsLib] - + FSharp """ module M @@ -387,7 +387,7 @@ type FooB(x:int) = member this.Value = x """ |> withName "fsBaseB" - + let csLib = CSharp """ using BaseEmFs; @@ -404,7 +404,7 @@ namespace EmLibCs """ |> withName "csEmLibCsB" |> withReferences [fsLib] - + FSharp """ module M @@ -425,7 +425,7 @@ foo.M3B(5) |> ignore // ======================================== // Static Field Assignment Test // ======================================== - + [] let ``Static field assignment - F# can assign to a static field imported from C#`` () = let csLib = @@ -436,7 +436,7 @@ public static class C } """ |> withName "csStaticClass" - + FSharp """ module StaticFieldTest @@ -453,7 +453,7 @@ let check () = (before = 1.2M && C.d = -3.4M) // ======================================== // InternalsVisibleTo Tests // ======================================== - + [] let ``InternalsVisibleTo - F# can access C# internal types and members with IVT`` () = let csLib = @@ -473,7 +473,7 @@ internal class Calc } """ |> withName "csInternalsLib" - + FSharp """ module InternalsConsumerTest @@ -494,7 +494,7 @@ let test () = // ======================================== // FamAndAssembly (private protected) Test // ======================================== - + [] let ``FamAndAssembly - F# can access private protected member with IVT`` () = // Migrated from: FamAndAssembly.fs @@ -513,7 +513,7 @@ public class Accessibility } """ |> withName "csAccessibilityTests" - + FSharp """ namespace NS @@ -541,7 +541,7 @@ public class Accessibility } """ |> withName "csAccessibilityNoIVT" - + FSharp """ namespace NS @@ -579,7 +579,7 @@ public class Accessibility } """ |> withName "csAccessibilityFamOrAssembly" - + FSharp """ namespace NS @@ -608,7 +608,7 @@ public class Accessibility } """ |> withName "csAccessibilityFamOrAssemblyNoIVT" - + FSharp """ namespace NS @@ -626,7 +626,7 @@ type T() = // ======================================== // Iterate Over Collections Test // ======================================== - + [] let ``Iterate over collections - StringDictionary entries work correctly`` () = FSharp """ @@ -650,7 +650,7 @@ for de in strDict do // ======================================== // Accessing Record Fields from Other Assembly // ======================================== - + [] let ``Accessing record fields - F# can access record fields from other assembly`` () = let fsLib = @@ -660,7 +660,7 @@ module InfoLib type Info = { Name : string; DoB: System.DateTime; mutable Age : int } """ |> withName "fsRecordLib" - + FSharp """ module RecordTest @@ -687,7 +687,7 @@ let updateAge () = // ======================================== // F# Module/Namespace Reference Tests // ======================================== - + [] let ``F# module reference - DLL can reference DLL`` () = let fsLib = @@ -699,7 +699,7 @@ type x () = with set ((x:decimal,y:decimal)) = verificationX <- (x = 1M && y= -2M) """ |> withName "fsReference1" - + FSharp """ module M2 @@ -722,7 +722,7 @@ module M = type T = string """ |> withName "fsReference5ns" - + FSharp """ module Reference5aTest open N.M @@ -737,7 +737,7 @@ let foo : T = "" // ======================================== // Reference Exe Test // ======================================== - + [] let ``Reference exe - F# can reference an executable assembly`` () = let fsExe = @@ -751,7 +751,7 @@ let main args = f 1 """ |> withName "fsReferenceExe" |> asExe - + FSharp """ module RefExeTest let x = M.f 1 @@ -765,7 +765,7 @@ let x = M.f 1 // ======================================== // Line Directive from C# Test // ======================================== - + [] let ``Line directive from C# - CallerLineNumber and CallerFilePath work from F#`` () = let csLib = @@ -790,7 +790,7 @@ namespace ClassLibrary1 } """ |> withName "csLineDirective" - + FSharp """ module LineDirectiveTest @@ -848,7 +848,7 @@ let answer = Class1.GetAnswer() // Original: PRECMD="$FSC_PIPE --target:library reference5ns.fs" SCFLAGS="--target:library -r:reference5ns.dll" // Regression for FSHARP1.0:3200 // ======================================== - + [] [] [] @@ -920,8 +920,8 @@ module M = """ |> asLibrary |> withName "reference1ns" - - // Note: Script tests with #r directives that reference in-memory assemblies + + // Note: Script tests with #r directives that reference in-memory assemblies // work differently. We test the compile-time behavior instead. FSharp """ module Reference4aTest diff --git a/tests/FSharp.Compiler.ComponentTests/InteractiveSession/ErrorTestCases/E_ErrorRanges01.fs b/tests/FSharp.Compiler.ComponentTests/InteractiveSession/ErrorTestCases/E_ErrorRanges01.fs index 85bca0aa954..e894667d9b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/InteractiveSession/ErrorTestCases/E_ErrorRanges01.fs +++ b/tests/FSharp.Compiler.ComponentTests/InteractiveSession/ErrorTestCases/E_ErrorRanges01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSharp1.0:2815 - fsi.exe underlines one too many characters for error spans (off by 1 error) //Incomplete pattern matches on this expression. diff --git a/tests/FSharp.Compiler.ComponentTests/InteractiveSession/Misc.fs b/tests/FSharp.Compiler.ComponentTests/InteractiveSession/Misc.fs index 74298498dbb..1ace807a8fd 100644 --- a/tests/FSharp.Compiler.ComponentTests/InteractiveSession/Misc.fs +++ b/tests/FSharp.Compiler.ComponentTests/InteractiveSession/Misc.fs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. /// Tests for FSI Interactive Session - migrated from tests/fsharpqa/Source/InteractiveSession/Misc/ -/// NOTE: Many InteractiveSession tests from fsharpqa require FSI-specific features (fsi.CommandLineArgs, -/// FSIMODE=PIPE with stdin, #r with relative paths, etc.) that cannot be easily migrated to the +/// NOTE: Many InteractiveSession tests from fsharpqa require FSI-specific features (fsi.CommandLineArgs, +/// FSIMODE=PIPE with stdin, #r with relative paths, etc.) that cannot be easily migrated to the /// ComponentTests framework which runs FSI externally. The tests migrated here are the subset that /// work with the runFsi external process approach. namespace InteractiveSession @@ -575,7 +575,7 @@ exit 1;; |> ignore // INTERACTIVE is defined for FSI sessions - // Note: This test is skipped because preprocessor directives work differently + // Note: This test is skipped because preprocessor directives work differently // when running FSI externally via runFsi vs. in-process //[] let ``DefinesInteractive - INTERACTIVE is defined - SKIPPED``() = @@ -920,7 +920,7 @@ if person.Age <> 30 then failwith "test assertion failed";; |> shouldSucceed |> ignore - // Struct tuple in FSI + // Struct tuple in FSI [] let ``StructTuple - struct tuple syntax``() = Fsx """ @@ -1441,7 +1441,7 @@ type T() = |> withStdErrContains "implicitly ignored" |> ignore - // Test: E_let_id_equal01 - incomplete let x = + // Test: E_let_id_equal01 - incomplete let x = // Regression for FSHARP1.0:5629 [] let ``E_let_id_equal01 - incomplete let binding``() = @@ -2063,9 +2063,9 @@ if fsi.CommandLineArgs.Length >= 1 then exit 0 else exit 1 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| tmpFile |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| tmpFile |] "" Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally @@ -2084,9 +2084,9 @@ exit 0 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| tmpFile |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| tmpFile |] "" Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally @@ -2106,9 +2106,9 @@ exit 0 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| tmpFile; "Hello" |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| tmpFile; "Hello" |] "" Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally @@ -2339,11 +2339,11 @@ let f x y = x + y // Get a full path to a framework assembly let fwkDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() let dllPath = Path.Combine(fwkDir, "System.dll") - + // Verify the assembly exists if not (File.Exists(dllPath)) then failwith $"Expected framework assembly not found: {dllPath}" - + // Test #r with full absolute path (using sprintf to inject path) Fsx (sprintf "#r @\"%s\"\nopen System\nlet now = DateTime.Now\nnow |> ignore\n()" dllPath) |> withOptions ["--nologo"] @@ -2362,13 +2362,13 @@ let f x y = x + y let file2 = writeScript tempDir "LoadOrder2.fsx" file2Content let file3Content = sprintf "#load @\"%s\"\nprintfn \"let w = y 10\"" (file2.Replace("\\", "\\\\")) let file3 = writeScript tempDir "LoadOrder3.fsx" file3Content - + // Execute and verify load order via Loading messages - let result = + let result = FsxFromPath file3 |> runFsi |> shouldSucceed - + // The stdout should show loading messages in correct order // We can't rely on printfn from #load'ed files as they don't get captured properly // Instead verify the files were loaded in correct order: 1 -> 2 -> 3 diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs b/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs index 487b7f6ee1a..1e58ff9f063 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs @@ -133,7 +133,7 @@ let main _args = |> compileAndRun |> shouldSucceed |> verifyOutputContains [|": false";"x: true";"xyz: true"|] - |> verifyIL + |> verifyIL ["callvirt instance valuetype [System.Collections]System.Collections.Generic.Dictionary`2/AlternateLookup`1 class [System.Collections]System.Collections.Generic.Dictionary`2::GetAlternateLookup>()"] [] @@ -155,7 +155,7 @@ let main _args = [ Async.RunSynchronously")>] [] let ``Ref structs in generics - builders`` (build:string) (getter:string) = - + FSharp $$$"""module Foo open System @@ -183,8 +183,8 @@ let main _args = |> compileAndRun |> shouldSucceed |> verifyOutputContains [|"1";"System.Action`1[System.ReadOnlySpan`1[System.Int32]]"|] - |> verifyIL - [ if build = "task" then + |> verifyIL + [ if build = "task" then "valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1>>>" else "[FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1>>>" ] @@ -208,7 +208,7 @@ let processRecord (recd:MyRecordFullOfWrongStuff>>) = |> withLangVersion10 |> typecheck |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 412, Line 7, Col 7, Line 7, Col 12, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." Error 437, Line 6, Col 6, Line 6, Col 30, "A type would store a byref typed value. This is not permitted by Common IL." Error 412, Line 8, Col 7, Line 8, Col 12, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." @@ -218,4 +218,4 @@ let processRecord (recd:MyRecordFullOfWrongStuff>>) = Error 412, Line 13, Col 5, Line 13, Col 22, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." Error 412, Line 13, Col 5, Line 13, Col 16, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." Error 412, Line 13, Col 5, Line 13, Col 9, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL."] - + diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs b/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs index 1885328b541..c22713be976 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs @@ -16,7 +16,7 @@ module ``Required and init-only properties`` = }""" |> withCSharpLanguageVersion CSharpLanguageVersion.Preview |> withName "csLib" - let csharpBaseClass = + let csharpBaseClass = CSharp """ namespace RequiredAndInitOnlyProperties { @@ -29,7 +29,7 @@ module ``Required and init-only properties`` = }""" |> withCSharpLanguageVersion CSharpLanguageVersion.Preview |> withName "csLib" - let csharpRBaseClass = + let csharpRBaseClass = CSharp """ namespace RequiredAndInitOnlyProperties { @@ -98,7 +98,7 @@ let main _ = |> withReferences [csharpLib] |> compileAndRun |> shouldSucceed - + [] let ``F# can change set property via calling an explicit setter`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/StaticsInInterfaces.fs b/tests/FSharp.Compiler.ComponentTests/Interop/StaticsInInterfaces.fs index c752900f15b..8aec53f82c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/StaticsInInterfaces.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/StaticsInInterfaces.fs @@ -12,7 +12,7 @@ module ``Static Methods In Interfaces`` = | CS cs -> CS { cs with LangVersion = ver } | _ -> failwith "Only supported in C#" - let csharpBaseClass = + let csharpBaseClass = CSharp """ namespace StaticsInInterfaces { @@ -38,7 +38,7 @@ module ``Static Methods In Interfaces`` = }""" |> withCSharpLanguageVersion CSharpLanguageVersion.Preview |> withName "csLib" - + let csharpOperators = CSharp """ namespace StaticsInInterfaces @@ -110,7 +110,7 @@ let main _ = [] let ``F# can call static methods declared in interfaces from C#`` () = - let csharpLib = csharpBaseClass + let csharpLib = csharpBaseClass let fsharpSource = """ @@ -145,18 +145,18 @@ let main _ = .class interface public auto ansi abstract IGetNext`1<(class IGetNext`1) T> { // Methods - .method public hidebysig abstract virtual static + .method public hidebysig abstract virtual static !T Next ( !T other - ) cil managed + ) cil managed { } // end of method IGetNext`1::Next } // end of class IGetNext`1 And the following implementation: - .method public hidebysig static - class RepeatSequence Next (class RepeatSequence other) cil managed + .method public hidebysig static + class RepeatSequence Next (class RepeatSequence other) cil managed { .override method !0 class IGetNext`1::Next(!0) ... @@ -165,7 +165,7 @@ let main _ = [] let ``F# generates valid IL for abstract static interface methods`` () = - let csharpLib = csharpBaseClass + let csharpLib = csharpBaseClass let fsharpSource = """ @@ -250,11 +250,11 @@ implements class [csLib]StaticsInInterfaces.IGetNext`1] let ``F# can implement static methods declared in interfaces from C#`` () = - let csharpLib = csharpBaseClass + let csharpLib = csharpBaseClass let fsharpSource = """ diff --git a/tests/FSharp.Compiler.ComponentTests/Language/AttributeCheckingTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/AttributeCheckingTests.fs index 7464dec733b..85bbdde6074 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/AttributeCheckingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/AttributeCheckingTests.fs @@ -153,7 +153,7 @@ let main _ = [] let ``Regression: typechecker does not fail when attribute is on type variable (https://github.com/dotnet/fsharp/issues/13525)`` () = - let csharpBaseClass = + let csharpBaseClass = CSharp """ using System.Diagnostics.CodeAnalysis; @@ -170,7 +170,7 @@ let main _ = node; } }""" |> withName "csLib" - + let fsharpSource = """ module FooBar diff --git a/tests/FSharp.Compiler.ComponentTests/Language/BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs index 60c5c919bc8..8c468c4f69e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs @@ -26,7 +26,7 @@ let ``Partial struct active pattern returns bool`` () = |> withLangVersion10 |> typecheck |> shouldSucceed - + [] let ``Single case active pattern returning bool should success`` () = FSharp """ @@ -35,7 +35,7 @@ let (IsA r) = "A" """ |> typecheck |> shouldSucceed - + [] let ``Partial struct active pattern results can be retrieved`` () = Fsx """ diff --git a/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs index 7085bd7a3a7..07ba21f7b5c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs @@ -96,11 +96,11 @@ match expr with |> shouldSucceed // Tests for issues #11131 and #15648 - anonymous record field ordering - // Note: The fix is in FSharp.Core/Linq.fs - these tests verify that queries + // Note: The fix is in FSharp.Core/Linq.fs - these tests verify that queries // with anonymous records work correctly regardless of field order. // The expression tree structure tests are in FSharp.Core.UnitTests which directly // references the modified FSharp.Core. - + [] let ``Anonymous records with both field orders produce equivalent results - issue 11131 and 15648`` () = Fsx """ diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index 8ae3b0d4ef6..3ac901933df 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -60,7 +60,7 @@ let f3 () = |> withDiagnostics [ (Error 3350, Line 11, Col 16, Line 11, Col 42, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 10.0 or greater.") ] - + [] let ``Version 9.0: Allow CE return! and type annotations don't to play well together needing parentheses``() = FSharp """ @@ -92,7 +92,7 @@ let f1() = |> withDiagnostics [ (Error 3350, Line 16, Col 17, Line 16, Col 43, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 10.0 or greater.") ] - + [] let ``Preview: Allow CE return and type annotations to play well together without needing parentheses``() = FSharp """ @@ -234,9 +234,9 @@ let x = lb {1; 2; if true then 3;} [] [] [] - [] - [] - let ``A CE with BindReturn and Zero can omit else in an if-then return`` (langVersion, bindReturnName) = + [] + [] + let ``A CE with BindReturn and Zero can omit else in an if-then return`` (langVersion, bindReturnName) = let code = $""" type Builder () = member inline __.Return (x: 'T) = Seq.singleton x @@ -255,8 +255,8 @@ let _pythags = seqbuilder {{ |> typecheck |> shouldSucceed - [] - let ``A CE with BindReturn and Zero can work without Return if flow control is not used`` () = + [] + let ``A CE with BindReturn and Zero can work without Return if flow control is not used`` () = let code = $""" type Builder () = member inline __.Bind (p: seq<'T>, rest: 'T->seq<'U>) = Seq.collect rest p @@ -269,7 +269,7 @@ let _pythags = seqbuilder {{ let! z = seq [5;10] return (z,z) }} """ code - |> FSharp + |> FSharp |> typecheck |> shouldSucceed @@ -319,7 +319,7 @@ let run r2 r3 = |> withDiagnostics [ (Error 3345, Line 18, Col 9, Line 18, Col 13, "use! may not be combined with and!") ] - + [] let ``multiple use! may not be combined with and!`` () = Fsx """ @@ -350,7 +350,7 @@ let run r2 r3 = |> withDiagnostics [ (Error 3345, Line 18, Col 9, Line 18, Col 13, "use! may not be combined with and!") ] - + [] let ``multiple use! may not be combined with multiple and!`` () = Fsx """ @@ -419,7 +419,7 @@ let run r2 r3 = |> withDiagnostics [ (Error 708, Line 23, Col 9, Line 23, Col 13, "This control construct may only be used if the computation expression builder defines a 'Bind' method") ] - + [] let ``This control construct may only be used if the computation expression builder defines a 'Using' method`` () = Fsx """ @@ -454,7 +454,7 @@ let run r2 r3 = |> withDiagnostics [ (Error 708, Line 23, Col 9, Line 23, Col 13, "This control construct may only be used if the computation expression builder defines a 'Using' method") ] - + [] let ``do! expressions may not be used in queries`` () = Fsx """ @@ -469,7 +469,7 @@ query { |> withDiagnostics [ (Error 3143, Line 3, Col 5, Line 3, Col 8, "'let!', 'use!' and 'do!' expressions may not be used in queries") ] - + [] let ``let! expressions may not be used in queries`` () = Fsx """ @@ -484,7 +484,7 @@ query { |> withDiagnostics [ (Error 3143, Line 3, Col 5, Line 3, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") ] - + [] let ``let!, and! expressions may not be used in queries`` () = Fsx """ @@ -500,7 +500,7 @@ query { |> withDiagnostics [ (Error 3143, Line 3, Col 5, Line 3, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") ] - + [] let ``use! expressions may not be used in queries`` () = Fsx """ @@ -529,9 +529,9 @@ query { |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3143, Line 4, Col 5, Line 4, Col 8, "'let!', 'use!' and 'do!' expressions may not be used in queries") + (Error 3143, Line 4, Col 5, Line 4, Col 8, "'let!', 'use!' and 'do!' expressions may not be used in queries") ] - + [] let ``let! expressions may not be used in queries(SynExpr.Sequential)`` () = Fsx """ @@ -547,7 +547,7 @@ query { |> withDiagnostics [ (Error 3143, Line 4, Col 5, Line 4, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") ] - + [] let ``let!, and! expressions may not be used in queries(SynExpr.Sequential)`` () = Fsx """ @@ -564,7 +564,7 @@ query { |> withDiagnostics [ (Error 3143, Line 4, Col 5, Line 4, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") ] - + [] let ``use! expressions may not be used in queries(SynExpr.Sequential)`` () = Fsx """ @@ -631,7 +631,7 @@ let run r2 r3 = |> withDiagnostics [ (Error 750, Line 3, Col 5, Line 3, Col 11, "This construct may only be used within computation expressions") ] - + [] let ``This control construct may only be used if the computation expression builder defines a 'Yield' method`` () = Fsx """ @@ -649,7 +649,7 @@ let f3 = |> withDiagnostics [ (Error 708, Line 5, Col 13, Line 5, Col 18, "This control construct may only be used if the computation expression builder defines a 'Yield' method") ] - + [] let ``This control construct may only be used if the computation expression builder defines a 'YieldFrom' method`` () = Fsx """ @@ -667,7 +667,7 @@ let f3 = |> withDiagnostics [ (Error 708, Line 5, Col 13, Line 5, Col 19, "This control construct may only be used if the computation expression builder defines a 'YieldFrom' method") ] - + [] let ``This control construct may only be used if the computation expression builder defines a 'Return' method`` () = @@ -704,7 +704,7 @@ let run r2 r3 = |> withDiagnostics [ (Error 708, Line 24, Col 19, Line 24, Col 25, "This control construct may only be used if the computation expression builder defines a 'Return' method") ] - + [] let ``This control construct may only be used if the computation expression builder defines a 'ReturnFrom' method`` () = @@ -740,7 +740,7 @@ let run r2 r3 = |> shouldFail |> withDiagnostics [ (Error 708, Line 24, Col 19, Line 24, Col 26, "This control construct may only be used if the computation expression builder defines a 'ReturnFrom' method") - ] + ] [] let ``This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = @@ -779,7 +779,7 @@ let run r2 r3 = |> withDiagnostics [ (Error 708, Line 27, Col 9, Line 27, Col 15, "This control construct may only be used if the computation expression builder defines a 'Combine' method") ] - + [] let ``Sequence2 This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = Fsx """ @@ -822,7 +822,7 @@ let run (r2: Result) (r3: Result) = |> withDiagnostics [ (Error 708, Line 32, Col 9, Line 32, Col 15, "This control construct may only be used if the computation expression builder defines a 'Combine' method") ] - + [] let ``Sequence 5 This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = Fsx """ @@ -865,7 +865,7 @@ let run (r2: Result) (r3: Result) = |> withDiagnostics [ (Error 708, Line 32, Col 9, Line 32, Col 16, "This control construct may only be used if the computation expression builder defines a 'Combine' method") ] - + [] let ``Sequence 7 This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = Fsx """ @@ -908,8 +908,8 @@ let run (r2: Result) (r3: Result) = |> shouldFail |> withDiagnostics [ (Error 708, Line 33, Col 9, Line 33, Col 16, "This control construct may only be used if the computation expression builder defines a 'Combine' method") - ] - + ] + [] let ``Sequence 8 This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = Fsx """ @@ -953,7 +953,7 @@ let run (r2: Result) (r3: Result) = |> withDiagnostics [ (Error 708, Line 33, Col 9, Line 33, Col 16, "This control construct may only be used if the computation expression builder defines a 'Combine' method") ] - + [] let ``Sequence 9 This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = Fsx """ @@ -1042,7 +1042,7 @@ let run (r2: Result) (r3: Result) = |> withDiagnostics [ (Error 708, Line 34, Col 9, Line 34, Col 15, "This control construct may only be used if the computation expression builder defines a 'Combine' method") ] - + [] let ``Sequence 4 This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = Fsx """ @@ -1086,7 +1086,7 @@ let run (r2: Result) (r3: Result) = |> shouldFail |> withDiagnostics [ (Error 708, Line 34, Col 9, Line 34, Col 14, "This control construct may only be used if the computation expression builder defines a 'Combine' method") - ] + ] [] let ``Sequence 6 This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = Fsx """ @@ -1235,7 +1235,7 @@ module Test = |> withDiagnostics [ (Error 708, Line 25, Col 7, Line 26, Col 13, "This control construct may only be used if the computation expression builder defines a 'Combine' method") ] - + [] let ``Sequence 13 This control construct may only be used if the computation expression builder defines a 'Combine' method`` () = Fsx """ @@ -1395,7 +1395,7 @@ let x18mutable = (Error 3147, Line 13, Col 20, Line 13, Col 23, "This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.") (Error 3147, Line 20, Col 21, Line 20, Col 22, "This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.") ] - + [] let ``Fix resumable and non-resumable CE error ranges`` () = FSharp """ @@ -1427,7 +1427,7 @@ is not compatible with type 'TaskCode' ") ] - + [] let ``Fix resumable and non-resumable CE error ranges 2`` () = FSharp """ @@ -1465,8 +1465,8 @@ but here has type 'int' but here has type 'string' ") - ] - + ] + [] let ``Fix resumable and non-resumable CE error ranges 3`` () = FSharp """ @@ -1493,7 +1493,7 @@ is not compatible with type 'TaskCode,IList>' ") ] - + [] let ``Fix resumable and non-resumable CE error ranges 4`` () = FSharp """ @@ -1523,7 +1523,7 @@ is not compatible with type 'TaskCode' ") ] - + [] let ``Version 9.0: and! with type annotations requires parentheses`` () = FSharp """ @@ -1580,7 +1580,7 @@ let testParallel3() = (Error 3350, Line 43, Col 17, Line 43, Col 20, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 10.0 or greater."); (Error 3350, Line 44, Col 17, Line 44, Col 20, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 10.0 or greater.") ] - + [] let ``Preview: and! with type annotations works without parentheses`` () = FSharp """ @@ -2247,7 +2247,7 @@ but here has type [] let ``tail call methods work`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> runFsi |> shouldSucceed @@ -2255,7 +2255,7 @@ but here has type [] let ``YieldFromFinal works in coroutines`` compilation = compilation - |> getCompilation + |> getCompilation |> asFsx |> runFsi |> shouldSucceed @@ -2399,7 +2399,7 @@ let foo() = """ |> typecheck |> shouldSucceed - + // https://github.com/dotnet/fsharp/issues/19457: a let!/use!/do!-headed RHS of a plain 'let' // inside a CE now runs as a nested computation. The following tests pin both compilation and the // runtime values (scoping in particular). diff --git a/tests/FSharp.Compiler.ComponentTests/Language/CopyAndUpdateTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/CopyAndUpdateTests.fs index 872d8129b9b..eb5fc1240be 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/CopyAndUpdateTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/CopyAndUpdateTests.fs @@ -19,7 +19,7 @@ let t2 x = { x with D.B = "a"; D.B = "b" } |> withDiagnostics [ Error 668, Line 6, Col 34, Line 6, Col 41, "The field 'B' appears multiple times in this record expression or pattern" ] - + [] let ``Cannot update the same field appears multiple times in nested copy-and-update``() = FSharp """ @@ -35,7 +35,7 @@ let t2 x = { x with D.B = "a"; D.B = "b"; D.B = "c" } Error 668, Line 6, Col 34, Line 6, Col 41, "The field 'B' appears multiple times in this record expression or pattern" Error 668, Line 6, Col 45, Line 6, Col 52, "The field 'B' appears multiple times in this record expression or pattern" ] - + [] let ``Cannot update the same field appears multiple times in nested copy-and-update 2``() = FSharp """ diff --git a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs index bc939111cf7..e3ecacd4674 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs @@ -77,7 +77,7 @@ let ``Bug - all of these should be an error`` (code:string) = |> withErrorCodes [3584] [] -let ``Underscore Dot ToString With Space Before Parenthesis - NonAtomic`` () = +let ``Underscore Dot ToString With Space Before Parenthesis - NonAtomic`` () = Fsx """ let x = "a" |> _.ToString () """ |> withLangVersion80 @@ -100,7 +100,7 @@ let myFunction (x:MyRecord) = x |> _.DoStuff 1 2 3""" |> withLangVersion80 |> typecheck |> shouldFail - |> withDiagnostics [ + |> withDiagnostics [ Error 3584, Line 4, Col 36, Line 4, Col 45, "Shorthand lambda syntax is only supported for atomic expressions, such as method, property, field or indexer on the implied '_' argument. For example: 'let f = _.Length'." Error 72, Line 4, Col 36, Line 4, Col 45, "The type of this expression could not be inferred before accessing its members. Add a type annotation, e.g. (expr: SomeType), to constrain the type before this point." ] @@ -117,7 +117,7 @@ let ``Underscore Dot Lambda - Missing qualification after dot`` () = ] [] -let ``Underscore Dot Length on string`` () = +let ``Underscore Dot Length on string`` () = Fsx """ let x = "a" |> _.Length printfn "%i" x @@ -125,7 +125,7 @@ printfn "%i" x |> withLangVersion80 |> typecheck |> shouldSucceed - + [] let ``Types`` () = Fsx """ @@ -136,7 +136,7 @@ let c = _.ToString().Length |> withLangVersion80 |> typecheck |> shouldSucceed - + [] let ``Regression with an underscore using pattern match`` () = Fsx """ @@ -144,10 +144,10 @@ type MyDU = A | B let getnumberOutOfDU x = match x with | A -> 42 - | _ -> 43""" + | _ -> 43""" |> withLangVersion80 - |> typecheck - |> shouldSucceed + |> typecheck + |> shouldSucceed [] let ``DotLambda does NOT generalize automatically to a member based SRTP`` () = @@ -155,14 +155,14 @@ let ``DotLambda does NOT generalize automatically to a member based SRTP`` () = |> withLangVersion80 |> typecheck |> shouldFail - |> withDiagnostics [(Error 72, Line 1, Col 28, Line 1, Col 47, "The type of this expression could not be inferred before accessing its members. Add a type annotation, e.g. (expr: SomeType), to constrain the type before this point.")] + |> withDiagnostics [(Error 72, Line 1, Col 28, Line 1, Col 47, "The type of this expression could not be inferred before accessing its members. Add a type annotation, e.g. (expr: SomeType), to constrain the type before this point.")] [] let ``DotLambda does allow member based SRTP if labelled explicitly`` () = Fsx "let inline myFunc<'a when 'a:(member WhatANiceProperty: int)> (x: 'a) = x |> _.WhatANiceProperty " |> withLangVersion80 |> typecheck - |> shouldSucceed + |> shouldSucceed [] let ``ToString with preview version`` () = @@ -184,7 +184,7 @@ let c = ( _ :> obj) """ Error 10, Line 2, Col 20, Line 2, Col 21, "Unexpected symbol ')' in expression. Expected '.' or other token." Error 10, Line 3, Col 13, Line 3, Col 15, "Unexpected symbol ':>' in expression. Expected '.' or other token." Error 10, Line 4, Col 13, Line 4, Col 15, "Unexpected symbol ':>' in expression. Expected '.' or other token."] - + [] [] [ _.ToString() """)>] @@ -230,7 +230,7 @@ let a6 = [1] |> List.map _.ToString() [] let ``Regression 16318 Error on explicit generic type argument dot dot lambda`` () = - + FSharp """ module Regression type A() = @@ -244,7 +244,7 @@ let _ = [A()] |> Seq.map _.M() |> shouldSucceed [] -let ``Regression 16318 typeof dotlambda should fail`` () = +let ``Regression 16318 typeof dotlambda should fail`` () = FSharp """ let x = _.typeof""" |> withLangVersion80 |> typecheck @@ -261,10 +261,10 @@ let a : string = {| Inner = (fun x -> x.ToString()) |} |> _.Inner([5] |> _.[0]) |> withWarnOn 3570 |> typecheck |> shouldFail - |> withDiagnostics [ - Warning 3570, Line 3, Col 75, Line 3, Col 76, "The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope." + |> withDiagnostics [ + Warning 3570, Line 3, Col 75, Line 3, Col 76, "The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope." Error 3584, Line 3, Col 77, Line 3, Col 80, "Shorthand lambda syntax is only supported for atomic expressions, such as method, property, field or indexer on the implied '_' argument. For example: 'let f = _.Length'." ] - + [] let ``Anonymous unary function shorthand with conflicting wild argument`` () = FSharp """ @@ -278,7 +278,7 @@ let c : string = let _ = "test" in "asd" |> _.ToString() |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3570, Line 3, Col 43, Line 3, Col 44, "The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope.") - + [] let ``DotLambda selector converted to Func when used in LINQ`` () = FSharp """open System.Linq diff --git a/tests/FSharp.Compiler.ComponentTests/Language/DynamicAssignmentOperatorTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/DynamicAssignmentOperatorTests.fs index 6808519b9a8..aaa750be572 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/DynamicAssignmentOperatorTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/DynamicAssignmentOperatorTests.fs @@ -11,7 +11,7 @@ module DynamicAssignmentOperatorTests = [] [] [] - let ``Implementing dynamic assignment operator does not produce a warning`` version = + let ``Implementing dynamic assignment operator does not produce a warning`` version = Fsx """ type T = T with static member inline (?<-) (f, x, y) = f x y diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ExperimentalAttributeCheckingTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ExperimentalAttributeCheckingTests.fs index a6ad6717df9..298c8fb404c 100755 --- a/tests/FSharp.Compiler.ComponentTests/Language/ExperimentalAttributeCheckingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ExperimentalAttributeCheckingTests.fs @@ -5,7 +5,7 @@ open FSharp.Test.Compiler open FSharp.Test module ExperimentalAttributeCheckingTests = - + [] let ``C# Experimental(diagnosticId) attribute warning is taken into account`` () = @@ -121,4 +121,3 @@ module TestModule = |> withDiagnostics [ (Warning 57, Line 7, Col 8, Line 7, Col 17, """This construct is experimental. Preview library feature, requires '--langversion:preview'. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'.""") ] - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ExtensionMethodTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ExtensionMethodTests.fs index 771b4d17bb2..128fd34b705 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ExtensionMethodTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ExtensionMethodTests.fs @@ -38,7 +38,7 @@ let f (b:int) = b.PlusOne() |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Extension method without toplevel attribute on recursive type`` () = Fsx @@ -57,7 +57,7 @@ let f (b:int) = b.PlusOne() |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``F# CSharpStyleExtensionMethod consumed in C#`` () = let fsharp = @@ -134,7 +134,7 @@ namespace Consumer |> withReferences [ fsharp ] csharp |> compile |> shouldSucceed - + [] let ``F# CSharpStyleExtensionMethod defined in top level module with attribute consumed in C#`` () = let fsharp = @@ -222,7 +222,7 @@ namespace Consumer """ |> withLangVersion80 |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -241,7 +241,7 @@ namespace Consumer |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed [] @@ -255,7 +255,7 @@ namespace Consumer """ |> withLangVersion80 |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -274,7 +274,7 @@ namespace Consumer |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed [] @@ -289,7 +289,7 @@ namespace Consumer """ |> withLangVersion80 |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -308,9 +308,9 @@ namespace Consumer |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed - + [] let ``Recursive toplevel named module without Extension attribute and top level let binding with Extension attribute`` () = let fsharp = @@ -322,7 +322,7 @@ namespace Consumer """ |> withLangVersion80 |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -341,7 +341,7 @@ namespace Consumer |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed [] @@ -357,7 +357,7 @@ type Bar = """ |> withLangVersion80 |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -375,9 +375,9 @@ type Bar = """ |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed - + [] let ``Recursive named module with type with CSharp style extension can be consumed in CSharp`` () = let fsharp = @@ -390,7 +390,7 @@ type Bar = """ |> withLangVersion80 |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -408,7 +408,7 @@ type Bar = """ |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed [] @@ -441,7 +441,7 @@ type Bar = |> withLangVersion80 |> withAdditionalSourceFile implementation |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -459,7 +459,7 @@ type Bar = """ |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed [] @@ -492,7 +492,7 @@ type Bar = |> withLangVersion80 |> withAdditionalSourceFile implementation |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -510,7 +510,7 @@ type Bar = """ |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed [] @@ -527,7 +527,7 @@ type Bar = """ |> withLangVersion80 |> withName "FSLib" - + let csharp = CSharp """ namespace Consumer @@ -546,7 +546,7 @@ type Bar = |> withName "CSLib" |> withReferences [ fsharp ] - + csharp |> compile |> shouldSucceed [] @@ -569,7 +569,7 @@ namespace CSharpLib { } """ |> withName "CSLib" - + let fsharp = FSharp """ module Module @@ -585,9 +585,9 @@ module M = |> withLangVersion80 |> withName "FSLib" |> withReferences [ csharp ] - + fsharp |> compile |> shouldSucceed - + [] let ``F# CSharpStyleExtensionMethod consumed in F#`` () = let producer = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs index 2fba7454498..846ac7f1402 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs @@ -16,7 +16,7 @@ module FixedBindingsTests = (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] let ``Pin naked array`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedArray.fs") @@ -28,7 +28,7 @@ module FixedBindingsTests = (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] let ``Pin naked array with mismatching type`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedArrayWithMismatchingType.fs") @@ -43,7 +43,7 @@ but given a 'nativeptr' The type 'int' does not match the type 'byte'""") ] - + [] let ``Pin naked string with mismatching type`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedStringWithMismatchingType.fs") @@ -58,7 +58,7 @@ but given a 'nativeptr' The type 'char' does not match the type 'byte'""") ] - + [] let ``Pin naked Tuple -- illegal`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedTuple.fs") @@ -69,7 +69,7 @@ The type 'char' does not match the type 'byte'""") (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Error 3207, Line 5, Col 9, Line 5, Col 12, """Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is one of the following: an array, the address of an array element, a string, a byref, an inref, or a type implementing GetPinnableReference()""") ] - + [] let ``Pin naked ValueTuple -- illegal`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedValueTuple.fs") @@ -80,7 +80,7 @@ The type 'char' does not match the type 'byte'""") (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Error 3207, Line 5, Col 9, Line 5, Col 12, """Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is one of the following: an array, the address of an array element, a string, a byref, an inref, or a type implementing GetPinnableReference()""") ] - + [] let ``Pin naked discriminated union -- illegal`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedDU.fs") @@ -91,7 +91,7 @@ The type 'char' does not match the type 'byte'""") (Warning 9, Line 7, Col 9, Line 7, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Error 3207, Line 7, Col 9, Line 7, Col 12, """Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is one of the following: an array, the address of an array element, a string, a byref, an inref, or a type implementing GetPinnableReference()""") ] - + [] let ``Pin naked struct discriminated union -- illegal`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinNakedStructDU.fs") @@ -102,7 +102,7 @@ The type 'char' does not match the type 'byte'""") (Warning 9, Line 8, Col 9, Line 8, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Error 3207, Line 8, Col 9, Line 8, Col 12, """Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is one of the following: an array, the address of an array element, a string, a byref, an inref, or a type implementing GetPinnableReference()""") ] - + [] let ``Pin address of array element`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinAddressOfArrayElement.fs") @@ -114,7 +114,7 @@ The type 'char' does not match the type 'byte'""") (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] let ``Pin address of record field`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinAddressOfRecordField.fs") @@ -126,7 +126,7 @@ The type 'char' does not match the type 'byte'""") (Warning 9, Line 7, Col 9, Line 7, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 8, Col 5, Line 8, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] let ``Pin address of explicit field on this`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinAddressOfExplicitFieldOnThis.fs") @@ -149,7 +149,7 @@ The type 'char' does not match the type 'byte'""") (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Error 3207, Line 5, Col 9, Line 5, Col 12, """Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is one of the following: an array, the address of an array element, a string, a byref, an inref, or a type implementing GetPinnableReference()""") ] - + [] let ``Pin naked int - illegal`` () = @@ -172,7 +172,7 @@ The type 'char' does not match the type 'byte'""") (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Error 3207, Line 5, Col 9, Line 5, Col 12, """Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is one of the following: an array, the address of an array element, a string, a byref, an inref, or a type implementing GetPinnableReference()""") ] - + [] let ``Pin generic with unmanaged - illegal`` () = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinGenericWithUnmanagedConstraint.fs") @@ -198,7 +198,7 @@ module ExtendedFixedBindings = (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] [] let ``Pin int inref parameter`` langVersion = @@ -211,7 +211,7 @@ module ExtendedFixedBindings = (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] [] let ``Pin int outref parameter`` langVersion = @@ -224,7 +224,7 @@ module ExtendedFixedBindings = (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] [] let ``Pin address of explicit field on this with default constructor class syntax`` langVersion = @@ -239,7 +239,7 @@ module ExtendedFixedBindings = (Warning 9, Line 8, Col 13, Line 8, Col 16, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 9, Col 9, Line 9, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] [] let ``Pin int byref local variable`` langVersion = @@ -267,7 +267,7 @@ module ExtendedFixedBindings = (Warning 9, Line 7, Col 5, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] #endif - + [] [] let ``Pin custom struct byref type without GetPinnableReference method - illegal`` langVersion = @@ -293,7 +293,7 @@ module ExtendedFixedBindings = (Warning 9, Line 9, Col 9, Line 9, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 10, Col 5, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] [] let ``Pin type with method GetPinnableReference : unit -> inref`` langVersion = @@ -306,7 +306,7 @@ module ExtendedFixedBindings = (Warning 9, Line 9, Col 9, Line 9, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 10, Col 5, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] [] let ``Pin type with extension method GetPinnableReference : unit -> byref`` langVersion = @@ -319,7 +319,7 @@ module ExtendedFixedBindings = (Warning 9, Line 13, Col 9, Line 13, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 14, Col 5, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] [] let ``Pin type with method GetPinnableReference with parameters - illegal`` langVersion = @@ -358,7 +358,7 @@ module ExtendedFixedBindings = (Warning 9, Line 11, Col 9, Line 11, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") (Warning 9, Line 12, Col 5, Line 12, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] - + [] [] let ``Pin type with private method GetPinnableReference - illegal`` langVersion = @@ -400,7 +400,7 @@ but given a 'nativeptr' The type 'int' does not match the type 'char'") ] - + [] [] let ``Pin type with mismatching extension GetPinnableReference return type`` langVersion = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinAddressOfExplicitFieldOnThis.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinAddressOfExplicitFieldOnThis.fs index 6215bccc864..6a71eac5738 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinAddressOfExplicitFieldOnThis.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinAddressOfExplicitFieldOnThis.fs @@ -4,9 +4,9 @@ open Microsoft.FSharp.NativeInterop type Point = val mutable X: int val mutable Y: int - + new(x: int, y: int) = { X = x; Y = y } - + member this.PinIt() = use ptr = fixed &this.X NativePtr.get ptr 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinAddressOfExplicitFieldOnThisWithDefaultCtorClassSyntax.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinAddressOfExplicitFieldOnThisWithDefaultCtorClassSyntax.fs index 88153fed1ce..0fd6ba82691 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinAddressOfExplicitFieldOnThisWithDefaultCtorClassSyntax.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinAddressOfExplicitFieldOnThisWithDefaultCtorClassSyntax.fs @@ -3,7 +3,7 @@ open Microsoft.FSharp.NativeInterop type Point() = let mutable value = 42 - + member this.PinIt() = let ptr = fixed &value NativePtr.get ptr 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithExtensionGetPinnableReferenceReturningByref.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithExtensionGetPinnableReferenceReturningByref.fs index c71f42eeb32..17a2f400cc5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithExtensionGetPinnableReferenceReturningByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithExtensionGetPinnableReferenceReturningByref.fs @@ -7,7 +7,7 @@ type RefField<'T> = { mutable _value: 'T } [] type RefFieldExtensions = [] - static member GetPinnableReference(refField: RefField<'T>) : byref<'T> = &refField._value + static member GetPinnableReference(refField: RefField<'T>) : byref<'T> = &refField._value let pinIt (thing: RefField<'T>) = use ptr = fixed thing diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithGetPinnableReferenceReturningByref.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithGetPinnableReferenceReturningByref.fs index bf5981d0657..9752e01db39 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithGetPinnableReferenceReturningByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithGetPinnableReferenceReturningByref.fs @@ -2,7 +2,7 @@ module FixedBindings open Microsoft.FSharp.NativeInterop type RefField<'T>(_value) = - let mutable _value = _value + let mutable _value = _value member this.GetPinnableReference () : byref<'T> = &_value let pinIt (thing: RefField<'T>) = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithGetPinnableReferenceReturningInref.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithGetPinnableReferenceReturningInref.fs index 79f298d5809..300256a577c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithGetPinnableReferenceReturningInref.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithGetPinnableReferenceReturningInref.fs @@ -2,7 +2,7 @@ module FixedBindings open Microsoft.FSharp.NativeInterop type RefField<'T>(_value) = - let mutable _value = _value + let mutable _value = _value member this.GetPinnableReference () : inref<'T> = &_value let pinIt (thing: RefField<'T>) = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithMismatchingExtensionGetPinnableReferenceReturnType.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithMismatchingExtensionGetPinnableReferenceReturnType.fs index c71f42eeb32..17a2f400cc5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithMismatchingExtensionGetPinnableReferenceReturnType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithMismatchingExtensionGetPinnableReferenceReturnType.fs @@ -7,7 +7,7 @@ type RefField<'T> = { mutable _value: 'T } [] type RefFieldExtensions = [] - static member GetPinnableReference(refField: RefField<'T>) : byref<'T> = &refField._value + static member GetPinnableReference(refField: RefField<'T>) : byref<'T> = &refField._value let pinIt (thing: RefField<'T>) = use ptr = fixed thing diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithValidAndInvalidGetPinnableReferenceOverloads.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithValidAndInvalidGetPinnableReferenceOverloads.fs index be1242b4525..0fac8e29acf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithValidAndInvalidGetPinnableReferenceOverloads.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/PinTypeWithValidAndInvalidGetPinnableReferenceOverloads.fs @@ -2,7 +2,7 @@ module FixedBindings open Microsoft.FSharp.NativeInterop type RefField<'T>(_value) = - let mutable _value = _value + let mutable _value = _value member this.GetPinnableReference (x: int) : string = string x member this.GetPinnableReference (x: int, y: string) = string x + y member this.GetPinnableReference () : byref<'T> = &_value diff --git a/tests/FSharp.Compiler.ComponentTests/Language/InterpolatedStringsTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/InterpolatedStringsTests.fs index 6a1e194362d..270a3a51a09 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/InterpolatedStringsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/InterpolatedStringsTests.fs @@ -23,7 +23,7 @@ module InterpolatedStringsTests = |> withSingleDiagnostic (Error 1, Line 1, Col 15, Line 1, Col 28, "This expression was expected to have type" + Environment.NewLine + " 'byte' " + Environment.NewLine + "but here has type" + Environment.NewLine + " 'string' ") [] - let ``Interpolated String without holes properly typeckecks with explicit type on binding`` () = + let ``Interpolated String without holes properly typeckecks with explicit type on binding`` () = Fsx """ let a: obj = $"string" let b: System.IComparable = $"string" diff --git a/tests/FSharp.Compiler.ComponentTests/Language/NameofTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/NameofTests.fs index da6b7478c41..8a7fa44fc58 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/NameofTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/NameofTests.fs @@ -24,9 +24,9 @@ if actual <> expected then failwith $"Expected nameof({{expected}}) to be '{{exp |> withLangVersionPreview |> compileAndRun |> shouldSucceed - + [] - let ``nameof() with member of a generic type should return the name without types provided`` () = + let ``nameof() with member of a generic type should return the name without types provided`` () = let source = $""" type A<'a>() = static member P = () @@ -41,12 +41,12 @@ if actual <> expected then failwith $"Expected nameof({{expected}}) to be '{{exp |> ignoreWarnings |> compileAndRun |> shouldSucceed - + [] [] [] [] - let ``nameof() with member of a generic type should return the name`` numberOfGenericParameters = + let ``nameof() with member of a generic type should return the name`` numberOfGenericParameters = let source = $""" type A<{(seq {for i in 1 .. numberOfGenericParameters -> "'a" + string i } |> String.concat ", ")}>() = static member P = () @@ -62,7 +62,7 @@ if actual <> expected then failwith $"Expected nameof({{expected}}) to be '{{exp |> shouldSucceed [] - let ``nameof() in a pattern should return the correct type`` () = + let ``nameof() in a pattern should return the correct type`` () = let source = $""" open Microsoft.FSharp.Reflection let f x = match x with nameof x -> true | _ -> false @@ -86,7 +86,7 @@ if actual <> expected then failwith $"Expected type to be '{{expected}}', but go [] - let ``nameof works for pattern matching of DU case names`` () = + let ``nameof works for pattern matching of DU case names`` () = let source = """ /// Simplified version of EventStore's API type RecordedEvent = { EventType: string; Data: string } diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/EventNullnessTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/EventNullnessTests.fs index a89fbd0762a..fdb0c1b1ae6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/EventNullnessTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/EventNullnessTests.fs @@ -5,7 +5,7 @@ open FSharp.Test.Compiler // Test for https://github.com/dotnet/fsharp/issues/18361 // INotifyPropertyChanged CLIEvent causes FS3261 nullness warning -// +// // Fixed: The compiler now correctly handles delegate nullness in CLIEvent properties. [] let ``INotifyPropertyChanged CLIEvent should not produce nullness warning`` () = @@ -30,7 +30,7 @@ type XViewModel() = // Test for https://github.com/dotnet/fsharp/issues/18349 // ICommand CLIEvent CanExecuteChanged causes FS3261 nullness warning -// +// // Fixed: The compiler now correctly handles delegate nullness in CLIEvent properties. [] let ``ICommand CanExecuteChanged CLIEvent should not produce nullness warning`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs index f3900c89b38..b3d94217e57 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs @@ -17,7 +17,7 @@ let typeCheckWithStrictNullness cu = [] -let ``Passing null to IlGenerator BeginCatchBlock is fine`` () = +let ``Passing null to IlGenerator BeginCatchBlock is fine`` () = FSharp """module MyLibrary open System.Reflection.Emit open System @@ -39,7 +39,7 @@ let doSomethingAboutIt (ilg:ILGenerator) = |> shouldSucceed [] -let ``Consuming C# generic API which allows struct and yet uses question mark on the typar`` () = +let ``Consuming C# generic API which allows struct and yet uses question mark on the typar`` () = FSharp """module MyLibrary let ec = { new System.Collections.Generic.IEqualityComparer with @@ -51,7 +51,7 @@ let ec = |> shouldSucceed [] -let ``TypeBuilder CreateTypeInfo with an upcast`` () = +let ``TypeBuilder CreateTypeInfo with an upcast`` () = FSharp """module MyLibrary open System open System.Reflection.Emit @@ -64,7 +64,7 @@ let createType (typB:TypeBuilder) : Type= |> shouldSucceed [] -let ``CurrentDomain ProcessExit add to event`` () = +let ``CurrentDomain ProcessExit add to event`` () = FSharp """module MyLibrary open System @@ -75,7 +75,7 @@ do System.AppDomain.CurrentDomain.ProcessExit |> Event.add (fun args -> failwith |> shouldSucceed [] -let ``Consuming C# extension methods which allow nullable this`` () = +let ``Consuming C# extension methods which allow nullable this`` () = FSharp """module MyLibrary open System @@ -95,7 +95,7 @@ let asMemoryOnNull : Memory = |> shouldSucceed [] -let ``Consuming LinkedList First and Last should warn about nullness`` () = +let ``Consuming LinkedList First and Last should warn about nullness`` () = FSharp """module MyLibrary let ll = new System.Collections.Generic.LinkedList() @@ -105,14 +105,14 @@ let y:System.Collections.Generic.LinkedListNode = ll.First |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3261, Line 4, Col 59, Line 4, Col 66, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." Error 3261, Line 4, Col 59, Line 4, Col 66, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." Error 3261, Line 5, Col 59, Line 5, Col 67, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." Error 3261, Line 5, Col 59, Line 5, Col 67, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] [] -let ``Nullable directory info show warn on prop access`` () = +let ``Nullable directory info show warn on prop access`` () = FSharp """module MyLibrary open System.IO open System @@ -126,7 +126,7 @@ let s : string = d.Name // should warn here!! |> withDiagnostics [Error 3261, Line 6, Col 18, Line 6, Col 19, "Nullness warning: Possible dereference of a null value when accessing member 'Name' on the nullable value 'd' of type 'DirectoryInfo | null'."] [] -let ``Consumption of netstandard2 BCL api which is not annotated`` () = +let ``Consumption of netstandard2 BCL api which is not annotated`` () = FSharp """module MyLibrary open System.Reflection @@ -225,8 +225,8 @@ let ``Consumption of nullable C# - no generics, just strings in methods and fiel Error 3261, Line 25, Col 85, Line 25, Col 97, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." Error 3261, Line 28, Col 99, Line 28, Col 111, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." Error 3261, Line 30, Col 97, Line 30, Col 109, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression."] - - + + [] let ``Regression 17701 - Nullable value type with nested generics`` () = let csharpLib = @@ -250,14 +250,14 @@ let firstString = (toOption.Value |> Seq.head) let lengthOfIt = firstString.Length let theOtherOne = NullableClass.nullableImmArrayOfNotNullStrings - """ + """ |> asLibrary |> withReferences [csharpLib] |> withStrictNullness |> withLangVersion10 |> compile |> shouldFail - |> withDiagnostics + |> withDiagnostics [Error 3261, Line 7, Col 18, Line 7, Col 29, "Nullness warning: Possible dereference of a null value when accessing member 'Length' on the nullable value 'firstString' of type 'string | null'."] // https://github.com/dotnet/fsharp/issues/17734#issuecomment-5197965168 diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableLibraryConstructsTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableLibraryConstructsTests.fs index e9542620f7a..db793dbe1c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableLibraryConstructsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableLibraryConstructsTests.fs @@ -12,7 +12,7 @@ let typeCheckWithStrictNullness cu = |> typecheck [] -let ``Can unsafely forgive null using Unchecked nonNull function`` () = +let ``Can unsafely forgive null using Unchecked nonNull function`` () = FSharp """module MyLibrary let readAllLines (reader:System.IO.StreamReader) : seq = @@ -26,7 +26,7 @@ let readAllLines (reader:System.IO.StreamReader) : seq = |> shouldSucceed [] -let ``Can unsafely forgive null using Unchecked NonNullQuick active pattern`` () = +let ``Can unsafely forgive null using Unchecked NonNullQuick active pattern`` () = FSharp """module MyLibrary let readAllLines (reader:System.IO.StreamReader) : seq = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs index ee1ea4039b6..5b7a883d8b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs @@ -27,7 +27,7 @@ let ``Can imply notstruct for classconstraint`` () = """ |> asLibrary |> typecheck // This has nullable off! - |> shouldSucceed + |> shouldSucceed [] let ``Warning on nullness hidden behind interface upcast`` () = @@ -65,7 +65,7 @@ let main _args = |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3265, Line 8, Col 13, Line 8, Col 60, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for '{| x: int |}'. Nullness warnings won't be reported correctly for such types." Error 3265, Line 11, Col 13, Line 11, Col 50, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for '{| x: int |}'. Nullness warnings won't be reported correctly for such types." Error 3261, Line 15, Col 14, Line 15, Col 17, "Nullness warning: The types 'R' and 'R | null' do not have compatible nullability."] @@ -101,14 +101,14 @@ let main _args = |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3265, Line 13, Col 13, Line 13, Col 60, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for '{| x: int |}'. Nullness warnings won't be reported correctly for such types." Error 3265, Line 14, Col 13, Line 14, Col 51, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for 'System.Int32'. Nullness warnings won't be reported correctly for such types." Error 3265, Line 15, Col 13, Line 15, Col 59, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for 'int * float'. Nullness warnings won't be reported correctly for such types." Error 3265, Line 16, Col 13, Line 16, Col 67, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for 'struct (int * float)'. Nullness warnings won't be reported correctly for such types." Error 3265, Line 17, Col 13, Line 17, Col 57, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for 'int'. Nullness warnings won't be reported correctly for such types." Error 3265, Line 18, Col 13, Line 18, Col 57, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for 'int'. Nullness warnings won't be reported correctly for such types."] - + @@ -124,13 +124,13 @@ let parsedDate3 = DateTime.Parse(null) |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [Error 3261, Line 3, Col 18, Line 3, Col 52, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." Error 3261, Line 4, Col 33, Line 4, Col 50, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." Error 3261, Line 5, Col 19, Line 5, Col 39, "Nullness warning: The type 'string' does not support 'null'."] [] -let ``Downcasts and typetests with nullables``() = +let ``Downcasts and typetests with nullables``() = FSharp """module MyLib type AB = A | B @@ -317,7 +317,7 @@ Test.XString("x":(string|null)) |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3261, Line 7, Col 8, Line 7, Col 9, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." Error 3261, Line 7, Col 1, Line 7, Col 9, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 8, Col 17, Line 8, Col 18, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." @@ -353,12 +353,12 @@ let result8 = genericWithNull ("":(obj|null)) |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 43, Line 8, Col 34, Line 8, Col 38, "The constraints 'null' and 'not null' are inconsistent" Error 3261, Line 9, Col 35, Line 9, Col 48, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." Error 3261, Line 12, Col 35, Line 12, Col 54, "Nullness warning: The type 'string | null' supports 'null' but a non-null type is expected."] - + [] let ``Cannot pass possibly null value to a strict function``() = FSharp """ @@ -371,7 +371,7 @@ let nonStrictFunc(x:string | null) = strictFunc(x) |> shouldFail |> withDiagnostics [ Error 3261, Line 4, Col 49, Line 4, Col 50, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression."] - + [] let ``Can have nullable prop of same type T within a custom type T``() = FSharp """ @@ -514,7 +514,7 @@ let %s{inln} f (x %s{xArg}) = |> shouldSucceed [] -let ``Mutable string binding initially assigned to null should not need type annotation``() = +let ``Mutable string binding initially assigned to null should not need type annotation``() = FSharp """ module MyLib @@ -528,7 +528,7 @@ cache <- name |> shouldSucceed [] -let ``Mutable string binding assigned to null and matched against null``() = +let ``Mutable string binding assigned to null and matched against null``() = FSharp """ module MyLib @@ -553,7 +553,7 @@ match cache with |> shouldSucceed [] -let ``Mutable cache binding initially assigned to null should not need type annotation``() = +let ``Mutable cache binding initially assigned to null should not need type annotation``() = FSharp """ module MyLib open System.Collections.Concurrent @@ -584,7 +584,7 @@ let mkCacheInt32 () = |> shouldSucceed [] -let ``Can infer underscore or null``() = +let ``Can infer underscore or null``() = FSharp """ module MyLib let iAcceptNullPartiallyInferred(arg: _ | null) = 42 @@ -595,7 +595,7 @@ let iHaveMissingContraint(arg: 'a | null) = 42 |> shouldSucceed [] -let ``Invalid usages of WithNull syntax``() = +let ``Invalid usages of WithNull syntax``() = FSharp """ module MyLib let f1(x: option | null) = () @@ -608,7 +608,7 @@ let f6(x: 'a | null when 'a:null) = () |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3261, Line 3, Col 11, Line 3, Col 32, "Nullness warning: The type 'string option' uses 'null' as a representation value but a non-null type is expected." Error 3260, Line 4, Col 11, Line 4, Col 21, "The type 'int' does not support a nullness qualification." Error 43, Line 4, Col 11, Line 4, Col 21, "A generic construct requires that the type 'int' have reference semantics, but it does not, i.e. it is a struct" @@ -618,7 +618,7 @@ let f6(x: 'a | null when 'a:null) = () Error 43, Line 8, Col 26, Line 8, Col 33, "The constraints 'null' and 'not null' are inconsistent"] [] -let ``Boolean literal to string is not nullable`` () = +let ``Boolean literal to string is not nullable`` () = FSharp """module MyLibrary let onlyWantNotNullString(x:string) = () @@ -634,7 +634,7 @@ let processBool () : string = |> shouldSucceed [] -let ``Boolean to string is not nullable`` () = +let ``Boolean to string is not nullable`` () = FSharp """module MyLibrary let onlyWantNotNullString(x:string) = () @@ -661,7 +661,7 @@ type MyCustomType with override x.ToString() = null """ -let toStringCodeSnippet myTypeDef = +let toStringCodeSnippet myTypeDef = FSharp $"""module MyLibrary type MyCustomType = {myTypeDef} @@ -685,14 +685,14 @@ let processBool (x:MyCustomType) = [] [] [] -let ``Generated ToString() methods are not nullable`` (myTypeDef) = +let ``Generated ToString() methods are not nullable`` (myTypeDef) = toStringCodeSnippet myTypeDef |> shouldSucceed [] [] [] -let ``ToString override warns if it returns nullable`` (myTypeDef) = +let ``ToString override warns if it returns nullable`` (myTypeDef) = toStringCodeSnippet myTypeDef |> shouldFail |> withDiagnosticMessage "With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function." @@ -759,7 +759,7 @@ let main _ = |> withStdOutContains expected [] -let ``Printing a nullable string should pass`` () = +let ``Printing a nullable string should pass`` () = FSharp """module MyLibrary let maybeNull : string | null = null let nonNullString = "abc" @@ -777,7 +777,7 @@ let sprintfnNullLiteral = sprintf "This is null: %s" null [] -let ``Printing a nullable object should pass`` () = +let ``Printing a nullable object should pass`` () = FSharp """module MyLibrary let maybeNull : string | null = null let maybeUri : System.Uri | null = null @@ -790,7 +790,7 @@ let printViaO = sprintf "This is null: %O and this is null %O and this is not nu [] -let ``Printing a nullable array via percent A should pass`` () = +let ``Printing a nullable array via percent A should pass`` () = FSharp """module MyLibrary let maybeArray : ((string array) | null) = null let arrayOfMaybes : ((string | null) array ) = [|null|] @@ -801,7 +801,7 @@ let printViaA = sprintf "This is null: %A and this has null inside %A" maybeArra |> shouldSucceed [] -let ``Type inference with sprintfn`` () = +let ``Type inference with sprintfn`` () = FSharp """module MyLibrary let needsString(x:string) = () @@ -814,7 +814,7 @@ let myTopFunction inferredVal = |> shouldSucceed [] -let ``WhatIf the format itself is null`` () = +let ``WhatIf the format itself is null`` () = FSharp """module MyLibrary [] let thisCannotBeAFormat : string | null = null @@ -834,7 +834,7 @@ let doStuff() = |> shouldSucceed [] -let ``Match null on two strings`` () = +let ``Match null on two strings`` () = FSharp """module MyLibrary let len2r (str1: string | null) (str2: string | null) = match str1, str2 with @@ -853,7 +853,7 @@ let len2r (str1: string | null) (str2: string | null) = [] [] [] -let ``Eliminate nullness after matching`` (tp) = +let ``Eliminate nullness after matching`` (tp) = FSharp $"""module MyLibrary let myFunction (input : string | null) : string = @@ -868,7 +868,7 @@ let myFunction (input : string | null) : string = [] [] [] -let ``Eliminate tupled nullness after matching`` (tp) = +let ``Eliminate tupled nullness after matching`` (tp) = FSharp $"""module MyLibrary let myFunction (input1 : string | null) (input2 : string | null): (string*string) = @@ -888,7 +888,7 @@ let myFunction (input1 : string | null) (input2 : string | null): (string*string [] [] [] -let ``Should NOT eliminate tupled nullness after matching`` (tp) = +let ``Should NOT eliminate tupled nullness after matching`` (tp) = FSharp $"""module MyLibrary let myFunction (input1 : string | null) (input2 : string | null): (string*string) = @@ -902,7 +902,7 @@ let myFunction (input1 : string | null) (input2 : string | null): (string*string |> withErrorCode 3261 [] -let ``Eliminate aliased nullness after matching`` () = +let ``Eliminate aliased nullness after matching`` () = FSharp $"""module MyLibrary type Maybe<'T when 'T:not struct> = 'T | null @@ -915,9 +915,9 @@ let myFunction (input : string Maybe) : string = |> asLibrary |> typeCheckWithStrictNullness |> shouldSucceed - + [] -let ``WithNull used on anon type`` () = +let ``WithNull used on anon type`` () = FSharp """module MyLibrary let maybeAnon : _ | null = {|Hello="there"|} @@ -926,13 +926,13 @@ let maybeAnon2 : {|Hello:string|} | null = null |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3260, Line 4, Col 18, Line 4, Col 41, "The type '{| Hello: string |}' does not support a nullness qualification." Error 43, Line 4, Col 44, Line 4, Col 48, "The type '{| Hello: string |}' does not have 'null' as a proper value"] - - + + [] -let ``WithNull on a DU`` () = +let ``WithNull on a DU`` () = FSharp """module MyLibrary type MyDu = A | B @@ -963,9 +963,9 @@ looseFunc(maybeDu2) |> ignore |> withDiagnostics [ Error 3261, Line 18, Col 12, Line 18, Col 19, "Nullness warning: The type 'MyDu | null' supports 'null' but a non-null type is expected." Error 3261, Line 19, Col 12, Line 19, Col 20, "Nullness warning: The type ''a | null' supports 'null' but a non-null type is expected."] - + [] -let ``Strict func handling of obj type`` () = +let ``Strict func handling of obj type`` () = FSharp """module MyLibrary let strictFunc(arg: 'x when 'x : not null) = printfn "%s" (arg.ToString()) @@ -978,15 +978,15 @@ strictFunc(null:(string|null)) |> ignore |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3261, Line 6, Col 12, Line 6, Col 16, "Nullness warning: The type 'obj' does not support 'null'." Error 3261, Line 7, Col 12, Line 7, Col 27, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." Error 3261, Line 8, Col 12, Line 8, Col 30, "Nullness warning: The type 'string | null' supports 'null' but a non-null type is expected."] - - + + [] -let ``Strict func null literal`` () = +let ``Strict func null literal`` () = FSharp """module MyLibrary let strictFunc(arg: 'x when 'x : not null) = printfn "%s" (arg.ToString()) @@ -994,11 +994,11 @@ strictFunc(null) |> ignore """ |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 43, Line 4, Col 12, Line 4, Col 16, "The constraints 'null' and 'not null' are inconsistent"] - + [] -let ``Strict func null literal2`` () = +let ``Strict func null literal2`` () = FSharp """module MyLibrary let strictFunc(arg: 'x when 'x : not null) = printfn "%s" (arg.ToString()) @@ -1008,9 +1008,9 @@ strictFunc("hi") |> ignore """ |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 43, Line 4, Col 12, Line 4, Col 16, "The constraints 'null' and 'not null' are inconsistent"] - + [] let ``Supports null in generic code`` () = FSharp """module MyLibrary @@ -1071,7 +1071,7 @@ myNullReturningFunction myValOfY |> ignore |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [Error 3261, Line 17, Col 25, Line 17, Col 34, "Nullness warning: The type 'string' does not support 'null'." Error 193, Line 19, Col 26, Line 19, Col 45, "The type 'System.DateTime' does not have 'null' as a proper value" Error 1, Line 20, Col 25, Line 20, Col 36, "The type '{| Anon: 'a |}' does not have 'null' as a proper value" @@ -1091,13 +1091,13 @@ let test = |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [Error 1, Line 5, Col 7, Line 5, Col 9, "The type 'int' does not have 'null' as a proper value. See also test.fs(3,10)-(3,14)." Error 25, Line 3, Col 11, Line 3, Col 15, "Incomplete pattern matches on this expression."] - + [] -let ``Nullness support for F# types`` () = +let ``Nullness support for F# types`` () = FSharp """module MyLibrary type MyDu = A | B type MyRecord = {X:int;Y:string} @@ -1144,15 +1144,15 @@ looseFunc(maybeTuple2) |> ignore |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 43, Line 21, Col 12, Line 21, Col 16, "The constraints 'null' and 'not null' are inconsistent" Error 3260, Line 27, Col 18, Line 27, Col 34, "The type 'int * int' does not support a nullness qualification." Error 43, Line 27, Col 37, Line 27, Col 41, "The type 'int * int' does not have 'null' as a proper value" Error 3261, Line 29, Col 12, Line 29, Col 19, "Nullness warning: The type 'MyDu | null' supports 'null' but a non-null type is expected." Error 3261, Line 30, Col 12, Line 30, Col 21, "Nullness warning: The type 'MyRecord | null' supports 'null' but a non-null type is expected." Error 43, Line 40, Col 36, Line 40, Col 40, "The type 'Maybe' does not have 'null' as a proper value"] - - + + [] let ``Nullness support for flexible types`` () = FSharp """module MyLibrary @@ -1205,13 +1205,13 @@ let thisShouldAlsoWarn = MyRecord.Create(maybeNull) |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [Error 3261, Line 7, Col 38, Line 7, Col 42, "Nullness warning: The type 'string' does not support 'null'." Error 3261, Line 9, Col 42, Line 9, Col 51, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression."] [] -let ``Option ofObj should remove nullness when used in a function`` () = +let ``Option ofObj should remove nullness when used in a function`` () = FSharp """module MyLibrary let processOpt2 (s: string | null) : string option = Option.ofObj s""" |> asLibrary @@ -1219,7 +1219,7 @@ let processOpt2 (s: string | null) : string option = Option.ofObj s""" |> shouldSucceed [] -let ``Option ofObj should remove nullness when piping`` () = +let ``Option ofObj should remove nullness when piping`` () = FSharp """module MyLibrary let processOpt (s: string | null) : string option = let stringOpt = Option.ofObj s @@ -1231,7 +1231,7 @@ let processOpt3 (s: string | null) : string option = s |> Option.ofObj |> shouldSucceed [] -let ``Option ofObj called in a useless way raises warning`` () = +let ``Option ofObj called in a useless way raises warning`` () = FSharp """module MyLibrary let processOpt1 (s: string) = Option.ofObj s @@ -1244,14 +1244,14 @@ let processOpt3 (s: string) : string option = |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3262, Line 3, Col 44, Line 3, Col 45, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." Error 3262, Line 5, Col 18, Line 5, Col 19, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." Error 3262, Line 7, Col 29, Line 7, Col 30, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] -let ``Option ofObj called on a string literal`` () = +let ``Option ofObj called on a string literal`` () = FSharp """module MyLibrary let whatIsThis = Option.ofObj "abc123" """ @@ -1261,7 +1261,7 @@ let whatIsThis = Option.ofObj "abc123" |> withErrorCodes [3262] [] -let ``Option ofObj for PathGetDirectoryName`` () = +let ``Option ofObj for PathGetDirectoryName`` () = FSharp """module MyLibrary open System.IO @@ -1275,7 +1275,7 @@ let whatIsThis3 = Option.ofObj ("" |> Path.GetDirectoryName ) // Warnings were |> shouldSucceed [] -let ``Option ofObj with fully annotated nullsupportive func`` () = +let ``Option ofObj with fully annotated nullsupportive func`` () = FSharp """module MyLibrary let nullSupportiveFunc (x: string | null) : string | null = x @@ -1287,7 +1287,7 @@ let whatIsThis3 = Option.ofObj (maybePath |> nullSupportiveFunc) |> shouldSucceed [] -let ``Option ofObj with calling id inside`` () = +let ``Option ofObj with calling id inside`` () = FSharp """module MyLibrary let maybePath : string | null = null @@ -1298,7 +1298,7 @@ let whatIsThis5 = Option.ofObj (id maybePath) |> shouldSucceed [] -let ``Useless null pattern match`` () = +let ``Useless null pattern match`` () = FSharp """module MyLibrary let clearlyNotNull = "42" @@ -1313,7 +1313,7 @@ let mappedVal = |> withDiagnostics [Error 3261, Line 6, Col 7, Line 6, Col 11, "Nullness warning: The type 'string' does not support 'null'."] [] -let ``Useless usage of nonNull utility from fscore`` () = +let ``Useless usage of nonNull utility from fscore`` () = FSharp """module MyLibrary let clearlyNotNull = "42" @@ -1327,7 +1327,7 @@ let mappedMaybe = nonNull maybeNull |> withDiagnostics [Error 3262, Line 4, Col 25, Line 4, Col 39, "Value known to be without null passed to a function meant for nullables: You can remove this `nonNull` assertion."] [] -let ``Useless null check when used in piping`` () = +let ``Useless null check when used in piping`` () = FSharp """module MyLibrary let foo = "test" @@ -1339,7 +1339,7 @@ let bar = foo |> Option.ofObj // Should produce FS3262, but did not |> withDiagnostics [Error 3262, Line 4, Col 18, Line 4, Col 30, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] -let ``Useless null check when used in multi piping`` () = +let ``Useless null check when used in multi piping`` () = FSharp """module MyLibrary let myFunc whateverArg = @@ -1351,7 +1351,7 @@ let myFunc whateverArg = |> withDiagnostics [Error 3262, Line 4, Col 30, Line 4, Col 42, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] -let ``Useless null check when used in more exotic pipes`` () = +let ``Useless null check when used in more exotic pipes`` () = FSharp """module MyLibrary let functionComposition x = x |> (string >> Option.ofObj) @@ -1362,13 +1362,13 @@ let pointfree = intToint >> string >> Option.ofObj |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3262, Line 3, Col 45, Line 3, Col 57, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." Error 3262, Line 4, Col 60, Line 4, Col 61, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." Error 3262, Line 6, Col 39, Line 6, Col 51, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] -let ``Regression: Useless usage in nested calls`` () = +let ``Regression: Useless usage in nested calls`` () = FSharp """module MyLibrary open System.IO @@ -1380,7 +1380,7 @@ let meTry = Option.ofObj (Path.GetDirectoryName "") [] -let ``Useless usage of null active patterns from fscore`` () = +let ``Useless usage of null active patterns from fscore`` () = FSharp """module MyLibrary let clearlyNotNull = "42" @@ -1396,13 +1396,13 @@ let mapped2 = |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3262, Line 6, Col 7, Line 6, Col 24, "Value known to be without null passed to a function meant for nullables: You can remove this |NonNullQuick| pattern usage." Error 3262, Line 10, Col 6, Line 10, Col 10, "Value known to be without null passed to a function meant for nullables: You can remove this |Null|NonNull| pattern usage." Error 3262, Line 11, Col 6, Line 11, Col 15, "Value known to be without null passed to a function meant for nullables: You can remove this |Null|NonNull| pattern usage."] [] -let ``Obj can be passed to not null constrained methods`` () = +let ``Obj can be passed to not null constrained methods`` () = FSharp """module MyLibrary let objVal:(obj | null) = box 42 @@ -1418,8 +1418,8 @@ let mappableFunc = |> shouldSucceed [] -let ``Importing and processing contravariant interfaces`` () = - +let ``Importing and processing contravariant interfaces`` () = + FSharp """module MyLibrary open System @@ -1463,8 +1463,8 @@ let test<'T> () = [] [] [] -let ``Nullness in inheritance chain`` (returnExp:string) = - +let ``Nullness in inheritance chain`` (returnExp:string) = + FSharp $"""module MyLibrary [] @@ -1483,7 +1483,7 @@ type ListGenerator<'T>() = [] -let ``Notnull constraint and inline annotated value`` () = +let ``Notnull constraint and inline annotated value`` () = FSharp """module MyLibrary open System @@ -1501,7 +1501,7 @@ let v3WithNull = f3 (null: obj | null) |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics + |> withDiagnostics [ Error 3261, Line 6, Col 14, Line 6, Col 18, "Nullness warning: The type 'obj' does not support 'null'." Error 3261, Line 7, Col 14, Line 7, Col 33, "Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected." Error 3261, Line 8, Col 14, Line 8, Col 20, "Nullness warning: The type ''a option' uses 'null' as a representation value but a non-null type is expected." diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs index a7ff6c2e89b..794de64eed3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs @@ -11,7 +11,7 @@ let withVersionAndCheckNulls (version,checknulls) cu = |> withOptions ["--warnaserror+"] |> if checknulls then withCheckNulls else id - + [] [] [] @@ -21,8 +21,8 @@ let ``Micro compilation`` langVersion checknulls = FsFromPath (__SOURCE_DIRECTORY__ ++ "micro.fsi") |> withAdditionalSourceFile (SourceFromPath (__SOURCE_DIRECTORY__ ++ "micro.fs")) |> withLangVersion langVersion - |> fun x -> - if checknulls then + |> fun x -> + if checknulls then x |> withCheckNulls |> withDefines ["CHECKNULLS"] else x |> compile @@ -35,8 +35,8 @@ let ``Signature conformance`` langVersion checknulls = FsFromPath (__SOURCE_DIRECTORY__ ++ "signatures.fsi") |> withAdditionalSourceFile (SourceFromPath (__SOURCE_DIRECTORY__ ++ "signatures.fs")) |> withLangVersion langVersion - |> fun x -> - if checknulls then + |> fun x -> + if checknulls then x |> withCheckNulls |> withDefines ["CHECKNULLS"] else x |> compile @@ -72,70 +72,70 @@ let ``Signature conformance`` langVersion checknulls = [] let ``Existing positive v8 disabled`` compilation = compilation - |> withVersionAndCheckNulls ("8.0",false) + |> withVersionAndCheckNulls ("8.0",false) |> typecheck |> verifyBaseline [] let ``Existing positive vPreview disabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",false) + |> withVersionAndCheckNulls ("preview",false) |> typecheck |> verifyBaseline [] let ``Existing positive vPreview enabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",true) + |> withVersionAndCheckNulls ("preview",true) |> typecheck |> verifyBaseline [] let ``Existing negative v8 disabled`` compilation = compilation - |> withVersionAndCheckNulls ("8.0",false) + |> withVersionAndCheckNulls ("8.0",false) |> typecheck |> verifyBaseline [] let ``Existing negative vPreview disabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",false) + |> withVersionAndCheckNulls ("preview",false) |> typecheck |> verifyBaseline [] let ``Existing negative vPreview enabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",true) + |> withVersionAndCheckNulls ("preview",true) |> typecheck |> verifyBaseline [] let ``Library functions nullness disabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",false) + |> withVersionAndCheckNulls ("preview",false) |> typecheck |> verifyBaseline [] let ``Library functions nullness enabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",true) + |> withVersionAndCheckNulls ("preview",true) |> typecheck |> verifyBaseline [] let ``With new nullness syntax nullness disabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",false) + |> withVersionAndCheckNulls ("preview",false) |> typecheck |> verifyBaseline [] let ``DefaultValueBug when checknulls is disabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",false) + |> withVersionAndCheckNulls ("preview",false) |> typecheck |> verifyBaseline @@ -178,7 +178,7 @@ let ``Inference problem limit regression v8`` compilation = [] [] [] -let ``DefaultValue regression`` (version,checknulls,fullCompile) = +let ``DefaultValue regression`` (version,checknulls,fullCompile) = FSharp $""" module MyLib @@ -190,13 +190,13 @@ type C7 = |> asLibrary |> withVersionAndCheckNulls (version,checknulls) |> (if fullCompile then compile else typecheck) - |> fun x -> - if checknulls then + |> fun x -> + if checknulls then x |> shouldSucceed - else + else x |> shouldFail - |> withDiagnostics + |> withDiagnostics [(Error 444, Line 7, Col 17, Line 7, Col 23, "The type of a field using the 'DefaultValue' attribute must admit default initialization, i.e. have 'null' as a proper value or be a struct type whose fields all admit default initialization. You can use 'DefaultValue(false)' to disable this check")] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs index 2f46eb0370e..058029105c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs @@ -15,7 +15,7 @@ module NullConstraintTests = module DefaultValueTests = - module StructExamples = + module StructExamples = [] type C1 = [] @@ -36,7 +36,7 @@ module DefaultValueTests = [] val mutable Whoops : int -> int // This gave an error in F# 4.5 and we expect it to continue to give an error - module ClassExamples = + module ClassExamples = type C4a = [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs index 727a1a8b69d..fcd5015380b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs @@ -20,15 +20,15 @@ module Extractions0d = let f<'T when 'T : null> (x: 'T, y: 'T) = () let result = f (x, "") //The type 'string' does not support 'null'. -module Basics = +module Basics = let x1 : String = null // expect a warning when checknulls is on let x4 : String = "" -module Basics2 = +module Basics2 = let f1 () = null let f8 () : String = null // expect a warning when checknulls is on -type C(s: String) = +type C(s: String) = member __.Value = s module InteropBasics = @@ -43,9 +43,9 @@ module InteropBasics = System.Console.WriteLine("a") System.Console.WriteLine("a", (null: obj[])) // expect a warning when checknulls is on -let f0 line = +let f0 line = let add (s:String) = () - match line with + match line with | null | "" -> () //The type 'string' does not support 'null'. | _ -> add line @@ -56,14 +56,14 @@ module NullConstraintTests = module DefaultValueTests = - module StructExamples = + module StructExamples = [] type C2 = [] val mutable Whoops : String // expect no warning or error under any configuration - module ClassExamples = + module ClassExamples = type C2 = [] val mutable Whoops : String // expect no warning or error under any configuration diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/inference-problem-size-explosion.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/inference-problem-size-explosion.fs index e40f8177094..c181c2e87f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/inference-problem-size-explosion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/inference-problem-size-explosion.fs @@ -8,7 +8,7 @@ type ToSeq = static member inline ToSeq (x: 'Foldable , _: ToSeq) = (^Foldable: (static member ToSeq : _ -> _) x) static member inline ToSeq (_: 'T when 'T: null and 'T: struct, _: ToSeq) = () -type Append = +type Append = static member inline Append (x: 'AltT , y: 'AltT , _: obj ) = (^AltT : (static member Append : _*_ -> _) x, y) : 'AltT static member inline Append (_: ^t when ^t: null and ^t: struct, _, _: obj ) = () static member inline Append (x: Result<_,_> , y , _: Append) = match x, y with Ok _, _ -> x | Error x, Error y -> Error (x + y) | _, _ -> y diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs index 03dc226b725..6f435c1551e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs @@ -3,13 +3,13 @@ module LibraryFunctions open System let x4 : string = "plain string" -let x5 = nonNull ("": string | null) // Should not give a Nullness warning -let x6 = nonNull "" // **Expected to give a Nullness warning -let x7 = nonNull "" +let x5 = nonNull ("": string | null) // Should not give a Nullness warning +let x6 = nonNull "" // **Expected to give a Nullness warning +let x7 = nonNull "" let _x7 : String = x7 -let x8 = nonNull Array.empty -let x9 = nonNull [| "" |] -let x10 = nonNullV (Nullable(3)) +let x8 = nonNull Array.empty +let x9 = nonNull [| "" |] +let x10 = nonNullV (Nullable(3)) let x11 = try nonNullV (Nullable()) with :? System.NullReferenceException -> 10 let x12 = nullV let x13 = nullV @@ -26,16 +26,16 @@ let y1b = isNull (null: String | null) // Should not give a Nullness warning let y2 = isNull "" // **Expected to give a Nullness warning - type instantiation of a nullable type is non-nullable String let y9 = isNull "" // **Expected to give a Nullness warning - type instantiation of a nullable type is non-nullable String let y10 = isNull "" // Should not give a Nullness warning. -// Not yet allowed +// Not yet allowed //let f7 () : 'T | null when 'T : struct = null -let f7b () : Nullable<'T> = nullV +let f7b () : Nullable<'T> = nullV -let f0b (line:string | null) = +let f0b (line:string | null) = let add (s:String) = () - match line with + match line with | null -> () | _ -> add (line) // warning expected let add (s:String) = () -let f0c line = +let f0c line = add (nonNull "") \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fs index 191d1d0f274..f52df29a6f1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fs @@ -1,13 +1,13 @@ module M -let isNotNull (value: 'T) = - match value with +let isNotNull (value: 'T) = + match value with | null -> false | _ -> true #if CHECKNULLS let s: System.String | null = null #else -let s: System.String = null +let s: System.String = null #endif diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/signatures.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/signatures.fs index ebff7bf03f8..5c7e2e7e185 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/signatures.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/signatures.fs @@ -3,7 +3,7 @@ module M let test1 (x: string) = () let test2 (x: string | null) = () -let iRejectNulls (x:_|null) = +let iRejectNulls (x:_|null) = match x with | null -> "null" | s -> String.length s |> string diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/signatures.fsi b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/signatures.fsi index 42247ec7115..b7dca8089d0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/signatures.fsi +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/signatures.fsi @@ -6,7 +6,7 @@ val test2: string -> unit val iRejectNulls: string -> string -[] +[] type GenericContainer<'T when 'T:not null and 'T:not struct> = member GetNull : unit -> ('T|null) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs index 69b554bd48f..6e1c6b30eee 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs @@ -1,25 +1,25 @@ module EnabledPositive open System -module Basics = +module Basics = let x2 : String | null = null // expect no warning in any configuration let x3 : String | null = "a" // expect no warning in any configuration module NotNullConstraint = let f3 (x: 'T when 'T : not null) = 1 - let v1 = f3 1 + let v1 = f3 1 let v2 = f3 "a" - let v3 = f3 (null: obj) // Expect no warning in any configuration - warnings about 'obj' and nulls are suppressed + let v3 = f3 (null: obj) // Expect no warning in any configuration - warnings about 'obj' and nulls are suppressed let v4 = f3 (null: String | null) // Expect to give a warning let v5 = f3 (Some 1) // Expect to give a warning let w1 = 1 |> f3 let w2 = "a" |> f3 - let w3 = (null: obj) |> f3 // Expect no warning in any configuration - warnings about 'obj' and nulls are suppressed + let w3 = (null: obj) |> f3 // Expect no warning in any configuration - warnings about 'obj' and nulls are suppressed let w4 = (null: String | null) |> f3 // Expect to give a warning let w5 = (Some 1) |> f3 // Expect to give a warning -module MemberBasics = - type C() = +module MemberBasics = + type C() = member x.P = 1 member x.M() = 2 @@ -29,7 +29,7 @@ module MemberBasics = let f1 = c.M // Expected to give a warning -module Basics2 = +module Basics2 = let f1 () = null let f2 () : String | null = null @@ -43,7 +43,7 @@ module Basics2 = let f8 () : String = null // Expected to give a Nullness warning -type C(s: String) = +type C(s: String) = member __.Value = s @@ -78,39 +78,39 @@ module InteropBasics = let test4() = System.AppDomain.CurrentDomain let test5 : System.AppDomain = System.AppDomain.CurrentDomain -type KonsoleWithNulls = +type KonsoleWithNulls = static member WriteLine(s: String | null) = Console.WriteLine(s) static member WriteLine(fmt: String, arg1: String | null) = Console.WriteLine(fmt, arg1) static member WriteLine(fmt: String, [] args: (obj | null)[] | null) = Console.WriteLine(fmt, args) static member WriteLineC(s: C | null) = Console.WriteLine(s.Value) static member WriteLineC(fmt: C | null, arg1: C | null) = Console.WriteLine(fmt.Value, arg1.Value) -module KonsoleWithNullsModule = +module KonsoleWithNullsModule = let WriteLine(s: String | null) = Console.WriteLine(s) let WriteLine2(fmt: String, arg1: String | null) = Console.WriteLine(fmt, arg1) let WriteLineC(s: C | null) = Console.WriteLine(s.Value) let WriteLineC2(fmt: C | null, arg1: C | null) = Console.WriteLine(fmt.Value, arg1.Value) -module KonsoleWithNullsModule2 = +module KonsoleWithNullsModule2 = let WriteLine (x : string | null) = KonsoleWithNullsModule.WriteLine x let WriteLine2 (fmt: string, arg1: string | null) = KonsoleWithNullsModule.WriteLine2(fmt, arg1) let WriteLineC(s: _ | null) = KonsoleWithNullsModule.WriteLineC(s) let WriteLineC2(fmt: _ , arg1: _ | null) = KonsoleWithNullsModule.WriteLineC2(fmt, arg1) -type KonsoleNoNulls = +type KonsoleNoNulls = static member WriteLine(s: String) = Console.WriteLine(s) static member WriteLine(fmt: String, arg1: String | null) = Console.WriteLine(fmt, arg1) static member WriteLine(fmt: String, [] args: obj[]) = Console.WriteLine(fmt, args) static member WriteLineC(s: C) = Console.WriteLine(s.Value) static member WriteLineC(fmt: C, arg1: C) = Console.WriteLine(fmt.Value, arg1.Value) -module KonsoleNoNullsModule = +module KonsoleNoNullsModule = let WriteLine(s: String) = Console.WriteLine(s) let WriteLine2(fmt: String, arg1: String) = Console.WriteLine(fmt, arg1) let WriteLineC(s: C) = Console.WriteLine(s.Value) let WriteLineC2(fmt: C, arg1: C) = Console.WriteLine(fmt.Value, arg1.Value) -module KonsoleNoNullsModule2 = +module KonsoleNoNullsModule2 = let WriteLine x = KonsoleNoNullsModule.WriteLine x let WriteLine2 (fmt, arg1) = KonsoleNoNullsModule.WriteLine2(fmt, arg1) let WriteLineC(s) = KonsoleNoNullsModule.WriteLineC(s) @@ -125,42 +125,42 @@ KonsoleWithNulls.WriteLine("Hello","world") KonsoleWithNulls.WriteLine("Hello","world","there") KonsoleNoNulls.WriteLine("Hello world") -try +try KonsoleNoNulls.WriteLine(null) // Expected to give a Nullness warning with :? System.ArgumentNullException -> () KonsoleNoNulls.WriteLine("Hello","world") -//KonsoleNoNulls.WriteLine("Hello",null) // CHECK ME -try +//KonsoleNoNulls.WriteLine("Hello",null) // CHECK ME +try KonsoleNoNulls.WriteLine(null, "World") // Expected to give a Nullness warning with :? System.ArgumentNullException -> () KonsoleWithNullsModule.WriteLine("Hello world") -try - KonsoleWithNullsModule.WriteLine(null) +try + KonsoleWithNullsModule.WriteLine(null) with :? System.ArgumentNullException -> () -KonsoleWithNullsModule.WriteLine2("Hello","world") +KonsoleWithNullsModule.WriteLine2("Hello","world") KonsoleWithNullsModule.WriteLine2("Hello",null) try KonsoleWithNullsModule.WriteLine2(null,"world") with :? System.ArgumentNullException -> () KonsoleWithNullsModule2.WriteLine("Hello world") -try - KonsoleWithNullsModule2.WriteLine(null) +try + KonsoleWithNullsModule2.WriteLine(null) with :? System.ArgumentNullException -> () KonsoleWithNullsModule2.WriteLine2("Hello","world") KonsoleWithNullsModule2.WriteLine2("Hello",null) -try +try KonsoleWithNullsModule2.WriteLine2(null,"world") with :? System.ArgumentNullException -> () KonsoleNoNullsModule.WriteLine("Hello world") -try +try KonsoleNoNullsModule.WriteLine(null) // Expected to give a Nullness warning with :? System.ArgumentNullException -> () KonsoleNoNullsModule.WriteLine2("Hello","world") KonsoleNoNullsModule.WriteLine2("Hello",null) // Expected to give a Nullness warning -try +try KonsoleNoNullsModule.WriteLine2(null,"world") // Expected to give a Nullness warning with :? System.ArgumentNullException -> () @@ -169,17 +169,17 @@ with :? System.ArgumentNullException -> () // Param array cases KonsoleNoNulls.WriteLine("Hello","world","there") -KonsoleWithNulls.WriteLine("Hello","world",null) // Expected to give no Nullness warning +KonsoleWithNulls.WriteLine("Hello","world",null) // Expected to give no Nullness warning KonsoleNoNulls.WriteLine("Hello","world",null) // Expected to give a Nullness warning -System.Console.WriteLine("a", (null: obj[] | null)) +System.Console.WriteLine("a", (null: obj[] | null)) System.Console.WriteLine("a", (null: (obj | null)[] | null)) //------- // random stuff -let f0 line = +let f0 line = let add (s:String) = () - match line with + match line with | null | "" -> () | _ -> add line // Expected to give a nullness warning @@ -188,16 +188,16 @@ module NullConstraintTests = let f3 (y : C) = y // Expect a Nullness warning - let f4 (y : C) = y // No warning expected + let f4 (y : C) = y // No warning expected let f5 (y : C | null>) = y // No warning expected - let f6 (y : C | null>) = y // No warning expected, lexing/parsing should succeed + let f6 (y : C | null>) = y // No warning expected, lexing/parsing should succeed module DefaultValueTests = - module StructExamples = + module StructExamples = [] type C2 = [] @@ -218,7 +218,7 @@ module DefaultValueTests = [] val mutable Whoops : (int -> int) | null // expect no warning - module ClassExamples = + module ClassExamples = type C2 = [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs index b6efad6eea6..30ee89f2506 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs @@ -4,7 +4,7 @@ open Xunit open FSharp.Test.Compiler module ObsoleteAttributeCheckingTests = - + [] let ``Obsolete attribute is not taken into account when used on on a member and instantiate the type`` () = Fsx """ @@ -19,7 +19,7 @@ let c = C() |> ignoreWarnings |> compile |> shouldSucceed - + [] let ``Obsolete attribute warning taken into account when used instantiating a type`` () = Fsx """ @@ -35,7 +35,7 @@ let c = C() |> withDiagnostics [ (Warning 44, Line 7, Col 9, Line 7, Col 10, "This construct is deprecated. Use B instead") ] - + [] let ``Obsolete attribute warning taken into account when used with a literal`` () = @@ -66,7 +66,7 @@ let myRes = myLit |> withDiagnostics [ (Error 101, Line 6, Col 13, Line 6, Col 18, "This construct is deprecated. Use lit2") ] - + [] let ``Obsolete attribute warning taken into account when used with a simple unit of measure`` () = Fsx """ @@ -81,7 +81,7 @@ let myCm = 3 |> withDiagnostics [ (Warning 44, Line 6, Col 14, Line 6, Col 16, "This construct is deprecated. Use cm2") ] - + [] let ``Obsolete attribute error taken into account when used with a simple unit of measure`` () = Fsx """ @@ -96,7 +96,7 @@ let myCm = 3 |> withDiagnostics [ (Error 101, Line 6, Col 14, Line 6, Col 16, "This construct is deprecated. Use cm2") ] - + [] let ``Obsolete attribute warning taken into account when used with a simple unit of measure type abbrev`` () = Fsx """ @@ -122,8 +122,8 @@ type IMl2 = (Warning 44, Line 11, Col 34, Line 11, Col 36, "This construct is deprecated. Use something else") (Warning 44, Line 11, Col 47, Line 11, Col 49, "This construct is deprecated. Use something else") (Warning 44, Line 11, Col 58, Line 11, Col 60, "This construct is deprecated. Use something else") - ] - + ] + [] let ``Obsolete attribute error taken into account when used with a simple unit of measure type abbrev`` () = Fsx """ @@ -136,7 +136,7 @@ open System |> shouldFail |> withDiagnostics [ (Error 101, Line 5, Col 23, Line 5, Col 25, "This construct is deprecated. Use something else") - ] + ] [] let ``Obsolete attribute warning taken into account when used with a complex unit of measure definition`` () = @@ -159,7 +159,7 @@ type s (Warning 44, Line 12, Col 22, Line 12, Col 24, "This construct is deprecated. Use kg2"); (Warning 44, Line 12, Col 29, Line 12, Col 30, "This construct is deprecated. Use s2") ] - + [] let ``Obsolete attribute error taken into account when used with a complex unit of measure definition`` () = Fsx """ @@ -180,7 +180,7 @@ type s |> withDiagnostics [ (Error 101, Line 12, Col 22, Line 12, Col 24, "This construct is deprecated. Use kg2"); ] - + [] let ``Obsolete attribute warning taken into account when used within a complex unit of measure`` () = Fsx """ @@ -228,7 +228,7 @@ let mPerCm = 0.01 (Warning 44, Line 11, Col 19, Line 11, Col 20, "This construct is deprecated. Use m2") (Warning 44, Line 11, Col 21, Line 11, Col 23, "This construct is deprecated. Use cm2") ] - + [] let ``Obsolete attribute warning taken into account when used with a complex(multiple obsolete) unit of measure`` () = Fsx """ @@ -300,7 +300,7 @@ let res = System.Collections.Generic.Dictionary,int>() (Warning 44, Line 26, Col 53, Line 26, Col 54, "This construct is deprecated. Use m2") (Warning 44, Line 26, Col 60, Line 26, Col 61, "This construct is deprecated. Use s2") ] - + [] let ``Class- Obsolete attribute warning taken into account when used with a complex(multiple obsolete) unit of measure usages`` () = Fsx """ @@ -379,7 +379,7 @@ type B(x: int, y: int) = (Warning 44, Line 41, Col 15, Line 41, Col 16, "This construct is deprecated. Use m2") (Warning 44, Line 41, Col 26, Line 41, Col 27, "This construct is deprecated. Use s2") ] - + [] let ``Obsolete attribute error taken into account when used instantiating a type`` () = Fsx """ @@ -531,7 +531,7 @@ C.Update() |> withDiagnostics [ (Error 101, Line 10, Col 1, Line 10, Col 2, "This construct is deprecated. Use B instead") ] - + [] let ``Obsolete attribute is taken into account when used on a record member and method invocation`` () = Fsx """ @@ -550,7 +550,7 @@ C.Update() |> withDiagnostics [ (Error 101, Line 9, Col 3, Line 9, Col 9, "This construct is deprecated. Use B instead") ] - + [] let ``Obsolete attribute error is taken into account when used on a struct du and invocation`` () = Fsx """ @@ -638,7 +638,7 @@ let c = Color.Red |> 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 an enum field and invocation`` () = Fsx """ @@ -941,7 +941,7 @@ b.text("Hello 2") |> ignore |> withDiagnostics [ (Error 101, Line 16, Col 3, Line 16, Col 7, "This construct is deprecated. Use B instead") ] - + [] let ``Obsolete attribute error is taken into account when used in one the record properties`` () = Fsx """ @@ -955,7 +955,7 @@ let a = { DeprecatedField= "23" ; JustField = "" } |> withDiagnostics [ (Error 101, Line 4, Col 11, Line 4, Col 26, "This construct is deprecated. Deprecated Field") ] - + // This should only report one warning but instead show two. Related issue https://github.com/dotnet/fsharp/issues/14203 [] let ``Obsolete attribute warning is taken into account when used in one the record properties`` () = @@ -969,7 +969,7 @@ let a = { DeprecatedField= "23" ; JustField = "" } |> withDiagnostics [ (Warning 44, Line 4, Col 11, Line 4, Col 26, "This construct is deprecated. Deprecated Field") ] - + [] let ``Obsolete attribute warning is taken into account when used in one the class with a setter`` () = Fsx """ @@ -988,7 +988,7 @@ let value2 = class1.A <- 12 (Warning 44, Line 9, Col 21, Line 9, Col 22, "This construct is deprecated. member A is deprecated"); (Warning 44, Line 9, Col 14, Line 9, Col 28, "This construct is deprecated. member A is deprecated") ] - + [] let ``Obsolete attribute error is taken into account when used in one the class with a setter`` () = Fsx """ @@ -1006,7 +1006,7 @@ let value2 = class1.A <- 12 |> withDiagnostics [ (Error 101, Line 9, Col 21, Line 9, Col 22, "This construct is deprecated. member A is deprecated") ] - + [] let ``Obsolete attribute warning is taken into account when used in one the class with a getter`` () = Fsx """ @@ -1026,7 +1026,7 @@ let value2 = class1.A <- 12 (Warning 44, Line 8, Col 14, Line 8, Col 22, "This construct is deprecated. member A is deprecated"); (Warning 44, Line 9, Col 21, Line 9, Col 22, "This construct is deprecated. member A is deprecated") ] - + [] let ``Obsolete attribute error is taken into account when used in one the class with a getter`` () = Fsx """ @@ -1045,7 +1045,7 @@ let value2 = class1.A <- 12 (Error 101, Line 8, Col 21, Line 8, Col 22, "This construct is deprecated. member A is deprecated") (Error 101, Line 9, Col 21, Line 9, Col 22, "This construct is deprecated. member A is deprecated") ] - + [] let ``Obsolete attribute warning is taken into account when a module is is marked as [] but not when calling a function`` () = Fsx """ @@ -1063,7 +1063,7 @@ testFun () |> withDiagnostics [ (Warning 44, Line 7, Col 6, Line 7, Col 14, "This construct is deprecated. This is obsolete") ] - + [] let ``Obsolete attribute error is taken into account when a module is is marked as [] but not when calling a function`` () = Fsx """ @@ -1082,7 +1082,7 @@ testFun () |> withDiagnostics [ (Error 101, Line 7, Col 6, Line 7, Col 14, "This construct is deprecated. This is obsolete") ] - + [] let ``Obsolete attribute warning is taken into account when used on an C# struct`` () = let CSLib = @@ -1186,7 +1186,7 @@ let c2 = ObsoleteClass() (Error 101, Line 3, Col 9, Line 3, Col 22, "This construct is deprecated. Class is obsolete"); (Error 101, Line 4, Col 10, Line 4, Col 23, "This construct is deprecated. Class is obsolete") ] - + [] let ``Obsolete attribute warning is taken into account when used on an C# interface`` () = let CSLib = @@ -1376,7 +1376,7 @@ Class.ObsoleteEvent |> ignore (Error 101, Line 5, Col 7, Line 5, Col 23, "This construct is deprecated. Property is obsolete") (Error 101, Line 6, Col 7, Line 6, Col 20, "This construct is deprecated. Event is obsolete") ] - + [] let ``Obsolete attribute warning is taken into account when used in one the record properties with a static member when one of them is not used`` () = Fsx """ @@ -1558,7 +1558,7 @@ let f (x: IFirst) = x.F() |> withDiagnostics [ (Error 101, Line 13, Col 23, Line 13, Col 24, "This construct is deprecated. Use G instead") ] - + [] let ``Obsolete attribute warning is taken into account when used in interface that is used in an object expression`` () = Fsx """ @@ -1582,7 +1582,7 @@ let f (x: IFirst) = x.F() (Warning 44, Line 13, Col 11, Line 13, Col 17, "This construct is deprecated. Use G instead") (Warning 44, Line 13, Col 23, Line 13, Col 24, "This construct is deprecated. Use G instead") ] - + [] let ``Obsolete attribute error is taken into account when used in interface that is used in an object expression`` () = Fsx """ @@ -1629,7 +1629,7 @@ let options2 = JsonSerializerOptions(DefaultOptions = true, DefaultOptions = fal (Warning 44, Line 10, Col 38, Line 10, Col 52, "This construct is deprecated. This is bad") (Warning 44, Line 10, Col 61, Line 10, Col 75, "This construct is deprecated. This is bad") ] - + [] let ``Obsolete attribute warning is not taken into account in prop setters that can be included in methods which are not constructors`` () = Fsx """ @@ -1674,7 +1674,7 @@ let options2 = |> withDiagnostics [ (Error 101, Line 13, Col 15, Line 13, Col 29, "This construct is deprecated. This is bad") ] - + [] let ``Obsolete attribute error is taken into account in a constructor property assignment`` () = Fsx """ @@ -1695,7 +1695,7 @@ let options2 = JsonSerializerOptions(DefaultOptions = true, DefaultOptions = fal (Error 364, Line 10, Col 16, Line 10, Col 84, "The named argument 'DefaultOptions' has been assigned more than one value"); (Error 101, Line 10, Col 38, Line 10, Col 52, "This construct is deprecated. This is bad") ] - + [] let ``Obsolete attribute warning is taken into account in a nested constructor property assignment`` () = Fsx """ @@ -1718,7 +1718,7 @@ let options = JsonSerializerOptions(DefaultOptions = JsonSerializer1Options(Defa |> withDiagnostics [ (Warning 44, Line 14, Col 77, Line 14, Col 91, "This construct is deprecated. This is bad") ] - + [] let ``Obsolete attribute error is taken into account in a nested constructor property assignment`` () = Fsx """ @@ -1765,7 +1765,7 @@ let res = JsonProtocolTestData(IgnoreNullValues = false) |> withDiagnostics [ (Warning 44, Line 3, Col 32, Line 3, Col 48, "This construct is deprecated. Use Json instead") ] - + [] let ``Obsolete attribute error is taken into account in a constructor property assignment from a csharp class`` () = let CSLib = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/PrintfFormatTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/PrintfFormatTests.fs index 44e21a82989..173e941b73e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/PrintfFormatTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/PrintfFormatTests.fs @@ -8,7 +8,7 @@ open StructuredResultsAsserts [] let ``Constant defined in C# can be used as printf format``() = - let csLib = + let csLib = CSharp """ public static class Library { diff --git a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/E_SequenceExpressions01.fs b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/E_SequenceExpressions01.fs index 37ca58c3db6..a3dfffd8747 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/E_SequenceExpressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/E_SequenceExpressions01.fs @@ -39,7 +39,7 @@ let fe start finish = [| for x in { start..finish } -> x |] for x in { 1..10 } do () for x in { 1..5..10 } do () - + let f = Seq.head let a2 = f { 1..6 } diff --git a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressionTests.fs index 993a7238f55..049971fb261 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressionTests.fs @@ -498,7 +498,7 @@ let typedSeq = """ |> withLangVersion80 |> typecheck - |> shouldFail + |> shouldFail |> withDiagnosticMessageMatches "This expression returns a value of type 'int' but is implicitly discarded." |> withDiagnosticMessageMatches "If you intended to use the expression as a value in the sequence then use an explicit 'yield'." @@ -549,7 +549,7 @@ let typedSeq = |> withErrorCode 30 |> withDiagnosticMessageMatches "Value restriction: The value 'typedSeq' has an inferred generic type" |> withDiagnosticMessageMatches "val typedSeq: '_a seq" - + [] let ``yield may only be used within list, array, and sequence expressions``() = Fsx """ @@ -562,7 +562,7 @@ let f2 = yield! [ 3; 4 ] (Error 747, Line 2, Col 10, Line 2, Col 15, "This construct may only be used within list, array and sequence expressions, e.g. expressions of the form 'seq { ... }', '[ ... ]' or '[| ... |]'. These use the syntax 'for ... in ... do ... yield...' to generate elements"); (Error 747, Line 3, Col 10, Line 3, Col 16, "This construct may only be used within list, array and sequence expressions, e.g. expressions of the form 'seq { ... }', '[ ... ]' or '[| ... |]'. These use the syntax 'for ... in ... do ... yield...' to generate elements") ] - + [] let ``return may only be used within list, array, and sequence expressions``() = Fsx """ @@ -596,7 +596,7 @@ let c = [ { 1;10 } ] (Error 740, Line 5, Col 12, Line 5, Col 20, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") (Error 740, Line 6, Col 11, Line 6, Col 19, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") ] - + [] let ``Sequence(SynExpr.Sequential) expressions should be of the form 'seq { ... } lang version preview``() = Fsx """ @@ -690,7 +690,7 @@ let c = [ { 1;10 } ] |> withLangVersion90 |> typecheck |> shouldSucceed - + // SOURCE=SequenceExpressions01.fs # SequenceExpressions01.fs [] let ``SequenceExpressions01 lang version preview`` compilation = @@ -700,7 +700,7 @@ let c = [ { 1;10 } ] |> withLangVersion10 |> typecheck |> shouldSucceed - + [] let ``Version 9.0: Allow SE yield and type annotations don't play well together needing parentheses``() = FSharp """ @@ -723,7 +723,7 @@ let f1() = |> withDiagnostics [ (Error 3350, Line 7, Col 15, Line 7, Col 22, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 10.0 or greater.") ] - + [] let ``Preview: Allow SE yield and type annotations to play well together without needing parentheses``() = FSharp """ @@ -745,7 +745,7 @@ let f1() = |> ignoreWarnings |> compileAndRun |> shouldSucceed - + [] let ``Version 9.0: Allow SE yield! and type annotations don't play well together needing parentheses``() = FSharp """ @@ -768,7 +768,7 @@ let f1() = |> withDiagnostics [ (Error 3350, Line 7, Col 16, Line 7, Col 32, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 10.0 or greater.") ] - + [] let ``Preview: Allow SE yield! and type annotations to play well together without needing parentheses``() = FSharp """ diff --git a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressions01.fs b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressions01.fs index ea1ab603eef..d1849ef28cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressions01.fs @@ -39,7 +39,7 @@ let fe start finish = [| for x in seq { start..finish } -> x |] for x in seq { 1..10 } do () for x in seq { 1..5..10 } do () - + let f = Seq.head let a2 = f (seq { 1..6 }) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index dc929dea744..c4002767e55 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -53,7 +53,7 @@ if FailingInlinedHelper.repro 42 <> 42 then failwith "unexpected result" |> shouldSucceed [] // https://github.com/dotnet/fsharp/issues/13067 - let ``Local function with a flexible type``() = + let ``Local function with a flexible type``() = """ task { let m1 f s = Seq.map f s @@ -72,7 +72,7 @@ task { |> shouldSucceed [] // https://github.com/dotnet/fsharp/issues/14806 - let ``Explicit returns types + constraints on generics``() = + let ``Explicit returns types + constraints on generics``() = """ module Foo @@ -94,10 +94,10 @@ run() """ |> verifyOptimizedAndRun |> shouldSucceed - + [] // https://github.com/dotnet/fsharp/issues/14807 - let ``let _ = null``() = + let ``let _ = null``() = """ module TestProject1 @@ -140,7 +140,7 @@ for i in 1 .. 100 do |> shouldSucceed [] // https://github.com/dotnet/fsharp/issues/16068 - let ``Decision tree with 32+ binds with nested expression is not getting splitted and state machine is successfully statically compiles``() = + let ``Decision tree with 32+ binds with nested expression is not getting splitted and state machine is successfully statically compiles``() = FSharp """ module Testing diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StaticClassTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StaticClassTests.fs index c47a3fefc31..99805fddcb2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StaticClassTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StaticClassTests.fs @@ -66,7 +66,7 @@ type T(x: int) = (Warning 3552, Line 3, Col 8, Line 3, Col 14, "If a type uses both [] and [] attributes, it means it is static. Constructor with arguments is not allowed.") (Warning 3553, Line 4, Col 5, Line 4, Col 19, "If a type uses both [] and [] attributes, it means it is static. Additional constructor is not allowed.") ] - + [] let ``When Sealed and AbstractClass on a generic type with constructor`` () = Fsx """ @@ -156,7 +156,7 @@ type T() = |> withDiagnostics [ (Warning 3554, Line 4, Col 5, Line 4, Col 25, "If a type uses both [] and [] attributes, it means it is static. Instance members are not allowed.") ] - + [] let ``Sealed and AbstractClass on a type with static members`` () = Fsx """ @@ -168,7 +168,7 @@ type T() = |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Sealed and AbstractClass with static and non static let bindings`` () = Fsx """ @@ -183,7 +183,7 @@ type C() = |> withDiagnostics [ (Warning 3555, Line 4, Col 5, Line 4, Col 14, "If a type uses both [] and [] attributes, it means it is static. Instance let bindings are not allowed.") ] - + [] let ``Sealed and AbstractClass with static and non static recursive let bindings`` () = Fsx """ @@ -210,7 +210,7 @@ type C() = |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Sealed and AbstractClass with recursive static let bindings`` () = Fsx """ @@ -222,7 +222,7 @@ type C() = |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Sealed and AbstractClass on a type implementing interface`` () = Fsx """ @@ -240,7 +240,7 @@ type C() = |> withDiagnostics [ (Warning 3556, Line 8, Col 9, Line 8, Col 29, "If a type uses both [] and [] attributes, it means it is static. Implementing interfaces is not allowed.") ] - + [] let ``Sealed and AbstractClass on a type implicit constructor implementing interface`` () = Fsx """ @@ -258,7 +258,7 @@ type C = |> withDiagnostics [ (Warning 3556, Line 8, Col 9, Line 8, Col 29, "If a type uses both [] and [] attributes, it means it is static. Implementing interfaces is not allowed.") ] - + [] let ``Sealed and AbstractClass on a type implicit constructor declaring abstract members`` () = Fsx """ @@ -274,7 +274,7 @@ type T = (Warning 3557, Line 4, Col 14, Line 4, Col 15, "If a type uses both [] and [] attributes, it means it is static. Abstract member declarations are not allowed.") (Warning 3557, Line 5, Col 14, Line 5, Col 15, "If a type uses both [] and [] attributes, it means it is static. Abstract member declarations are not allowed.") ] - + [] let ``Sealed and AbstractClass on a type declaring abstract members`` () = Fsx """ @@ -313,7 +313,7 @@ type ConsoleRetriever = |> withLangVersion80 |> compile |> shouldSucceed - + #if !NETCOREAPP [] #else @@ -336,7 +336,7 @@ type ConsoleRetriever = |> withLangVersion80 |> compile |> shouldSucceed - + #if !NETCOREAPP [] #else @@ -359,7 +359,7 @@ type ConsoleRetriever() = |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Sealed and AbstractClass on a type with implicit constructor declaring static explicit field`` () = Fsx """ @@ -377,7 +377,7 @@ type T = |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``Sealed and AbstractClass on a type declaring static explicit field`` () = Fsx """ @@ -395,7 +395,7 @@ type T() = |> withLangVersion80 |> compile |> shouldSucceed - + [] let ``When Sealed and AbstractClass on a type with non static explicit fields and implicit constructor`` () = Fsx """ @@ -411,7 +411,7 @@ type B = (Warning 3558, Line 4, Col 9, Line 4, Col 10, "If a type uses both [] and [] attributes, it means it is static. Explicit field declarations are not allowed.") (Warning 3558, Line 5, Col 17, Line 5, Col 18, "If a type uses both [] and [] attributes, it means it is static. Explicit field declarations are not allowed.") ] - + [] let ``When Sealed and AbstractClass on a type with non static explicit fields and constructor`` () = Fsx """ @@ -429,7 +429,7 @@ type B() = (Warning 3558, Line 4, Col 9, Line 4, Col 10, "If a type uses both [] and [] attributes, it means it is static. Explicit field declarations are not allowed.") (Warning 3558, Line 5, Col 17, Line 5, Col 18, "If a type uses both [] and [] attributes, it means it is static. Explicit field declarations are not allowed.") ] - + [] let ``Sealed and AbstractClass on a types with instance member properties`` () = Fsx """ @@ -447,7 +447,7 @@ type T = (Warning 3554, Line 5, Col 5, Line 5, Col 41, "If a type uses both [] and [] attributes, it means it is static. Instance members are not allowed.") (Warning 3554, Line 6, Col 5, Line 6, Col 55, "If a type uses both [] and [] attributes, it means it is static. Instance members are not allowed.") ] - + [] let ``Sealed and AbstractClass on types with non static members`` () = Fsx """ diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs index 0d5caabb982..22a0584e351 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs @@ -18,4 +18,3 @@ let NoRaceCondition() = if indices[0] <> indices[1] then Assert.Fail $"Found different indices: {indices[0]} and {indices[1]}" count <- count - 1 - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs index 7fb9a614885..a9a7c5f94f3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs @@ -7,19 +7,19 @@ open System.IO open Xunit open FSharp.Test open FSharp.Test.Compiler -open FSharp.Test.ScriptHelpers +open FSharp.Test.ScriptHelpers -module Configuration = +module Configuration = let supportedNames = set ["testlib.fsi";"testlib.fs";"test.fsi";"test.fs";"test2.fsi";"test2.fs";"test.fsx";"test2.fsx"] [] type ScriptSessionIsolation = Shared | Isolated -module ScriptRunner = +module ScriptRunner = open Internal.Utilities.Library - + let private getOrCreateEngine(args,version) sessionIsolation = match sessionIsolation with | ScriptSessionIsolation.Isolated -> @@ -27,8 +27,8 @@ module ScriptRunner = | ScriptSessionIsolation.Shared -> getSessionForEval args version - let defaultDefines = - [ + let defaultDefines = + [ #if NETCOREAPP "NETCOREAPP" #endif @@ -36,7 +36,7 @@ module ScriptRunner = let runScriptFile version sessionIsolation (cu:CompilationUnit) = let cu = cu |> withDefines defaultDefines - match cu with + match cu with | FS fsSource -> use capture = new TestConsole.ExecutionCapture() let engine = getOrCreateEngine (fsSource.Options |> Array.ofList,version) sessionIsolation @@ -47,7 +47,7 @@ module ScriptRunner = if capture.OutText |> TestFramework.outputPassed then res else - failwith $"Results looked correct, but 'TEST PASSED OK' was not printed." + failwith $"Results looked correct, but 'TEST PASSED OK' was not printed." | _ -> printfn $"Cannot process %A{cu}" @@ -55,35 +55,35 @@ module ScriptRunner = /// This test file was created by porting over (slower) FsharpSuite.Tests /// In order to minimize human error, the test definitions have been copy-pasted and this adapter provides implementations of the test functions -module TestFrameworkAdapter = +module TestFrameworkAdapter = open FSharp.Test.Compiler.Assertions.TextBasedDiagnosticAsserts - type ExecutionMode = - | FSC_DEBUG - | FSC_OPTIMIZED + type ExecutionMode = + | FSC_DEBUG + | FSC_OPTIMIZED | FSI | COMPILED_EXE_APP | NEG_TEST_BUILD of testName:string - let baseFolder = Path.Combine(__SOURCE_DIRECTORY__,"..","..","fsharp") |> Path.GetFullPath + let baseFolder = Path.Combine(__SOURCE_DIRECTORY__,"..","..","fsharp") |> Path.GetFullPath let diffNegativeBaseline (cr:CompilationUnit) absFolder testName _version = let expectedFiles = Directory.GetFiles(absFolder, testName + ".*") - let baselines = + let baselines = [ for f in expectedFiles do match Path.GetExtension(f) with | ".bsl" -> cr, f | ".vsbsl" -> cr |> withOptions ["--test:ContinueAfterParseFailure"], f | _ -> () ] [ for compilationUnit,baseline in baselines do - compilationUnit + compilationUnit |> typecheck |> withResultsMatchingFile baseline ] |> List.head - - let adjustVersion version bonusArgs = - match version with + + let adjustVersion version bonusArgs = + match version with | LangVersion.V80 -> "8.0",bonusArgs | LangVersion.V90 -> "9.0",bonusArgs | LangVersion.V10 -> "10.0",bonusArgs @@ -93,10 +93,10 @@ module TestFrameworkAdapter = let singleTestBuildAndRunAuxVersion (folder:string) bonusArgs mode langVersion sessionIsolation = let absFolder = Path.Combine(baseFolder,folder) - let supportedNames, files = - match mode with - | NEG_TEST_BUILD testName -> - let nameSet = + let supportedNames, files = + match mode with + | NEG_TEST_BUILD testName -> + let nameSet = Configuration.supportedNames .Add(testName+".fsx") .Add(testName+".fs") @@ -105,18 +105,18 @@ module TestFrameworkAdapter = let files = Directory.GetFiles(absFolder,"*.fs*") |> Array.filter(fun n -> nameSet.Contains(Path.GetFileName(n))) nameSet, files | _ -> Configuration.supportedNames, Directory.GetFiles(absFolder,"test*.fs*") - - let mainFile,otherFiles = + + let mainFile,otherFiles = match files.Length with | 1 -> files |> Array.exactlyOne, [||] - | _ -> - let mainFile,dependencies = - files - |> Array.filter (fun n -> supportedNames.Contains(Path.GetFileName(n))) + | _ -> + let mainFile,dependencies = + files + |> Array.filter (fun n -> supportedNames.Contains(Path.GetFileName(n))) // Convention in older FsharpSuite: test2 goes last, longer names like testlib before test, .fsi before .fs on equal filenames - |> Array.sortBy (fun n -> n.Contains("test2"), -n.IndexOf('.'), n.EndsWith(".fsi") |> not) - |> Array.splitAt 1 - + |> Array.sortBy (fun n -> n.Contains("test2"), -n.IndexOf('.'), n.EndsWith(".fsi") |> not) + |> Array.splitAt 1 + mainFile[0],dependencies let version,bonusArgs = adjustVersion langVersion bonusArgs @@ -124,42 +124,42 @@ module TestFrameworkAdapter = FsFromPath mainFile |> withAdditionalSourceFiles [for f in otherFiles -> SourceFromPath f] |> withLangVersion version - |> fun cu -> + |> fun cu -> match mode with - | FSC_DEBUG | FSC_OPTIMIZED | FSI | COMPILED_EXE_APP -> - cu - |> ignoreWarnings - |> withOptions (["--nowarn:0988;3370"] @ bonusArgs) - | NEG_TEST_BUILD _ -> - cu |> - withOptions (["--vserrors";"--maxerrors:10000";"--warnaserror";"--warn:3";"--nowarn:20;21;1178;52"] @ bonusArgs) - |> fun cu -> + | FSC_DEBUG | FSC_OPTIMIZED | FSI | COMPILED_EXE_APP -> + cu + |> ignoreWarnings + |> withOptions (["--nowarn:0988;3370"] @ bonusArgs) + | NEG_TEST_BUILD _ -> + cu |> + withOptions (["--vserrors";"--maxerrors:10000";"--warnaserror";"--warn:3";"--nowarn:20;21;1178;52"] @ bonusArgs) + |> fun cu -> match mode with - | FSC_DEBUG -> - cu - |> withDebug - |> withNoOptimize + | FSC_DEBUG -> + cu + |> withDebug + |> withNoOptimize |> ScriptRunner.runScriptFile langVersion sessionIsolation - |> shouldSucceed - | FSC_OPTIMIZED -> - cu - |> withOptimize - |> withNoDebug + |> shouldSucceed + | FSC_OPTIMIZED -> + cu + |> withOptimize + |> withNoDebug |> ScriptRunner.runScriptFile langVersion sessionIsolation - |> shouldSucceed - | FSI -> - cu + |> shouldSucceed + | FSI -> + cu |> ScriptRunner.runScriptFile langVersion sessionIsolation - |> shouldSucceed - | COMPILED_EXE_APP -> - cu - |> withDefines ("TESTS_AS_APP" :: ScriptRunner.defaultDefines) - |> compileExeAndRun - |> shouldSucceed + |> shouldSucceed + | COMPILED_EXE_APP -> + cu + |> withDefines ("TESTS_AS_APP" :: ScriptRunner.defaultDefines) + |> compileExeAndRun + |> shouldSucceed | NEG_TEST_BUILD testName -> diffNegativeBaseline (cu |> withName mainFile) absFolder testName langVersion - + |> ignore - + let singleTestBuildAndRunAux folder bonusArgs mode = singleTestBuildAndRunAuxVersion folder bonusArgs mode LangVersion.Latest let singleTestBuildAndRunVersion folder mode version : unit = singleTestBuildAndRunAuxVersion folder [] mode version ScriptSessionIsolation.Shared @@ -169,6 +169,6 @@ module TestFrameworkAdapter = let singleVersionedNegTestAux folder bonusArgs version testName = singleTestBuildAndRunAuxVersion folder bonusArgs (NEG_TEST_BUILD testName) version ScriptSessionIsolation.Shared - let singleVersionedNegTest (folder:string) (version:LangVersion) (testName:string) = + let singleVersionedNegTest (folder:string) (version:LangVersion) (testName:string) = singleVersionedNegTestAux folder [] version testName let singleNegTest folder testName = singleVersionedNegTest folder LangVersion.Latest testName \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs index 16feb622251..c1b6c9bcbeb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs @@ -4,7 +4,7 @@ module Miscellaneous.FsharpSuiteMigrated_CoreTests open Xunit open FSharp.Test -open FSharp.Test.ScriptHelpers +open FSharp.Test.ScriptHelpers open System.Runtime.InteropServices open Miscellaneous.FsharpSuiteMigrated.TestFrameworkAdapter @@ -49,11 +49,11 @@ let ``array-no-dot-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "core/array let ``array-no-dot-FSI`` () = singleTestBuildAndRunVersion "core/array-no-dot" FSI LangVersion.Preview [] -let ``array-no-dot-warnings-langversion-default`` () = +let ``array-no-dot-warnings-langversion-default`` () = singleVersionedNegTest "core/array-no-dot-warnings" LangVersion.Latest "test-langversion-default" [] -let ``array-no-dot-warnings-langversion-8_0`` () = +let ``array-no-dot-warnings-langversion-8_0`` () = singleVersionedNegTest "core/array-no-dot-warnings" LangVersion.V80 "test-langversion-8.0" [] @@ -76,11 +76,11 @@ let ``auto-widen-minimal``() = singleTestBuildAndRunVersion "core/auto-widen/minimal" FSC_OPTIMIZED LangVersion.V80 [] -let ``auto-widen-version-preview-warns-on``() = +let ``auto-widen-version-preview-warns-on``() = singleVersionedNegTestAux "core/auto-widen/preview" ["--warnon:3388";"--warnon:3389";"--warnon:3395";"--warnaserror+";"--define:NEGATIVE"] LangVersion.V80 "test" [] -let ``auto-widen-version-preview-default-warns``() = +let ``auto-widen-version-preview-default-warns``() = singleVersionedNegTestAux "core/auto-widen/preview-default-warns" ["--warnaserror+";"--define:NEGATIVE"] LangVersion.V80 "test" [] @@ -442,7 +442,7 @@ let ``reflect-FSI`` () = singleTestBuildAndRunIsolated "core/reflect" FSI let isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) [] -let ``pinvoke-FSC_OPTIMIZED`` () = +let ``pinvoke-FSC_OPTIMIZED`` () = if isWindows then singleTestBuildAndRun "core/pinvoke" FSC_OPTIMIZED diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedTypeCheckTests.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedTypeCheckTests.fs index aee6c4b940d..914b6cf56a5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedTypeCheckTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedTypeCheckTests.fs @@ -3,8 +3,8 @@ module Miscellaneous.FsharpSuiteMigrated_TypeCheckTests open Xunit open FSharp.Test -open FSharp.Test.ScriptHelpers -open Miscellaneous.FsharpSuiteMigrated.TestFrameworkAdapter +open FSharp.Test.ScriptHelpers +open Miscellaneous.FsharpSuiteMigrated.TestFrameworkAdapter [] let ``type check neg01`` () = singleNegTest ( "typecheck/sigs") "neg01" @@ -314,7 +314,7 @@ let ``type check neg98`` () = singleNegTest ( "typecheck/sigs") "neg98" let ``type check neg99`` () = singleNegTest ( "typecheck/sigs") "neg99" [] -let ``type check neg100`` () = singleVersionedNegTestAux "typecheck/sigs" ["--warnon:3218" ] LangVersion.Latest "neg100" +let ``type check neg100`` () = singleVersionedNegTestAux "typecheck/sigs" ["--warnon:3218" ] LangVersion.Latest "neg100" [] let ``type check neg101`` () = singleNegTest ( "typecheck/sigs") "neg101" @@ -346,9 +346,9 @@ let ``type check neg110`` () = singleNegTest ( "typecheck/sigs") "neg110" [] let ``type check neg111`` () = singleNegTest ( "typecheck/sigs") "neg111" -[] +[] let ``type check neg112`` () = singleNegTest ( "typecheck/sigs") "neg112" - + [] let ``type check neg113`` () = singleNegTest ( "typecheck/sigs") "neg113" @@ -405,7 +405,7 @@ let ``type check neg131`` () = singleVersionedNegTest ( "typecheck/sigs") LangVe [] let ``type check neg132`` () = singleVersionedNegTest ( "typecheck/sigs") LangVersion.V80 "neg132" - + [] let ``type check neg133`` () = singleNegTest ( "typecheck/sigs") "neg133" diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/ReallyLongList01.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/ReallyLongList01.fs index e2d31344fc4..333b92c42f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/ReallyLongList01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/ReallyLongList01.fs @@ -1153,5 +1153,5 @@ "Kerrie"; "Kerry"; ] - + if List.length names <> 1153 then failwith "List length doesn't match" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Scripting/PreferredUiLangTests.fs b/tests/FSharp.Compiler.ComponentTests/Scripting/PreferredUiLangTests.fs index 63fbfb3df7c..6ad2de837a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Scripting/PreferredUiLangTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Scripting/PreferredUiLangTests.fs @@ -24,11 +24,11 @@ exit 0 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| "--preferreduilang:es-ES"; tmpFile; "arg1" |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| "--preferreduilang:es-ES"; tmpFile; "arg1" |] "" - + // Should succeed (exit 0) Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally @@ -46,11 +46,11 @@ exit 0 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| tmpFile; "--preferreduilang:es-ES"; "arg1" |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| tmpFile; "--preferreduilang:es-ES"; "arg1" |] "" - + // Should succeed (exit 0) Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally @@ -68,11 +68,11 @@ exit 0 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| tmpFile; "/preferreduilang:de-DE"; "arg1" |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| tmpFile; "/preferreduilang:de-DE"; "arg1" |] "" - + // Should succeed (exit 0) Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally @@ -91,11 +91,11 @@ exit 0 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| "--preferreduilang:fr-FR"; tmpFile |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| "--preferreduilang:fr-FR"; tmpFile |] "" - + // Should succeed (exit 0) Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally @@ -114,11 +114,11 @@ exit 0 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| tmpFile; "--preferreduilang:ja-JP" |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| tmpFile; "--preferreduilang:ja-JP" |] "" - + // Should succeed (exit 0) Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally @@ -136,11 +136,11 @@ exit 0 let tmpFile = Path.GetTempFileName() + ".fsx" try File.WriteAllText(tmpFile, scriptContent) - let errors, _, _ = - CompilerAssert.RunScriptWithOptionsAndReturnResult - [| tmpFile; "--preferreduilang:invalid-culture-xyz"; "arg1" |] + let errors, _, _ = + CompilerAssert.RunScriptWithOptionsAndReturnResult + [| tmpFile; "--preferreduilang:invalid-culture-xyz"; "arg1" |] "" - + // Should succeed - invalid culture is ignored, but switch is still consumed Assert.True((errors: ResizeArray).Count = 0, sprintf "Expected no errors, got: %A" errors) finally diff --git a/tests/FSharp.Compiler.ComponentTests/Scripting/TypeCheckOnlyTests.fs b/tests/FSharp.Compiler.ComponentTests/Scripting/TypeCheckOnlyTests.fs index 9a3279f7105..b5ba2e28568 100644 --- a/tests/FSharp.Compiler.ComponentTests/Scripting/TypeCheckOnlyTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Scripting/TypeCheckOnlyTests.fs @@ -69,10 +69,10 @@ let x = 21+21 let ``typecheck-only flag catches type errors in scripts with #load``() = withTempDirectory (fun tempDir -> let domainPath = writeScript tempDir "Domain.fsx" "type T = {\n Field: string\n}\n\nprintfn \"printfn Domain.fsx\"" - + let mainContent = sprintf "#load \"%s\"\n\nopen Domain\n\nlet y = {\n Field = 1\n}\n\nprintfn \"printfn A.fsx\"" (domainPath.Replace("\\", "\\\\")) let mainPath = writeScript tempDir "A.fsx" mainContent - + FsxFromPath mainPath |> withOptions ["--typecheck-only"] |> runFsi @@ -84,10 +84,10 @@ let ``typecheck-only flag catches type errors in scripts with #load``() = let ``typecheck-only flag catches type errors in loaded file``() = withTempDirectory (fun tempDir -> let domainPath = writeScript tempDir "Domain.fsx" "type T = { Field: string }\nlet x: int = \"error\"\nprintfn \"D\"" - + let mainContent = sprintf "#load \"%s\"\nopen Domain\nlet y = { Field = \"ok\" }\nprintfn \"A\"" (domainPath.Replace("\\", "\\\\")) let mainPath = writeScript tempDir "A.fsx" mainContent - + FsxFromPath mainPath |> withOptions ["--typecheck-only"] |> runFsi diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs index 74a69d7e703..201bedbd0ac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/ArrayTests.fs @@ -36,7 +36,7 @@ let ``jagged array 1`` () = assertSingleSignatureBinding "let a : array>>>> = failwith \"todo\"" "val a: int array array array array array" - + [] let ``jagged array 2`` () = assertSingleSignatureBinding diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/ImpliedSignatureHashTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/ImpliedSignatureHashTests.fs index 93ffca0d74c..cdd5825b263 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/ImpliedSignatureHashTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/ImpliedSignatureHashTests.fs @@ -15,7 +15,7 @@ type MyRecord = {X:string}""" type MyRecord = {X:string} module private PrivateInnerModule = let private add a b = a + b""")>] - + [] -let ``Hash should be stable for`` (change:string,codeBefore:string,codeAfter:string) = +let ``Hash should be stable for`` (change:string,codeBefore:string,codeAfter:string) = let hashBefore = Fs codeBefore |> getImpliedSignatureHash let hashAfter = Fs codeAfter |> getImpliedSignatureHash @@ -301,7 +301,7 @@ type MyRecord = { Mass: int }""")>] //TODO add a lot more negative tests - in which cases should hash in fact change [] -let ``Hash should change when`` (change:string,codeBefore:string,codeAfter:string) = +let ``Hash should change when`` (change:string,codeBefore:string,codeAfter:string) = let hashBefore = Fs codeBefore |> getImpliedSignatureHash let hashAfter = Fs codeAfter |> getImpliedSignatureHash diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs index 571b4ca58fb..b7f639c6279 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs @@ -155,7 +155,7 @@ do () """ |> printSignatures |> assertEqualIgnoreLineEnding "namespace System" - + [] let ``Empty module`` () = FSharp diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs index 97df2389c78..71c772213c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs @@ -92,7 +92,7 @@ type ImmutableArrayViaBuilder<'T>(builder: ImmutableArray<'T>.Builder) = class e let signature = printSignatures (Fs impl) - Fsi signature + Fsi signature |> withAdditionalSourceFile (FsSource impl) |> compile |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs index 4e71a676efc..3f9230c6241 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs @@ -25,7 +25,7 @@ let transpose (source: seq<#seq<'T>>) = source |> Seq.collect Seq.indexed |> Seq.groupBy fst |> Seq.map (snd >> (Seq.map snd))""" Fsi """module Program -val transpose: source: seq<'Collection> -> seq> when 'Collection :> seq<'T>""" +val transpose: source: seq<'Collection> -> seq> when 'Collection :> seq<'T>""" |> withAdditionalSourceFile encodeFs |> withLangVersion10 |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/members_basics.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/members_basics.fs index 0c067192b26..749ed206ad8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/members_basics.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/members_basics.fs @@ -14,12 +14,12 @@ let decr (r: int ref) = r.Value <- r.Value - 1 let failures = ref [] -let report_failure (s : string) = +let report_failure (s : string) = stderr.Write" NO: " stderr.WriteLine s failures := !failures @ [s] -let test (s : string) b = +let test (s : string) b = stderr.Write(s) if b then stderr.WriteLine " OK" else report_failure (s) @@ -47,7 +47,7 @@ do test "fweoew092" (rval2.b = 2) do rval2.b <- 3 do test "fweoew093" (rval2.b = 3) -let f(x) = +let f(x) = { new RecordType2<'a,int> with a = x and b = 2 } do test "fweoew091" ((f(1)).a = 1) @@ -72,10 +72,10 @@ let x0 = { new System.Object() with member __.GetHashCode() = 3 } type ClassType1 = class - inherit System.Object + inherit System.Object val someField : string - interface IEnumerable + interface IEnumerable abstract VirtualMethod1: string -> int abstract VirtualMethod2: string * string -> int @@ -88,15 +88,15 @@ type ClassType1 = end type ClassType1 - with + with default x.VirtualMethod1PostHoc(s) = 3 default x.VirtualMethod2PostHoc(s1,s2) = 3 new(s1,s2) = { inherit System.Object(); someField = "constructor2" + s1 + s2 } end type ClassType1 - with - interface IEnumerable with + with + interface IEnumerable with member x.GetEnumerator() = failwith "no implementation" end @@ -104,8 +104,8 @@ type ClassType1 let x2 = { new ClassType1("a") with member __.GetHashCode() = 3 } let x3 = { new ClassType1("a") with member __.VirtualMethod1(s) = 4 } -let x4 = { new ClassType1("a") with - member __.VirtualMethod1(s) = 5 +let x4 = { new ClassType1("a") with + member __.VirtualMethod1(s) = 5 member __.VirtualMethod2(s1,s2) = s1.Length + s2.Length } @@ -125,7 +125,7 @@ do test "e09wckj321" (x4.VirtualMethod2("abc","d") = 4) type ClassType2 = class - inherit ClassType1 + inherit ClassType1 val someField2 : string override x.VirtualMethod1(s) = 2001 @@ -138,7 +138,7 @@ type ClassType2 = let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 } let x32 = { new ClassType2("abc") with member __.VirtualMethod1(s) = 4002 } let x42 = { new ClassType2("abcd") with - member __.VirtualMethod1(s) = 5004 + member __.VirtualMethod1(s) = 5004 member __.VirtualMethod2(s1,s2) = 500 + s1.Length + s2.Length } do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true) @@ -161,10 +161,10 @@ module AbstractClassTest = begin [] type ClassType1 = class - inherit System.Object + inherit System.Object val someField : string - interface IEnumerable + interface IEnumerable abstract AbstractMethod1: string -> int abstract AbstractMethod2: string * string -> int @@ -173,8 +173,8 @@ module AbstractClassTest = begin end type ClassType1 - with - interface IEnumerable with + with + interface IEnumerable with member x.GetEnumerator() = failwith "no implementation" end @@ -183,8 +183,8 @@ module AbstractClassTest = begin //let shouldGiveError1 = { new ClassType1("a") with GetHashCode() = 3 } //let shouldGiveError2 = { new ClassType1("a") with AbstractMethod1(s) = 4 } //let shouldGiveError3a = new ClassType1("a") - let x4 = { new ClassType1("a") with - member __.AbstractMethod1(s) = 5 + let x4 = { new ClassType1("a") with + member __.AbstractMethod1(s) = 5 member __.AbstractMethod2(s1,s2) = s1.Length + s2.Length } @@ -197,7 +197,7 @@ module AbstractClassTest = begin type ClassType2 = class - inherit ClassType1 + inherit ClassType1 val someField2 : string override x.AbstractMethod1(s) = 2001 @@ -210,7 +210,7 @@ module AbstractClassTest = begin let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 } let x32 = { new ClassType2("abc") with member __.AbstractMethod1(s) = 4002 } let x42 = { new ClassType2("abcd") with - member __.AbstractMethod1(s) = 5004 + member __.AbstractMethod1(s) = 5004 member __.AbstractMethod2(s1,s2) = 500 + s1.Length + s2.Length } do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true) @@ -264,20 +264,20 @@ end // new(s: string) = { new ClassType1 with base=new Object() and x = "abc" } // new(s: string) = { new ClassType1 with base=new Form() and x = "abc" } // new(s: string) = ((new System.Object()) :?> ClassType1) - + //----------------------------------------- // Thorough testing of members for records. module RecordTypeTest = begin - type AbstractType = + type AbstractType = { instanceField: string; mutable mutableInstanceField: string; instanceArray: string array; instanceArray2: string array array; mutableInstanceArray: string array; - mutableInstanceArray2: string array array; + mutableInstanceArray2: string array array; recursiveInstance: AbstractType; } @@ -286,20 +286,20 @@ module RecordTypeTest = begin let staticArray = [| "staticArrayElement1"; "staticArrayElement2" |] let mutableStaticArray = [| "mutableStaticArrayElement1InitialValue"; "mutableStaticArrayElement2InitialValue" |] - let NewAbstractValue(s) = + let NewAbstractValue(s) = let rec self = { instanceField=s; mutableInstanceField=s; instanceArray=[| s;s |]; instanceArray2=[| [| s;s |];[| s;s |] |]; mutableInstanceArray =[| s;s |]; - mutableInstanceArray2 =[| [| s;s |];[| s;s |] |]; + mutableInstanceArray2 =[| [| s;s |];[| s;s |] |]; recursiveInstance=self; - } in + } in self - type AbstractType - with + type AbstractType + with // properties override x.ToString() = x.instanceField member x.InstanceProperty = x.instanceField + ".InstanceProperty" @@ -308,7 +308,7 @@ module RecordTypeTest = begin member x.MutableInstanceProperty with get() = x.mutableInstanceField and set(v:string) = x.mutableInstanceField <- v - + member x.InstanceIndexerCount = Array.length x.instanceArray member x.InstanceIndexer @@ -334,10 +334,10 @@ module RecordTypeTest = begin static member MutableStaticProperty with get() = !mutableStaticField and set(v:string) = mutableStaticField := v - + static member StaticIndexer with get(idx) = staticArray.[idx] - + static member StaticIndexerCount = Array.length staticArray static member MutableStaticIndexer @@ -355,7 +355,7 @@ module RecordTypeTest = begin member x.PrivateMutableInstanceProperty with get() = x.mutableInstanceField and set(v:string) = x.mutableInstanceField <- v - + member x.PrivateInstanceIndexerCount = Array.length x.instanceArray member x.PrivateInstanceIndexer @@ -381,10 +381,10 @@ module RecordTypeTest = begin static member PrivateMutableStaticProperty with get() = !mutableStaticField and set(v:string) = mutableStaticField := v - + static member PrivateStaticIndexer with get(idx) = staticArray.[idx] - + static member PrivateStaticIndexerCount = Array.length staticArray static member PrivateMutableStaticIndexer @@ -562,8 +562,8 @@ module UnionTypeTest = begin let NewAbstractValue(s) = B(s) - type AbstractType - with + type AbstractType + with // properties override x.ToString() = match x with A _ -> "A" | B(s) -> "B" member x.InstanceProperty = "instanceProperty" @@ -572,7 +572,7 @@ module UnionTypeTest = begin member x.MutableInstanceProperty with get() = x.InstanceProperty and set(v:string) = Printf.printf "called MutableInstanceProperty.set\n" - + member x.InstanceIndexerCount = 1 member x.InstanceIndexer @@ -598,10 +598,10 @@ module UnionTypeTest = begin static member MutableStaticProperty with get() = !mutableStaticField and set(v:string) = mutableStaticField := v - + static member StaticIndexer with get(idx) = staticArray.[idx] - + static member StaticIndexerCount = Array.length staticArray static member MutableStaticIndexer @@ -619,7 +619,7 @@ module UnionTypeTest = begin member x.PrivateMutableInstanceProperty with get() = "a" and set(v:string) = Printf.printf "called mutator\n" - + member x.PrivateInstanceIndexerCount = 1 member x.PrivateInstanceIndexer @@ -645,10 +645,10 @@ module UnionTypeTest = begin static member PrivateMutableStaticProperty with get() = !mutableStaticField and set(v:string) = mutableStaticField := v - + static member PrivateStaticIndexer with get(idx) = staticArray.[idx] - + static member PrivateStaticIndexerCount = Array.length staticArray static member PrivateMutableStaticIndexer @@ -816,14 +816,14 @@ end module OverrideIComparableOnClassTest = begin - type MyStringClass = - class - val cache: int - val v: string - interface IComparable with - member x.CompareTo(y:obj) = compare x.v (y :?> MyStringClass).v - end - override x.GetHashCode() = hash(x.v) + type MyStringClass = + class + val cache: int + val v: string + interface IComparable with + member x.CompareTo(y:obj) = compare x.v (y :?> MyStringClass).v + end + override x.GetHashCode() = hash(x.v) override x.Equals(y:obj) = (compare x.v (y :?> MyStringClass).v) = 0 member x.Length = x.cache new(s:string) = { inherit Object(); cache=s.Length; v=s } @@ -835,7 +835,7 @@ module OverrideIComparableOnClassTest = begin let s4 = new MyStringClass("abcd") do test "cepoiwelk" (s1.Length = 3) do test "cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringClass) (s2:MyStringClass) = + let testc (s1:MyStringClass) (s2:MyStringClass) = test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -845,30 +845,30 @@ module OverrideIComparableOnClassTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "cepoiwelk7" (hash(s1) = hash(s1.v)); - test "cepoiwelk8" (hash(s2) = hash(s2.v)) + test "cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIStructuralComparableOnClassTest = begin - type MyStringClass = - class - val cache: int - val v: string - interface IStructuralComparable with - member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringClass).v - end - interface IStructuralEquatable with - member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) + type MyStringClass = + class + val cache: int + val v: string + interface IStructuralComparable with + member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringClass).v + end + interface IStructuralEquatable with + member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringClass).v) = 0 - end + end member x.Length = x.cache new(s:string) = { inherit Object(); cache=s.Length; v=s } end @@ -879,7 +879,7 @@ module OverrideIStructuralComparableOnClassTest = begin let s4 = new MyStringClass("abcd") do test "cepoiwelk" (s1.Length = 3) do test "cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringClass) (s2:MyStringClass) = + let testc (s1:MyStringClass) (s2:MyStringClass) = test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -889,28 +889,28 @@ module OverrideIStructuralComparableOnClassTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "cepoiwelk7" (hash(s1) = hash(s1.v)); - test "cepoiwelk8" (hash(s2) = hash(s2.v)) + test "cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIComparableOnStructTest = begin [] - type MyStringStruct = + type MyStringStruct = struct - val cache: int - val v: string - interface IComparable with - member x.CompareTo(y:obj) = compare x.v (y :?> MyStringStruct).v - end - override x.GetHashCode() = hash(x.v) + val cache: int + val v: string + interface IComparable with + member x.CompareTo(y:obj) = compare x.v (y :?> MyStringStruct).v + end + override x.GetHashCode() = hash(x.v) override x.Equals(y:obj) = (compare x.v (y :?> MyStringStruct).v) = 0 member x.Length = x.cache new(s:string) = { cache=s.Length; v=s } @@ -922,7 +922,7 @@ module OverrideIComparableOnStructTest = begin let s4 = new MyStringStruct("abcd") do test "cepoiwelk" (s1.Length = 3) do test "cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringStruct) (s2:MyStringStruct) = + let testc (s1:MyStringStruct) (s2:MyStringStruct) = test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -932,31 +932,31 @@ module OverrideIComparableOnStructTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "cepoiwelk7" (hash(s1) = hash(s1.v)); - test "cepoiwelk8" (hash(s2) = hash(s2.v)) + test "cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIStructuralComparableOnStructTest = begin [] - type MyStringStruct = + type MyStringStruct = struct - val cache: int - val v: string - interface IStructuralComparable with - member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringStruct).v - end - interface IStructuralEquatable with - member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) + val cache: int + val v: string + interface IStructuralComparable with + member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringStruct).v + end + interface IStructuralEquatable with + member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringStruct).v) = 0 - end + end member x.Length = x.cache new(s:string) = { cache=s.Length; v=s } end @@ -967,7 +967,7 @@ module OverrideIStructuralComparableOnStructTest = begin let s4 = new MyStringStruct("abcd") do test "cepoiwelk" (s1.Length = 3) do test "cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringStruct) (s2:MyStringStruct) = + let testc (s1:MyStringStruct) (s2:MyStringStruct) = test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -977,26 +977,26 @@ module OverrideIStructuralComparableOnStructTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "cepoiwelk7" (hash(s1) = hash(s1.v)); - test "cepoiwelk8" (hash(s2) = hash(s2.v)) + test "cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIComparableOnRecordTest = begin [] type MyStringRecord = { cache: int; v: string } - with - interface IComparable with - member x.CompareTo(y:obj) = compare x.v (y :?> MyStringRecord).v - end - override x.GetHashCode() = hash(x.v) + with + interface IComparable with + member x.CompareTo(y:obj) = compare x.v (y :?> MyStringRecord).v + end + override x.GetHashCode() = hash(x.v) override x.Equals(y:obj) = (compare x.v (y :?> MyStringRecord).v) = 0 member x.Length = x.cache static member Create(s:string) = { cache=s.Length; v=s } @@ -1009,7 +1009,7 @@ module OverrideIComparableOnRecordTest = begin let s4 = MyStringRecord.Create("abcd") do test "recd-cepoiwelk" (s1.Length = 3) do test "recd-cepoiwelk" (s2.Length = 3) - let testc s1 s2 = + let testc s1 s2 = test "recd-cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "recd-cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "recd-cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -1019,29 +1019,29 @@ module OverrideIComparableOnRecordTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "recd-cepoiwelk7" (hash(s1) = hash(s1.v)); - test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) + test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIStructuralComparableOnRecordTest = begin [] type MyStringRecord = { cache: int; v: string } - with - interface IStructuralComparable with - member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringRecord).v - end - interface IStructuralEquatable with - member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) + with + interface IStructuralComparable with + member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringRecord).v + end + interface IStructuralEquatable with + member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringRecord).v) = 0 - end + end member x.Length = x.cache static member Create(s:string) = { cache=s.Length; v=s } end @@ -1053,7 +1053,7 @@ module OverrideIStructuralComparableOnRecordTest = begin let s4 = MyStringRecord.Create("abcd") do test "recd-cepoiwelk" (s1.Length = 3) do test "recd-cepoiwelk" (s2.Length = 3) - let testc s1 s2 = + let testc s1 s2 = test "recd-cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "recd-cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "recd-cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -1063,31 +1063,31 @@ module OverrideIStructuralComparableOnRecordTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "recd-cepoiwelk7" (hash(s1) = hash(s1.v)); - test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) + test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIComparableOnUnionTest = begin [] type MyStringUnion = A of int * string | B of int * string - with - member x.Value = match x with A(_,s) | B(_,s) -> s + with + member x.Value = match x with A(_,s) | B(_,s) -> s override x.GetHashCode() = hash(x.Value) override x.Equals(y:obj) = x.Value = (y :?> MyStringUnion).Value interface IComparable with - member x.CompareTo(y:obj) = + member x.CompareTo(y:obj) = compare x.Value (y :?> MyStringUnion).Value - end + end member x.Length = match x with A(n,_) | B(n,_) -> n static member Create(s:string) = A(s.Length,s) end @@ -1099,7 +1099,7 @@ module OverrideIComparableOnUnionTest = begin let s4 = MyStringUnion.Create("abcd") do test "union-cepoiwelk" (s1.Length = 3) do test "union-cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringUnion) (s2:MyStringUnion) = + let testc (s1:MyStringUnion) (s2:MyStringUnion) = test "union-cepoiwelk1" ((s1 = s2) = (s1.Value = s2.Value)); test "union-cepoiwelk2" ((s1 < s2) = (s1.Value < s2.Value)); test "union-cepoiwelk3" ((s1 > s2) = (s1.Value > s2.Value)); @@ -1110,18 +1110,18 @@ module OverrideIComparableOnUnionTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.Value = %d\n" (hash(s1.Value)); test "union-cepoiwelk7" (hash(s1) = hash(s1.Value)); - test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) + test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end -module TwoCaseUnionTest = +module TwoCaseUnionTest = [] type MyUnion = A | B @@ -1161,7 +1161,7 @@ module ToStringOnUnionTestOverride = begin type MyUnion = A of string | B with override x.ToString() = expected1 - + let expected2 = "MyStructUnion" type MyStructUnion = C of string | D @@ -1204,14 +1204,14 @@ module ToStringOnRecordTestOverride = begin type MyRecord = { A: string; B: int } with override x.ToString() = expected1 - + let expected2 = "MyStructRecord" [] type MyStructRecord = { C: string; D: int } with override x.ToString() = expected2 - + let a1 = {A = "201"; B = 7} let c1 = {C = "20"; D = 17} @@ -1226,18 +1226,18 @@ module OverrideIStructuralComparableOnUnionTest = begin [] type MyStringUnion = A of int * string | B of int * string - with - member x.Value = match x with A(_,s) | B(_,s) -> s + with + member x.Value = match x with A(_,s) | B(_,s) -> s interface IStructuralEquatable with member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.Value) member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = x.Value = (y :?> MyStringUnion).Value - end + end interface IStructuralComparable with - member x.CompareTo(y:obj,comp:System.Collections.IComparer) = + member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.Value (y :?> MyStringUnion).Value - end + end member x.Length = match x with A(n,_) | B(n,_) -> n static member Create(s:string) = A(s.Length,s) end @@ -1249,7 +1249,7 @@ module OverrideIStructuralComparableOnUnionTest = begin let s4 = MyStringUnion.Create("abcd") do test "union-cepoiwelk" (s1.Length = 3) do test "union-cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringUnion) (s2:MyStringUnion) = + let testc (s1:MyStringUnion) (s2:MyStringUnion) = test "union-cepoiwelk1" ((s1 = s2) = (s1.Value = s2.Value)); //test "union-cepoiwelk2" ((s1 < s2) = (s1.Value < s2.Value)); //test "union-cepoiwelk3" ((s1 > s2) = (s1.Value > s2.Value)); @@ -1260,25 +1260,25 @@ module OverrideIStructuralComparableOnUnionTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.Value = %d\n" (hash(s1.Value)); test "union-cepoiwelk7" (hash(s1) = hash(s1.Value)); - test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) + test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end //--------------------------------------------------------------------- // Test we can define an attribute -type DontPressThisButtonAttribute = - class +type DontPressThisButtonAttribute = + class inherit System.Attribute - val v: string + val v: string member x.Message = x.v new(s:string) = { inherit System.Attribute(); v=s } end @@ -1292,9 +1292,9 @@ let [] button () = 1 //open System.Windows.Forms -//type MyCanvas2 = -// class -// inherit Form +//type MyCanvas2 = +// class +// inherit Form // override x.OnPaint(args) = Printf.printf "OnPaint\n"; base.OnPaint(args) // new() = { inherit Form(); } @@ -1316,16 +1316,16 @@ let (|>) x f = f x (* type MyEventListeners<'a> = class - inherit Event<'a> + inherit Event<'a> - val mutable listeners2: (Handler<'a>) list + val mutable listeners2: (Handler<'a>) list - member l.Fire(x : 'a) = - let arg = new SimpleEventArgs<_>(x) in - l.listeners2 |> List.iter (fun d -> ignore(d.Invoke((null:obj),arg))) + member l.Fire(x : 'a) = + let arg = new SimpleEventArgs<_>(x) in + l.listeners2 |> List.iter (fun d -> ignore(d.Invoke((null:obj),arg))) - new() = - { inherit Event<'a>(); + new() = + { inherit Event<'a>(); listeners2 = [] } end @@ -1333,8 +1333,8 @@ type MyEventListeners<'a> = *) (* -type MyCanvas2 = - class +type MyCanvas2 = + class inherit Form member x.Redraw : Event new: unit -> MyCanvas2 @@ -1342,8 +1342,8 @@ type MyCanvas2 = *) (* -type MyCanvas2 = - class +type MyCanvas2 = + class inherit Form val redrawListeners: MyEventListeners member x.Redraw = x.redrawListeners @@ -1355,7 +1355,7 @@ type MyCanvas2 = (* class MyCanvas2() = - let l = MyEventListeners() in + let l = MyEventListeners() in object inherit Form() member x.Redraw = l @@ -1363,7 +1363,7 @@ class MyCanvas2() = end class MyCanvas2 = - let l = MyEventListeners() in + let l = MyEventListeners() in object inherit Form member x.Redraw = l @@ -1389,9 +1389,9 @@ do Application.Run(form) // Test we can define an exception type MyException = - class + class inherit System.Exception - val v: string + val v: string override x.Message = x.v new(s:string) = { inherit System.Exception(); v=s } end @@ -1417,7 +1417,7 @@ type IMyInterface = //--------------------------------------------------------------------- // Test we can define and subscribe to a generic interface - + //--------------------------------------------------------------------- // Test we can define a struct @@ -1437,8 +1437,8 @@ type MyStruct = //--------------------------------------------------------------------- // Test we can define a class with no fields -type NoFieldClass = - class +type NoFieldClass = + class new() = { inherit System.Object() } end @@ -1450,12 +1450,12 @@ module MultiInterfaceTest = begin type PrivateInterfaceA2 = interface abstract M2 : unit -> unit end [] - type C1 = - class - interface PrivateInterfaceA1 with + type C1 = + class + interface PrivateInterfaceA1 with member x.M1() = () end - interface PrivateInterfaceA2 with + interface PrivateInterfaceA2 with member x.M2() = () end end @@ -1465,12 +1465,12 @@ module MultiInterfaceTestNameConflict = begin type PrivateInterfaceA1 = interface abstract M : unit -> unit end type PrivateInterfaceA2 = interface abstract M : unit -> unit end [] - type C1 = - class - interface PrivateInterfaceA1 with + type C1 = + class + interface PrivateInterfaceA1 with member x.M() = () end - interface PrivateInterfaceA2 with + interface PrivateInterfaceA2 with member x.M() = () end end @@ -1481,12 +1481,12 @@ module GenericMultiInterfaceTestNameConflict = begin type PrivateInterfaceA1<'a> = interface abstract M : 'a -> 'a end type PrivateInterfaceA2<'a> = interface abstract M : 'a -> 'a end [] - type C1 = - class - interface PrivateInterfaceA1 with + type C1 = + class + interface PrivateInterfaceA1 with member x.M(y) = y end - interface PrivateInterfaceA2 with + interface PrivateInterfaceA2 with member x.M(y) = y end end @@ -1498,30 +1498,30 @@ module DeepInterfaceInheritance = begin type InterfaceA2 = interface inherit InterfaceA1 abstract M2 : int -> int end type InterfaceA3 = interface inherit InterfaceA1 inherit InterfaceA2 abstract M3 : int -> int end - type C1 = - class - interface InterfaceA2 with - member x.M1(y) = y - member x.M2(y) = y + y + type C1 = + class + interface InterfaceA2 with + member x.M1(y) = y + member x.M2(y) = y + y end new() = { inherit Object(); } end - type C2 = - class - interface InterfaceA3 with + type C2 = + class + interface InterfaceA3 with member x.M1(y) = y member x.M2(y) = y + y member x.M3(y) = y + y + y end new() = { inherit Object(); } end - type C3 = - class - interface InterfaceA2 with + type C3 = + class + interface InterfaceA2 with member x.M1(y) = y member x.M2(y) = y + y end - interface InterfaceA3 with + interface InterfaceA3 with member x.M3(y) = y + y + y end new() = { inherit Object(); } @@ -1529,19 +1529,19 @@ module DeepInterfaceInheritance = begin do test "fewopvrej1" (((new C1()) :> InterfaceA1).M1(4) = 4) do test "fewopvrej2" (((new C1()) :> InterfaceA2).M2(4) = 8) - + do test "fewopvrej3" (((new C2()) :> InterfaceA1).M1(4) = 4) do test "fewopvrej4" (((new C2()) :> InterfaceA2).M2(4) = 8) do test "fewopvrej5" (((new C2()) :> InterfaceA3).M3(4) = 12) do test "fewopvrej6" (((new C2()) :> InterfaceA3).M1(4) = 4) do test "fewopvrej7" (((new C2()) :> InterfaceA3).M2(4) = 8) - + do test "fewopvrej8" (((new C3()) :> InterfaceA1).M1(4) = 4) do test "fewopvrej9" (((new C3()) :> InterfaceA2).M2(4) = 8) do test "fewopvrej10" (((new C3()) :> InterfaceA3).M3(4) = 12) do test "fewopvrej11" (((new C3()) :> InterfaceA3).M1(4) = 4) do test "fewopvrej12" (((new C3()) :> InterfaceA3).M2(4) = 8) - + end module DeepGenericInterfaceInheritance = begin @@ -1549,30 +1549,30 @@ module DeepGenericInterfaceInheritance = begin type InterfaceA2<'b> = interface inherit InterfaceA1<'b list> abstract M2 : 'b * 'b list -> 'b list end type InterfaceA3 = interface inherit InterfaceA2 abstract M3 : string list -> string list end - type C1 = - class - interface InterfaceA2 with - member obj.M1(y) = 1::y + type C1 = + class + interface InterfaceA2 with + member obj.M1(y) = 1::y member obj.M2(x,y) = x::y end new() = { inherit Object(); } end - type C2 = - class - interface InterfaceA3 with + type C2 = + class + interface InterfaceA3 with member obj.M1(y) = "a" :: y member obj.M2(x,y) = x :: y member obj.M3(y) = "a" :: "b" :: "c" :: y end new() = { inherit Object(); } end - type C3 = - class - interface InterfaceA2 with + type C3 = + class + interface InterfaceA2 with member obj.M1(y) = "a" :: y member obj.M2(x,y) = x :: y end - interface InterfaceA3 with + interface InterfaceA3 with member obj.M3(y) = "a" :: "b" :: "c" :: y end new() = { inherit Object(); } @@ -1580,21 +1580,21 @@ module DeepGenericInterfaceInheritance = begin do test "fewopvrej1" (((new C1()) :> InterfaceA1).M1([1]) = [1;1]) do test "fewopvrej2" (((new C1()) :> InterfaceA2).M2(3,[1]) = [3;1]) - + do test "fewopvrej3" (((new C2()) :> InterfaceA1).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej4" (((new C2()) :> InterfaceA2).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej4" (((new C2()) :> InterfaceA2).M2("a",["hi"]) = ["a";"hi"]) do test "fewopvrej5" (((new C2()) :> InterfaceA3).M3(["hi"]) = ["a";"b";"c";"hi"]) do test "fewopvrej6" (((new C2()) :> InterfaceA3).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej7" (((new C2()) :> InterfaceA3).M2("a",["hi"]) = ["a";"hi"]) - + do test "fewopvrej8" (((new C3()) :> InterfaceA1).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej8" (((new C3()) :> InterfaceA2).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej9" (((new C3()) :> InterfaceA2).M2("a",["hi"]) = ["a";"hi"]) do test "fewopvrej10" (((new C3()) :> InterfaceA3).M3(["hi"]) = ["a";"b";"c";"hi"]) do test "fewopvrej11" (((new C3()) :> InterfaceA3).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej12" (((new C3()) :> InterfaceA3).M2("a",["hi"]) = ["a";"hi"]) - + end @@ -1603,7 +1603,7 @@ module PointTest = begin type Point = class - new(x_init) = { inherit System.Object(); x_init = x_init; x = x_init } + new(x_init) = { inherit System.Object(); x_init = x_init; x = x_init } val x_init : int val mutable x : int member p.X = p.x @@ -1621,7 +1621,7 @@ module PointTest = begin type Point_with_no_inherits_clause = class - new x_init = { x_init = x_init; x = x_init } + new x_init = { x_init = x_init; x = x_init } val x_init : int val mutable x : int member p.X = p.x @@ -1629,9 +1629,9 @@ module PointTest = begin member p.Move d1 d2 = p.x <- p.x + d1 + d2 end - do - let p = (new Point_with_no_inherits_clause(3)) in - let f = p.Move 4 in + do + let p = (new Point_with_no_inherits_clause(3)) in + let f = p.Move 4 in test "wdfjcdwkj1" (p.X = 3); f 4; test "wdfjcdwkj2" (p.X = 11); @@ -1641,7 +1641,7 @@ module PointTest = begin test "wdfjcdwkj5" (Point.TwoPatternArgs [1] [2] = 3); test "wdfjcdwkj6" (Point.ThreeArgs 1 2 3 = 6); test "wdfjcdwkj7" (Point.ThreePatternArgs [1] [2] [3] = 6); - let p2 = (new Point(16)) in + let p2 = (new Point(16)) in test "wdfjcdwkj4" (p2.InstanceTwoArgs 1 2 = 16 + 3); test "wdfjcdwkj5" (p2.InstanceTwoPatternArgs [1] [2] = 16 + 3); test "wdfjcdwkj6" (p2.InstanceThreeArgs 1 2 3 = 16 + 6); @@ -1656,20 +1656,20 @@ end open System.Diagnostics -type +type [) >] MyIntList = MyNil | MyCons of int * MyIntList and MyIntListDebugView = - class + class val v: MyIntList - new(x) = { v = x } - [] - member x.Items = - let rec length x acc = match x with MyNil -> acc | MyCons(a,b) -> length b (acc+1) in - let len = length x.v 0 in - let items = Array.zeroCreate len in - let rec go n l = match l with MyNil -> () | MyCons(a,b) -> items.[n] <- a; go (n+1) b in + new(x) = { v = x } + [] + member x.Items = + let rec length x acc = match x with MyNil -> acc | MyCons(a,b) -> length b (acc+1) in + let len = length x.v 0 in + let items = Array.zeroCreate len in + let rec go n l = match l with MyNil -> () | MyCons(a,b) -> items.[n] <- a; go (n+1) b in go 0 x.v; items end @@ -1689,10 +1689,10 @@ end module ThenDoTest = begin let res = ref 2 - type P = - class - val x1: int; val x2: string; - new(a,b) = {x1=a; x2=(test "ewqonce1" (!res = 2); b) } then res := !res + 1 + type P = + class + val x1: int; val x2: string; + new(a,b) = {x1=a; x2=(test "ewqonce1" (!res = 2); b) } then res := !res + 1 end do ignore(new P(3,"5")) @@ -1705,17 +1705,17 @@ end module ThenDoTest2 = begin let res = ref 2 - type P = - class - val x1: int; val x2: string; - new(a,b) as x = - { x1= !res; - x2=(test "ewqonce3" (!res = 2); b) } - then + type P = + class + val x1: int; val x2: string; + new(a,b) as x = + { x1= !res; + x2=(test "ewqonce3" (!res = 2); b) } + then test "ewqonce4" (!res = 2); - res := !res + 1; + res := !res + 1; test "ewqonce5" (!res = 3); - test "ewqonce6" (x.x1 = 2) + test "ewqonce6" (x.x1 = 2) end do ignore(new P(3,"5")) @@ -1726,14 +1726,14 @@ end module GenericInterfaceTest = begin type Foo<'a> = - interface + interface abstract fun1 : 'a -> 'a abstract fun2 : int -> int end type Bar<'b> = - class + class val store : 'b interface Foo<'b> with member self.fun1(x) = x @@ -1744,7 +1744,7 @@ module GenericInterfaceTest = begin type Bar2<'b> = - class + class val store : 'b interface Foo<'b> with member self.fun1(x:'b) = x @@ -1754,7 +1754,7 @@ module GenericInterfaceTest = begin end type Bar3<'b> = - class + class val store : int interface Foo<'b> with member self.fun1(x) = x @@ -1768,7 +1768,7 @@ end //--------------------------------------------------------------------- // - + module Inventory = begin @@ -1776,7 +1776,7 @@ module Inventory = begin type item = A | B type image = A | B - type ItemDetails = + type ItemDetails = { ItemIndex: item; InventoryImage: image; Name : string } @@ -1784,21 +1784,21 @@ module Inventory = begin type IInventory = interface abstract Contains : item -> bool abstract Remove : item -> unit - abstract GetDetails : item -> ItemDetails - abstract Add : ItemDetails -> unit - abstract GetTuple : unit -> (item * image * string) list + abstract GetDetails : item -> ItemDetails + abstract Add : ItemDetails -> unit + abstract GetTuple : unit -> (item * image * string) list end - module List = + module List = let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection")) - let rec assoc x l = - match l with + let rec assoc x l = + match l with | [] -> indexNotFound() | ((h,r)::t) -> if x = h then r else assoc x t - let rec remove_assoc x l = - match l with + let rec remove_assoc x l = + match l with | [] -> [] | (((h,_) as p) ::t) -> if x = h then t else p:: remove_assoc x t @@ -1822,21 +1822,21 @@ end module SamplerTest = begin - type Sampler<'a,'b> = + type Sampler<'a,'b> = interface - abstract Sample : 'a -> unit + abstract Sample : 'a -> unit abstract GetStatistic : unit -> 'b end - - let NewAverage(toFloat) = + + let NewAverage(toFloat) = let count = ref 0 in - let total = ref 0.0 in + let total = ref 0.0 in { new Sampler<_,float> with member __.Sample(x) = incr count; total := !total + toFloat x member __.GetStatistic() = !total / float(!count) } - type Average<'a> = + type Average<'a> = class val mutable total : float val mutable count : int @@ -1855,10 +1855,10 @@ end // This simple case of forward-reference revealed a bug type callconv = AA - with - member x.IsInstance = x.ThisConv + with + member x.IsInstance = x.ThisConv member x.ThisConv = 1 - end + end // Likewise @@ -1867,7 +1867,7 @@ module OverloadZeroOneTestSoohyoung = begin type Point = class val mutable mx: int - + new () = { mx = 0 } new (ix) = { mx = ix } end @@ -1875,16 +1875,16 @@ module OverloadZeroOneTestSoohyoung = begin end //--------------------------------------------------------------------- -// Bad error message case +// Bad error message case -module Ralf = begin +module Ralf = begin type Matrix = M | N [] - type Distribution = - class + type Distribution = + class new () = { } abstract member NumberOfDimensions : unit -> int @@ -1897,13 +1897,13 @@ module Ralf = begin end type Gaussian1D = - class + class inherit Distribution val PrecisionMean : float val Precision : float new (precisionMean, precision) = { PrecisionMean = 0.0; Precision = 0.0 } override x.NumberOfDimensions() = 1 - override x.Density point = 1.0 + override x.Density point = 1.0 override x.AbsoluteDifference distribution = 0.0 override x.Clone() = new Gaussian1D (0.0,0.0) :> Distribution override x.CloneConstant() = new Gaussian1D (x.PrecisionMean,x.Precision) :> Distribution @@ -1955,14 +1955,14 @@ module OverloadedOperatorTests = begin let _ = SCGL.[0] let _ = SCGL.[0] <- 3 - let f (x: 'a) = - let SCGL = new System.Collections.Generic.List<'a>() in - let _ = SCGL.Add(x) in - let _ = SCGL.[0] in - let _ = SCGL.[0] <- x in + let f (x: 'a) = + let SCGL = new System.Collections.Generic.List<'a>() in + let _ = SCGL.Add(x) in + let _ = SCGL.[0] in + let _ = SCGL.[0] <- x in () - // check we have generalized + // check we have generalized do f 1 do f "3" @@ -1970,8 +1970,8 @@ module OverloadedOperatorTests = begin let _ = SCGD.Add("hello",3.0) let _ = SCGD.["hello"] - let g (k: 'a) (v:'b)= - let SCGD = new System.Collections.Generic.Dictionary<'a,'b>() in + let g (k: 'a) (v:'b)= + let SCGD = new System.Collections.Generic.Dictionary<'a,'b>() in let _ = SCGD.Add(k,v) in let _ = SCGD.[k] in let _ = SCGD.[k] <- v in @@ -1979,20 +1979,20 @@ module OverloadedOperatorTests = begin - // check we have generalized + // check we have generalized do g 1 "3" do g "3" 1 do g "3" "1" do g 1 1 - let h (v:'b)= - let arr = [| v;v;v |] in - let elem = arr.[0] in - let _ = arr.[0] <- v in + let h (v:'b)= + let arr = [| v;v;v |] in + let elem = arr.[0] in + let _ = arr.[0] <- v in () - // check we have generalized + // check we have generalized do h 1 do h "3" @@ -2010,7 +2010,7 @@ module PropertyOverrideTests = begin abstract G2 : string-> float with get abstract G3 : string * string -> float with get end - + type IA = interface abstract S1 : float with set abstract S2 : string-> float with set @@ -2019,22 +2019,22 @@ module PropertyOverrideTests = begin abstract G2 : string-> float with get abstract G3 : string * string -> float with get end - + [] - type CTest = + type CTest = class inherit A - override x.S1 with set v = () - override x.S2 with set s v = () - override x.S3 with set (s1,s2) v = () + override x.S1 with set v = () + override x.S2 with set s v = () + override x.S3 with set (s1,s2) v = () override x.G1 with get () = 1.0 override x.G2 with get (s:string) = 2.0 override x.G3 with get (s1,s2) = 3.0 - interface IA with - override x.S1 with set v = () - override x.S2 with set s v = () - override x.S3 with set (s1,s2) v = () + interface IA with + override x.S1 with set v = () + override x.S2 with set s v = () + override x.S3 with set (s1,s2) v = () override x.G1 with get () = 1.0 override x.G2 with get (s:string) = 2.0 override x.G3 with get (s1,s2) = 3.0 @@ -2048,7 +2048,7 @@ module FieldsInClassesDontContributeToRecordFieldInference = begin type container = class val capacity : float - new(cap) = { capacity = cap } + new(cap) = { capacity = cap } end type cargo = class @@ -2065,8 +2065,8 @@ end module LucianRecords1 = begin type MyRecord1 = {a:int; x:int} type MyRecord2 = {a:int; y:string} - let f (m:MyRecord1) : MyRecord1 = {m with a=3} - let g (m:MyRecord2) : MyRecord2 = {m with a=3} + let f (m:MyRecord1) : MyRecord1 = {m with a=3} + let g (m:MyRecord2) : MyRecord2 = {m with a=3} let h (m:MyRecord1) = m.a type Tab = {a:string; b:string} @@ -2088,7 +2088,7 @@ end // let y2 = (f2() : int) // let y3 = (f2() : DateTime) // let y4 = (f2() : System.Windows.Forms.Form) - + //end //module AccessBugOnFSharpList = begin @@ -2097,31 +2097,31 @@ end // open System.Web.Hosting // open System.Data.SqlClient -// type TopicPathProvider = +// type TopicPathProvider = // class -// inherit VirtualPathProvider - -// new() = { inherit VirtualPathProvider(); } - +// inherit VirtualPathProvider + +// new() = { inherit VirtualPathProvider(); } + // member x.TopicExists topic = // let cmd = new SqlCommand() in // cmd.CommandText <- "SELECT COUNT(*) FROM Topic WHERE Topic.Name = @name"; // (cmd.Parameters.Add("@name", System.Data.SqlDbType.NVarChar, 255)).Value <- topic; // unbox(cmd.ExecuteScalar()) > 0 - + // override x.FileExists((virtualPath: string)) = // let relPath = VirtualPathUtility.ToAppRelative(virtualPath) in // if relPath.StartsWith("~/topic") then // x.TopicExists (relPath.Substring(7)) // else // x.Previous.FileExists(virtualPath) - + // override x.DirectoryExists((virtualDir: string)) = // let relPath = VirtualPathUtility.ToAppRelative(virtualDir) in // relPath.StartsWith("~/topic") || x.DirectoryExists(virtualDir) // end -// let AppInitialize() = +// let AppInitialize() = // let provider = new TopicPathProvider() in // HostingEnvironment.RegisterVirtualPathProvider(provider) @@ -2135,9 +2135,9 @@ module TupledTests = begin let _ = C1.Foo((1,2)) - - - + + + end @@ -2154,7 +2154,7 @@ let fails = ff.Invoke() module RecursiveClassDefinitions = begin - type t1 = + type t1 = class val t2: t2 member t1.M1(t2:t2) = t2.M2() @@ -2163,9 +2163,9 @@ module RecursiveClassDefinitions = begin member t1.P1 = t1.t2.P2 member t1.P2 = t1.P1 member t1.P3 = t1.t2.P3 + 1 - new() = { t2 = new t2() } - end - and t2 = + new() = { t2 = new t2() } + end + and t2 = class val t1: t1 member t2.M1() = t2.t1.M2() @@ -2174,10 +2174,10 @@ module RecursiveClassDefinitions = begin member t2.P1 : int = t2.P2 member t2.P2 = t2.t1.P1 member t2.P3 = t2.P3 - new() = { t1 = new t1() } - end + new() = { t1 = new t1() } + end - //let t2 = new t2() + //let t2 = new t2() //let b = (t2.P1 = 3) end @@ -2191,7 +2191,7 @@ module RecursiveAugmentationDefinitions = begin member t1.P1 = t1.t2.P2 member t1.P2 = t1.P1 member t1.P3 = t1.t2.P3 + 1 - end + end and t2 = { t1:t1 } with member t2.M1() = t2.t1.M2() @@ -2200,15 +2200,15 @@ module RecursiveAugmentationDefinitions = begin member t2.P1 : int = t2.P2 member t2.P2 = t2.t1.P1 member t2.P3 = t2.P3 - end + end - //let t2 = new t2() + //let t2 = new t2() //let b = (t2.P1 = 3) end module RecursiveAbstractClassDefinitions = begin - type t1 = + type t1 = class val t2: t2 abstract M1 : t2 -> t1 @@ -2219,21 +2219,21 @@ module RecursiveAbstractClassDefinitions = begin abstract P3 : int default t1.M1(t2:t2) = t2.M2() default t1.M2() = t1.M1(t1.t2) - default t1.M3(t2:t2) = + default t1.M3(t2:t2) = // Note we can use object expressions within the recursive // definition of the type itself. This requires real care - the // exact set of abstract members that still need implementing // must have been determined correctly before any expressions are // analyzed. - { new t1() with - member x.P1 = 4 + { new t1() with + member x.P1 = 4 end } default t1.P1 = t1.t2.P2 default t1.P2 = t1.P1 default t1.P3 = t1.t2.P3 + 1 new() = { t2 = new t2() } - end - and t2 = + end + and t2 = class val t1: t1 abstract M1 : unit -> t1 @@ -2249,22 +2249,22 @@ module RecursiveAbstractClassDefinitions = begin default t2.P2 = t2.t1.P1 default t2.P3 = t2.P3 new() = { t1 = new t1() } - end + end end module RecursiveAbstractClassDefinitions2 = begin (* same test as above but in different order and some missing implementations *) [] - type t1 = + type t1 = class val t2: t2 default t1.M1(t2:t2) = t2.M2() - default x.M3(t2:t2) = { new t1() with - member x.P1 = 4 + default x.M3(t2:t2) = { new t1() with + member x.P1 = 4 member x.M2() = t1.MakeT1() } - static member MakeT1() = { new t1() with - member x.P1 = 4 + static member MakeT1() = { new t1() with + member x.P1 = 4 member x.M2() = t1.MakeT1() } default t1.P2 = t1.P1 default t1.P3 = t1.t2.P3 + 1 @@ -2275,8 +2275,8 @@ module RecursiveAbstractClassDefinitions2 = begin abstract P1 : int abstract P2 : int abstract P3 : int - end - and t2 = + end + and t2 = class val t1: t1 default t2.M1() = t2.t1.M2() @@ -2292,9 +2292,9 @@ module RecursiveAbstractClassDefinitions2 = begin abstract P2 : int abstract P3 : int new() = { t1 = t1.MakeT1() } - end + end - //let t2 = new t2() + //let t2 = new t2() //let b = (t2.P1 = 3) end @@ -2327,8 +2327,8 @@ end module TestConstrainedItemProperty = begin - type Foo = - interface + type Foo = + interface abstract Item : int -> string with get end @@ -2344,10 +2344,10 @@ module DefaultStructCtor = begin let i2 = new System.Nullable() do test "cwehoiewc" (i1.HasValue=false) do test "cwehoiewc" (i2.HasValue=false) - type S = - struct - new(v:int) = { v=v } - val v : int + type S = + struct + new(v:int) = { v=v } + val v : int end let i3 = new S() let i3b = new S(3) @@ -2357,56 +2357,56 @@ end module MiscNullableTests = begin open System - let (>=?!) (x : Nullable<'a>) (y: 'a) = + let (>=?!) (x : Nullable<'a>) (y: 'a) = x.HasValue && x.Value >= y - let (>?!) (x : Nullable<'a>) (y: 'a) = + let (>?!) (x : Nullable<'a>) (y: 'a) = x.HasValue && x.Value > y - let (<=?!) (x : Nullable<'a>) (y: 'a) = + let (<=?!) (x : Nullable<'a>) (y: 'a) = not x.HasValue || x.Value <= y - let () (y: 'a) = + let () (y: 'a) = not x.HasValue || x.Value < y - let (=?!) (x : Nullable<'a>) (y: 'a) = + let (=?!) (x : Nullable<'a>) (y: 'a) = x.HasValue && x.Value = y - let (<>?!) (x : Nullable<'a>) (y: 'a) = + let (<>?!) (x : Nullable<'a>) (y: 'a) = not x.HasValue || x.Value <> y /// This overloaded operator divides Nullable values by non-Nullable values /// using the overloaded operator "/". Inlined to allow use over any type, /// as this resolves the overloading on "/". - let inline (/?!) (x : Nullable<'a>) (y: 'a) = + let inline (/?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value / y) - else x + else x /// This overloaded operator adds Nullable values by non-Nullable values /// using the overloaded operator "+". Inlined to allow use over any type, /// as this resolves the overloading on "+". - let inline (+?!) (x : Nullable<'a>) (y: 'a) = + let inline (+?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value + y) else x /// This overloaded operator adds Nullable values by non-Nullable values /// using the overloaded operator "-". Inlined to allow use over any type, /// as this resolves the overloading on "-". - let inline (-?!) (x : Nullable<'a>) (y: 'a) = + let inline (-?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value - y) else x /// This overloaded operator adds Nullable values by non-Nullable values /// using the overloaded operator "*". Inlined to allow use over any type, /// as this resolves the overloading on "*". - let inline ( *?!) (x : Nullable<'a>) (y: 'a) = + let inline ( *?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value * y) else x /// This overloaded operator adds Nullable values by non-Nullable values /// using the overloaded operator "%". Inlined to allow use over any type, /// as this resolves the overloading on "%". - let inline ( %?!) (x : Nullable<'a>) (y: 'a) = + let inline ( %?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value % y) else x @@ -2421,7 +2421,7 @@ module BaseCallWorkaround = begin end type C2 = class - inherit C1 + inherit C1 new() = {inherit C1()} override this.Blah() = ignore <| printf "From C2\n"; @@ -2433,7 +2433,7 @@ module BaseCallWorkaround = begin end module BaseCallTest = begin - let res = ref 0 + let res = ref 0 type C1 = class new() = {} abstract Blah : unit -> unit @@ -2443,7 +2443,7 @@ module BaseCallTest = begin end type C2 = class - inherit C1 + inherit C1 new() = {inherit C1()} override this.Blah() = ignore <| printf "From C2\n"; @@ -2459,7 +2459,7 @@ module BaseCallTest = begin end module BaseCallTest2 = begin - let res = ref 0 + let res = ref 0 type C1 = class new() = {} abstract Blah : unit -> unit @@ -2474,7 +2474,7 @@ module BaseCallTest2 = begin end type C2 = class - inherit C1 + inherit C1 new() = {inherit C1()} override this.Blah() = ignore <| printf "From C2b\n"; @@ -2488,7 +2488,7 @@ module BaseCallTest2 = begin type C3 = class - inherit C2 + inherit C2 new() = {inherit C2()} override this.Blah() = ignore <| printf "From C3c\n"; @@ -2508,12 +2508,12 @@ end open System //open System.Windows.Forms -//type Bug856 = -// class +//type Bug856 = +// class // inherit CheckBox // new() = { inherit CheckBox(); } // member x.PerformClick() = x.OnClick(new EventArgs()) // peverify failed -// end +// end //do let form = new Form() in // let checkBox = new Bug856(Text="Test") in // form.Controls.Add(checkBox); @@ -2524,11 +2524,11 @@ module SelfInitCalls = begin open System.IO type File2 = class - val path: string + val path: string val innerFile: FileInfo // note this calls another constructor. new() = new File2("default.txt") - new(path) = + new(path) = { path = path ; innerFile = new FileInfo(path) } end @@ -2588,11 +2588,11 @@ end // Finish up -//type SmoothForm = class +//type SmoothForm = class // inherit Form -// new() as x = -// { inherit Form(); } -// then +// new() as x = +// { inherit Form(); } +// then // x.SetStyle(ControlStyles.AllPaintingInWmPaint ||| ControlStyles.Opaque, true); //end @@ -2655,7 +2655,7 @@ end // a.GetSchemaSerializable() |> ignore; // t.GetSchemaSerializable() |> ignore; // () - + // end //end @@ -2672,27 +2672,27 @@ module SomeMoreCtorCases = begin type C = class val xx : int - new(x,y) = - if y then + new(x,y) = + if y then { xx = x} else { xx = x+x} - new(x) = + new(x) = let six = 3 + 3 in { xx = x} - static member Create() = + static member Create() = let six = 3 + 3 in new C(3+3) - new() = + new() = let six = 3 + 3 in new C(3+3) new(a,b,c) = new C(a+b+c) - new(a,b,c,d) = + new(a,b,c,d) = new C(a+b+c+d) then printf "hello" end - + end module StillMoreCtorCases = begin @@ -2715,9 +2715,9 @@ module StephenTolksdorfBug1112 = begin abstract Read4: IList<('U * 'T)> -> unit end - - + + /// other manifestation of the same bug type ITest2 = interface abstract Foo<'t> : 't -> 't @@ -2746,7 +2746,7 @@ module Bug1281Test = begin [] type node = struct - + val mutable key: int new (keyIn) = {key=keyIn} member n.Item with get(i:int) = if i=0 then 1 else @@ -2780,7 +2780,7 @@ module Bug960Test2 = begin inherit B new() = { inherit B(3,4) } - + override x.A with get() = 3 and set(v : int) = (invalidArg "arg" "C.A.set" : unit) end @@ -2790,24 +2790,24 @@ end module RandomAdditionalNameResolutionTests = begin module M = begin - type Foo() = + type Foo() = class member x.Name = "a" end - type Foo<'a>() = + type Foo<'a>() = class member x.Name = "a" end - type Goo<'a>() = + type Goo<'a>() = class member x.Name = "a" end - type Goo() = + type Goo() = class member x.Name = "a" end end - + let f2 = new M.Foo() let f3 = new M.Foo< >() let f4 = new M.Foo() @@ -2894,11 +2894,11 @@ end module LeakyAbbreviation_bug1542_FSharp_1_0 = begin - type MM<'a,'b>() = + type MM<'a,'b>() = class static member Create() = 1 end - + type Graph<'a> = MM<'a,'a> let g = Graph.Create() @@ -2906,13 +2906,13 @@ end module CheckoptionalArgumentAttributeDeclaresOptionalArgument = begin - type C() = + type C() = class static member M([] x : int option) = x end - + let v = C.M(x=3) - + end module PropertySetter_FSharp1_0_bug_1422 = begin @@ -2923,7 +2923,7 @@ module PropertySetter_FSharp1_0_bug_1422 = begin end type Variable<'a>() = - class + class inherit Variable() static member Random(y:Variable<'b>) = new Variable<'a>() end @@ -2931,7 +2931,7 @@ module PropertySetter_FSharp1_0_bug_1422 = begin let x : Variable = new Variable() let _ = Variable.Random (x, Name = "m_") - + end @@ -2951,26 +2951,26 @@ module StructKeywordAsConstraintTest = begin struct val x : int end - + type Class1<'a when 'a : struct> = class val x : int end - + type Class2<'a when 'a : not struct> = class val x : int end let inline f<'a when 'a : null> () : 'a = null - let v1 = f () - let v2 = f () - + let v1 = f () + let v2 = f () + end module MutateStructFieldOnPropertySet = begin - type C() = class + type C() = class [] val mutable F : int end @@ -2986,15 +2986,15 @@ module Bug618 = begin type c<'a> when 'a :> c<'a> () = class end type d() = class inherit c() end let x = new c() - + end -(* +(* module Bug618b = begin type c<'a> when 'a :> c<'a>() = class end type d() = class inherit c() end let x = new c() - + end *) @@ -3053,7 +3053,7 @@ module MiscGenericMethodInference = begin member x.TextWriter = tw member x.Print fmt = Printf.fprintfn tw fmt end - + let test2 () = let pr = Printer() in pr.Print "test %s" "test"; @@ -3066,24 +3066,24 @@ module CondensationTest = begin open System open System.Reflection - + [] type public APropAttribute() = class - inherit Attribute() + inherit Attribute() end [] type public AMethodAttribute() = class - inherit Attribute() + inherit Attribute() end - + type AType() = class - - [] + + [] member this.Prop = "Hello" - [] + [] member this.Meth() = "Boo" end let getAttribute<'t> (memb: MemberInfo) = @@ -3092,16 +3092,16 @@ module CondensationTest = begin match attrib with | [| theAttrib |] -> Some(memb, (theAttrib :?> 't)) | _ -> None - + let hasAttribute<'t> (memb: MemberInfo) = match getAttribute<'t> memb with | Some(_) -> true | None -> false - + let t = AType() let p = t.GetType().GetProperties() |> Array.filter (hasAttribute) let m = t.GetType().GetMethods() |> Array.filter (hasAttribute) - + end @@ -3109,8 +3109,8 @@ module OptionalArgumentWithSubTyping = begin type Base() = class end - type Child() = - class + type Child() = + class inherit Base() end @@ -3157,7 +3157,7 @@ module ParamArgs = begin let () = check "vskncvewq" (System.String.Format("{0},{1},{2}",box 1,box 2,box 3)) "1,2,3" let () = check "vskncveww" (System.String.Format("{0},{1},{2},{3}",box 1,box 2,box 3,box 4)) "1,2,3,4" let () = check "vskncvewe" (System.String.Format("{0},{1},{2},{3},{4}",box 1,box 2,box 3,box 4,box 5)) "1,2,3,4,5" - + type C() = class static member M( fmt:string, [] args : obj[]) = System.String.Format(fmt,args) end @@ -3176,7 +3176,7 @@ module ParamArgs = begin let () = check "vskncvewd" (C.M("{0},{1},{2}",box 1,box 2,box 3)) "1,2,3" let () = check "vskncvewf" (C.M("{0},{1},{2},{3}",box 1,box 2,box 3,box 4)) "1,2,3,4" let () = check "vskncvewg" (C.M("{0},{1},{2},{3},{4}",box 1,box 2,box 3,box 4,box 5)) "1,2,3,4,5" - + type C2() = class static member M( fmt:string, [] args : int[]) = System.String.Format(fmt,Array.map box args) static member M2( fmt:string, [] args : System.ValueType[]) = System.String.Format(fmt,Array.map box args) @@ -3207,7 +3207,7 @@ module ParamArgs = begin let () = check "vskncvewT" (C2.M3("")) "" let () = check "vskncvewY" (C2.M3("{0}","1")) "1" let () = check "vskncvewU" (C2.M3("{0},{1}","1","2")) "1,2" - + end module MiscTest = begin @@ -3241,7 +3241,7 @@ end module TestTupleOverloadRules_Bug5985 = begin - type C() = + type C() = class member device.CheckCooperativeLevel() = true member device.CheckCooperativeLevel([] x:byref) = true @@ -3250,7 +3250,7 @@ module TestTupleOverloadRules_Bug5985 = begin let c = C() let z = c.CheckCooperativeLevel() - let _ : bool = z + let _ : bool = z let a,b = c.CheckCooperativeLevel() end @@ -3259,22 +3259,22 @@ module AutoProps = begin type C(ppppp:int) = /// Test doc StaticProperty static let ssss = 11 - member val Property = printfn "Property..."; ppppp + member val Property = printfn "Property..."; ppppp member val PropertyExplicitGet = printfn "PropertyExplicitGet..."; ppppp with get static member val StaticProperty = printfn "StaticProperty..."; 3 + ssss static member val StaticPropertyExplicitGet = printfn "StaticPropertyExplicitGet..."; 3 + ssss with get /// Test doc SettableProperty - member val SettableProperty = printfn "SettableProperty..."; ppppp with get, set - + member val SettableProperty = printfn "SettableProperty..."; ppppp with get, set + /// Test doc MutableStaticProperty - static member val SettableStaticProperty = printfn "SettableStaticProperty..."; 4 + 5 with get, set + static member val SettableStaticProperty = printfn "SettableStaticProperty..."; 4 + 5 with get, set // --- these have type definitions /// Test doc PropertyWithType - member val PropertyWithType : int = ppppp + member val PropertyWithType : int = ppppp /// Test doc StaticPropertyWithType static member val StaticPropertyWithType : int = 6 @@ -3283,7 +3283,7 @@ module AutoProps = begin /// Test doc SettableStaticPropertyWithType static member val SettableStaticPropertyWithType : int = 7 + 8 with get,set - // --- use them + // --- use them member this.PUse = printfn "PUse..."; this.Property + 9 member this.PEGUse = printfn "PUse..."; this.PropertyExplicitGet + 9 @@ -3355,7 +3355,7 @@ module AutoProps_2 = begin let c1 = D1() check "autoprops_210" c1.Property 10 - // override - getter + // override - getter [] type C2() = abstract Property : int with get @@ -3374,7 +3374,7 @@ module AutoProps_2 = begin let c21 = D21() check "autoprops_221" c21.Property 8 - // override - setter + // override - setter [] type C3() = abstract Property : int with get, set @@ -3442,10 +3442,10 @@ module AutoProps_2 = begin let c61 = C6(23) :> I6 check "autoprops_261" c61.Property 23 c61.Property <- c61.Property + 21 - check "autoprops_262" c61.Property 44 + check "autoprops_262" c61.Property 44 end -module MoreKindInferenceTests = +module MoreKindInferenceTests = [] type C1<'a> = class member _.Foo(x:'a) = x end diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/zero_constraint.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/zero_constraint.fs index 91e9041eb16..d248b377b20 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/zero_constraint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/zero_constraint.fs @@ -1,5 +1,5 @@ module Foo.Array - + [] let inline average (array: 'T[] when ^T: (static member Zero: ^T) and ^T: (static member (+) : ^T * ^T -> ^T) and ^T: (static member DivideByInt: ^T * int -> ^T)) : 'T = failwith "todo" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs index 38ca5c26ee0..d17dc823621 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs @@ -109,7 +109,7 @@ module Extensions type Map<'K,'V when 'K: comparison> with member X: t: 'T -> k: 'K -> 'K option * ({| n: 'K array |} * int) when 'K: comparison""" - + [] let ``Type extension with lowercase type parameters names from source`` () = FSharp """ diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/CrgpLibrary.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/CrgpLibrary.fs index 0c64b053d30..93fc3c76719 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/CrgpLibrary.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/CrgpLibrary.fs @@ -5,14 +5,14 @@ type IFoo<'T when 'T :> IFoo<'T>> = [] type FooBase() = - + interface IFoo with member this.Bar (other: FooBase) = () [] type FooDerived<'T>() = inherit FooBase() - + interface IFoo> with member this.Bar other = () @@ -26,7 +26,7 @@ let inline takeSame<'a> (x: 'a) (y: 'a) = () // Error under .NET 10 + F# 10: Program.fs(26,13): Error FS0193 : The type 'FooDerived<'TId>' does not match the type 'FooBase' let callBar_NewlyBroken (foo1: IFooContainer<'TId>) (foo2: IFooContainer<'TId>) = bar foo1.Foo foo2.Foo - + // Successfully compiles under both versions let callBar (foo1: IFooContainer<'TId>) (foo2: IFooContainer<'TId>) = let id1 = foo1.Foo diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs index 81adc540766..d9413c7dbda 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs @@ -13,7 +13,7 @@ let ``Supported scenario`` (scenario: Scenario) = let files = scenario.Files |> List.map (fun f -> - {Idx = f.Index; FileName = f.FileName; ParsedInput = parseSourceCode(f.FileName, f.Content)}) + {Idx = f.Index; FileName = f.FileName; ParsedInput = parseSourceCode(f.FileName, f.Content)}) |> List.toArray let filePairs = FilePairMap(files) let graph, _trie = DependencyResolution.mkGraph filePairs files diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs index 675294acf0c..68f6894a63b 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs @@ -8,7 +8,7 @@ open Xunit let ``When processing a node throws an exception, an exception is raised with the original exception included`` () = let graph = [1, [|2|]; 2, [||]] |> readOnlyDict let work (_processor : int -> ProcessedNode) (_node : NodeInfo) : string = failwith "Work exception" - + let exn = Assert.Throws( fun () -> diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs index 8b644ca4f84..97bb1ac9618 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs @@ -1366,7 +1366,7 @@ let add () = (1, 2) +++ (3, 4) // Implementation given before signature file. This scenario will not compile, but is supported. -// Produced graph should have a necessary dependecy to trigger expected errors. +// Produced graph should have a necessary dependecy to trigger expected errors. let internal misorderedScenario = scenario "Signature file follows implementation" diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TrieMappingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TrieMappingTests.fs index 1ff1923bd21..cd4e6eb6c05 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TrieMappingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TrieMappingTests.fs @@ -155,7 +155,7 @@ type B = { Y : int } Idx = 2 FileName = "B.fs" // The last file shouldn't be processed - ParsedInput = Unchecked.defaultof + ParsedInput = Unchecked.defaultof } |] @@ -198,7 +198,7 @@ type B = { Y : int } Idx = 2 FileName = "B.fs" // The last file shouldn't be processed - ParsedInput = Unchecked.defaultof + ParsedInput = Unchecked.defaultof } |] @@ -612,12 +612,12 @@ let ``Tries are built up incrementally`` () = { Idx = 0 FileName = "A.fs" - ParsedInput = parseSourceCode ("A.fs", "module A") + ParsedInput = parseSourceCode ("A.fs", "module A") } { Idx = 1 FileName = "B.fs" - ParsedInput = parseSourceCode ("B.fs", "module B") + ParsedInput = parseSourceCode ("B.fs", "module B") } { Idx = 2 diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Utils.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Utils.fs index 02dd073625d..79b993238f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Utils.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Utils.fs @@ -26,7 +26,7 @@ type TestFileWithAST = File: string AST: ParsedInput } - + static member internal Map (x:TestFileWithAST) : FileInProject = { Idx = x.Idx diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/TyparNameTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/TyparNameTests.fs index 174a5fa15cb..0b4314871bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/TyparNameTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/TyparNameTests.fs @@ -161,7 +161,7 @@ type One.GenericType<'DeclaredType> with member x.Print () = printfn "%A" x.Value """ - let result = + let result = one |> withAdditionalSourceFile two |> typecheckProject false CompilerAssertHelpers.UseTransparentCompiler diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs index 1e21dee32de..49b5b3e9654 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions #RequiresENU +// #Regression #NoMT #CompilerOptions #RequiresENU // Test that without [--flaterrors] flag multi-line errors are emitted in a regular way, i.e. spanned to more that one line //This expression was expected to have type // ''a list' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs index 6098e469d5b..537bf25cb87 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Test that using [--flaterrors] flag multi-line errors are flattened, i.e. concatenated into one-line error message. //This expression was expected to have type. ''a list' .but here has type. ''b seq' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs index 7df7e334e11..e2b270f88bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Test that using [--flaterrors] does not make an impact on regular single-line error messages //The value or constructor 'b' is not defined diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine04.fs index 31c3bf614e8..09542163a91 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/flaterrors/E_MultiLine04.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Used by various [--flaterrors] tests //Unrecognized option: '.+' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/E_optimizeOMinus.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/E_optimizeOMinus.fs index b3690fde704..710592822b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/E_optimizeOMinus.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/E_optimizeOMinus.fs @@ -1,3 +1,3 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions //Unrecognized option: '-O-' exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/E_optimizeOPlus.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/E_optimizeOPlus.fs index cc3b57dc941..5e81050793d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/E_optimizeOPlus.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/E_optimizeOPlus.fs @@ -1,3 +1,3 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions //Unrecognized option: '-O\+' exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/Regressions01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/Regressions01.fs index c2ef84b8a3b..eced07cd503 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/Regressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/Regressions01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #CompilerOptions +// #Regression #NoMT #CompilerOptions // Regression for internal compiler error (ICE), FSB 4674 // Compile with '--debug --optimize-' @@ -8,7 +8,7 @@ let PrependOrReplaceByToString s = id type StorageDirectory() = - let rec ReplaceOrInsert (e:StorageDirectory) = + let rec ReplaceOrInsert (e:StorageDirectory) = let newFiles = PrependOrReplaceByToString 3 [] e.Copy(newFiles) @@ -17,9 +17,9 @@ type StorageDirectory() = (* // From dsyme: -The call e.Copy([]) is a recursive call. We get to provide any -instantiation, e.g. T[], and then T becomes a "free choice" -type parameter. However we don't record a TEXpr_choose anywhere +The call e.Copy([]) is a recursive call. We get to provide any +instantiation, e.g. T[], and then T becomes a "free choice" +type parameter. However we don't record a TEXpr_choose anywhere for the free choice. *) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/optimize01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/optimize01.fs index e1dbd3ff1f2..14087a439c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/optimize01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/CompilerOptions/fsc/optimize/optimize01.fs @@ -1,3 +1,3 @@ -// #NoMT #CompilerOptions +// #NoMT #CompilerOptions module optimize01 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/AlternateGenericTypeSyntax01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/AlternateGenericTypeSyntax01.fs index 25e97d9d9f7..e3a380cac19 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/AlternateGenericTypeSyntax01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/AlternateGenericTypeSyntax01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #ObjectConstructors +// #Regression #Conformance #DeclarationElements #ObjectConstructors // Test for alternate syntax for declaring generic types @@ -8,7 +8,7 @@ // vs. // ClassName<'a, 'b> -type ('a, 'b) StoreValues(a : 'a, b : 'b) = +type ('a, 'b) StoreValues(a : 'a, b : 'b) = member this.Value1 = a member this.Value2 = b diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ChainingCtors.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ChainingCtors.fs index dea7008e64c..5bb3e5c922a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ChainingCtors.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ChainingCtors.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #ObjectConstructors +// #Conformance #DeclarationElements #ObjectConstructors open System // Test chaining of constructors. @@ -6,9 +6,9 @@ open System type TestType(arg1 : int, arg2 : int) = let m_value = arg1 + arg2 member this.Value = m_value - + new (sarg1 : string, sarg2 : string) = TestType(Int32.Parse(sarg1), Int32.Parse(sarg2)) - + new (x : int list) = TestType((List.nth x 0), (List.nth x 1)) new (x : string list) = TestType((List.nth x 0), (List.nth x 1)) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_ExtraneousFields01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_ExtraneousFields01.fs index f64f545a4ef..95f6e68852b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_ExtraneousFields01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_ExtraneousFields01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #ObjectConstructors +// #Regression #Conformance #DeclarationElements #ObjectConstructors // Regression test for dev10 bug 840657 // Field "Z" has a default value, and we should not allow it to be set via an object expression //Extraneous fields have been given values diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_ImplicitExplicitCTors.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_ImplicitExplicitCTors.fs index 91fbb8533d3..acc5d1ab2cd 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_ImplicitExplicitCTors.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_ImplicitExplicitCTors.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #ObjectConstructors +// #Regression #Conformance #DeclarationElements #ObjectConstructors // Regression test for FSHARP1.0:1341 // Compiler should reject explicit class construction when an implicit one is defined //Constructors for the type 't' must directly or indirectly call its implicit object constructor\. Use a call to the implicit object constructor instead of a record expression -type s = class +type s = class new () = {} end diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_MissingArgumentForGetterProp01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_MissingArgumentForGetterProp01.fs index 2bf0ac0e25d..c6156996dfe 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_MissingArgumentForGetterProp01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_MissingArgumentForGetterProp01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #ObjectConstructors +// #Regression #Conformance #DeclarationElements #ObjectConstructors //A getter property is expected to be a function, e\.g\. 'get\(\) = \.\.\.' or 'get\(index\) = \.\.\.' // Regression test for FSHARP1.0:5375 type T = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_NoLetBindingsWOObjCtor.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_NoLetBindingsWOObjCtor.fs index 6952181aa86..c81ccf4c734 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_NoLetBindingsWOObjCtor.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_NoLetBindingsWOObjCtor.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #DeclarationElements #ObjectConstructors +// #Regression #Conformance #DeclarationElements #ObjectConstructors //This definition may only be used in a type with a primary constructor\. Consider adding arguments to your type definition, e\.g\. 'type X\(args\) = \.\.\.'\.$ type NoObjCtor = let m_value = 42 override this.ToString() = "ToString" - + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_NoObjectConstructorOnInterfaces.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_NoObjectConstructorOnInterfaces.fs index b6d51632d4a..ec2916a6d91 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_NoObjectConstructorOnInterfaces.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/E_NoObjectConstructorOnInterfaces.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #ObjectConstructors +// #Regression #Conformance #DeclarationElements #ObjectConstructors // FSB 1749, Interfaces should not allow implicit construction pattern. Bad codegen. //Interfaces cannot contain definitions of object constructors$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ExplicitCtors01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ExplicitCtors01.fs index f04d217a25a..d1df4fbd72b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ExplicitCtors01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ExplicitCtors01.fs @@ -1,13 +1,13 @@ -// #Regression #Conformance #DeclarationElements #ObjectConstructors +// #Regression #Conformance #DeclarationElements #ObjectConstructors // Verify explicit constructors work for class types // FSB 1.0 2927, grammar collision for accessibility modifiers on representation and members -type MyClass1 = +type MyClass1 = new(x) = let v : int = x in {} -type MyClass2 = +type MyClass2 = internal new(x) = let v : int = x in {} exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/GenericTypesInObjCtor.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/GenericTypesInObjCtor.fs index 3359215faf6..5f54099624a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/GenericTypesInObjCtor.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/GenericTypesInObjCtor.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #ObjectConstructors +// #Conformance #DeclarationElements #ObjectConstructors // Verify ability to create a generic class with a generic type in its object ctor. @@ -6,7 +6,7 @@ type Foo1<'a, 'b>(param1 : 'a, param2 : 'b) = let mutable m_a = param1 let mutable m_b = param2 - + member this.A with get () = m_a and set x = m_a <- x member this.B with get () = m_b and set x = m_b <- x diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ImplicitCtorsCallingBaseclassPassingSelf.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ImplicitCtorsCallingBaseclassPassingSelf.fs index 9580cb3b4a2..126cf3389d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ImplicitCtorsCallingBaseclassPassingSelf.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ImplicitCtorsCallingBaseclassPassingSelf.fs @@ -6,53 +6,53 @@ open System type Parent(o:obj) = class end -type Parent<'t>(t:'t) = +type Parent<'t>(t:'t) = member val T = t // this used to not work, causing NullReferenceException -module Implicit = +module Implicit = // Instantiating this type should throw InvalidOperationException. - type Broken() as bself = + type Broken() as bself = inherit Parent(bself) // this should work. - type Ok() as self = + type Ok() as self = inherit ParentOk>(fun () -> self) module Explicit = // should throw InvalidOperationException. - type Broken = + type Broken = inherit Parent new() as gself = { inherit Parent(gself) } // this should work. - type Ok = + type Ok = inherit ParentOk> new() as self = { inherit ParentOk>(fun () -> self) } - -let case1() = + +let case1() = try let r = Implicit.Broken() false - with - | :? InvalidOperationException -> true + with + | :? InvalidOperationException -> true | _ -> false - -let case2() = + +let case2() = try let r = Explicit.Broken() false - with - | :? InvalidOperationException -> true + with + | :? InvalidOperationException -> true | _ -> false -let case3() = +let case3() = let r = Implicit.Ok().T() true - + let case4() = let r = Explicit.Ok().T() true diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/MutuallyRecursive01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/MutuallyRecursive01.fs index 6a1e0bfc2fc..bb6c316d70b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/MutuallyRecursive01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/MutuallyRecursive01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #ObjectConstructors +// #Conformance #DeclarationElements #ObjectConstructors // Verify the ability to define mutually recursive types. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ObjCtorParamsToBaseclass.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ObjCtorParamsToBaseclass.fs index e04f21fd1ed..7f16cdbf91c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ObjCtorParamsToBaseclass.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ObjCtorParamsToBaseclass.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #ObjectConstructors +// #Conformance #DeclarationElements #ObjectConstructors // Verify ability to pass parameters in obj ctor to constructor of base class. type s1 = string @@ -16,7 +16,7 @@ type Father (name : s2, gfName : s1) = let m_name = name member this.FatherName = m_name member this.GetName() = sprintf "%s son of %s" m_name ((this :> Grandfather).GetName()) - + type Son (name : s3, fName : s2, gfName : s1) = inherit Father(fName, gfName) let m_name = name diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/SanityCheck01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/SanityCheck01.fs index ffbaf45c0e1..d72bcdf1e94 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/SanityCheck01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/SanityCheck01.fs @@ -1,10 +1,10 @@ -// #Conformance #DeclarationElements #ObjectConstructors +// #Conformance #DeclarationElements #ObjectConstructors type Foo(arg1:string, arg2:int) = let m_value = arg2 member this.Property = m_value - + let test1 = new Foo("foo", 42) if test1.Property <> 42 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/SanityCheck02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/SanityCheck02.fs index d005e3e2671..577a94fb6db 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/SanityCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/SanityCheck02.fs @@ -1,14 +1,14 @@ -// #Conformance #DeclarationElements #ObjectConstructors +// #Conformance #DeclarationElements #ObjectConstructors type King = class val mutable m_value : int - member this.Value with get () = this.m_value + member this.Value with get () = this.m_value and set x = this.m_value <- x new() = {m_value = 0} end - + let test1 = new King() if test1.Value <> 0 then exit 1 @@ -19,5 +19,5 @@ let test2 = new King() if test2.Value <> 0 then exit 1 test2.Value <- 42 if test2.Value <> 42 then exit 1 - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ValOKWithoutImplicitCtor.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ValOKWithoutImplicitCtor.fs index 04897d38c76..937580a3990 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ValOKWithoutImplicitCtor.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/ValOKWithoutImplicitCtor.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #ObjectConstructors +// #Conformance #DeclarationElements #ObjectConstructors // Verify val fields OK without default value if no implicit ctor is provided @@ -6,10 +6,10 @@ type King = class val mutable m_value : int - member this.Value with get () = this.m_value + member this.Value with get () = this.m_value and set x = this.m_value <- x end -// We can't construct type King, but it compiles OK, which is is all we care about - +// We can't construct type King, but it compiles OK, which is is all we care about + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/WarningforLessGenericthanIndicated.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/WarningforLessGenericthanIndicated.fs index cc8a653e3d5..9ee9570e31b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/WarningforLessGenericthanIndicated.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/ObjectConstructors/WarningforLessGenericthanIndicated.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #ObjectConstructors +// #Regression #Conformance #DeclarationElements #ObjectConstructors // Regression test for FSHARP1.0:2939 // No warning when generic code is less generic than indicated by annotations //This construct causes code to be less generic than indicated by the type annotations diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/CallingConventions01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/CallingConventions01.fs index 703241b2368..ecbc76633fc 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/CallingConventions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/CallingConventions01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #PInvoke +// #Regression #Conformance #DeclarationElements #PInvoke // Regression for Dev11:25538, we used to only work with StdCall // We need to use different C libraries for x64 and x86, hence the ifdefs @@ -42,7 +42,7 @@ let test2() = if (c2.im <> 8.000000 || c2.re <> 2.000000) then exit 1 -// This just automatically passes if we're in an invalid config +// This just automatically passes if we're in an invalid config // ex the x86 case on an x64 machine just doesn't execute the test logic (otherwise we'd get a BadImageFormatException) if IntPtr.Size = 8 then // we don't use System.Environment.Is64BitOperatingSystem because it is not in NetFx2.0 #if AMD64 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/CallingConventions01_Records.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/CallingConventions01_Records.fs index 723d978c9b5..80674ea20e5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/CallingConventions01_Records.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/CallingConventions01_Records.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #PInvoke +// #Regression #Conformance #DeclarationElements #PInvoke // Regression for Dev11:25538, we used to only work with StdCall // We need to use different C libraries for x64 and x86, hence the ifdefs @@ -48,7 +48,7 @@ let test2() = if (c2.im <> 8.000000 || c2.re <> 2.000000) then exit 1 -// This just automatically passes if we're in an invalid config +// This just automatically passes if we're in an invalid config // ex the x86 case on an x64 machine just doesn't execute the test logic (otherwise we'd get a BadImageFormatException) if IntPtr.Size = 8 then // we don't use System.Environment.Is64BitOperatingSystem because it is not in NetFx2.0 #if AMD64 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/ComVisible01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/ComVisible01.fs index 426937b3397..da3179345f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/ComVisible01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/ComVisible01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #PInvoke +// #Conformance #DeclarationElements #PInvoke // Verify we can place the ComVisible attribute on Records diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/ComVisible02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/ComVisible02.fs index 38071be164a..ab39e0d7463 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/ComVisible02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/ComVisible02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #DeclarationElements #PInvoke +// #Regression #Conformance #DeclarationElements #PInvoke // Verify the generated constructors aren't usable from F# //No constructors are available for the type 'r' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/E_DLLImportInTypeDef01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/E_DLLImportInTypeDef01.fs index 8e9378691da..c0be1cb0434 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/E_DLLImportInTypeDef01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/E_DLLImportInTypeDef01.fs @@ -12,9 +12,9 @@ type Works() = type FailsAtRuntime() = [] let GetCaretBlinkTime() : int = failwith "" - do + do printf "%d" (GetCaretBlinkTime()) // used to throw here - + Works() |> ignore FailsAtRuntime() |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/EntryPoint.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/EntryPoint.fs index 9b20a9c8e28..bd4d7f76d66 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/EntryPoint.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/EntryPoint.fs @@ -1,10 +1,10 @@ -// #Conformance #DeclarationElements #PInvoke +// #Conformance #DeclarationElements #PInvoke // Verify ability to map an F# function to a differently named Win32 method // via the 'EntryPoint' parameter. -// Testcase +// Testcase open System.IO open System.Runtime.InteropServices @@ -43,9 +43,9 @@ extern bool CopyFile_PassByRefSpace(char [] lpExistingFileName, char []lpNewFile let result4 = CopyFile_Arrays(tempFile1.ToCharArray(), tempFile2.ToCharArray(), false) printfn "ByRef Space %A" result4 -type SomeAttrib() = +type SomeAttrib() = inherit System.Attribute() - + [] extern bool CopyFile_Attrib([] char [] lpExistingFileName, char []lpNewFileName, [] bool & bFailIfExists); diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/MarshalStruct01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/MarshalStruct01.fs index fa08a8fb5e4..b66df1bdf11 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/MarshalStruct01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/MarshalStruct01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #PInvoke +// #Conformance #DeclarationElements #PInvoke // Sanity check marshalling structs via PInvoke @@ -9,10 +9,10 @@ open System.Runtime.InteropServices; // Define a Point using the sequential layout [] type SequentialPoint = struct - new (x, y) = { X = x; Y = y } + new (x, y) = { X = x; Y = y } val X : int val Y : int -end +end // Define the same point structure but using an explicit layout [] @@ -20,7 +20,7 @@ type ExplicitPoint = struct // Randomize elements, the end result is: // [X1, X1][X2, X2][Y1][Y2][Y3][Y4] new (x1, x2, y1, y2, y3, y4) = { X1 = x1; X2 = x2; Y1 = y1; Y2 = y2; Y3 = y3; Y4 = y4 } - + [] val Y1 : byte [] @@ -33,7 +33,7 @@ type ExplicitPoint = struct val Y3 : byte [] val X1 : int16 -end +end // Define a rectangle struct explicitly [] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/MarshalStruct01_Records.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/MarshalStruct01_Records.fs index 99956124976..befcdcb3bc3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/MarshalStruct01_Records.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/MarshalStruct01_Records.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #PInvoke +// #Conformance #DeclarationElements #PInvoke // copy of MarshalStruct01 test, but with struct records instead of standard structs @@ -23,7 +23,7 @@ type ExplicitPoint = // Randomize elements, the end result is: // [X1, X1][X2, X2][Y1][Y2][Y3][Y4] { - + [] Y1 : byte [] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/SanityCheck01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/SanityCheck01.fs index 76db6389cb7..e7245315a0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/SanityCheck01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/DeclarationElements/P-invokeDeclarations/SanityCheck01.fs @@ -1,4 +1,4 @@ -// #Conformance #DeclarationElements #PInvoke +// #Conformance #DeclarationElements #PInvoke // Sanity check PInvoke from F# diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/AbstractSlot01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/AbstractSlot01.fs index c72d221b9da..44bc6aa3cb0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/AbstractSlot01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/AbstractSlot01.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Check FSI signature files for abstract slots @@ -11,7 +11,7 @@ type Foo() = type Bar() = inherit Foo() override this.AbstractMethod () = 2 - + let t = new Foo() if t.AbstractMethod() <> 1 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/AbstractSlot01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/AbstractSlot01.fsi index e646d4977e5..d90cc682442 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/AbstractSlot01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/AbstractSlot01.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles module AbstractSlot01 @@ -12,4 +12,4 @@ type Bar = inherit Foo new : unit -> Bar override AbstractMethod : unit -> int - + diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E-SignatureAfterSource.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E-SignatureAfterSource.fs index a645845f47e..d72cc17c741 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E-SignatureAfterSource.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E-SignatureAfterSource.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles //An implementation of file or module 'E-SignatureAfterSource' has already been given\. Compilation order is significant in F# because of type inference\. You may need to adjust the order of your files to place the signature file before the implementation\. In Visual Studio files are type-checked in the order they appear in the project file, which can be edited manually or adjusted using the solution explorer module ``E-SignatureAfterSource`` diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E-SignatureAfterSource.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E-SignatureAfterSource.fsi index 5b144029ad4..af2c79cf3f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E-SignatureAfterSource.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E-SignatureAfterSource.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Test the ability to declare anonymous signature files, that is FSI files without a diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_AnonSignatureFile.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_AnonSignatureFile.fs index e3d1cce1d59..258e2f98044 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_AnonSignatureFile.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_AnonSignatureFile.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles type TypeInAnonSigFile() = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_AnonSignatureFile.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_AnonSignatureFile.fsi index 3a60b363650..e49e239ecc2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_AnonSignatureFile.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_AnonSignatureFile.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles //Files in libraries or multiple-file applications must begin with a namespace or module declaration, e\.g\. 'namespace SomeNamespace\.SubNamespace' or 'module SomeNamespace\.SomeModule'\. Only the last source file of an application may omit such a declaration\.$ // Test the ability to declare anonymous signature files, that is FSI files without a diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint01.fs index e0f79e7e3f3..85452b638d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint01.fs @@ -1,18 +1,18 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles module M open System -type Color = +type Color = | Red = 0 | Green = 1 | Blue = 2 -module Enum = +module Enum = let fromString str : 'enumType = Enum.Parse(typeof<'enumType>, str, true) |> unbox - + let green : Color = fromString "Green" - + if green <> Color.Green then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint01.fsi index 511c708ca98..4d4d11ff8e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint01.fsi @@ -1,10 +1,10 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles module M // Regression test for FSharp1.0:2089 - Generic parameter type constraints in .fsi files are ignored //The signature and implementation are not compatible because the type parameter 'enumType' has a constraint of the form 'enumType :> Enum but the implementation does not\. Either remove this constraint from the signature or add it to the implementation\.$ -open System +open System -module Enum = +module Enum = val fromString : string -> 'enumType when 'enumType :> Enum diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint02.fs index fdf37d7ca05..eca55a36a33 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint02.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles module Test type G<'a when 'a : struct> = X diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint02.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint02.fsi index 73c47e3d084..b41345e7888 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint02.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_GenericTypeConstraint02.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles module Test // Regression test for FSharp1.0:5834 - Generic constraints on explicitly specified type parameters work differently in fsi and fs diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MatchOnProperCtor.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MatchOnProperCtor.fs index 4ad8838607b..54a269f41fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MatchOnProperCtor.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MatchOnProperCtor.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Regression test for bug 6465 namespace MyNamespace diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MemberNotImplemented01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MemberNotImplemented01.fs index fc268be91ff..25b5b242bf9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MemberNotImplemented01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MemberNotImplemented01.fs @@ -1,7 +1,7 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles module Test [] -type C1() = +type C1() = // static member op_Explicit (x:C1) = 1 static member op_Explicit (x:C1) = 1.0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MemberNotImplemented01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MemberNotImplemented01.fsi index 5c2886da572..1b59674592a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MemberNotImplemented01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/E_MemberNotImplemented01.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Regression test for FSharp1.0:5628 // Title: incorrect signature check: implementation file missing implementation of method declared in signature file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Interfaces01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Interfaces01.fs index 0bb8d344e25..b720b5abf6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Interfaces01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Interfaces01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Regression test for FSharp1.0:4649 // Title: Having a signature file and implementing an interface incorrectly generates level 4 'This method will be made public in the underlying IL because it may implement an interface or override a method' // Descr: Verify no level-4 warning message is displayed when implementing interface incorrectly @@ -18,7 +18,7 @@ type T private (_i: int, _s: string) = struct interface IStructuralEquatable with member x.Equals(y, cmp) = cmp.Equals(x.i, (y :?> T).i) member x.GetHashCode(_cmp) = hash x.i - + interface System.IComparable with member x.CompareTo y = compare x.i (y :?> T).i diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Interfaces01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Interfaces01.fsi index a4389fa2cf2..f9614ddd4bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Interfaces01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Interfaces01.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles module Interfaces01 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/NullAsTrueUnion01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/NullAsTrueUnion01.fs index c3d99c6c300..e39291dd1fd 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/NullAsTrueUnion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/NullAsTrueUnion01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Regression for FSHARP1.0:6094 // nullary union cases and signature files @@ -8,7 +8,7 @@ open System // used to warn [] -type DU = +type DU = | A | B of string with @@ -16,15 +16,15 @@ type DU = // always worked [] -type DU2 = +type DU2 = | A | B of string let x = A // make sure it's actually represented with null -exit <| - try +exit <| + try x.ToString() |> ignore - -1 - with - | :? NullReferenceException -> 0 + -1 + with + | :? NullReferenceException -> 0 | _ -> 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/NullAsTrueUnion01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/NullAsTrueUnion01.fsi index 5c2f8fed357..d45fc5e50dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/NullAsTrueUnion01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/NullAsTrueUnion01.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Regression for FSHARP1.0:6094 // nullary union cases and signature files diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Properties01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Properties01.fs index fba8b449d5f..9d46f514b74 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Properties01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/Properties01.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Check FSI signature files for properties diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/PublicPrivateInternal01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/PublicPrivateInternal01.fs index 8c25ceced66..9e3277ad4bf 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/PublicPrivateInternal01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/PublicPrivateInternal01.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles module Island diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/PublicPrivateInternal01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/PublicPrivateInternal01.fsi index a5fc035b591..4b62e44ad7a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/PublicPrivateInternal01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/PublicPrivateInternal01.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Test FSI checking for public, private, and internal 'stuff' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties01.fsi index b424aeec022..2bfa5b9a13e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties01.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles namespace Properties01 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties02.fs index 759d9120680..44f195e7d6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties02.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Check FSI signature files for properties @@ -19,7 +19,7 @@ type Implementation() = override this.GetSetProperty with get () = "things" and set x = () -module Test = +module Test = let t = new Implementation() :> AbstractPropertiesTest diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties02.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties02.fsi index 90ee071606b..e0f477af07f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties02.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/properties02.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles namespace Properties01 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal02.fs index b69445efd85..16efac5c374 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal02.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Verify error if you FSI has methods listed as internal / private but implementation does not diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal02.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal02.fsi index 8ecf6534e1d..cc0fe082a74 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal02.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal02.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Verify error if you FSI has methods listed as internal / private but implementation does not @@ -7,7 +7,7 @@ namespace Cake [] type Cake = - + member Description : string [] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal03.fs index a948622cde1..d66f8e42a2b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Verify error if the declared accessibility of the implementation differs with the FSI file @@ -10,7 +10,7 @@ // Marked public in FSI but marked private in FS //Module 'PublicPrivateInternal' contains\smember FsiSaysArePublic.B : unit -> unit\sbut its signature specifies\s member FsiSaysArePublic.B : unit -> unit\sThe accessibility specified in the signature is more than that specified in the implementation -// Marked internal in FSI but marked private in FS +// Marked internal in FSI but marked private in FS //Module 'PublicPrivateInternal' contains\smember FsiSaysAreInternal.C : unit -> unit\sbut its signature specifies\s member FsiSaysAreInternal.C : unit -> unit\sThe accessibility specified in the signature is more than that specified in the implementation namespace PublicPrivateInternal diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal03.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal03.fsi index df8a5547fac..3cc20ecf63a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal03.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles/publicprivateinternal03.fsi @@ -1,7 +1,7 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles -// Marked internal in FSI but marked private in FS +// Marked internal in FSI but marked private in FS //Module 'PublicPrivateInternal' contains diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/AnonModule01Main.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/AnonModule01Main.fs index 9db99e9d26e..fa4c3e0e11c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/AnonModule01Main.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/AnonModule01Main.fs @@ -1,5 +1,5 @@ -// #Conformance #SignatureFiles #Namespaces -// This file has been compiled with AnonModule01.fs, so +// #Conformance #SignatureFiles #Namespaces +// This file has been compiled with AnonModule01.fs, so // open the generated anonymous module. open AnonModule01 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_AnonModule01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_AnonModule01.fs index 3572c13c226..74a6159a504 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_AnonModule01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_AnonModule01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Test 'anonymous implementation files', which is a code file // without a leading module or namespace declaration. The filename // will be used first letter caps-else lower case, extension dropped. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_HashDirectives01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_HashDirectives01.fs index 04b4b1037b6..0db2711dcc3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_HashDirectives01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_HashDirectives01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Verify error if anything other than '#' directives come before the first namespace decl //Only '#' compiler directives may occur prior to the first 'namespace' declaration diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_HashDirectives02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_HashDirectives02.fs index 5348b9aca91..8ef28f0851f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_HashDirectives02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_HashDirectives02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Verify error if anything other than '#' directives come before the first namespace decl //Only '#' compiler directives may occur prior to the first 'namespace' declaration diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_LastFileDllCantBeAnona.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_LastFileDllCantBeAnona.fs index b3ae54a2bdd..ee79ae67994 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_LastFileDllCantBeAnona.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_LastFileDllCantBeAnona.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Verify no warning about the second file in the project being // an anonymous module, since the project compiles to an EXE diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_LastFileDllCantBeAnonb.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_LastFileDllCantBeAnonb.fs index 3eb700b9cb4..39d3938b74d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_LastFileDllCantBeAnonb.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_LastFileDllCantBeAnonb.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Normally this would produce a warning, but // since this compiles an EXE one shouldn't be emitted. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_ModuleCollision01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_ModuleCollision01.fs index 2cebb6e1c28..1ce481ed8f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_ModuleCollision01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_ModuleCollision01.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Verify error if the same fully-qualified type is defined twice //Duplicate definition of type, exception or module 'B' -module A +module A module B = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule01.fs index d0a82e9e482..182183d1c0e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Regression test for FSHARP1.0:4987 // Can't have both namespace and module in the same file //Incomplete structured construct at or before this point in definition\. Expected '=' or other token\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule02.fs index c489315f5c1..609f377a987 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Regression test for FSHARP1.0:4987 // Can't have both namespace and module in the same file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule02.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule02.fsi index 0dedcd436c0..125e6c11384 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule02.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceAndModule02.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Regression test for FSHARP1.0:4987 // Can't have both namespace and module in the same file //Incomplete structured construct at or before this point in signature file\. Expected '=' or other token\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceCollision01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceCollision01.fs index 09899629a2b..1ff10829087 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceCollision01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceCollision01.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Verify error if the same fully-qualified type is defined twice //Two type definitions named 'DU' occur in namespace 'A\.B\.C' in two parts of this assembly namespace A.B.C -type DU = +type DU = | X of float | Y of float namespace A.B.C -type DU = +type DU = | X' of float | Y' of float diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceModuleCollision01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceModuleCollision01.fs index 40a7a256114..08ec6740bae 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceModuleCollision01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NamespaceModuleCollision01.fs @@ -1,16 +1,16 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces //The name 'A\.B' is used as both a namespace and a module in this assembly\. Rename one of them to avoid the conflict\. namespace A module B = - + module C = - + type DU = | X' of float | Y' of float - + namespace A.B.C type DU = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec01a.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec01a.fs index 44a974b035d..fa7f0c6bd91 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec01a.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces //Files in libraries or multiple-file applications must begin with a namespace or module declaration, e\.g\. 'namespace SomeNamespace\.SubNamespace' or 'module SomeNamespace\.SomeModule'\. Only the last source file of an application may omit such a declaration\.$ type Car = Flying | Hybrid | GasGuzzler diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec01b.fs index 5b8bd2abf81..88798473e41 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec01b.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles #Namespaces +// #Conformance #SignatureFiles #Namespaces open W_NoNamespaceModuleDec01a let methodOfTransport = GasGuzzler diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec02a.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec02a.fs index b5936e2d839..b60a3d92d3a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec02a.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec02a.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // This testcase will emit a warning even though it contains a module, because // it is a nested module and not a 'real' module diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec02b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec02b.fs index bbb90b5b1c4..792208de839 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/E_NoNamespaceModuleDec02b.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles #Namespaces +// #Conformance #SignatureFiles #Namespaces module W_NoNamespaceModuleDec02b open W_NoNamespaceModuleDec02a.ANestedModule diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/HashDirectives03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/HashDirectives03.fs index 90416273224..2ac85620823 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/HashDirectives03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/HashDirectives03.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles #Namespaces +// #Conformance #SignatureFiles #Namespaces // Verify an empty file with just hash directives diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/LastFileExeCanBeAnona.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/LastFileExeCanBeAnona.fs index 0ecedb25305..80750fcf24e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/LastFileExeCanBeAnona.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/LastFileExeCanBeAnona.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles #Namespaces +// #Conformance #SignatureFiles #Namespaces // Verify no warning about the second file in the project being // an anonymous module, since the project compiles to an EXE diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/LastFileExeCanBeAnonb.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/LastFileExeCanBeAnonb.fs index 3dbb6d9d955..e1dfe40c6ac 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/LastFileExeCanBeAnonb.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/LastFileExeCanBeAnonb.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles #Namespaces +// #Conformance #SignatureFiles #Namespaces // Normally this would produce a warning, but // since this compiles an EXE one shouldn't be emitted. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningForOneCompiland.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningForOneCompiland.fs index ef85b963538..8ab42947503 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningForOneCompiland.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningForOneCompiland.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles #Namespaces +// #Conformance #SignatureFiles #Namespaces // Verify no warning for a single-file compile //namespace //module diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningWithModNS01a.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningWithModNS01a.fs index 4f3bccf0d48..b8130ace43e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningWithModNS01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningWithModNS01a.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles #Namespaces +// #Conformance #SignatureFiles #Namespaces // Verify no warning if every file has a module or namespace //namespace diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningWithModNS01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningWithModNS01b.fs index f7ff2bf2943..a16b708004f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningWithModNS01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/NoWarningWithModNS01b.fs @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles #Namespaces +// #Conformance #SignatureFiles #Namespaces // Verify no warning if every file has a module or namespace //namespace diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/hashdirectives01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/hashdirectives01.fs index 735d37fdba0..551c19fd8cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/hashdirectives01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/hashdirectives01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Verify an empty file with just hash directives diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/hashdirectives02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/hashdirectives02.fs index 829860cc051..c7038e3ef18 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/hashdirectives02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/basic/hashdirectives02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Verify an empty file with just hash directives diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/global/FSharpImportCSharp.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/global/FSharpImportCSharp.fs index c3b3343e60e..9b265a6a8e0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/global/FSharpImportCSharp.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/global/FSharpImportCSharp.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces #ReqNOMT +// #Regression #Conformance #SignatureFiles #Namespaces #ReqNOMT // Regression test for FSHARP1.0:4932 // This is really the case behind the implementation diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/global/MiscNegativeTests.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/global/MiscNegativeTests.fs index ab6bb8c6029..6de2890f264 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/global/MiscNegativeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/NamespacesFragmentsAndImplementationFiles/global/MiscNegativeTests.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles #Namespaces +// #Regression #Conformance #SignatureFiles #Namespaces // Regression tests for FSHARP1.0:2737 // Miscellaneous negative tests - the positive tests listed // in the bug are already part of the FSHARP suite. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile01.fsi index efa1bd825eb..6e4cf254a8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile01.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Test you get an error if you specify an .fsi file but not the corresponding .fs file. //The signature file 'E_MissingSourceFile01' does not have a corresponding implementation file\. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match @@ -11,7 +11,7 @@ open Microsoft.FSharp.Core [] /// Delayed computations. -module Lazy = +module Lazy = type 'a t = Lazy<'a> diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile02.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile02.fsi index 3e1f8c1a515..a35154cad41 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile02.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile02.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles @@ -14,7 +14,7 @@ open Microsoft.FSharp.Core [] /// Delayed computations. -module Lazy = +module Lazy = type 'a t = Lazy<'a> diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/DontEscapeCommentFromString01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/DontEscapeCommentFromString01.fs index 93b819d7551..7b46d9f7036 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/DontEscapeCommentFromString01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/DontEscapeCommentFromString01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Verify that '*)' doesn't end a comment if within a string literal diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_IncompleteComment01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_IncompleteComment01.fs index a1f400e9973..c1a1e6a1632 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_IncompleteComment01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_IncompleteComment01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis //Incomplete structured construct at or before this point in binding diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_IncompleteComment02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_IncompleteComment02.fs index d5f19df9418..4205309825e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_IncompleteComment02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_IncompleteComment02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis //End of file in comment begun at or before here diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_embeddedString005.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_embeddedString005.fs index 61b32dc9f2d..fe69d998ff4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_embeddedString005.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_embeddedString005.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // string embedded in a comment: malformed string // which yield to a compilation error //End of file in string embedded in comment begun at or before here diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_ocamlstyle_nested007.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_ocamlstyle_nested007.fs index e6a5da22510..8d1f9bd3484 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_ocamlstyle_nested007.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_ocamlstyle_nested007.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1561 // Since OCaml-style comments are now gone, this is going to be a negative test diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_star02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_star02.fs index b8e58e34d4f..1368cb35730 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_star02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/E_star02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:5444 // (*) in comments //Unexpected symbol '\*' in implementation file$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/XmlDocComments01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/XmlDocComments01.fs index c8fc91c7bf9..b7dae374279 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/XmlDocComments01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/XmlDocComments01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Verify no syntax errors or problems when using XML doc comments @@ -18,7 +18,7 @@ type DU = A | B type R = { F : DU } /// Class -type C = +type C = class end diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString001.fs index 1b9730dd6dc..89b0375d3dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString001.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // string embedded in a comment: invalid escape sequence // \s is not an escaped char, so it's the same as \\s // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString002.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString002.fs index e0746ab2522..8382f2b9988 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString002.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString002.fs @@ -1,5 +1,5 @@ -// #Conformance #LexicalAnalysis -// string embedded in a comment: legitimate string containing the +// #Conformance #LexicalAnalysis +// string embedded in a comment: legitimate string containing the // block-comment-end token // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString003.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString003.fs index c3ef58c92eb..9c0f3cf45cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString003.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString003.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // string embedded in a comment: legitimate escape sequence // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString004.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString004.fs index 404835b7308..7cead2711af 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString004.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/embeddedString004.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // string embedded in a comment: legitimate escape sequence // A backslash in in the string // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/escapeCharsInComments001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/escapeCharsInComments001.fs index 7d25c1f2a90..94dfdfe7fb1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/escapeCharsInComments001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/escapeCharsInComments001.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:945 // comment lexing does not handle \" inside quoted strings // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/escapeCharsInComments002.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/escapeCharsInComments002.fs index a372e1f8724..dc1f3ef16fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/escapeCharsInComments002.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/escapeCharsInComments002.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:946 // comment lexing does not handle "" and \ inside @" strings // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle001.fs index 5c7d06c167a..f4cc1bb58b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle001.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1561 // Verify that (**) does not leave the lexer in a comment state // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle002.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle002.fs index e5766769036..8bd649bff5e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle002.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle002.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis open System.Text.RegularExpressions @@ -8,28 +8,28 @@ open System.Text.RegularExpressions (** This is a normal comment. **) -let (|RegExMatch|_|) (pat:string) (inp:string) = +let (|RegExMatch|_|) (pat:string) (inp:string) = let m = Regex.Match(inp, pat) in // Note the List.tl, since the first group is always the entirety of the matched string. if m.Success - then Some (List.tail [ for g in m.Groups -> g.Value ]) + then Some (List.tail [ for g in m.Groups -> g.Value ]) else None (**This is a normal comment.**) -let (|RegExMatch2|_|) (pat:string) (inp:string) = +let (|RegExMatch2|_|) (pat:string) (inp:string) = let m = Regex.Match(inp, pat) in // Note the List.tl, since the first group is always the entirety of the matched string. if m.Success - then Some (List.tail [ for g in m.Groups -> g.Value ]) + then Some (List.tail [ for g in m.Groups -> g.Value ]) else None (** This is a normal comment. **) -let (|RegExMatch3|_|) (pat:string) (inp:string) = +let (|RegExMatch3|_|) (pat:string) (inp:string) = let m = Regex.Match(inp, pat) in // Note the List.tl, since the first group is always the entirety of the matched string. if m.Success - then Some (List.tail [ for g in m.Groups -> g.Value ]) + then Some (List.tail [ for g in m.Groups -> g.Value ]) else None exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested001.fs index 1d45b47c4e0..0c34e6c96d4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested001.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1561 // Verify that (**) does not leave the lexer in a comment state diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested002.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested002.fs index 75df7b12158..ba3420293f1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested002.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested002.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1561 // Verify that (**) does not leave the lexer in a comment state diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested003.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested003.fs index 2eb08d95b87..b4efce7c968 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested003.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested003.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1561 // Verify that (**) does not leave the lexer in a comment state diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested004.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested004.fs index 2ccd1653950..c47750b4025 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested004.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested004.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1561 // Verify that (**) does not leave the lexer in a comment state diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested005.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested005.fs index a51d31937cd..d7a4121a9f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested005.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/ocamlstyle_nested005.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1561 // Verify that (**) does not leave the lexer in a comment state diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/star01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/star01.fs index dac4bbddea8..c5587868bd4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/star01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/star01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:5444 // (*) in comments // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/star03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/star03.fs index 97607a0c508..21bc7c6d0f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/star03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Comments/star03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:5444 // (*) in comments // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/ConditionalCompilation01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/ConditionalCompilation01.fs index b88679f92d8..47a9416c63a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/ConditionalCompilation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/ConditionalCompilation01.fs @@ -1,7 +1,7 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis -// Test conditional compilation flags. +// Test conditional compilation flags. // To run this test please define "THIS_IS_DEFINED" let runTest () = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedEndif01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedEndif01.fs index fc88a89d136..0b49d3817de 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedEndif01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedEndif01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:2261 //#endif has no matching #if in implementation file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedIf01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedIf01.fs index 1af988f58f3..452549ed47a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedIf01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedIf01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:2261 //#if directive should be immediately followed by an identifier diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedIf02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedIf02.fs index 8abbddc423d..a5176bcab27 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedIf02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/E_UnmatchedIf02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:2261 //End of file in #if section begun at or after here diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/FSharp01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/FSharp01.fs index b7de54872e7..226d39ff01b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/FSharp01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/FSharp01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis (*IF-FSHARP diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/FSharp02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/FSharp02.fs index f1ea6b2a941..d3410fd268e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/FSharp02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/FSharp02.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis (*F# diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InComment01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InComment01.fs index c7260e16d30..fe1b47878f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InComment01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InComment01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis let x = @@ -9,12 +9,12 @@ let x = #else 2 #endif - - + + if x <> 2 then exit 1 -let y = +let y = #if NOTDEFINED 1 (* multi diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral01.fs index a5eeb1bd312..852cb255b3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // test1 -------------------------------------- diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral02.fs index c90decfc04b..12b731a3bc5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral02.fs @@ -1,12 +1,12 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // test1 -------------------------------------- -let test1 = +let test1 = "a" #if DEFINED + "b - #else + #else c" #else + "d" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral03.fs index 01034fc7b1c..0d3a9c94730 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/InStringLiteral03.fs @@ -1,12 +1,12 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // test1 -------------------------------------- -let test1 = +let test1 = "a" #if NOTDEFINED + "b - #else + #else + "c #else d" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/Nested01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/Nested01.fs index 5c80700c599..c6143f060ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/Nested01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/Nested01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Verify nested conditional compilation flags @@ -30,7 +30,7 @@ exit 1 (*Active Code2*) let legitCode2 = 2 #endif (*Active Code1*) let legitCode1 = 1 - + #endif #if DEFINED1 @@ -55,5 +55,5 @@ exit 1 legitCode6 legitCode7 ] - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/Nested02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/Nested02.fs index efbf1e4ac3b..3e48e4333d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/Nested02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/Nested02.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Verify nested conditional compilation flags @@ -54,7 +54,7 @@ exit 1 (*Active Code2*)let legitCode2 = 2 #endif (*Active Code1*)let legitCode1 = 1 - + #endif #if DEFINED1 @@ -84,5 +84,5 @@ exit 1 legitCodeA legitCodeB ] - + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/OCaml01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/OCaml01.fs index 0b41344ce8d..1bb2e8ba2e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/OCaml01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/ConditionalCompilation/OCaml01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis let x = 0 (*IF-OCAML*) + 1 (*ENDIF-OCAML*) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn01.fs index 726f2b8658b..511a546c190 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #ReqNOMT +// #Regression #Conformance #LexicalAnalysis #ReqNOMT // Regression test for FSHARP1.0:6044 #nowarn "44" "49" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn_many.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn_many.fs index c4c1f6278c7..1405b3cf48d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn_many.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn_many.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #ReqNOMT +// #Regression #Conformance #LexicalAnalysis #ReqNOMT // Regression test for FSHARP1.0:6044 // 100 nowarns... #nowarn "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72" "73" "74" "75" "76" "77" "78" "79" "80" "81" "82" "83" "84" "85" "86" "87" "88" "89" "90" "91" "92" "93" "94" "95" "96" "97" "98" "99" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn_one.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn_one.fs index f15d59dc31c..179a6c09a72 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn_one.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Directives/multiple_nowarn_one.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #ReqNOMT +// #Regression #Conformance #LexicalAnalysis #ReqNOMT // Regression test for FSHARP1.0:6044 // Just one #nowarn #nowarn "49" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifierReplacements/SourceFile01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifierReplacements/SourceFile01.fs index 2dd37d61035..773309649a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifierReplacements/SourceFile01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifierReplacements/SourceFile01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Related to FSHARP1.0:4287 // Test the __SOURCE_FILE__ directive diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_InvalidIdentifier01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_InvalidIdentifier01.fs index 5655e325e97..9640e82b39e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_InvalidIdentifier01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_InvalidIdentifier01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Test invalid identifiers diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_KeywordIdent01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_KeywordIdent01.fs index 52d76fe1158..a51c89bc149 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_KeywordIdent01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_KeywordIdent01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis //Unexpected keyword 'type' in binding diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_MissingQualification.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_MissingQualification.fs index 5f26f244f6c..cc3ba4c2d25 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_MissingQualification.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_MissingQualification.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSharp1.0:3420 - parsing glitch allows trailing "." in file //Missing qualification after '\.' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_NameCollision01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_NameCollision01.fs index c7800b0c5e7..85fade595af 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_NameCollision01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_NameCollision01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Verify error when names collide. Typically you just outscope the diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_QuotedTypeModuleNames01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_QuotedTypeModuleNames01.fs index 8bf297ed7d3..b44b41399ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_QuotedTypeModuleNames01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_QuotedTypeModuleNames01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSharp1.0:4854 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ReservedIdentKeywords.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ReservedIdentKeywords.fs index 993798e6e7d..f51cb2a678b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ReservedIdentKeywords.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ReservedIdentKeywords.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Reserved identifiers and keywords // Also cover regression test for FSHARP1.0:5367 (keyword 'virtual') diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ValidIdentifier03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ValidIdentifier03.fs index 52d0f91eb00..73b06dbb5f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ValidIdentifier03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ValidIdentifier03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSharp1.0:2270 - namespaces, types, modules and union casts should not allow literal DOT in their names //Invalid namespace, module, type or union case name$ @@ -6,6 +6,6 @@ namespace A.B type C() = class end -// ERR +// ERR namespace ``A.B`` type C() = class inherit A.B.C() end diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ValidIdentifier04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ValidIdentifier04.fs index db6ca878fb3..870653c563d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ValidIdentifier04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/E_ValidIdentifier04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSharp1.0:2371 - Compiler should, at least, emit a better error message when trying to define a function whose name is ±, §, or §§ //Unexpected character '.+' in pattern. Expected '\)' or other token //Unmatched '\(' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/StructNotAllowDoKeyword.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/StructNotAllowDoKeyword.fs index 8dec5b84d7c..1e6c355b2b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/StructNotAllowDoKeyword.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/StructNotAllowDoKeyword.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSharp1.0:3820 - structs should not allow 'do' //This construct is deprecated: Structs cannot contain 'do' bindings because the default constructor for structs would not execute these bindings$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/ValidIdentifier01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/ValidIdentifier01.fs index 3bae6791603..5b607ca42f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/ValidIdentifier01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/ValidIdentifier01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Test strange but valid identifiers diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/ValidIdentifier02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/ValidIdentifier02.fs index f8630cecc7e..03680d5280d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/ValidIdentifier02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/ValidIdentifier02.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Test more valid identifiers diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/W_IdentContainsAtSign.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/W_IdentContainsAtSign.fs index 5d83fa96dc1..0e27f96e62d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/W_IdentContainsAtSign.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/W_IdentContainsAtSign.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Verify error when an identifier contains an '@' symbol //Identifiers containing '@' are reserved for use in F# code generation diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/W_ReservedWord01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/W_ReservedWord01.fs index f5c7838f6d3..adfadc06b61 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/W_ReservedWord01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/IdentifiersAndKeywords/W_ReservedWord01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Verify warning when using a reserved identifier diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/LineDirectives/Line01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/LineDirectives/Line01.fs index b76513ad2ef..e800a0c9b3f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/LineDirectives/Line01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/LineDirectives/Line01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis open System diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/LineDirectives/Line02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/LineDirectives/Line02.fs index e310bd7838c..5a84fa9ef7d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/LineDirectives/Line02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/LineDirectives/Line02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:5855 // The following test (when compiled with --parseonly) // should yield no errors/warnings @@ -9,14 +9,14 @@ type Foo()= [] default this.__BuildControlForm1 () = let mutable (__ctrl:global.System.Web.UI.HtmlControls.HtmlForm) = Unchecked.defaultof<_> - + __ctrl <- new global.System.Web.UI.HtmlControls.HtmlForm() this.Form1 <- __ctrl - + # 6 "C:\Hello.pif" __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("
\r\n ")) |> ignore let mutable (__ctrl2:global.System.Web.UI.WebControls.Label) = Unchecked.defaultof<_> - - + + __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("\r\n ")) |> ignore ((__ctrl :> obj) :?> global.System.Web.UI.HtmlControls.HtmlForm) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigIntConversion02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigIntConversion02.fs index ede894d64a8..304f41434a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigIntConversion02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigIntConversion02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify BigInt uses op_Implicit conversions // Regression test for FSHARP1.0:4498 // Supported conversions diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigIntConversion02b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigIntConversion02b.fs index b900086c1fc..5385ea57f8c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigIntConversion02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigIntConversion02b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants #NoMono #ReqNOMT +// #Regression #Conformance #LexicalAnalysis #Constants #NoMono #ReqNOMT // Verify BigInt uses op_Implicit conversions // Regression test for FSHARP1.0:4498 // Supported conversions - on Dev10/NetFx4.0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigNums01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigNums01.fs index 37c5614824f..532f17d102a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigNums01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/BigNums01.fs @@ -1,15 +1,15 @@ -// #Conformance #LexicalAnalysis #Constants +// #Conformance #LexicalAnalysis #Constants // Verify ability to write custom big num libraries type DerivedFrom = FromInt32 | FromInt64 | FromString module NumericLiteralG = let IAmImplemented = true - + let FromInt32(i : int) = (i, FromInt32) let FromInt64(i : int64) = (i, FromInt64) let FromString(s : string) = (s, FromString) - + let int32Range = -2147483647G if int32Range <> (-2147483647, FromInt32) then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigIntConversion01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigIntConversion01.fs index c95e6849910..c4a7f446885 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigIntConversion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigIntConversion01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify BigInt uses op_Implicit conversions // Regression test for FSHARP1.0:4498 // Unsupported conversions - on VS2008/NetFx2.0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigIntConversion01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigIntConversion01b.fs index 6fd13d3c76a..fec955009a4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigIntConversion01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigIntConversion01b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants #ReqNOMT +// #Regression #Conformance #LexicalAnalysis #Constants #ReqNOMT // Verify BigInt uses op_Implicit conversions // Regression test for FSHARP1.0:4498 // Unsupported conversions - on Dev10/NetFx4.0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNumNotImpl01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNumNotImpl01.fs index 75812223fe7..4f166a8f3d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNumNotImpl01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNumNotImpl01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify ability to write custom big num libraries //The value, constructor, namespace or type 'FromInt32' is not defined //The value, constructor, namespace or type 'FromInt64' is not defined @@ -6,8 +6,8 @@ module NumericLiteralG = let IAmNotComplete = true - - + + let int32Range = 2147483647G let int64Range = 9223372036854775807G let fromStringRange = 12345678901234567890G diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNums01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNums01.fs index 2862a895e94..77f1df5ab8b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNums01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNums01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify errors when trying to use non bigint big numbers //This numeric literal requires that a module 'NumericLiteralN' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNums40.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNums40.fs index ba6a5c2ffff..0286b448a0a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNums40.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_BigNums40.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants #NoMono #ReqNOMT +// #Regression #Conformance #LexicalAnalysis #Constants #NoMono #ReqNOMT // Verify errors when trying to use non bigint big numbers //No deprecation on NetFx4.0/Dev10 (see FSHARP1.0:4599) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_DecimalWO0Prefix.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_DecimalWO0Prefix.fs index a37d5c8f2fc..39616f013b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_DecimalWO0Prefix.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_DecimalWO0Prefix.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify error when you specify a sub zero floating point // number without a zero prefix. //Unexpected symbol '\.' in binding diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_InvalidIEEE64.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_InvalidIEEE64.fs index 795cf0aa3a9..2eca692c4c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_InvalidIEEE64.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_InvalidIEEE64.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify error when parsing invalid IEEE64 value // Regression from TFS 715348 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals01.fs index fa5f7887d13..dccef9fa354 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify compile error for signed literals which are MaxSize + 1, MaxSize - 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals02.fs index 77b065ce9dc..34af53ed480 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify compile error for unsigned literals which are MaxSize + 1, MaxSize - 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals03.fs index 4760ceb87fe..e9ef5a0f215 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify compile error for unsigned literals which are MaxSize + 1, MaxSize - 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals04.fs index f451f17e326..eaf633f3ee7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_MaxLiterals04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify compile error for signed literals which are MaxSize + 1, MaxSize - 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals001.fs index d87a07bb097..c2a6ae119c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals001.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with space +// Negative literal with space //Unexpected symbol '-' in union case$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals002.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals002.fs index ac5cca4f23c..82a05a7132f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals002.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals002.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with space +// Negative literal with space //Unexpected symbol '-' in union case$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals003.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals003.fs index 0a811e240c0..e061881ee1d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals003.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals003.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with space +// Negative literal with space //Unexpected symbol '-' in union case$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals004.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals004.fs index 0bdbde6f172..d276d0bb33c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals004.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals004.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with space +// Negative literal with space //Unexpected symbol '-' in union case$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals005.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals005.fs index bc034b63565..bb9f089f68b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals005.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals005.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with space +// Negative literal with space //Unexpected symbol '-' in union case$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals006.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals006.fs index 49b4b8ecbb8..401eb8e1fbd 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals006.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals006.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with space +// Negative literal with space //Unexpected symbol '-' in union case$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals007.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals007.fs index bf0ceb30c52..bbd80e8d91a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals007.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals007.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with space +// Negative literal with space //Unexpected symbol '-' in union case$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals008.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals008.fs index ae2b7768b0e..726d03afa45 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals008.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals008.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with space +// Negative literal with space //Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals009.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals009.fs index 02d92124725..38400ec3daf 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals009.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals009.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with no space +// Negative literal with no space // As per FSHARP1.0:3714, enums can't be based on floats (pos/neg) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/MaxLiterals01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/MaxLiterals01.fs index 6a754f41871..31fb8bf29e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/MaxLiterals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/MaxLiterals01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Constants +// #Conformance #LexicalAnalysis #Constants // Verify ability to specify min and max for literals diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/NumericLiterals01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/NumericLiterals01.fs index d70c1d192a1..ff41e2f70e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/NumericLiterals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/NumericLiterals01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Verify numeric literals work as expected diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingBin.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingBin.fs index 9ee5dfcbb90..3e3ed5d523f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingBin.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingBin.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Constants +// #Conformance #LexicalAnalysis #Constants // Number type specifier are not case-sensitive // Bin // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingHex.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingHex.fs index 4e58c1dece7..14bffa66862 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingHex.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingHex.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Constants +// #Conformance #LexicalAnalysis #Constants // Number type specifier are not case-sensitive // Float // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF01.fs index cf4c60e25d2..492208796f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Constants +// #Conformance #LexicalAnalysis #Constants // Number type specifier LF/lf are case-sensitive // IEEE32/IEEE64 - lf vs LF // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF02.fs index 7bc601141f1..bca11c38ea1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF02.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Constants +// #Conformance #LexicalAnalysis #Constants // Number type specifier are not case-sensitive // IEEE32/IEEE64 - lf vs LF // verify that xint can be specified either with '0x' or '0X' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF03a.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF03a.fs index 0a564fd2e81..5cd5b4b5b45 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF03a.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF03a.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Number type specifier // IEEE32/IEEE64 - lF is illegal //This is not a valid numeric literal. Valid numeric literals include diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF03b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF03b.fs index 4602d7cb54a..f2f540d3821 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF03b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingIEEE-lf-LF03b.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Number type specifier // IEEE32/IEEE64 - Lf is illegal //This is not a valid numeric literal. Valid numeric literals include diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingOct.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingOct.fs index a2041ef2e58..b9028be9828 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingOct.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/casingOct.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Constants +// #Conformance #LexicalAnalysis #Constants // Number type specifier are not case-sensitive // Oct // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/enumNegativeLiterals001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/enumNegativeLiterals001.fs index 08b90df2356..9481807ccd5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/enumNegativeLiterals001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/enumNegativeLiterals001.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis #Constants +// #Regression #Conformance #LexicalAnalysis #Constants // Regression test for FSHARP1.0:1284 // Enum type definitions do not support negative literals -// Negative literal with no space +// Negative literal with no space // See FSHARP1.0:3714 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Shift/Generics/RightShift001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Shift/Generics/RightShift001.fs index ef829012d5a..f327ded685d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Shift/Generics/RightShift001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Shift/Generics/RightShift001.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSharp1.0#1076 // Usage of >> and . // No spaces between >> and . diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Shift/Generics/RightShift002.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Shift/Generics/RightShift002.fs index 43f9b5bd203..9849821c7ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Shift/Generics/RightShift002.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Shift/Generics/RightShift002.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSharp1.0#1076 // Usage of >> and . // 1 space >> and . diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/Backslash01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/Backslash01.fs index 47121343154..4c751361692 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/Backslash01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/Backslash01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Test the backslash functionality when defining strings (continues on next line) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/Backslash02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/Backslash02.fs index 45968d9d290..001db1728f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/Backslash02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/Backslash02.fs @@ -1,9 +1,9 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Verify the backslash in string literals chomps all whitespace -// Note that it just chews whitespace up to the next newline. So +// Note that it just chews whitespace up to the next newline. So // in this example, all spaces on the next line after 'c' but once // the line ends, the '\r\n' are added, and the '\t' on the same line as d // is added as well. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteChars01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteChars01.fs index 8a19615437e..708308055f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteChars01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteChars01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Verify byte chars return the expected value diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString01.fs index eb14e4c2cb7..fe899c7ea38 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Test the ability to specify byte strings diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString02.fs index af1e966ff6c..af30c0b5b06 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString02.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Test ability to specify byte strings diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString03.fs index f42964af065..b80cee6ed7d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/ByteString03.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Test ability to create byte strings diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals01.fs index 5512d8ab49e..109063f867a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Define trigraph character literals diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals02.fs index c6a74a965fc..0cf97e0cb37 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals02.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Character escape sequences diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals03.fs index 235b9d71ef1..e08c5b9dab6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/CharLiterals03.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Test two-byte Unicode Character literals diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_BogusLongUnicodeEscape.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_BogusLongUnicodeEscape.fs index eeeafda03c6..8129230d1e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_BogusLongUnicodeEscape.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_BogusLongUnicodeEscape.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Verify error with malformed long unicode escape sequences diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteCharUnicodeChar01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteCharUnicodeChar01.fs index 7a255c2306b..39d4510d5c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteCharUnicodeChar01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteCharUnicodeChar01.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis -// Verify error when trying to take the byte value of +// Verify error when trying to take the byte value of // a unicode character literal. //This is not a valid byte character literal. The value must be less than or equal to '\\127'B. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteChars02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteChars02.fs index e197d358871..086ed2e31b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteChars02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteChars02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Verify getting the byte value of a char works past the first 128 ASCII characters // It is not valid because it must be <= 127 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteStrUnicodeChar01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteStrUnicodeChar01.fs index 979c997fb0a..a93093ba156 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteStrUnicodeChar01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_ByteStrUnicodeChar01.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis -// Verify error when trying to take the byte string of +// Verify error when trying to take the byte string of // a string literal with unicode characters //This byte array literal contains 1 characters that do not encode as a single byte diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_MalformedShortUnicode01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_MalformedShortUnicode01.fs index af0565f7fde..7a1b3e45e32 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_MalformedShortUnicode01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/E_MalformedShortUnicode01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Verify error with malformed short unicode character diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/EscapeSequences01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/EscapeSequences01.fs index 18e208d1608..ef9df3ced7d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/EscapeSequences01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/EscapeSequences01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Verify String Escape sequences diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/EscapeSequences02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/EscapeSequences02.fs index 1cddef1d2f5..2874fca227e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/EscapeSequences02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/EscapeSequences02.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Verify behavior of invalid escape sequences diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/TripleQuote.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/TripleQuote.fs index 32df2e5b181..299c7f910f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/TripleQuote.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/TripleQuote.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Verify the compiler now allows the (""") token // Part of FSB 1684 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/TripleQuoteString01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/TripleQuoteString01.fs index a86b00d9a16..e594545c8f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/TripleQuoteString01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/TripleQuoteString01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Some basic checks duplicated from fsharp\core\libtest and then some open System diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString01.fs index 3cce7e6fb8c..b1da68f25e5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString01.fs @@ -20,7 +20,7 @@ let checkStr (inputStr:string) expectedChars expectedStr = let test (inputStr:string) expectedChars expectedStr = failure <- (checkStr inputStr expectedChars expectedStr) && failure - + test "\u2660\u2663\u2665\u2666" [| 0x2660; 0x2663; 0x2665; 0x2666 |] (Some("♠♣♥♦")) test "\uD800 \uDBFF \uDC00 \uDFFF" [| 0xD800; 32; 0xDBFF; 32; 0xDC00; 32; 0xDFFF |] None test "\u0000\u0000\uFFFE\uFFFD\uFFFC" [| 0; 0; 0xFFFE; 0xFFFD; 0xFFFC |] None diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString02.fs index 1b09c4c0cb4..5755875a926 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString02.fs @@ -20,7 +20,7 @@ let checkStr (inputStr:string) expectedChars expectedStr = let test (inputStr:string) expectedChars expectedStr = failure <- (checkStr inputStr expectedChars expectedStr) && failure - + test "\U00002660\U00002663\U00002665\U00002666" [| 0x2660; 0x2663; 0x2665; 0x2666 |] (Some("♠♣♥♦")) test "\U0000D800 \U0000DBFF \U0000DC00 \U0000DFFF" [| 0xD800; 32; 0xDBFF; 32; 0xDC00; 32; 0xDFFF |] None test "\U00000000\U00000000\U0000FFFE\U0000FFFD\U0000FFFC" [| 0; 0; 0xFFFE; 0xFFFD; 0xFFFC |] None diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString03.fs index a444372550c..6eb3bbe292c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/UnicodeString03.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:2193 // Unicodegraph-long not in parity with C# // -let some_unicode_char = '\u00D6' -let another_unicode_char = '\U000007FF' +let some_unicode_char = '\u00D6' +let another_unicode_char = '\U000007FF' exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/VerbatimString01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/VerbatimString01.fs index fddf17a8991..29d56493d03 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/VerbatimString01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/StringsAndCharacters/VerbatimString01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis +// #Conformance #LexicalAnalysis // Test verbatim strings diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly01.fs index 4f05653288b..ce71b3d5f14 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1077 // closing brace following generic type bracket is syntax error without whitespace (lexed into symbolic token). // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly02.fs index fc73641321f..3dbc7766c99 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1077 // closing brace following generic type bracket is syntax error without whitespace (lexed into symbolic token). // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly03.fs index 12e4d4e77ac..fd23d61bd2f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1077 // closing brace following generic type bracket is syntax error without whitespace (lexed into symbolic token). // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly04.fs index 1590945bbdb..d0638482bb1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly04.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1077 // closing brace following generic type bracket is syntax error without whitespace (lexed into symbolic token). // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly05.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly05.fs index f94f5ec93fc..1a750c788b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly05.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedCurly05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:1077 // closing brace following generic type bracket is syntax error without whitespace (lexed into symbolic token). // @@ -7,5 +7,5 @@ type A<'t> = interface end - + let x = {new A} diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedParenthesis01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedParenthesis01.fs index a7871f3cf29..54e7356be40 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedParenthesis01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedParenthesis01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:2464 // closing square bracket following closing generic type angle bracket is syntax error without whitespace // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedSquare01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedSquare01.fs index 59574d333d3..18009c7e6a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedSquare01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedSquare01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:2464 // closing square bracket following closing generic type angle bracket is syntax error without whitespace // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedSquare02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedSquare02.fs index 755128d1c60..53dd7462237 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedSquare02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicKeywords/GreaterThanClosedSquare02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis +// #Regression #Conformance #LexicalAnalysis // Regression test for FSHARP1.0:2464 // closing square bracket following closing generic type angle bracket is syntax error without whitespace // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_CantUseDollarSign.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_CantUseDollarSign.fs index adff2955157..56a771e067a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_CantUseDollarSign.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_CantUseDollarSign.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Operators +// #Regression #Conformance #LexicalAnalysis #Operators // Verify the use of the dollar sign in symbolic functions is deprecated // Related to FSB 1684 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_GreaterThanColon002.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_GreaterThanColon002.fs index 04baeb0d62b..8c7bea6b909 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_GreaterThanColon002.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_GreaterThanColon002.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Operators +// #Regression #Conformance #LexicalAnalysis #Operators // Regression test for FSHARP1.0:1392 // Space should not be required between : and > // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_GreaterThanDotParen01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_GreaterThanDotParen01.fs index 8edab7d166f..a839e2a5c53 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_GreaterThanDotParen01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_GreaterThanDotParen01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Operators +// #Regression #Conformance #LexicalAnalysis #Operators // Regression test for FSHARP1.0:4994 // We could not define operator >. //Invalid operator definition\. Prefix operator definitions must use a valid prefix operator name\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs index a8cf50ea24b..6bad6e18fa8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Operators +// #Regression #Conformance #LexicalAnalysis #Operators // Regression test for FSHARP1.0:4805 // We are not really after the actual error messages here (some of them have been omitted), rather we // want to verify we do not crash! @@ -6,7 +6,7 @@ //This code is not sufficiently generic\. The type variable \^T when \^T : \(static member \( \+ \) : \^T \* \^T -> \^a\) could not be generalized because it would escape its scope type public TestType<'T,'S>() = - + member public s.Value with get() = Unchecked.defaultof<'T> static member public (+++) (a : TestType<'T,'S>, b : TestType<'T,'S>) = a.Value static member public (+++) (a : TestType<'T,'S>, b : 'T) = b diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_QMarkGeneric.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_QMarkGeneric.fs index 4c32b8be07e..2d8e006a204 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_QMarkGeneric.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_QMarkGeneric.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Operators +// #Regression #Conformance #LexicalAnalysis #Operators //Unexpected type arguments @@ -11,7 +11,7 @@ let foo (x : 'a) = let (?) (o:obj) (s:string) : ('a -> string) = m <- s fun n -> n.ToString() - + let test() = let r = "Hello" ? Contains(10) r diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/GreaterThanColon001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/GreaterThanColon001.fs index 66db991943b..32fc09fbfc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/GreaterThanColon001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/GreaterThanColon001.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Operators +// #Regression #Conformance #LexicalAnalysis #Operators // Regression test for FSHARP1.0:1392 // Space should not be required between : and > // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/GreaterThanDotParen01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/GreaterThanDotParen01.fs index a069d6c8e3f..8991590a70e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/GreaterThanDotParen01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/GreaterThanDotParen01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexicalAnalysis #Operators +// #Regression #Conformance #LexicalAnalysis #Operators // Regression test for FSHARP1.0:4994 // We could not define operator >. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/LessThanDotOpenParen001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/LessThanDotOpenParen001.fs index eaba7fbdb62..fce40b4ddf4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/LessThanDotOpenParen001.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/LessThanDotOpenParen001.fs @@ -1,9 +1,9 @@ -// #Regression #Conformance #LexicalAnalysis #Operators +// #Regression #Conformance #LexicalAnalysis #Operators // Regression test for FSHARP1.0:4805 // - + type public TestType<'T,'S>() = - + member public s.Value with get() = Unchecked.defaultof<'T> static member public (+++) (a : TestType<'T,'S>, b : TestType<'T,'S>) = a.Value static member public (+++) (a : TestType<'T,'S>, b : 'T) = b diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkArguments.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkArguments.fs index 6507e1a5db7..0af1dd3689e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkArguments.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkArguments.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable m : string = "" @@ -6,12 +6,12 @@ let mutable m : string = "" let (?) (o:obj) (s:string) : (int -> string) = m <- s fun n -> sprintf "called with %d" n - - + + let test() = let s = "Hello" ? Contains(10) s - + let res1 = test() let res2 = m diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkAssignSimple.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkAssignSimple.fs index 89addc07864..8848102a5a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkAssignSimple.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkAssignSimple.fs @@ -1,14 +1,14 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable result : string = "" let (?<-) (o : obj) (m : string) (v : obj) = result <- sprintf "%s = %A" m v - -let test() = + +let test() = "hello" ? Contains <- 10 - + test() if result = "Contains = 10" then exit 0 else exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkExpressionAsArgument.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkExpressionAsArgument.fs index b3d2580336e..dd68aed67a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkExpressionAsArgument.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkExpressionAsArgument.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable m : string = "" @@ -6,12 +6,12 @@ let mutable m : string = "" let (?) (o:obj) (s:string) : (int -> string) = m <- s fun n -> sprintf "called with %d" n - - + + let test() = let s = "Hello" ? ("Contains") (10) s - + let res1 = test() let res2 = m diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkExpressionAsArgument2.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkExpressionAsArgument2.fs index 68783dc0529..c3b4ed08f2d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkExpressionAsArgument2.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkExpressionAsArgument2.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable m : string = "" @@ -6,12 +6,12 @@ let mutable m : string = "" let (?) (o:obj) (s:string) : (int -> int -> string) = m <- s fun a b -> sprintf "called with %d %d" a b - - + + let test() = - let s = "Hello" ? ("Contain" + "s") 10 10 + let s = "Hello" ? ("Contain" + "s") 10 10 s - + let res1 = test() let res2 = m diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkNested.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkNested.fs index bc5c9137a62..38ad4cae092 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkNested.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkNested.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable members : string = "" @@ -6,11 +6,11 @@ let mutable members : string = "" let (?) (o:obj) (s:string) : obj = members <- members + s + " " o - + let test() = let _ = "Hello" ? Contains ? Startswith members - + let res = test() if res = "Contains Startswith " then exit 0 else exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceArray.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceArray.fs index 48b94d16850..60efd31d5f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceArray.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceArray.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable m : string = "" @@ -6,12 +6,12 @@ let mutable m : string = "" let (?) (o:obj) (s:string) : string array = m <- s [| "Index0" |] - - + + let test() = let s = "Hello" ? Contains.[0] s - + let res1 = test() let res2 = m diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceCurrying.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceCurrying.fs index 9862d94c867..242a8851756 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceCurrying.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceCurrying.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable m : string = "" @@ -9,12 +9,12 @@ let f a b c = let (?) (o:obj) (s:string) : (int -> int -> int -> string) = m <- s fun a b c -> sprintf "called with %d, %d, %d" a b c - - + + let test() = let s = "Hello" ? Contains 10 10 10 s - + let res1 = test() let res2 = m diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceInArrays.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceInArrays.fs index 53eba307336..28515083662 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceInArrays.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceInArrays.fs @@ -1,13 +1,13 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let (?) (o:obj) (s:string) : System.String = s - + let test() = let s = [ "Hello" ? Contains; "Hello" ? Empty ] s - + let res = test() if res.Head = "Contains" && res.Tail.Head = "Empty" then exit 0 else exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceMethodCall.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceMethodCall.fs index 9e086a37fbd..a022e635f26 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceMethodCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceMethodCall.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable m : string = "" @@ -6,12 +6,12 @@ let mutable m : string = "" let (?) (o:obj) (s:string) : System.String = m <- s "" - - + + let test() = let s = "Hello" ? Contains.GetType() s.Name - + let res1 = test() let res2 = m diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceMethodCallSpace.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceMethodCallSpace.fs index 8bdfbff6eed..af8d9ff1352 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceMethodCallSpace.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceMethodCallSpace.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable m : string = "" @@ -6,12 +6,12 @@ let mutable m : string = "" let (?) (o:obj) (s:string) : System.String = m <- s "" - - + + let test() = let s = "Hello" ? Contains . GetType() s.Name - + let res1 = test() let res2 = m diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceSpace.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceSpace.fs index 9c8d457ae0d..c98bc36070a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceSpace.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkPrecedenceSpace.fs @@ -1,4 +1,4 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let mutable m : string = "" @@ -6,12 +6,12 @@ let mutable m : string = "" let (?) (o:obj) (s:string) : (int -> string) = m <- s fun n -> sprintf "called with %d" n - - + + let test() = let s = "Hello" ? Contains (10) s - + let res1 = test() let res2 = m diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkSimple.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkSimple.fs index fcc70e46fb1..f8528297a3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkSimple.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/QMarkSimple.fs @@ -1,15 +1,15 @@ -// #Conformance #LexicalAnalysis #Operators +// #Conformance #LexicalAnalysis #Operators let (?) (o : obj) (s : string) : string = let ty = o.GetType() sprintf "type: %s, member: %s" ty.Name s - - + + let testSimple() = let res = "Hello" ? Length res - + let res = testSimple() if res = "type: String, member: Length" then exit 0 else exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Whitespace/WhiteSpace01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Whitespace/WhiteSpace01.fs index 92076c788e1..3886a4fc1ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Whitespace/WhiteSpace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/Whitespace/WhiteSpace01.fs @@ -1,5 +1,4 @@ -// #Conformance #LexicalAnalysis - +// #Conformance #LexicalAnalysis @@ -9,26 +8,27 @@ - - let + let - square - x + + + square + x = x * x in - + printf "%d" ( @@ -46,4 +46,4 @@ 42 -) +) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/ByExample/BasicCheck01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/ByExample/BasicCheck01.fs index da48a677e06..82d210f83d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/ByExample/BasicCheck01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/ByExample/BasicCheck01.fs @@ -1,13 +1,13 @@ -// #Conformance #LexFilter +// #Conformance #LexFilter // Sanity check #light functionality -let f x y z = +let f x y z = let a = x * y let b = y * z let c = x * z - let d = + let d = match a with | 0 -> "x|y = 0" | _ when a < 0 -> "x|y < 0 && x|y > 0" @@ -22,7 +22,7 @@ let f x y z = 1 else x * fact (x - 1) - + (a, b, c, d, fact 4) // Without #light there would be a compile error diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01a.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01a.fs index 8fad9e643c2..9580e915d0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01a.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #LexFilter #Exceptions +// #Regression #Conformance #LexFilter #Exceptions // Regression test for FSHARP1.0:5205 // Indentation rules // -let faaa xx = List.iter (fun z -> +let faaa xx = List.iter (fun z -> match 1 with | _ -> ()) [1;2] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01b.fs index f41118bd078..a2c1e92aa0d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01b.fs @@ -1,8 +1,8 @@ -// #Regression #Conformance #LexFilter #Exceptions +// #Regression #Conformance #LexFilter #Exceptions // Regression test for FSHARP1.0:5205 // Indentation rules // -let fbbbbbbb xx = List.iter (fun z -> +let fbbbbbbb xx = List.iter (fun z -> match 1 with | _ -> ()) [1;2] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01c.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01c.fs index 30ddb0a26a1..4fa4e3ce862 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01c.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/Basic/OffsideExceptions/Offside01c.fs @@ -1,10 +1,10 @@ -// #Regression #Conformance #LexFilter #Exceptions +// #Regression #Conformance #LexFilter #Exceptions // Regression test for FSHARP1.0:5205 // Indentation rules (this should have worked, but it has been made by design) //Unexpected symbol '\[' in binding\. Expected incomplete structured construct at or before this point or other token\.$ //Incomplete value or function definition\. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword\.$ //Incomplete structured construct at or before this point in implementation file$ -let fccccccc xx = List.iter (fun z -> +let fccccccc xx = List.iter (fun z -> match 1 with | _ -> ()) [1;2] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/CastOperators01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/CastOperators01.fs index 039fcc24d93..8d7882c996f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/CastOperators01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/CastOperators01.fs @@ -1,14 +1,14 @@ -// #Regression #Conformance #LexFilter +// #Regression #Conformance #LexFilter // Regression for FSHARP1.0:5933 // fix #light syntax for cast operators module M -let f (info: System.Reflection.MethodInfo) = +let f (info: System.Reflection.MethodInfo) = System.Attribute.GetCustomAttribute(info, typeof) :?> ReflectedDefinitionAttribute -let f2 x = +let f2 x = new ReflectedDefinitionAttribute() :> System.Attribute diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_SpacesAfterLetBinding.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_SpacesAfterLetBinding.fs index d254889cb70..be6c06d5105 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_SpacesAfterLetBinding.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_SpacesAfterLetBinding.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexFilter +// #Regression #Conformance #LexFilter // Verify you get a warning when you put spaces after a let-binding // Regression from FSB 1829 @@ -6,7 +6,7 @@ //Incomplete value or function definition\. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword\.$ let simpleFunc() = - let mutable counter = 0 + let mutable counter = 0 counter <- counter + 1 counter diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_TABsNotAllowedIndentOff.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_TABsNotAllowedIndentOff.fs index 1fb4e979927..aa94952abcf 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_TABsNotAllowedIndentOff.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_TABsNotAllowedIndentOff.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexFilter +// #Regression #Conformance #LexFilter // Regression test for FSHARP1.0:5399 //TABs are not allowed in F# code diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_UnclosedLetBlock01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_UnclosedLetBlock01.fs index 8d0b8e76f7e..bd088650ef9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_UnclosedLetBlock01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/E_UnclosedLetBlock01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexFilter +// #Regression #Conformance #LexFilter // Verify error on unclosed let-block // Regression for FSB 1616 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/First_Non_Comment_Text01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/First_Non_Comment_Text01.fs index 5533778e40f..0b1242a18ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/First_Non_Comment_Text01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/First_Non_Comment_Text01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexFilter +// #Regression #Conformance #LexFilter // Regression test for FSHARP1.0:1078 // The #light is now the default. See also FSHARP1.0:2319 //#light diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/MissingEndToken01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/MissingEndToken01.fs index cc1e2ca1335..c50a07234b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/MissingEndToken01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/MissingEndToken01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexFilter +// #Regression #Conformance #LexFilter // FSB 1431, 'end' token ambiguity for interface/class: Incorrect and unactionable error messages when defining class which just implements an interface diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/OffsideAccessibility01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/OffsideAccessibility01.fs index a068bded6f6..b9fee313ee7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/OffsideAccessibility01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/OffsideAccessibility01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #LexFilter +// #Regression #Conformance #LexFilter // FSB 2150, Offside rule for #light code should set offside to left of accessibility modifier if present @@ -8,10 +8,10 @@ open System.IO (* CodeFile *) type CodeFile = - + val m_code : string val m_lines : string[] - + public new(filename : string) = let allCode = "" // File.ReadAllText(filename) let lines = [| "" |] // Array.concat [ [|"[Dummy line which take lines being 1-indexed into account]"|]; (File.ReadAllLines(filename)) ] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/default_in_fsi01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/default_in_fsi01.fs index 379ba736e68..1c94f158886 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/default_in_fsi01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/default_in_fsi01.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #LexFilter #ReqNOMT +// #Regression #Conformance #LexFilter #ReqNOMT // Regression test for FSHARP1.0:1078 // The #light is default in fsi.exe // let SimpleSample() = - let x = 10 + 12 - 3 - let y = x * 2 + 1 - let r1,r2 = x/3, x%3 + let x = 10 + 12 - 3 + let y = x * 2 + 1 + let r1,r2 = x/3, x%3 (x,y,r1,r2) exit 0;; diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/default_in_fsi02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/default_in_fsi02.fs index d06c07211db..465e1f6c82d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/default_in_fsi02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HashLight/default_in_fsi02.fs @@ -1,8 +1,8 @@ -// #Conformance #LexFilter #ReqNOMT +// #Conformance #LexFilter #ReqNOMT //#light -module TestModule +module TestModule let SimpleSample() = - let x = 10 + 12 - 3 - let y = x * 2 + 1 - let r1,r2 = x/3, x%3 + let x = 10 + 12 - 3 + let y = x * 2 + 1 + let r1,r2 = x/3, x%3 (x,y,r1,r2) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HighPrecedenceApplication/BasicCheck01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HighPrecedenceApplication/BasicCheck01.fs index 19718113329..58dee178a5a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HighPrecedenceApplication/BasicCheck01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HighPrecedenceApplication/BasicCheck01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexFilter #Precedence +// #Conformance #LexFilter #Precedence // Verify high precedence applications. That is, if no space is between the function diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HighPrecedenceApplication/BasicCheck02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HighPrecedenceApplication/BasicCheck02.fs index 4eec1b7d06b..96c4dcdce3a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HighPrecedenceApplication/BasicCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/HighPrecedenceApplication/BasicCheck02.fs @@ -1,4 +1,4 @@ -// #Conformance #LexFilter #Precedence +// #Conformance #LexFilter #Precedence let mutable z=0;; // #light must not touch these. (non-#light will) @@ -7,30 +7,30 @@ let mutable x=1;; // #light must reset these. (non-#light will not) let mutable w=1;; -// In #light this means �if x then (y;z)�, in non-#light means �(if x then y); z�. +// In #light this means �if x then (y;z)�, in non-#light means �(if x then y); z�. if false then (); z<-z+1 ;; //In #light means �if x then (if y then z else w)�, in non-#light means �if x then (if y then z) else w� -if false then - if true then +if false then + if true then () -else +else x<-0 ;; -if false then - if false then +if false then + if false then () -else +else w<-0 ;; -if true then - if false then +if true then + if false then () -else +else y<-y+1 ;; diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/LexicalAnalysisOfTypeApplications/ComplexTypeApp01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/LexicalAnalysisOfTypeApplications/ComplexTypeApp01.fs index 7e47248811d..b4a6b3e0562 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/LexicalAnalysisOfTypeApplications/ComplexTypeApp01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalFiltering/LexicalAnalysisOfTypeApplications/ComplexTypeApp01.fs @@ -1,4 +1,4 @@ -// #Conformance #LexFilter +// #Conformance #LexFilter // Verify correct lexing of a complex type application let typeApp = typeof[],Map<_,_[]>>,_>,_>>.FullName diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/CustomExceptions01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/CustomExceptions01.fs index 5ad26072c33..db78927bf59 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/CustomExceptions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/CustomExceptions01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #Printing +// #Regression #NoMT #Printing // Test for FSharp1.0:4045 - exception printing adds Exception to name of exn constructor diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/DisposeOnSprintfA.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/DisposeOnSprintfA.fs index c554b44bedd..2b93c57c137 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/DisposeOnSprintfA.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/DisposeOnSprintfA.fs @@ -1,8 +1,8 @@ -// #Regression #NoMT #Printing +// #Regression #NoMT #Printing // Regression test for FSHARP1.0:4725 // F# is not disposing an IEnumerator in implementation of sprintf "%A" //Done -let x = seq { try yield 1; yield 2; +let x = seq { try yield 1; yield 2; finally printfn "Done" } sprintf "x = %A" x |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/Quotation01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/Quotation01.fs index ce92f6a2438..93ea59bc64d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/Quotation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/Quotation01.fs @@ -1,4 +1,4 @@ -// #NoMT #Printing +// #NoMT #Printing // Regression test for FSHARP1.0:524 //val it: Quotations.Expr = Value \(1\) <@ 1 @>;; diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/ToStringOnCollections.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/ToStringOnCollections.fs index 65e4e6d5fd3..7b79965c660 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/ToStringOnCollections.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/ToStringOnCollections.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #Printing +// #Regression #NoMT #Printing // Regression test on FSharp1.0:5129 // Debugger: provide a decent override of ToString on FSharpList diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/UnitsOfMeasureIdentifiersRoundTrip02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/UnitsOfMeasureIdentifiersRoundTrip02.fs index e7fc2dfbe17..aeffc99fc9a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/UnitsOfMeasureIdentifiersRoundTrip02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/UnitsOfMeasureIdentifiersRoundTrip02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #Printing +// #Regression #NoMT #Printing // Regression test for FSHARP1.0:3300 // Verify that Pretty-printing of measure identifiers round-trips, i.e. displays the long identified (Namespace.Module.Type) // This is an aux dll which defines UoM inside a namespace/module diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/VariantTypes01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/VariantTypes01.fs index 34d744e1497..b3094001d10 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/VariantTypes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/VariantTypes01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #Printing +// #Regression #NoMT #Printing // Regression test for FSHARP1.0:1401 // incorrect pretty printing of variant types // The issue here was the missing parens around the nested Some ... diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/WidthForAFormatter.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/WidthForAFormatter.fs index a20d63d0a3b..1610f47695d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/WidthForAFormatter.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/WidthForAFormatter.fs @@ -1,9 +1,9 @@ -// #Regression #NoMT #Printing +// #Regression #NoMT #Printing // Regression test for FSHARP1.0:4139 - %A formatter does not accept width, e.g. printf "%10000A" -let test = +let test = sprintf "%1A" [1..5] = "[1;\n 2;\n 3;\n 4;\n 5]" && sprintf "%13A" [|1..5|] = "[|1; 2; 3; 4;\n 5|]" && sprintf "%3.1A" (seq {1..3}) = "seq\n [1;\n ...]" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructConstructor01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructConstructor01.fs index 56ef42be030..70aef0f4a83 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructConstructor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructConstructor01.fs @@ -6,6 +6,6 @@ module M [] type Foo<'T> = val offset : int - new (x:'T) = { offset = 1 } - + new (x:'T) = { offset = 1 } + let foo = Foo() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict01.fs index 6e79ed62399..c10891e2de6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict01.fs @@ -10,8 +10,8 @@ open System.Collections.Generic type Foo<'T> = val offset : int new (x:'T) = { offset = 1 } - interface IEnumerable<'T> with - member this.GetEnumerator() = null :> IEnumerator<'T> + interface IEnumerable<'T> with + member this.GetEnumerator() = null :> IEnumerator<'T> member this.GetEnumerator() = null :> IEnumerator //let foo = Foo(1) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict01.fsi index b784cb1e69d..a460d85a2c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict01.fsi @@ -7,7 +7,7 @@ module M open System.Collections.Generic [] -type Foo<'T> = +type Foo<'T> = new : 'T -> 'T Foo - member public GetEnumerator: unit -> IEnumerator<'T> + member public GetEnumerator: unit -> IEnumerator<'T> interface IEnumerable<'T> diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict02.fs index cae98bedf4d..f3ae69725cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict02.fs @@ -10,8 +10,8 @@ open System.Collections.Generic type Foo<'T> = val offset : int new (x:'T) = { offset = 1 } - interface IEnumerable<'T> with - member this.GetEnumerator() = null :> IEnumerator<'T> + interface IEnumerable<'T> with + member this.GetEnumerator() = null :> IEnumerator<'T> member this.GetEnumerator() = null :> IEnumerator let foo = Foo(1) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict02.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict02.fsi index 4f3c6feb429..2f1552c377e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict02.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/E_StructWithNameConflict02.fsi @@ -7,7 +7,7 @@ module M open System.Collections.Generic [] -type Foo<'T> = +type Foo<'T> = new : 'T -> 'T Foo - member public GetEnumerator: unit -> IEnumerator<'T> + member public GetEnumerator: unit -> IEnumerator<'T> interface IEnumerable<'T> diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/ImplementsComparable.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/ImplementsComparable.fs index 09d42cd8bc6..72d939fd06c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/ImplementsComparable.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/ImplementsComparable.fs @@ -1,5 +1,5 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles module A -type C() = - interface System.IComparable with +type C() = + interface System.IComparable with member x.CompareTo(yobj) = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/ImplementsComparable.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/ImplementsComparable.fsi index 4f86d8e720f..63e13ee7a7b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/ImplementsComparable.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/ImplementsComparable.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles module A -type C = +type C = new : unit -> C diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility01.fs index a2ff756a4c2..9dade0762a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility01.fs @@ -1,11 +1,11 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Verify ability to use FSI files in conjunction with internal types module InternalAccessibility01 -type internal T() = +type internal T() = member x.P = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility01.fsi index 921dcf631bf..b77841ca960 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility01.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // Verify ability to use FSI files in conjunction with internal types diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility02.fs index 70825644d8e..832d0c6cf46 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Regression test for FSHARP1.0:4155 - combined accessibilities internal --> internal give "private" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility03.fs index 7c58a2ca93d..e0907b948fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Regression for FSHARP1.0:5852 // Overly strict checks when a type is implicitly hidden by signature @@ -6,9 +6,9 @@ module Module1 type internal Z() = member x.P = 1 type Q1 = { field : Z } // this is ok because Q1 is implicitly internal -type Q2 = ABC of Z +type Q2 = ABC of Z type Q3() = inherit Z() type Q4 = delegate of Z -> Z [] -type Q5() = +type Q5() = abstract M : Z -> Z diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility03.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility03.fsi index 72ac73c2afb..25451d6600c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility03.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/InternalAccessibility03.fsi @@ -1,4 +1,4 @@ -// #Conformance #SignatureFiles +// #Conformance #SignatureFiles // intentionally blank module Module1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/MissingMethodInImplementation01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/MissingMethodInImplementation01.fs index e1e7c4e31ef..0fe51b55e2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/MissingMethodInImplementation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/MissingMethodInImplementation01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Regression for 5618 // Used to get a bad error message here, LSS doesn't implement member Bar with is in the .fsi but also on another type //Module 'MyNS\.File2' requires a value 'member File2\.LSS\.Bar: string -> int'$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/MissingMethodInImplementation01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/MissingMethodInImplementation01.fsi index 7ac32f02f2e..c83b243de8f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/MissingMethodInImplementation01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Signatures/SignatureConformance/MissingMethodInImplementation01.fsi @@ -1,4 +1,4 @@ -// #Regression #Conformance #SignatureFiles +// #Regression #Conformance #SignatureFiles // Regression for 5618 // Used to get a bad error message here, LSS doesn't implement member Bar with is in the .fsi but also on another type //Module 'MyNS\.File2' requires a value 'member File2\.LSS\.Bar: string -> int'$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ByRef04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ByRef04.fs index f5d487357d8..478ada59361 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ByRef04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ByRef04.fs @@ -6,4 +6,4 @@ module M // Should compile just fine let inline f x (y:_ nativeptr) = (^a : (static member TryParse : string * ^a nativeptr -> bool)(x,y)) - + diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ComparisonConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ComparisonConstraint01.fs index 488770b7665..eccec25e6b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ComparisonConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ComparisonConstraint01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints open System @@ -11,7 +11,7 @@ testFunc 1 |> ignore type S3(x : int) = interface IComparable with override this.CompareTo(o : obj) = 0 - + member this.Test = x + 1 testFunc (S3(2)) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ConstraintCall1.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ConstraintCall1.fs index 8135596cfc5..98fce38559e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ConstraintCall1.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ConstraintCall1.fs @@ -1,10 +1,10 @@ // #Conformance #ConstraintCall let inline h x y z = ((^a or ^b or ^c) : (static member M : ^a * ^b * ^c -> ^d) (x,y,z)) -type T() = +type T() = static member M(_ : T, _ : int, _ : int) = 1 static member M(_ : int, _ : T, _ : int) = "" static member M(_ : int, _ : int, _ : T) = false - -let _ : int = h (T()) 1 1 + +let _ : int = h (T()) 1 1 let _ : string = h 1 (T()) 1 let _ : bool = h 1 1 (T()) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ConstraintCall2.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ConstraintCall2.fs index 9a24fe56e00..39be1279311 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ConstraintCall2.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ConstraintCall2.fs @@ -1,8 +1,8 @@ // #Conformance #ConstraintCall let inline h x = (^a: (static member M : ^a -> ^b) (x)) -type T() = +type T() = static member M(_ : T) = 1 static member M(_ : int) = "" - + let _ : int = h (T()) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint01.fs index 1a6310f43b9..6b1aca3e65b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // FSB 1742, Wrong ctor signature (in ctor constraint) is not reported as an error //'new'.+constraint @@ -6,7 +6,7 @@ (* 5.1.5.4 .NET Default Constructor Constraints -A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. +A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. During constraint solving, the constraint type : (new : unit -> 'a) is met if type has a parameterless object constructor. *) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint02.fs index 7e97d30d387..84183b2972e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint02.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // FSB 1742, Wrong ctor signature (in ctor constraint) is not reported as an error //Type constraint mismatch when applying the default type 'C' for a type inference variable // DefaultConstructorConstraint02.fs(17,11-17,15): error FS0071: Type constraint mismatch when applying the default type 'C' for a type inference variable (* 5.1.5.4 .NET Default Constructor Constraints -A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. +A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. During constraint solving, the constraint type : (new : unit -> 'a) is met if type has a parameterless object constructor. *) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint03.fs index 71a66ec3ecd..a43dbdc8588 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint03.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // FSB 2029, default constructor constraint is ignoring the return type of the signature //'new'.+constraint @@ -6,7 +6,7 @@ (* 5.1.5.4 .NET Default Constructor Constraints -A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. +A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. During constraint solving, the constraint type : (new : unit -> 'a) is met if type has a parameterless object constructor. *) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint04.fs index f0ecbe9519d..c2d07629061 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint04.fs @@ -1,11 +1,11 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // FSB 2029, default constructor constraint is ignoring the return type of the signature //'new'.+constrain // DefaultConstructorConstraint04.fs(11,15-11,40): error FS0191: 'new' constraints must take one argument of type 'unit' and return the constructed type. (* 5.1.5.4 .NET Default Constructor Constraints -A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. +A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. During constraint solving, the constraint type : (new : unit -> 'a) is met if type has a parameterless object constructor. *) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint05.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint05.fs index 0caa5e017da..c4646a0d1e5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint05.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/DefaultConstructorConstraint05.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // FSB 2029, default constructor constraint is ignoring the return type of the signature //'new'.+constraint @@ -6,7 +6,7 @@ (* 5.1.5.4 .NET Default Constructor Constraints -A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. +A constraint of the form typar : (new : unit -> 'a) is an explicit .NET default constructor constraint. During constraint solving, the constraint type : (new : unit -> 'a) is met if type has a parameterless object constructor. *) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ByRef01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ByRef01.fs index b609d716ee3..28874138a10 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ByRef01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ByRef01.fs @@ -5,4 +5,4 @@ module M // SHould give an error - not ICE! let inline f x (y:_ byref) = (^a : (static member TryParse : string * ^a byref -> bool)(x,y)) - + diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ByRef03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ByRef03.fs index da5ad234daa..b4dc3331ea7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ByRef03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ByRef03.fs @@ -5,4 +5,3 @@ module M // SHould give an error - not ICE! let inline f x (y:_ byref byref) = (^a : (static member TryParse : string * ^a byref byref -> bool)(x,y)) - \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethods1.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethods1.fs index 08febca56c1..119ba0b5df0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethods1.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_CannotInlineVirtualMethods1.fs @@ -1,12 +1,12 @@ -// #inline #FSharpQA #Conformance #TypeConstraints +// #inline #FSharpQA #Conformance #TypeConstraints //This member, function or value declaration may not be declared 'inline' //This member, function or value declaration may not be declared 'inline' [] -type Bad10 = +type Bad10 = abstract inline X : int [] -type Bad11 = +type Bad11 = abstract inline X : int -> int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ComparisonConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ComparisonConstraint01.fs index e56a106b6d8..c304f698b99 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ComparisonConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ComparisonConstraint01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints //The type 'S1' does not support the 'comparison' constraint\. For example, it does not support the 'System\.IComparable' interface //The type 'S2' does not support the 'comparison' constraint because it has the 'NoComparison' attribute diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ConstraintCall1.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ConstraintCall1.fs index 6686176a6b0..b76ae9d4340 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ConstraintCall1.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ConstraintCall1.fs @@ -1,4 +1,4 @@ // #Conformance #ConstraintCall //None of the types 'int, bool, string' support the operator 'M' let inline h (x, y, z) = ((^a or ^b or ^c) : (static member M : ^a * ^b * ^c -> ^d) (x,y,z)) -let _ : int = h (1,false,"") +let _ : int = h (1,false,"") diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ConstraintCall2.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ConstraintCall2.fs index 786d9ec68d9..eda0bd954d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ConstraintCall2.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_ConstraintCall2.fs @@ -1,5 +1,5 @@ // #Conformance #ConstraintCall //The type 'int' does not support the operator 'M' -let inline h x = (^a: (static member M : ^a -> ^b) (x)) +let inline h x = (^a: (static member M : ^a -> ^b) (x)) h 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_DelegateConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_DelegateConstraint01.fs index c072b57644c..169aa39ad05 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_DelegateConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_DelegateConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify error if the delegate constraint isn't met // Note this constraint requires that the delegate obey the // standard .NET idiom (obj sender, EventArgs args) -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EnumConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EnumConstraint01.fs index f9369aa7754..abd74d6da70 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EnumConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EnumConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify error if trying to use a failing enum type constraint @@ -6,11 +6,11 @@ let printByteEnum (e : 'a) : unit when 'a : enum = () -type ShortEnum = +type ShortEnum = | A = 0s | B = 1s printByteEnum (ShortEnum.A) exit 1 - + diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EnumConstraint02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EnumConstraint02.fs index 16c7b158499..1da70b1e347 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EnumConstraint02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EnumConstraint02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify error when enum constraint is not satisfied //The type 'string' is not a CLI enum type$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EqualityConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EqualityConstraint01.fs index 90d13742b36..c611d9a5ec2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EqualityConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_EqualityConstraint01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints //The type 'S' does not support the 'equality' constraint because it has the 'NoEquality' attribute let testFunc<'a, 'b when 'a:equality> (x : 'a) = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint01.fs index 113d7dbe1b7..8339e6f7da2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints //Type constraint mismatch when applying the default type 'obj' for a type inference variable\. The type 'obj' does not support the operator 'someFunc' Consider adding further type constraints$ let testFunc (a : ^x) = (^x : (static member someFunc : unit -> ^x) ()) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint04.fs index a045fa684e0..8bfce7500f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint04.fs @@ -9,12 +9,12 @@ let inline testFunc (a : ^x) (b : ^y) = let r1 = (^x : (static member someFunc : unit -> ^x) ()) let r2 = (^x : (static member someFunc : unit -> ^y) ()) () - -type Foo(x) = + +type Foo(x) = static member someFunc() = Foo(10) -type OtherFoo(x) = +type OtherFoo(x) = static member someFunc() = Foo(20) - + let r = testFunc (Foo(1)) (OtherFoo(2)) let r2 = testFunc (OtherFoo(2)) (Foo(1)) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_NullnessConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_NullnessConstraint01.fs index eb585a9f56f..a7b0cd36b2f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_NullnessConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_NullnessConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // The type 'int' does not have 'null' as a proper value // The type 'StructRecd' does not have 'null' as a proper value // The type 'StdRecd' does not have 'null' as a proper value diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_RefConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_RefConstraint01.fs index 6302ef9f07e..7069e5156c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_RefConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_RefConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify error when reference constraint is not satisfied //A generic construct requires that the type 'int' have reference semantics, but it does not, i.e. it is a struct //A generic construct requires that the type 'StructRecd' have reference semantics, but it does not, i.e. it is a struct diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_Regression02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_Regression02.fs index deb1f392352..67034b17e88 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_Regression02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_Regression02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Regression test for CTP bug reported at http://cs.hubfs.net/forums/thread/9313.aspx // In CTP, this was a stack overflow in the compiler. Now we give 64 errors //The type 'uint32' does not match the type 'int32' @@ -108,14 +108,14 @@ module SmartHashUtils = let ff = uint32 0xff match endian with - | 0 -> + | 0 -> let funn i n = (uint32 array.[offset + i*4] &&& ff) ||| ((uint32 array.[offset + i*4+1] &&& ff) <<< 8) ||| ((uint32 array.[offset + i*4+2] &&& ff) <<< 16) ||| ((uint32 array.[offset + i*4+3] &&& ff) <<< 24) Array.mapi funn temp - | _ -> + | _ -> let funn i n = ((uint32 array.[offset + i*4] &&& ff) <<< 24) ||| ((uint32 array.[offset + i*4+1] &&& ff) <<< 16) ||| @@ -126,29 +126,29 @@ module SmartHashUtils = let UIntToByte (array:uint32[]) offset length endian = let temp:byte[] = Array.create (length * 4) (byte 0) - + match endian with - | 0 -> - let funn i n = byte (array.[offset + i/4] >>> (i%4 * 8)) - Array.mapi funn temp - | _ -> - let funn i n = byte (array.[offset + i/4] >>> ((3 - i%4) * 8)) - Array.mapi funn temp - - + | 0 -> + let funn i n = byte (array.[offset + i/4] >>> (i%4 * 8)) + Array.mapi funn temp + | _ -> + let funn i n = byte (array.[offset + i/4] >>> ((3 - i%4) * 8)) + Array.mapi funn temp + + let ULongToByte (array:uint64[]) offset length endian = let temp:byte[] = Array.create (length * 8) (byte 0) - + match endian with - | 0 -> - let funn i n = byte (array.[offset + i/8] >>> (i%8 * 8)) - Array.mapi funn temp - | _ -> - let funn i n = byte (array.[offset + i/8] >>> ((7 - i%8) * 8)) - Array.mapi funn temp + | 0 -> + let funn i n = byte (array.[offset + i/8] >>> (i%8 * 8)) + Array.mapi funn temp + | _ -> + let funn i n = byte (array.[offset + i/8] >>> ((7 - i%8) * 8)) + Array.mapi funn temp - let LS (x:uint32) n = uint32 ((x <<< n) ||| (x >>> (32 - n))) + let LS (x:uint32) n = uint32 ((x <<< n) ||| (x >>> (32 - n))) let RS (x:uint32) n = uint32 ((x >>> n) ||| (x <<< (32 - n))) module SmartHashBlock = @@ -170,13 +170,13 @@ module SmartHashBlock = member b.BlockSize with get() = blockSize and set(v) = blockSize <- v member b.BufferCount with get() = bufferCount and set(v) = bufferCount <- v member b.Count with get() = count and set(v) = count <- v - - default x.Initialize() = + + default x.Initialize() = count <- uint64 0 bufferCount <- 0 buffer <- Array.zeroCreate blockSize - - default x.HashCore(array, ibStart, cbSize) = + + default x.HashCore(array, ibStart, cbSize) = //let engineUpdate input offset' length' = let mutable offset = ibStart let mutable length = cbSize @@ -189,29 +189,29 @@ module SmartHashBlock = length <- length - off bufferCount <- 0 x.BlockTransform (buffer, 0) - + let numBlocks = length / blockSize for i in 0..(numBlocks-1) do x.BlockTransform (array, (offset + i * blockSize)) - + let bytesLeft = length % blockSize - + if (bytesLeft <> 0) then Array.blit array (offset + (length - bytesLeft)) buffer bufferCount bytesLeft bufferCount <- bufferCount + bytesLeft - + abstract BlockTransform: (byte[] * int) -> unit - - member x.CreatePadding(minSize, append) = + + member x.CreatePadding(minSize, append) = let mutable paddingSize = x.BlockSize - ((int x.Count) % x.BlockSize) - - if (paddingSize < minSize) then paddingSize <- paddingSize + x.BlockSize + + if (paddingSize < minSize) then paddingSize <- paddingSize + x.BlockSize let Padding = Array.create paddingSize (byte 0) Padding.[0] <- append Padding -module SmartHashMD5 = +module SmartHashMD5 = open SmartHashUtils open SmartHashBlock @@ -220,12 +220,12 @@ module SmartHashMD5 = inherit BlockHashAlgorithm() ///The size in bytes of an individual block. let mutable state:int32[] = null - + do this.BlockSize <- 64 do this.HashSizeValue <- 128 do state <- Array.zeroCreate 4 do this.Initialize() - + override x.Initialize() = base.Initialize() state.[0] <- 0x67452301 @@ -233,7 +233,7 @@ module SmartHashMD5 = state.[2] <- 0x98BADCFE state.[3] <- 0x10325476 - member x.BlockTransform(data, iOffset) = + member x.BlockTransform(data, iOffset) = let mutable A = state.[0] let mutable B = state.[3] let mutable C = state.[2] @@ -241,7 +241,7 @@ module SmartHashMD5 = let X = ByteToUInt data iOffset 64 0 - A <- D + LS (P1 D C B + A + X.[0] + uint32 0xD76AA478) 7 + A <- D + LS (P1 D C B + A + X.[0] + uint32 0xD76AA478) 7 B <- A + LS(P1 A D C + B + X.[1] + uint32 0xE8C7B756) 12 C <- B + LS(P1 B A D + C + X.[2] + uint32 0x242070DB) 17 D <- C + LS(P1 C B A + D + X.[3] + uint32 0xC1BDCEEE) 22 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_Regressions01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_Regressions01.fs index 4023a97a584..d9b550de89f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_Regressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_Regressions01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Same as Regressions01, but we keep the incorrect 'base' // FSB 1748, Internal Error: when calling a base member // Regression test for internal compiler error when calling a class's base member. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_StructConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_StructConstraint01.fs index cd71018afc2..88d67941fe8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_StructConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_StructConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify error when struct constraint isn't satisfied //A generic construct requires that the type 'string' is a CLI or F# struct type diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_SubtypeConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_SubtypeConstraint01.fs index 1e117d358eb..47530450ec2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_SubtypeConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_SubtypeConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify error if subtype constraint is not met //The type 'Animal' is not compatible with the type 'Dog' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_UnmanagedConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_UnmanagedConstraint01.fs index a250a3787d4..ea7d7d710b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_UnmanagedConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_UnmanagedConstraint01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Simple baselines for unmanaged constraint //A generic construct requires that the type 'D' is an unmanaged type //A generic construct requires that the type 'C' is an unmanaged type diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ExplicitMemberConstraints1.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ExplicitMemberConstraints1.fs index 74c02ffca12..e2a5a869765 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ExplicitMemberConstraints1.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ExplicitMemberConstraints1.fs @@ -1,7 +1,7 @@ // #Conformance #TypeConstraints let inline f< ^t when ^t : (static member M : string)>() = 0 -type T() = +type T() = static member M = "" let _ = f() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ExplicitMemberConstraints2.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ExplicitMemberConstraints2.fs index 28246f30fa2..fad08180f24 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ExplicitMemberConstraints2.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/ExplicitMemberConstraints2.fs @@ -2,7 +2,7 @@ let inline g< ^t, ^u, ^v when (^t or ^u or ^v) : (static member M : string)>() = 0 -type T() = +type T() = static member M = "" let _ = g() diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/NativePtrArrayElementUsage.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/NativePtrArrayElementUsage.fs index d0f4b2ae341..43ae5b31ce3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/NativePtrArrayElementUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/NativePtrArrayElementUsage.fs @@ -1,16 +1,16 @@ -// #NativePtr #FSharpQA #Conformance #TypeConstraints +// #NativePtr #FSharpQA #Conformance #TypeConstraints // Dev11 bug 293120 open System.Runtime.InteropServices -module Array = +module Array = let inline pinObjUnscoped (obj: obj) = - GCHandle.Alloc(obj,GCHandleType.Pinned) + GCHandle.Alloc(obj,GCHandleType.Pinned) - let inline pinObj (obj: obj) f = + let inline pinObj (obj: obj) f = - let gch = pinObjUnscoped obj + let gch = pinObjUnscoped obj try f gch @@ -23,6 +23,6 @@ module Array = [] - let inline pin (arr: 'T []) (f : nativeptr<'T> -> 'U) = + let inline pin (arr: 'T []) (f : nativeptr<'T> -> 'U) = pinObj (box arr) (fun _ -> f (&&arr.[0])) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/NullnessConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/NullnessConstraint01.fs index c6841f10e45..67db27a71f1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/NullnessConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/NullnessConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Regression for FSB 4678 let mkInput<'d when 'd:null>() () = () diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/Regressions01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/Regressions01.fs index f4162fee133..a8d3b8b344a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/Regressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/Regressions01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // FSB 1748, Internal Error: when calling a base member diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/StructConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/StructConstraint01.fs index cf4a9e3862a..5d0a814abcc 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/StructConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/StructConstraint01.fs @@ -1,9 +1,9 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Struct Records should have the ValueType supertype constraint [] type StructRec = { Dummy: int -} +} let nullable = System.Nullable() diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/StructConstraint02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/StructConstraint02.fs index 74188d26f94..ea1584fc069 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/StructConstraint02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/StructConstraint02.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Struct Unions should have the ValueType supertype constraint [] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/UnmanagedConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/UnmanagedConstraint01.fs index b6ef00aa760..8d738983225 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/UnmanagedConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/UnmanagedConstraint01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Simple baselines for unmanaged constraint let testFunc<'a when 'a:unmanaged> (x : 'a) = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/W_LessGenericThanAnnotated01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/W_LessGenericThanAnnotated01.fs index c86e02997a8..512dee04ca0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/W_LessGenericThanAnnotated01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/W_LessGenericThanAnnotated01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify warning when a type is constrained further than is annotated // FSB 1436 //This construct causes code to be less generic than indicated by its type annotations. The type variable implied by the use of a '#', '_' or other type annotation at or near @@ -8,17 +8,17 @@ open Microsoft.FSharp.Math open System -type Node() = +type Node() = member this.Parent = this member this.ChildList = [this] |> List.toSeq - + let rec processNode (node : #Node) = let mutable t : Node = node // [1] cast node of type 'a (where 'a :> Node) to type node. while true do t <- t.Parent Console.Write("\t") Console.WriteLine(node.GetType().ToString()) - let childList = List.ofSeq node.ChildList // [2] .GetEnumerator() + let childList = List.ofSeq node.ChildList // [2] .GetEnumerator() List.iter (fun n -> processNode n) childList // [3] Problem... exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/AllowNullLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/AllowNullLiteral01.fs index 8c5e195c913..4dfd9310f50 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/AllowNullLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/AllowNullLiteral01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Verify [] does what it should. [] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Abstract.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Abstract.fs index 0c23c81a5e1..e27eb184288 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Abstract.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Abstract.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: AbstractClass diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Array.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Array.fs index 70caf32cb9f..2977c008a0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Array.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Array.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: Array diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Class.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Class.fs index 92401399c07..4e80bdf9245 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Class.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Class.fs @@ -1,14 +1,14 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints -// Test the base types of F# types: Class +// Test the base types of F# types: Class let baseTypeName<'a> = match typeof<'a> with | null -> null | x when x.BaseType <> null -> x.BaseType.Name | x -> null -type ClassType = +type ClassType = class end diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Delegate.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Delegate.fs index ee24c316794..8c75b7fd3be 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Delegate.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Delegate.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: Delegate @@ -12,7 +12,7 @@ type StructType = struct val dummy : byte // we need at least 1 member in a struct! end - + type DelegateType = delegate of (obj * StructType) -> int if baseTypeName <> "MulticastDelegate" then exit 1 else exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_DerivedClass.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_DerivedClass.fs index 3db7afe9614..0f172c4111a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_DerivedClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_DerivedClass.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: Derived Class @@ -8,7 +8,7 @@ let baseTypeName<'a> = match typeof<'a> with | x when x.BaseType <> null -> x.BaseType.Name | x -> null -// Abstract +// Abstract [] type AbstractType = class diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_DiscriminatedUnion.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_DiscriminatedUnion.fs index 5ba0428bf52..e7c5d4c470b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_DiscriminatedUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_DiscriminatedUnion.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: Discriminated Union diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Exception.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Exception.fs index 5ae982837bc..b8f8997c268 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Exception.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Exception.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: F#-style Exception diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Interface.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Interface.fs index 92c1427f7b5..8d92b21270c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Interface.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Interface.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: Interface @@ -17,7 +17,7 @@ if baseTypeName <> null then exit 1 // But for purposes of 'compiler goo' they do not, such as coercion between types. type AClass() = interface InterfaceType - + // Note how an interface has '.ToString()' despite not being derived from System.Object let anInterface = (new AClass() :> InterfaceType) if anInterface.ToString().EndsWith("AClass") = false then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Record.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Record.fs index 0be9de2c4c3..0d23e8b2720 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Record.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Record.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: Record diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Struct.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Struct.fs index 13a97b8d59e..77c91785582 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Struct.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Struct.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: Struct diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Tuple1.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Tuple1.fs index 3ac41b1cb41..2c55da51096 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Tuple1.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Tuple1.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints #ReqNOMT +// #Regression #Conformance #TypeConstraints #ReqNOMT // Regression test for FSHARP1.0:5091 // "CLR4 Tuple.Create<_>(x) leads to error 'type x is not compatible with type x'" // "System.Tuple.Create<_>(1) should return a tuple type, not an int" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Variable.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Variable.fs index 5dcb07a84ca..fef8f3f63c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Variable.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/BaseTypes_Variable.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the base types of F# types: Variable diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/E_AllowNullLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/E_AllowNullLiteral01.fs index ef7eec355a7..acdc365f22a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/E_AllowNullLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/E_AllowNullLiteral01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify error when treating F#-defined classes as null //The type 'Foo' does not have 'null' as a proper value diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/E_AllowNullLiteral02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/E_AllowNullLiteral02.fs index 13a707f7388..41a73bb8598 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/E_AllowNullLiteral02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/E_AllowNullLiteral02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Verify the [] attribute is only value on class and interface types //Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute @@ -10,7 +10,7 @@ type DiscUnion = A | B [] -type ClassType() = +type ClassType() = class end @@ -22,11 +22,11 @@ type Interface = type Record = { Field1 : int; Field2 : float } [] -type Struct = +type Struct = struct end [] -type TypeAbbrev = string * int +type TypeAbbrev = string * int exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/FSharpType_IsRecord.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/FSharpType_IsRecord.fs index b6e4a5a438d..d4a3345accd 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/FSharpType_IsRecord.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/FSharpType_IsRecord.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test Microsoft.FSharp.Reflection.IsRecord function works properly on various types @@ -27,7 +27,7 @@ type NonStandardType = | Function = 3 // Check if -let isOK = +let isOK = not (FSharpType.IsRecord ( typeof )) && // Color is not record not (FSharpType.IsRecord ( typeof )) && // Union type is not record not (FSharpType.IsRecord ( typeof )) && // Enum type is not record @@ -35,10 +35,10 @@ let isOK = not (FSharpType.IsRecord ( typeof )) && // Tuple of Records is not record not (FSharpType.IsRecord ( typeof )) && // Object is not record not (FSharpType.IsRecord ( typeof )) && // ValueType is not record - + FSharpType.IsRecord ( typeof ) && // Employee is record FSharpType.IsRecord ( typeof ) // Abbreviated SalesPerson type is record - + if not isOK then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/GenericTypeDef.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/GenericTypeDef.fs index 0801bec32c8..013f404efe8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/GenericTypeDef.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes/GenericTypeDef.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Test the ability to specify an anon, generic type let Name<'a> = typeof<'a>.Name diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/BasicTypeParam01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/BasicTypeParam01.fs index 623138687c3..052e26bcd7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/BasicTypeParam01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/BasicTypeParam01.fs @@ -1,4 +1,4 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints // Verify the ability to state type parameters in modules diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/E_GenericTypeConstraint.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/E_GenericTypeConstraint.fs index 1dea4c64c3e..f5533ae0145 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/E_GenericTypeConstraint.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/E_GenericTypeConstraint.fs @@ -1,7 +1,7 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Regression test for FSharp1.0:3407 - Internal error on code with member constraint and invalid method signature //This expression was expected to have type. ''a -> unit' .but here has type. 'unit' -let inline callfoo (a: ^a) : ^a -> unit when ^a : (member foo : ^a -> unit) = +let inline callfoo (a: ^a) : ^a -> unit when ^a : (member foo : ^a -> unit) = (^a : (member foo: unit (* <- incorrect *)-> unit) (a)) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/E_LazyInType02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/E_LazyInType02.fs index b42fa1ab260..40a6da17138 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/E_LazyInType02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/E_LazyInType02.fs @@ -4,6 +4,6 @@ //Unmatched '\('$ let f<'T> (x : Lazy<'T>) = () // this version works -let f1<'T> (x : 'T lazy) = () // Compiler doesn’t allow this notation +let f1<'T> (x : 'T lazy) = () // Compiler doesn’t allow this notation exit 1 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/HashConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/HashConstraint01.fs index 10d5f9a3fbb..f059a4e354d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/HashConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/HashConstraint01.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Regression test for FSHARP1.0:1419 // Tokens beginning with # should not match greedily with directives // The only case where we are still a bit confused is #light, which is missing in @@ -15,7 +15,7 @@ type r() = class type U() = class inherit r() end - + type u() = class inherit U() end diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/HashConstraint02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/HashConstraint02.fs index af41d59491d..54cd3c43dee 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/HashConstraint02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/HashConstraint02.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #TypeConstraints +// #Regression #Conformance #TypeConstraints // Regression test for FSHARP1.0:1419 // Tokens beginning with # should not match greedily with directives //The type 'float' is not compatible with the type 'light_' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/MultipleConstraints01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/MultipleConstraints01.fs index 7d861c14c11..e0d4735a19f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/MultipleConstraints01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/MultipleConstraints01.fs @@ -1,9 +1,9 @@ -// #Conformance #TypeConstraints +// #Conformance #TypeConstraints open System -let multipleConstraints<'T when 'T :> System.IDisposable and - 'T :> System.IComparable > (x: 'T, y: 'T) = +let multipleConstraints<'T when 'T :> System.IDisposable and + 'T :> System.IComparable > (x: 'T, y: 'T) = if x.CompareTo(y) < 0 then x.Dispose() else y.Dispose() type T() = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/UnitSpecialization.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/UnitSpecialization.fs index f56675b651d..870b9d7d492 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/UnitSpecialization.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/UnitSpecialization.fs @@ -1,4 +1,4 @@ -// #UnitGenericAbstractType +// #UnitGenericAbstractType // type Foo<'t> = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/ValueTypesWithConstraints01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/ValueTypesWithConstraints01.fs index 150dfe0d734..3f94bdc74f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/ValueTypesWithConstraints01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/TypesAndTypeConstraints/TypeParameterDefinitions/ValueTypesWithConstraints01.fs @@ -1,11 +1,11 @@ // #Conformance #TypeConstraints #Regression // Dev11:51952, at one point this was causing a StackOverflow in the compiler and crashing VS -type +type MyRecord<'X when 'X:> System.IComparable<'X>>() = static member P = 1 static member clone2 (v: MyField<'X>) = MyField.clone(v) -and +and MyField<'X when 'X:> System.IComparable<'X>> () = static member clone (v: MyField<'X>) : MyField<'X> = v diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AreYouMissingAnArgumentToAFunction01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AreYouMissingAnArgumentToAFunction01.fs index 408fc712932..9b56be9f5f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AreYouMissingAnArgumentToAFunction01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AreYouMissingAnArgumentToAFunction01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2804 // Make sure we don't emit ?. (notice that the error message changed a bit since the bug was opened) //This expression was expected to have type diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AreYouMissingAnArgumentToAFunction01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AreYouMissingAnArgumentToAFunction01b.fs index 7f03cb7eee4..007f963df94 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AreYouMissingAnArgumentToAFunction01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AreYouMissingAnArgumentToAFunction01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2804 // Make sure we don't emit ?. (notice that the error message changed a bit since the bug was opened) //\?\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AsBindingOnInheritDecl01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AsBindingOnInheritDecl01.fs index 0e8e0318638..094a592401a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AsBindingOnInheritDecl01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_AsBindingOnInheritDecl01.fs @@ -1,8 +1,8 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3491 //'inherit' declarations cannot have 'as' bindings\. To access members of the base class when overriding a method, the syntax 'base\.SomeMember' may be used; 'base' is a keyword\. Remove this 'as' binding\.$ let obj3 = { new System.Object() as xbase with - member x.ToString () = "Hello, base.ToString() = " + xbase.ToString() } + member x.ToString () = "Hello, base.ToString() = " + xbase.ToString() } diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_BaseInObjectExpression01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_BaseInObjectExpression01.fs index 19dd7ddc71f..c10267b63b8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_BaseInObjectExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_BaseInObjectExpression01.fs @@ -1,8 +1,8 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3491 //'inherit' declarations cannot have 'as' bindings\. To access members of the base class when overriding a method, the syntax 'base\.SomeMember' may be used; 'base' is a keyword\. Remove this 'as' binding\.$ let obj3 = { new System.Object() as base with - member x.ToString () = "Hello, base.ToString() = " + base.ToString() } + member x.ToString () = "Hello, base.ToString() = " + base.ToString() } diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Big_int01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Big_int01.fs index 1e505d08d4d..a9ca0dc56c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Big_int01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Big_int01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:5860 // Big_int module removed from PowerPack (was deprecated previously) //The namespace or module 'Big_int' is not defined diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ConsiderAddingSealedAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ConsiderAddingSealedAttribute01.fs index c6531a45b3e..968fe5d1eaa 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ConsiderAddingSealedAttribute01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ConsiderAddingSealedAttribute01.fs @@ -1,4 +1,4 @@ -// #Diagnostics +// #Diagnostics module M type T(d : decimal) = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ConsiderAddingSealedAttribute01.fsi b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ConsiderAddingSealedAttribute01.fsi index a8a004c51fd..ca824294389 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ConsiderAddingSealedAttribute01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ConsiderAddingSealedAttribute01.fsi @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //The type definitions for type 'T' in the signature and implementation are not compatible because the implementation type is not sealed but signature implies it is\. Consider adding the \[\] attribute to the implementation\.$ module M [] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ExpressionHasType_FullPath01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ExpressionHasType_FullPath01.fs index 56ae08065d8..39ef307f196 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ExpressionHasType_FullPath01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ExpressionHasType_FullPath01.fs @@ -1,16 +1,16 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3240 //This expression was expected to have type. 'M\.M1\.Typ1' .but here has type. 'M\.M2\.Typ1' module M - module M1 = + module M1 = type Typ1 = A - module M2 = + module M2 = type Typ1 = A - + open M1 open M2 - + let error = (M1.A = M2.A) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringBadPrecision01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringBadPrecision01.fs index 72df9196473..88ec805e589 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringBadPrecision01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringBadPrecision01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for Dev10:907600 //Unable to parse format string 'Bad precision in format specifier'$ // Unable to parse format string 'Bad precision in format specifier' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringBadSpecifier01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringBadSpecifier01.fs index a36ef159e27..84e650f477b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringBadSpecifier01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringBadSpecifier01.fs @@ -1,5 +1,5 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for Dev10:907600 //Unable to parse format string 'Bad format specifier: '/''$ // Unable to parse format string 'Bad format specifier: '/'' -printfn "%/110c" 'a' +printfn "%/110c" 'a' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringFlagSetTwice01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringFlagSetTwice01.fs index 7a0e0788ca6..3348f0e18ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringFlagSetTwice01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringFlagSetTwice01.fs @@ -1,5 +1,5 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for Dev10:907600 //Unable to parse format string ''c' format does not support precision'$ // Unable to parse format string ''c' format does not support precision -printfn "%10.0c" 'a' +printfn "%10.0c" 'a' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringInvalid01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringInvalid01.fs index ed68f4acc9e..ddaffb7fd53 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringInvalid01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringInvalid01.fs @@ -1,5 +1,5 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for Dev10:907600 //Unable to parse format string 'The # formatting modifier is invalid in F#'$ // Unable to parse format string 'The # formatting modifier is invalid in F#' -printfn "%#110c" 'a' +printfn "%#110c" 'a' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringPrecision01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringPrecision01.fs index 7a0e0788ca6..3348f0e18ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringPrecision01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FormattingStringPrecision01.fs @@ -1,5 +1,5 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for Dev10:907600 //Unable to parse format string ''c' format does not support precision'$ // Unable to parse format string ''c' format does not support precision -printfn "%10.0c" 'a' +printfn "%10.0c" 'a' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FoundInPowerPack_Matrix01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FoundInPowerPack_Matrix01.fs index e6f96c5f28e..ba58f0e9e31 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FoundInPowerPack_Matrix01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_FoundInPowerPack_Matrix01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // To ease up the transition path to the new F#, we (used to) emit diagnostic that is // useful to the user to figure out what to do to upgrade. //The type 'Matrix' is not defined diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IncompleteConstruct01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IncompleteConstruct01.fs index 63bbad5d811..87aebdfaa8a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IncompleteConstruct01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IncompleteConstruct01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1181 //Expecting member body diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IncompleteConstruct01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IncompleteConstruct01b.fs index b029157e52b..46fa9ca3ce2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IncompleteConstruct01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IncompleteConstruct01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1181 //syntax error // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IndexedPropertySetter01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IndexedPropertySetter01.fs index 1e62e360bbe..37599ae7891 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IndexedPropertySetter01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_IndexedPropertySetter01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Used to be regression test for FSHARP1.0:1185 // to be compiled with --warnaserror+ //Invalid declaration syntax diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_InvalidObjectExpression01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_InvalidObjectExpression01.fs index 2feabd28972..45524a9251d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_InvalidObjectExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_InvalidObjectExpression01.fs @@ -1,4 +1,4 @@ -// #Regression #FSharpQA #Diagnostics +// #Regression #FSharpQA #Diagnostics // Regression for 4858 //Invalid member signature encountered because of an earlier error //The member 'Text' does not correspond to any abstract or virtual method available to override or implement @@ -6,7 +6,7 @@ type T() = class end -let form = +let form = { new T() with Text="Hej" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs index c3e42520eb7..a815ea7d708 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs @@ -1,11 +1,11 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1729 // Notice that the bug was in the IDE, but a compiler test is equally useful. //This is not a valid value for an enumeration literal //This is not a valid value for an enumeration literal -// Shouldn't work +// Shouldn't work type EnumOfBigInt = | A = 0I | B = 0I diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_MemberConstraintsWithSpecialStatus01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_MemberConstraintsWithSpecialStatus01.fs index b043655991f..f7d318f1c25 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_MemberConstraintsWithSpecialStatus01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_MemberConstraintsWithSpecialStatus01.fs @@ -1,8 +1,8 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2890 //Member constraints with the name 'Pow' are given special status by the F# compiler as certain \.NET types are implicitly augmented with this member\. This may result in runtime failures if you attempt to invoke the member constraint from your own code\.$ module M -let inline trapPow (x: ^a) (y: ^a) : ^a = +let inline trapPow (x: ^a) (y: ^a) : ^a = (^a: (static member Pow : ^a * ^a -> ^a) (x,y)) (trapPow 1.1 2.2) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_MemberObjectctorTakeGiven.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_MemberObjectctorTakeGiven.fs index e94cdd80884..cce7b148ee0 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_MemberObjectctorTakeGiven.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_MemberObjectctorTakeGiven.fs @@ -1,9 +1,9 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1423 // // bad error message: The member or object constructor 'Random' takes 1 arguments but is here supplied with 1. // -// Now we should display: +// Now we should display: // The member or object constructor 'Random' takes 0 type argument(s) but is here given 1. The required signature is 'static member Variable.Random: y: Variable<'a> -> Variable<'a>'. E:\dd\fsharp_1\src\qa\md\src\fsh\Compiler\fsharp\Source\Conformance\DeclarationElements\ObjectConstructors\E-ImplicitExplicitCTors.fs // //The member or object constructor 'Random' takes 0 type argument\(s\) but is here given 1\. The required signature is 'static member Variable\.Random: y: Variable<'a> -> Variable<'a>' @@ -16,7 +16,7 @@ type Variable() = type Variable<'a>() = inherit Variable() static member Random(y:Variable<'a>) = new Variable<'a>() - + let x : Variable = failwith "" Variable.Random (x, Name = "m_") diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Multiline01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Multiline01.fs index 96106a8740c..984eb40016f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Multiline01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Multiline01.fs @@ -1,15 +1,15 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1269 // Make sure that error spans correctly across multiple lines //This expression was expected to have type -type Schedule = +type Schedule = | Seq of Schedule[] | Simple of (int -> int) - + let add n v = Simple (fun x -> x + n) - -let rec sched = + +let rec sched = Seq [ add 1 "v"; - Seq [ add 1 "u"; add 1 "t" ] + Seq [ add 1 "u"; add 1 "t" ] ] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Multiline03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Multiline03.fs index a7a5c035af5..84449d96d12 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Multiline03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Multiline03.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:5449 // Make sure that error spans correctly across multiple lines //This value is not a function and cannot be applied.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_NoPoundRDirectiveInFSFile01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_NoPoundRDirectiveInFSFile01.fs index 91a9ae713fb..0ec873fd13c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_NoPoundRDirectiveInFSFile01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_NoPoundRDirectiveInFSFile01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3203 //This directive may only be used in F# script files \(extensions \.fsx or \.fsscript\)\. module M diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ObjectConstructorAndTry01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ObjectConstructorAndTry01.fs index 9e23de30cc8..c29f5d863be 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ObjectConstructorAndTry01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ObjectConstructorAndTry01.fs @@ -1,10 +1,10 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1980 // type X = class - new (arg) = + new (arg) = for i in [1;2] do () X(1) - end + end diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ObjectConstructorAndTry02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ObjectConstructorAndTry02.fs index 395418b9df7..0aa58fa6c2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ObjectConstructorAndTry02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_ObjectConstructorAndTry02.fs @@ -1,11 +1,11 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1980 // type X = struct val f : decimal - new (arg) = + new (arg) = for i in [1;2] do () X(1) - end + end diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_PropertyIsNotReadable01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_PropertyIsNotReadable01.fs index e672267766f..71d2d361a85 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_PropertyIsNotReadable01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_PropertyIsNotReadable01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Property 'X' is not readable$ // See also FSHARP1.0:4963 ("property" should read "Property") module M diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Quotation_UnresolvedGenericConstruct01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Quotation_UnresolvedGenericConstruct01.fs index 1b2ae8383a4..4a8ce0bb955 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Quotation_UnresolvedGenericConstruct01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_Quotation_UnresolvedGenericConstruct01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1278 // Unresolved generic constructs in quotations should error instead of warn. //The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e\.g\. 'IB' and 'IA'\. Consider using type annotations to resolve the ambiguity @@ -7,8 +7,8 @@ type IA = abstract member Foo : unit -> unit type IB = abstract member Foo : unit -> unit -type T() = - member x.Foo(v:'t when 't :> IA and 't :> IB) : unit = +type T() = + member x.Foo(v:'t when 't :> IA and 't :> IB) : unit = failwith "!" -let x = <@@ T().Foo @@> +let x = <@@ T().Foo @@> diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_SpanExtendsToNextToken01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_SpanExtendsToNextToken01.fs index 28246eb1965..65ac4731a9b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_SpanExtendsToNextToken01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_SpanExtendsToNextToken01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics namespace N1 let x = 4444444 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_StructMustHaveAtLeastOneField.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_StructMustHaveAtLeastOneField.fs index 070367f5d01..ea91e247f30 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_StructMustHaveAtLeastOneField.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_StructMustHaveAtLeastOneField.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Somehow related to the fix for FSHARP1.0:3143: as a result, now struct may be empty diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_TryFinallyIncompleteStructuredConstruct.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_TryFinallyIncompleteStructuredConstruct.fs index 42f4dd0b7b6..ea79455e6c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_TryFinallyIncompleteStructuredConstruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_TryFinallyIncompleteStructuredConstruct.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2520 // The verification (to to speak) is to make sure we emit _at_least_ the error message ("missing qualification after '.') // Before the fix apparently, we were not emitting it. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedKeywordAs01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedKeywordAs01.fs index 9bb7ceb18d3..58d496a3a5d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedKeywordAs01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedKeywordAs01.fs @@ -1,18 +1,18 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1698 -// Make sure we don't emit the laconic "syntax error" message. +// Make sure we don't emit the laconic "syntax error" message. //Unexpected keyword 'as' in expression\. Expected '}' or other token //Unmatched '{' type Explicit = - inherit Base + inherit Base val y : int new(x) as self = let initialDummyCodeInConstructor = 3 { inherit Base(x) as base - y = x + y = x } then printfn "in the constructor" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedKeyworkWith01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedKeyworkWith01.fs index 8b858439663..99b32549e3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedKeyworkWith01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedKeyworkWith01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1872 //'with' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedSymbol01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedSymbol01.fs index cd83283d263..85599590b76 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedSymbol01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_UnexpectedSymbol01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2099 // Regression test for FSHARP1.0:2670 //Unexpected symbol '<-' in binding. Expected '=' or other token. @@ -10,14 +10,14 @@ open Microsoft.FSharp.Control let mutable sem = 0 -let counter = - MailboxProcessor.Start( fun inbox -> +let counter = + MailboxProcessor.Start( fun inbox -> let rec loop(n) = async { do printfn "n = %d, waiting..." n let! msg = inbox.Receive() if n+msg >= 500 then let sem <- 1 return! loop(n+msg) } loop(0)) - + for i = 0 to 500 do counter.Post(1) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_LetBinding01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_LetBinding01.fs index 86fd6bc7b85..436c3e45906 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_LetBinding01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_LetBinding01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3175 //The type 'matrix' is not defined in 'Microsoft.FSharp.Math'\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_class01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_class01.fs index 806c444041d..f1e045f60b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_class01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_class01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3175 //The type 'matrix' is not defined in 'Microsoft.FSharp.Math'\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_interface01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_interface01.fs index 59b2c81ed70..657dea66fc4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_interface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_interface01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3175 //The type 'matrix' is not defined in 'Microsoft.FSharp.Math'\.$ //The type 'matrix' is not defined in 'Microsoft.FSharp.Math'\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_struct01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_struct01.fs index b7b48288559..69a51d75588 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_struct01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/E_matrix_struct01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3175 //The type 'matrix' is not defined in 'Microsoft.FSharp.Math'\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/Generic_Subtype01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/Generic_Subtype01.fs index 1c6af333707..9ae6507d4a4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/Generic_Subtype01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/Generic_Subtype01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:4579 // The following code should not give any error/warning // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/MutatingImmutable01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/MutatingImmutable01.fs index 2995c3dc226..12e3899359d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/MutatingImmutable01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/MutatingImmutable01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:6135 //This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable m_cts = expression'. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/MutatingImmutable02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/MutatingImmutable02.fs index a3ca7dbcb5c..f0d20c1e62d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/MutatingImmutable02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/MutatingImmutable02.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:6135 //This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/TypecheckSignature01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/TypecheckSignature01.fs index c09be4da46b..1fb666884a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/TypecheckSignature01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/TypecheckSignature01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Negative test for signature errors // This test used to be part of the FSHARP suite (fsharp\typecheck\sigs\neg04.ml) @@ -14,6 +14,6 @@ module M type GrowingArray<'a> = System.Collections.Generic.List<'a> let nextPrime (sofar : GrowingArray) n = failwith "nyi" let primes = Seq.unfold - (fun (soFar,n) -> - let next = nextPrime soFar n in + (fun (soFar,n) -> + let next = nextPrime soFar n in Some(next, (soFar.Add(n), next+1))) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_CreateIDisposable.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_CreateIDisposable.fs index f37e3dd39d4..d479617c384 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_CreateIDisposable.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_CreateIDisposable.fs @@ -1,14 +1,14 @@ namespace Test open System.IO -type Foo = +type Foo = static member Bar() = use stream = File.OpenRead("foo") use readerGood = new StreamReader(stream) use readerBad1 = StreamReader(stream) - use readerBad2 = stream |> StreamReader - () - + use readerBad2 = stream |> StreamReader + () + //It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type\(args\)', rather than 'Type\(args\)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value //It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type\(args\)', rather than 'Type\(args\)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_FailwithRedundantArgs.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_FailwithRedundantArgs.fs index 22f2a29aa93..0a3a02cddae 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_FailwithRedundantArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_FailwithRedundantArgs.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Redundant arguments are being ignored in function 'failwith'\. Expected 1 but got 2 arguments\.$ module M let f() = failwith "Used" "Ignored" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_FailwithfRedundantArgs.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_FailwithfRedundantArgs.fs index 6a60486e5ab..b331c2ff72b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_FailwithfRedundantArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_FailwithfRedundantArgs.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Redundant arguments are being ignored in function 'failwithf'\. Expected 3 but got 4 arguments\.$ module M let f() = failwithf "Used %A %s" "this" "but not" "this" diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_GenericTypeProvideATypeInstantiation01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_GenericTypeProvideATypeInstantiation01.fs index 3bd3d79c61c..bcb83d20587 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_GenericTypeProvideATypeInstantiation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_GenericTypeProvideATypeInstantiation01.fs @@ -1,15 +1,15 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3229 //The instantiation of the generic type 'T' is missing and can't be inferred from the arguments or return type of this member\. Consider providing a type instantiation when accessing this type, e\.g\. 'T<_>' -type T<'a>() = +type T<'a>() = static member P = sizeof<'a> member x.M = T.P // warning: should have used T<'a>.P or T<_>.P, most likely! // Instead, the compiler thinks we meant T.P let v = (new T()).M -if v <> sizeof then +if v <> sizeof then exit 1 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_HashOfSealedType01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_HashOfSealedType01.fs index 50be4bc9cb9..d862691b51f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_HashOfSealedType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_HashOfSealedType01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Negative test for signature errors // This test used to be part of the FSHARP suite (fsharp\typecheck\sigs\neg06.ml) @@ -14,5 +14,5 @@ module M [] type SealedType() = member x.P = 1 // a sealed class - + let WarningOnHashOfSealedType (x: #SealedType) = x diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InstantiationOfGenericTypeMissing01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InstantiationOfGenericTypeMissing01.fs index 307fdcd2149..1ef6bb144fc 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InstantiationOfGenericTypeMissing01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InstantiationOfGenericTypeMissing01.fs @@ -1,10 +1,10 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3286 //The instantiation of the generic type 'C1' is missing and can't be inferred from the arguments or return type of this member\. Consider providing a type instantiation when accessing this type, e\.g\. 'C1<_>' //The instantiation of the generic type 'C2' is missing and can't be inferred from the arguments or return type of this member\. Consider providing a type instantiation when accessing this type, e\.g\. 'C2<_>' module M -type C1<'a>() = +type C1<'a>() = static member SizeOfA = sizeof<'a> // warning on use C.SizeOfA C1.SizeOfA |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InstantiationOfGenericTypeMissing02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InstantiationOfGenericTypeMissing02.fs index d65c5ad4470..7d2f40c4f01 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InstantiationOfGenericTypeMissing02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InstantiationOfGenericTypeMissing02.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3286 // module M diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InvalidArgRedundantArgs.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InvalidArgRedundantArgs.fs index be18dc99dd0..7cff9893d98 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InvalidArgRedundantArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InvalidArgRedundantArgs.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Redundant arguments are being ignored in function 'invalidArg'\. Expected 2 but got 3 arguments\.$ module M type T() = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InvalidOpRedundantArgs.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InvalidOpRedundantArgs.fs index 8e9bcc705d7..b1382d79d74 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InvalidOpRedundantArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_InvalidOpRedundantArgs.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Redundant arguments are being ignored in function 'invalidOp'\. Expected 1 but got 2 arguments\.$ namespace M0 module M1 = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_Keyword_tailcall01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_Keyword_tailcall01.fs index dc4ca1a466b..1ef668b4db1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_Keyword_tailcall01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_Keyword_tailcall01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2204 //\(13,11-13,19\).+warning FS0046: The keyword 'tailcall' is reserved for future use by F# //\(14,12-14,20\).+warning FS0046: The keyword 'tailcall' is reserved for future use by F# @@ -12,7 +12,7 @@ namespace tailcall - module tailcall = + module tailcall = type tailcall = | tailcall = 1 | tailcall_b = 2 let tailcall = tailcall.tailcall diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_LowercaseLiteralIgnored.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_LowercaseLiteralIgnored.fs index 6959ae44400..c13369885bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_LowercaseLiteralIgnored.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_LowercaseLiteralIgnored.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Lowercase literal 'lowerCase' is being shadowed by a new pattern with the same name\. Only uppercase and module-prefixed literals can be used as named patterns\.$ module M diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_LowercaseLiteralNotIgnored.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_LowercaseLiteralNotIgnored.fs index 6e45e9cff04..209d4f6f977 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_LowercaseLiteralNotIgnored.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_LowercaseLiteralNotIgnored.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //This rule will never be matched$ module M0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_Multiline02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_Multiline02.fs index 9905cd93d87..3db1c029ce9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_Multiline02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_Multiline02.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3596 // Make sure that error spans correctly across multiple lines //The result of this expression has type 'int' and is implicitly ignored diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_NoValueHasBeenCopiedWarning.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_NoValueHasBeenCopiedWarning.fs index 61315afcef0..2b70e6b2597 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_NoValueHasBeenCopiedWarning.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_NoValueHasBeenCopiedWarning.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:5259 // Make sure we do not emit an error on "e" // Instead we warn on 'TException @@ -10,8 +10,8 @@ let main(_) = try () - with - | :? 'TException as e -> + with + | :? 'TException as e -> let msg = e.ToString() () 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_NullArgRedundantArgs.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_NullArgRedundantArgs.fs index 6e121c4c31d..83099fc6dc7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_NullArgRedundantArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_NullArgRedundantArgs.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Redundant arguments are being ignored in function 'nullArg'\. Expected 1 but got 2 arguments\.$ namespace M0 module M1 = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation01a.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation01a.fs index 33e5b44c691..510ced3da48 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation01a.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation01a.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1273 // Give warning on use of interface and/or override implementations in augmentations // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation02b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation02b.fs index c2de0d1374a..536387625da 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation02b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1273 // Give warning on use of interface and/or override implementations in augmentations // @@ -10,5 +10,5 @@ type T2 = class //default a.M = 3 end type T2 with - default x.M = 0.0 // warning + error + default x.M = 0.0 // warning + error end diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation03a.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation03a.fs index ca6ad146d7e..74dd3bc7a82 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation03a.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation03a.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1273 // Give warning on use of interface and/or override implementations in augmentations // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation03b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation03b.fs index 8d07cd73fef..2c780cbc268 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation03b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_OverrideImplementationInAugmentation03b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:1273 // Give warning on use of interface and/or override implementations in augmentations // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_RaiseRedundantArgs.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_RaiseRedundantArgs.fs index 1c9abc9b4a8..5a9cb704771 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_RaiseRedundantArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_RaiseRedundantArgs.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Redundant arguments are being ignored in function 'raise'\. Expected 1 but got 2 arguments\.$ module M type T() = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator01.fs index fe3c870f1b2..0ba427b8ed4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3292 // Give a warning when the user attempts to redefine "=", "<", ">", ">=", "<=" or "<>" or define static members with these names //The '<' operator should not normally be redefined\. To define overloaded comparison semantics for a particular type, implement the 'System.IComparable' interface in the definition of that type\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator02.fs index cb36d371727..02bd648c591 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator02.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3292 // Give a warning when the user attempts to redefine "=", "<", ">", ">=", "<=" or "<>" or define static members with these names //The '>' operator should not normally be redefined\. To define overloaded comparison semantics for a particular type, implement the 'System.IComparable' interface in the definition of that type\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator03.fs index 8c74f6ee385..cc25a291c7f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator03.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3292 // Give a warning when the user attempts to redefine "=", "<", ">", ">=", "<=" or "<>" or define static members with these names //The '<=' operator should not normally be redefined\. To define overloaded comparison semantics for a particular type, implement the 'System.IComparable' interface in the definition of that type\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator04.fs index 87805359ef0..15bd5a7343f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator04.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3292 // Give a warning when the user attempts to redefine "=", "<", ">", ">=", "<=" or "<>" or define static members with these names //The '>=' operator should not normally be redefined\. To define overloaded comparison semantics for a particular type, implement the 'System.IComparable' interface in the definition of that type\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator05.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator05.fs index e69637ed822..2616ab8fc69 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator05.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator05.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3292 // Give a warning when the user attempts to redefine "=", "<", ">", ">=", "<=" or "<>" or define static members with these names //The '<>' operator should not normally be redefined\. To define equality semantics for a type, override the 'Object.Equals' member in the definition of that type\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator06.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator06.fs index 36f0788cac4..fab4627451b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator06.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator06.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3292 // Give a warning when the user attempts to redefine "=", "<", ">", ">=", "<=" or "<>" or define static members with these names //The '=' operator should not normally be redefined\. To define equality semantics for a type, override the 'Object.Equals' member in the definition of that type\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator08.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator08.fs index dd9611fb71e..aeb3b33d03f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator08.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator08.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3292 // Give a warning when the user attempts to redefine "=", "<", ">", ">=", "<=" or "<>" or define static members with these names //The '&&' operator should not normally be redefined\. Consider using a different operator name diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator10.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator10.fs index 511916e2a38..1cfc4ed9e0a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator10.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/General/W_redefineOperator10.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:3292 // Give a warning when the user attempts to redefine "=", "<", ">", ">=", "<=" or "<>" or define static members with these names //The '||' operator should not normally be redefined\. Consider using a different operator name\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/attrUnionCaseDecl01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/attrUnionCaseDecl01.fs index a64dd460bc2..461d0cbb659 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/attrUnionCaseDecl01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/attrUnionCaseDecl01.fs @@ -1,14 +1,14 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:3702 //Incomplete structured construct at or before this point in union case - + type Stuff = | AnonymousVariableType of string | TypeVariable of string | StaticHeadTypeTypeVariable of string - | - type Typar () = - member x.Random () = match rnd.Next( 3 ) with + | + type Typar () = + member x.Random () = match rnd.Next( 3 ) with | 0 -> AnonymousVariableType("_") | 1 -> TypeVariable("'" + Ident.Random()) | _ -> StaticHeadTypeTypeVariable("^" + Ident.Random()) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs index f178da2622c..31635ee7b34 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs @@ -1,16 +1,16 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:3702 //NONTERM //Incomplete structured construct at or before this point in union case - + type Stuff = | AnonymousVariableType of string | TypeVariable of string | StaticHeadTypeTypeVariable of string - | - type Typar () = - member x.Random () = match rnd.Next( 3 ) with + | + type Typar () = + member x.Random () = match rnd.Next( 3 ) with | 0 -> AnonymousVariableType("_") | 1 -> TypeVariable("'" + Ident.Random()) | _ -> StaticHeadTypeTypeVariable("^" + Ident.Random()) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/braceExpr01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/braceExpr01.fs index 5b02c28ae5b..ab8ea81318e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/braceExpr01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/braceExpr01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2369 //Unexpected symbol '<' in expression$ //Unmatched '{' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/braceExpr01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/braceExpr01b.fs index 6c016a87f7f..2b4b4856331 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/braceExpr01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/braceExpr01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2369 //NONTERM //Unexpected symbol '<' in expression\. Expected '}' or other token\. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl01.fs index 0af7f23be63..0655e9c8cb5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl01.fs @@ -1,8 +1,8 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2219 //'val' -[] +[] val inline sizeof<'a> : int diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl01b.fs index a9fb1c5dd80..038c578dba6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl01b.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2219 //NONTERM //Unexpected keyword 'val' in definition -[] +[] val inline sizeof<'a> : int diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl03.fs index 60c5736d092..53ee6f14ad7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl03.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #ReqNOMT +// #Regression #Diagnostics #ReqNOMT // Regression test for FSHARP1.0:2681 // To repro: fsi.exe < foo.fs, otherwise it won't repro! // This test used to emit an error, now (after fix for 2193, it works fine) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl03b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl03b.fs index ea3b05a44ae..7cb2ce9d898 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl03b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl03b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #ReqNOMT +// #Regression #Diagnostics #ReqNOMT // Regression test for FSHARP1.0:2681 //NONTERM //val it: char = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl04.fs index eec4866574f..60b377db4ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/fileModuleImpl04.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #ReqNOMT +// #Regression #Diagnostics #ReqNOMT // Regression test for FSHARP1.0:2681 // To repro: fsi.exe < foo.fs, otherwise it won't repro! //This Unicode encoding is only valid in string literals diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator01.fs index 2d99ef3b6ba..0caa25f173b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2124 //';;' //'\[' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator01b.fs index c68c6b60c4f..d328840e237 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2124 //NONTERM //Unexpected symbol ';;' in expression\. Expected '\]' or other token\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator02.fs index 2bc8dcc554d..5ac891864f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator02.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2124 //','.+'->' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator02b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator02b.fs index a68c24f01b8..8485329d2ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator02b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2124 //NONTERM //Unexpected symbol ',' in lambda expression. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator05.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator05.fs index aa6ccbefb1c..e39465e6930 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator05.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator05.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2124 //':' diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator05b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator05b.fs index e7aa4511525..5dfa27439f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator05b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator05b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2124 //NONTERM //Unexpected symbol '.' in implementation file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator06.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator06.fs index 70e492ad339..cec25a5b912 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator06.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator06.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:4245 // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator06b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator06b.fs index 4046e284f40..06f10261d80 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator06b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/interactiveExprOrDefinitionsTerminator06b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:4245 //NONTERM //Unexpected character '.' in implementation file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/memberDefinitionWithoutType01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/memberDefinitionWithoutType01.fs index a6da770c835..9daace7eafe 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/memberDefinitionWithoutType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/memberDefinitionWithoutType01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:4245 //Unexpected keyword 'member' in implementation file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/memberDefinitionWithoutType01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/memberDefinitionWithoutType01b.fs index 39cfda78348..d224f023016 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/memberDefinitionWithoutType01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/memberDefinitionWithoutType01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:4245 //NONTERM //Unexpected keyword 'member' in implementation file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicExprNonEmptyInitial01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicExprNonEmptyInitial01.fs index 01b22d84e67..ba7471771f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicExprNonEmptyInitial01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicExprNonEmptyInitial01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2104 //Unmatched '\{'$ @@ -13,8 +13,8 @@ open Microsoft.FSharp.Control -let counter = - MailboxProcessor.Start( fun inbox -> +let counter = + MailboxProcessor.Start( fun inbox -> let rec loop(n) = async { do printfn "n = %d, waiting..." n let! msg = inbox.Receive() diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicExprNonEmptyInitial01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicExprNonEmptyInitial01b.fs index 2d7adfc4d5d..a838cdc05d2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicExprNonEmptyInitial01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicExprNonEmptyInitial01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2104 //NONTERM //Unexpected end of input$ @@ -6,8 +6,8 @@ open Microsoft.FSharp.Control -let counter = - MailboxProcessor.Start( fun inbox -> +let counter = + MailboxProcessor.Start( fun inbox -> let rec loop(n) = async { do printfn "n = %d, waiting..." n let! msg = inbox.Receive() diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicPatternClauses01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicPatternClauses01.fs index b1a00f7b467..6becc809ccc 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicPatternClauses01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicPatternClauses01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2106 // @@ -6,14 +6,14 @@ open Microsoft.FSharp.Control -type internal msg = +type internal msg = | Increment of int | Fetch of IChannel | Stop - -type CountingAgent() = - let counter = - MailboxProcessor.Start( fun inbox -> + +type CountingAgent() = + let counter = + MailboxProcessor.Start( fun inbox -> let rec loop(n) = async { let! msg = inbox.Receive() match msg with diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicPatternClauses01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicPatternClauses01b.fs index 45593bb9f36..325bd5ae6b8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicPatternClauses01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/monadicPatternClauses01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2106 //NONTERM // @@ -7,14 +7,14 @@ open Microsoft.FSharp.Control -type internal msg = +type internal msg = | Increment of int | Fetch of IChannel | Stop - -type CountingAgent() = - let counter = - MailboxProcessor.Start( fun inbox -> + +type CountingAgent() = + let counter = + MailboxProcessor.Start( fun inbox -> let rec loop(n) = async { let! msg = inbox.Receive() match msg with diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/quoteExpr01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/quoteExpr01.fs index 9661e19c070..3494ff295eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/quoteExpr01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/quoteExpr01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2391, FSHARP1.0:1479 //The result of this expression has type 'Quotations.Var seq' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/quoteExpr01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/quoteExpr01b.fs index 32a0fe1d399..baafc47df6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/quoteExpr01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/quoteExpr01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2391, FSHARP1.0:1479 //NONTERM // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/tuplewithlazy01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/tuplewithlazy01.fs index cfbd4185bd4..d94abcf8df5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/tuplewithlazy01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/tuplewithlazy01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for DevDiv:64339 // Note that the bug still repros in CHK/DBG bits - we will knownfail it //Unexpected keyword 'lazy' in pattern$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/tuplewithlazy01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/tuplewithlazy01b.fs index cfbd4185bd4..d94abcf8df5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/tuplewithlazy01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/tuplewithlazy01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for DevDiv:64339 // Note that the bug still repros in CHK/DBG bits - we will knownfail it //Unexpected keyword 'lazy' in pattern$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typ01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typ01.fs index 01a8b72c045..9b731c0c57b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typ01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typ01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2467 //Expecting type diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typ01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typ01b.fs index c9a8124243b..3b68d2ba982 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typ01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typ01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2467 //NONTERM //Expecting type diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typeConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typeConstraint01.fs index c37d3f93fa4..02ea8f61206 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typeConstraint01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typeConstraint01.fs @@ -1,8 +1,8 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2648 //Unexpected end of input in type name\. Expected '>' or other token -type MonadMaker<'m, +type MonadMaker<'m, ^a when ^a : (new : unit -> ^a) and ^a : (static member Zero : unit -> 'm<'b>) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typeConstraint01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typeConstraint01b.fs index 61d4256e195..58f34d4bcf2 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typeConstraint01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typeConstraint01b.fs @@ -1,10 +1,10 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:2648 //NONTERM // -type MonadMaker<'m, +type MonadMaker<'m, ^a when ^a : (new : unit -> ^a) and ^a : (static member Zero : unit -> 'm<'b>) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock01.fs index 97be20d2de7..3f9074d8793 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2237 //Expecting expression diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock01b.fs index bfd910c9e3e..110ca2fd90c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock01b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2237 //NONTERM // diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock02.fs index cac4f6e0b77..66784854c85 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock02.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2237 //Expecting expression diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock02b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock02b.fs index 46f483d1f78..a56b785c3ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/NONTERM/typedSeqExprBlock02b.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSharp1.0:2237 //NONTERM //Expecting expression diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/for_in01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/for_in01.fs index f0ea2627f2a..8e1e0a98615 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/for_in01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/for_in01.fs @@ -1,5 +1,5 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics // Regression test for FSHARP1.0:5183 //Missing 'do' in 'for' expression\. Expected 'for in do '\.$ //Expected an expression after this point$ -for x in \ No newline at end of file +for x in \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/for_in_range01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/for_in_range01.fs index cdafcdcef18..eacb0fda7dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/for_in_range01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/for_in_range01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Missing 'do' in 'for' expression\. Expected 'for in do '\.$ for x in 3..4 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/if01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/if01.fs index e9a24ddc8fb..e81cc785ba3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/if01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/if01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Incomplete conditional\. Expected 'if then ' or 'if then else '\.$ if \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/match01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/match01.fs index 7763daea090..678386a399e 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/match01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/match01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Unexpected end of input in 'match' expression\. Expected 'match with | -> | -> \.\.\.'\.$ match 3 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/try01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/try01.fs index 561a747c50e..8d0087c4495 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/try01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/try01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Unexpected end of input in 'try' expression\. Expected 'try with ' or 'try finally '\.$ try 3 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/type_id_equal_curly01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/type_id_equal_curly01.fs index 34989bc23ef..86d7a0affd3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/type_id_equal_curly01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/type_id_equal_curly01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Unmatched '{'$ //Incomplete structured construct at or before this point in type definition\. Expected '}' or other token\.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/while_cond01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/while_cond01.fs index 49cf07ef2d0..cee219cfcb1 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/while_cond01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/ParsingAtEOF/while_cond01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics +// #Regression #Diagnostics //Missing 'do' in 'while' expression\. Expected 'while do '\.$ -while true +while true diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/LetBangNonAsync.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/LetBangNonAsync.fs index 61977d09ccb..39ebfa7d119 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/LetBangNonAsync.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/LetBangNonAsync.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //This expression was expected to have type. 'Async<'a>' .but here has type. 'int' async { let! x = 1 in return 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingBangForLoop01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingBangForLoop01.fs index 4a76753f582..3f67e005f4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingBangForLoop01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingBangForLoop01.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the ! for a loop //Type mismatch\. Expecting a.+''a'.+but given a.+'Async<'a>'.*The types ''a' and 'Async<'a>' cannot be unified. -let rec loop() = async { let x = 1 - return loop() +let rec loop() = async { let x = 1 + return loop() } diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingBangForLoop02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingBangForLoop02.fs index ad5f28403ea..49e183cd346 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingBangForLoop02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingBangForLoop02.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the ! for a loop // Note: Desugared form of MissingBangForLoop01.fs //Type mismatch\. Expecting a. ''a' .but given a. 'Async<'a>' .The types ''a' and 'Async<'a>' cannot be unified. -let rec loop2() = async.Delay(fun () -> async.Return(loop2())) +let rec loop2() = async.Delay(fun () -> async.Return(loop2())) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingIgnore.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingIgnore.fs index 85381cea43e..6c7c92ba3cb 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingIgnore.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingIgnore.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //The result of this expression has type 'int' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ async { 1; diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop01.fs index 22ebb43bd2a..dac78d6dcd6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the return! For a loop //The result of this expression has type 'Async<'a>' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop02.fs index a7c5b2b1468..de4a89ba1f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop02.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the return! For a loop //The result of this expression has type 'Async<'a>' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop03.fs index 277028e9bbf..8e805c7d880 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop03.fs @@ -1,6 +1,6 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the return! For a loop //The result of this expression has type 'Async<'a>' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ //This expression was expected to have type. 'Async<'a>' .but here has type. 'unit' -let rec loop2() = async.Delay(fun () -> loop2(); ()); +let rec loop2() = async.Delay(fun () -> loop2(); ()); diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop04.fs index 761020c2ec1..2f1782e0ef9 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/MissingReturnBangForLoop04.fs @@ -1,8 +1,8 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the return! For a loop //The result of this expression has type 'Async<'a>' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ //This expression was expected to have type. 'Async<'a>' .but here has type. 'unit' // Note: interestingly, this looks much better if a method call is not used let delay x = async.Delay x -let rec loop3() = delay(fun () -> loop3(); ()); +let rec loop3() = delay(fun () -> loop3(); ()); diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync01.fs index 6abb635fd0d..43f6bf9c49b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //This expression was expected to have type. 'Async<'a>' .but here has type. 'int' async { return! 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync02.fs index 1c16b389e2e..6b27825a244 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync02.fs @@ -1,5 +1,5 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //This expression was expected to have type. 'Async<'a>' .but here has type. 'int' -async { let x = 1 +async { let x = 1 return! 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_For.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_For.fs index 04307c671ec..a74a11379d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_For.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_For.fs @@ -1,5 +1,5 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //This expression was expected to have type. 'unit' .but here has type. 'int' -async { for x in [1;2] do +async { for x in [1;2] do return 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_IfThenElse.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_IfThenElse.fs index ecc1175241d..d6146a85750 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_IfThenElse.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_IfThenElse.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //All branches of an 'if' expression must return values implicitly convertible to the type of the first branch -async { if true then +async { if true then return () else return 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_TryFinally.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_TryFinally.fs index c3e5c3541bc..75a8d55b10f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_TryFinally.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_TryFinally.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //This expression was expected to have type. 'unit' .but here has type. 'int' -async { try +async { try return 1 finally 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_TryWith.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_TryWith.fs index 29c6d8729b0..f9cc7089a49 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_TryWith.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_TryWith.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //This expression was expected to have type. 'int' .but here has type. 'unit' -async { try +async { try return 1 - with _ -> + with _ -> return () } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_While.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_While.fs index 8cdda726f3e..af680642a36 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_While.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/ReturnBangNonAsync_While.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 //This expression was expected to have type. 'Async' .but here has type. 'int' -async { while true do - let x = 1 +async { while true do + let x = 1 return! 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UseBindingWrongForm01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UseBindingWrongForm01.fs index 5ee63e5cbd1..7e569a5c533 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UseBindingWrongForm01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UseBindingWrongForm01.fs @@ -1,4 +1,4 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for DEV10:916135 //The type 'int \[\]' is not compatible with the type 'System\.IDisposable'$ //The type 'int \[\]' is not compatible with the type 'System\.IDisposable'$ @@ -6,11 +6,11 @@ let ax = async { use! r1 = Async.Parallel [| async.Return(1); async.Return(2) |] - let y = 4 - return r1 - } + let y = 4 + return r1 + } -let a = async { +let a = async { use! [| r1; r2 |] = Async.Parallel [| async.Return(1); async.Return(2) |] let y = 4 return r1,r2 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UsingReturnInAWhileLoop.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UsingReturnInAWhileLoop.fs index 5b69d8c6d49..b7bf1689d6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UsingReturnInAWhileLoop.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UsingReturnInAWhileLoop.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // less common mistake: using "return" in a while loop //This expression was expected to have type. 'unit' .but here has type. 'int' -async { while true do +async { while true do return 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UsingReturnInIfThenElse.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UsingReturnInIfThenElse.fs index 52a2932b003..968a610add3 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UsingReturnInIfThenElse.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Diagnostics/async/UsingReturnInIfThenElse.fs @@ -1,7 +1,7 @@ -// #Regression #Diagnostics #Async +// #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // less common mistake: using "return" in an if/then/else //Type mismatch\. Expecting a. 'Async' .but given a. 'Async' .The type 'int' does not match the type 'unit'$ // -async { if true then +async { if true then return 1 } |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/Array2D01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/Array2D01.fs index 79a19c639e2..9a64aed8a0a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/Array2D01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/Array2D01.fs @@ -12,9 +12,9 @@ type Matrix<'T> internal (ops: IOps<'T>, arr: 'T[,]) = member internal x.Data = arr;; type Matrix = - /// A function to capture operations - static member inline private captureOps() = - { new IOps<_> with + /// A function to capture operations + static member inline private captureOps() = + { new IOps<_> with member x.Add(a,b) = a + b member x.Zero = LanguagePrimitives.GenericZero<_> } diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/BailAfterFirstError01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/BailAfterFirstError01.fs index 209573f12df..3fd965f667b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/BailAfterFirstError01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/BailAfterFirstError01.fs @@ -1,4 +1,4 @@ -// #NoMT #FSI +// #NoMT #FSI // Verify FSI bails after the first error it finds let x = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs01.fs index 99411073314..39077666ed4 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSHARP1.0:2439 // fsi.CommandLineArgs // scenario: no arguments diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs01b.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs01b.fs index e0ce34c0335..2e85144a153 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs01b.fs @@ -1,11 +1,11 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSHARP1.0:2439 // fsi.CommandLineArgs // scenario: no arguments - first arg (index 0) is fsi.exe / fsiAnyCPU.exe let x = System.IO.Path.GetFileName(fsi.CommandLineArgs.[0]) -let y1 = compare "fsi.exe" (x.ToLower()) // we accept both fsi.exe and fsi +let y1 = compare "fsi.exe" (x.ToLower()) // we accept both fsi.exe and fsi let y2 = compare "fsi" (x.ToLower()) -let y1' = compare "fsianycpu.exe" (x.ToLower()) // we accept both fsiAnyCPU.exe and fsiAnyCPU +let y1' = compare "fsianycpu.exe" (x.ToLower()) // we accept both fsiAnyCPU.exe and fsiAnyCPU let y2' = compare "fsianycpu" (x.ToLower()) if y1<>0 && y2<>0 && y1'<>0 && y2'<>0 then exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs02.fs index 11071010a88..2949668929c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/CommandLineArgs02.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSHARP1.0:2439 // fsi.CommandLineArgs // scenario: one argument diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DefinesCompiled.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DefinesCompiled.fs index c31af3411f2..6b04e119489 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DefinesCompiled.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DefinesCompiled.fs @@ -1,9 +1,9 @@ -// #NoMT #FSI +// #NoMT #FSI // Verify COMPILED is defined for all compiled .fs files -let test1 = +let test1 = #if COMPILED 1 #else @@ -11,7 +11,7 @@ let test1 = #endif // INTERACTIVE should NOT be defined -let test2 = +let test2 = #if INTERACTIVE 0 #else diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DefinesInteractive.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DefinesInteractive.fs index 50024bcdfb2..d60d5abb499 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DefinesInteractive.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DefinesInteractive.fs @@ -1,9 +1,9 @@ -// #NoMT #FSI +// #NoMT #FSI // Verify INTERACTIVE is defined for all fsi sessions -let test1 = +let test1 = #if INTERACTIVE 1 #else @@ -11,7 +11,7 @@ let test1 = #endif // COMPILED should NOT be defined -let test2 = +let test2 = #if COMPILED 0 #else diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DoWithNotUnit.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DoWithNotUnit.fs index de24b107af7..e3e21199532 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DoWithNotUnit.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/DoWithNotUnit.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSHARP1.0:3628 - "do 1" expression code gen error, unverifiable code diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/E_ErrorRanges01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/E_ErrorRanges01.fs index 85bca0aa954..e894667d9b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/E_ErrorRanges01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/E_ErrorRanges01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSharp1.0:2815 - fsi.exe underlines one too many characters for error spans (off by 1 error) //Incomplete pattern matches on this expression. diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/NativeIntSuffix01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/NativeIntSuffix01.fs index 21c0a233b2b..a20926bacfe 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/NativeIntSuffix01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/NativeIntSuffix01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSHARP1.0:4118 // FSI: PrettyPrinting of nativeint or unativeint does not emit the suffix (n or un, respectively) //val it: nativeint = 2n diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/PipingWithDirectives.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/PipingWithDirectives.fs index 3087e35a3fb..0f55da3f2a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/PipingWithDirectives.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/PipingWithDirectives.fs @@ -1,10 +1,10 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSHARP1.0:1564 - Parsing difference in FSI between redirection and loading with #directives let failures = ref false -let report_failure () = +let report_failure () = printfn " NO"; failures.contents <- true let test s b = printfn s; if b then printfn " OK" else report_failure() @@ -14,7 +14,7 @@ let test s b = printfn s; if b then printfn " OK" else report_failure() #types #r "System.Windows.Forms.dll" -let test2 x = +let test2 x = match x with | 1 -> true diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/Regressions02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/Regressions02.fs index ec7a27db2f5..3451fe3c214 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/Regressions02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/Regressions02.fs @@ -1,14 +1,14 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression for FSB 3739 // ICE in fsi with interface constraint on type generic parameter (for interface defined in the same interaction) [was: ICE when feeding code to fsi.exe] -type IA = +type IA = abstract AbstractMember : int -> int -type IB = +type IB = abstract AbstractMember : int -> int -type C<'a when 'a :> IB>() = +type C<'a when 'a :> IB>() = static member StaticMember(x:'a) = x.AbstractMember(1) ;; @@ -23,4 +23,4 @@ if C.StaticMember( new Tester() ) <> -1 then exit 0;; - + diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/UNativeIntSuffix01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/UNativeIntSuffix01.fs index a3e991331c5..d5e9e10a97d 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/UNativeIntSuffix01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/InteractiveSession/Misc/UNativeIntSuffix01.fs @@ -1,4 +1,4 @@ -// #Regression #NoMT #FSI +// #Regression #NoMT #FSI // Regression test for FSHARP1.0:4118 // FSI: PrettyPrinting of nativeint or unativeint does not emit the suffix (n or un, respectively) //val it: unativeint = 2un diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Libraries/Core/NativeInterop/stackalloc/negativesize01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Libraries/Core/NativeInterop/stackalloc/negativesize01.fs index 244ed561fa6..acf60fb1c50 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Libraries/Core/NativeInterop/stackalloc/negativesize01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Libraries/Core/NativeInterop/stackalloc/negativesize01.fs @@ -1,10 +1,10 @@ -// #Libraries #Stackalloc +// #Libraries #Stackalloc #nowarn "9" module M5 = // Regression test for FSHARP1.0: // stackalloc -1 // - + // This rightly causes a stack overflow exception (is interpreted as a unsigned int) let w = try let _ = NativeInterop.NativePtr.stackalloc -1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/ConstraintSolverRecursion01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/ConstraintSolverRecursion01.fs index 5cf940edb19..f92306c0e1a 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/ConstraintSolverRecursion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/ConstraintSolverRecursion01.fs @@ -5,11 +5,11 @@ module Monad open System -open Microsoft.FSharp.Reflection +open Microsoft.FSharp.Reflection type ITypeCons<'tag,'a> = interface end -type IMonad<'tag, 'a when 'tag :> ICMonad<'tag> and 'tag: (new: unit -> 'tag)> = +type IMonad<'tag, 'a when 'tag :> ICMonad<'tag> and 'tag: (new: unit -> 'tag)> = inherit ITypeCons<'tag,'a> and ICMonad<'tag when 'tag :> ICMonad<'tag> and 'tag: (new: unit -> 'tag)> = @@ -63,7 +63,7 @@ type abstract mappend: 'a -> 'a -> 'a abstract mconcat: seq<'a> -> 'a default me.mconcat xs = - xs |> Seq.cast |> Seq.fold me.mappend me.mempty + xs |> Seq.cast |> Seq.fold me.mappend me.mempty [] type CMonadReader<'r,'m when 'm :> ICMonad<'m> and 'm: (new: unit -> 'm)>() = @@ -98,7 +98,7 @@ type CMonadWriter<'w,'m when 'm :> ICMonad<'m> and 'w :> System.Collections.IEnu [] type CMonadState<'s,'m when 'm :> ICMonad<'m> and 'm: (new: unit -> 'm)>() = inherit MonadBase<'m>() - + abstract get: IMonad<'m,'s> abstract put: 's -> IMonad<'m, unit> @@ -116,13 +116,13 @@ type Result<'a> = Error of Exception | Success of 'a with override me.ToString() = match me with - | Error e -> + | Error e -> let et = e.GetType() if FSharpType.IsExceptionRepresentation(et) then sprintf "%A" e else sprintf "%s %A" et.Name e.Message - | Success x -> + | Success x -> sprintf "Success %A" x type ErrorT<'m when 'm :> ICMonad<'m> and 'm: (new: unit -> 'm)>() = @@ -152,7 +152,7 @@ type ErrorT<'m when 'm :> ICMonad<'m> and 'm: (new: unit -> 'm)>() = let binder = M { let! a = unwrap m match a with - | Error e -> + | Error e -> return Error e | Success x -> return! unwrap (f x) @@ -211,4 +211,4 @@ type ErrorT<'m when 'm :> ICMonad<'m> and 'm: (new: unit -> 'm)>() = and ErrorT<'m,'a when 'm :> ICMonad<'m> and 'm: (new: unit -> 'm)>(value: IMonad<'m, Result<'a>>) = member me.Value: IMonad<'m, Result<'a>> = value interface IMonad,'a> - + diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_CompiledName.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_CompiledName.fs index 437032e0112..16c34ad5808 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_CompiledName.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_CompiledName.fs @@ -1,30 +1,30 @@ // #Regression #Misc -// Regression test for FSHARP1.0:5936 +// 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\.$ module M -type T() = +type T() = let mutable bval = "Boo!" - + [] static member p = 1 - + [] static member m() = 1 - + [] member this.ip = 1 - + [] member this.im() = 1 - + // The additional applications of CompiledName to the getters and setters won't work // since CompiledName has already been applied to the property // CompiledName can be applied to the getter, setter or property - it will rename the // property itself - you can only use it once [] - member this.b + member this.b with [] get() = bval and [] set(v) = bval <- v diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage01.fs index 7d86c46977c..c10cec44a56 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage01.fs @@ -1,15 +1,15 @@ -// #Regression #Misc -// 390 atomicPatterns -> atomicPattern HIGH_PRECEDENCE_APP atomicPatterns +// #Regression #Misc +// 390 atomicPatterns -> atomicPattern HIGH_PRECEDENCE_APP atomicPatterns // Note, need a test case to check an error is raised here: //Successive patterns should be separated by spaces or tupled let (|C|_|) x inp = inp -let q x = +let q x = match 3 with | C x(3) -> "" | _ -> "" - + // Testcase should have build error exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage02.fs index 4984126166c..51cb66bcb93 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage02.fs @@ -1,9 +1,9 @@ -// #Regression #Misc -// Error +// #Regression #Misc +// Error //This runtime coercion or type test from type 'a to System.Exception involves an indeterminate type. Runtime type tests are not allowed on some types. Further type annotations are needed. //This runtime coercion or type test from type -//383 conjPatternElements -> headBindingPattern AMP headBindingPattern +//383 conjPatternElements -> headBindingPattern AMP headBindingPattern let :? System.Exception = box(3) diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage03.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage03.fs index ed3d535fee2..b1dfb24a3f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage03.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage03.fs @@ -1,4 +1,4 @@ -// #Regression #Misc +// #Regression #Misc // This construct is deprecated\: The treatment of this operator is now handled directly by the F# compiler and its meaning cannot be redefined // This construct is deprecated\: The treatment of this operator is now handled directly by the F# compiler and its meaning cannot be redefined // This construct is deprecated\: The treatment of this operator is now handled directly by the F# compiler and its meaning cannot be redefined @@ -8,15 +8,15 @@ module TestModule -//794 operatorName -> DOT LBRACK COMMA RBRACK +//794 operatorName -> DOT LBRACK COMMA RBRACK let (.[,]) v1 v2 = v1 + v2 -//795 operatorName -> DOT LBRACK COMMA COMMA RBRACK +//795 operatorName -> DOT LBRACK COMMA COMMA RBRACK let (.[,,]) v1 v2 = v1 + v2 -//797 operatorName -> DOT LBRACK COMMA RBRACK LARROW +//797 operatorName -> DOT LBRACK COMMA RBRACK LARROW let (.[,]<-) v1 v2 = v1 + v2 -//798 operatorName -> DOT LBRACK COMMA COMMA RBRACK LARROW +//798 operatorName -> DOT LBRACK COMMA COMMA RBRACK LARROW let (.[,,]<-) v1 v2 = v1 + v2 -//799 operatorName -> DOT LBRACK DOT_DOT RBRACK +//799 operatorName -> DOT LBRACK DOT_DOT RBRACK let (.[..]) v1 v2 = v1 + v2 -//800 operatorName -> DOT LBRACK DOT_DOT COMMA DOT_DOT RBRACK +//800 operatorName -> DOT LBRACK DOT_DOT COMMA DOT_DOT RBRACK let (.[..,..]) v1 v2 = v1 + v2 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage04.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage04.fs index b6d4ec04f99..56a80fb9417 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage04.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/E_productioncoverage04.fs @@ -1,11 +1,11 @@ -// #Regression #Misc +// #Regression #Misc // This used to be a warning, now it's an error //A parameter with attributes must also be given a name, e\.g\. '\[\] Name : Type'$ -type Doc() = +type Doc() = inherit System.Attribute() -type IFoo = +type IFoo = interface abstract Method1 : [] int * [] unit -> unit abstract Method2 : [] p1:int * [] p2:unit -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/FileWithSameNameDiffExt.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/FileWithSameNameDiffExt.fs index 42f11c37fa0..ec9794b92c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/FileWithSameNameDiffExt.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/FileWithSameNameDiffExt.fs @@ -1,4 +1,4 @@ -// #Regression #Misc +// #Regression #Misc // Regression test for FSHARP1.0:5268 namespace N module M = diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/Parsing01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/Parsing01.fs index d1b11debfdb..364dfb6bdfb 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/Parsing01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/Parsing01.fs @@ -1,4 +1,4 @@ -// #Misc +// #Misc // Verify if...then...else parsed as a single unit diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/Parsing02.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/Parsing02.fs index 55b5997b467..b64295b2df5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/Parsing02.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/Parsing02.fs @@ -1,4 +1,4 @@ -// #Regression #Misc +// #Regression #Misc // Verify warnings associated with top level expressions getting discarded //The result of this expression has type diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/UseStatementCallDisposeOnNullValue01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/UseStatementCallDisposeOnNullValue01.fs index ec51ca63720..2f4f9e8b885 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/UseStatementCallDisposeOnNullValue01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/UseStatementCallDisposeOnNullValue01.fs @@ -7,7 +7,7 @@ let _ = let _ = use key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("nonexistent") () - let _ = + let _ = use key : System.IDisposable = null () exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/UserCodeSnippet01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/UserCodeSnippet01.fs index f20b724c4e8..37f6fca0de7 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/UserCodeSnippet01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/UserCodeSnippet01.fs @@ -1,4 +1,4 @@ -// #Regression #Misc +// #Regression #Misc // Code snippet reported to crash the compiler (FSHARP1.0:5087) //Method or object constructor 'op_Addition' not found module TestModule diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/productioncoverage01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/productioncoverage01.fs index fb0be7c2eb4..f08f7313c20 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/productioncoverage01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Misc/productioncoverage01.fs @@ -1,4 +1,4 @@ -// #Misc +// #Misc (*** This testcase is designed to exercise uncommonly used grammar productions in the F# language. @@ -6,22 +6,22 @@ language. -/// RULE: 255 explicitValTyparDeclsCore -> +/// RULE: 255 explicitValTyparDeclsCore -> let f<'a> (x:'a) = x assert (f "foo" = "foo") let f1< > (x:int) = x assert ((f1 42) = 42) -//376 headBindingPattern -> headBindingPattern COLON_COLON headBindingPattern +//376 headBindingPattern -> headBindingPattern COLON_COLON headBindingPattern // Note: no parentheses on pattern let (h::t) = [3] assert (h = 3) assert (t = []) -//378 headBindingPattern -> conjPatternElements -//382 conjPatternElements -> conjPatternElements AMP headBindingPattern +//378 headBindingPattern -> conjPatternElements +//382 conjPatternElements -> conjPatternElements AMP headBindingPattern // Pattern matching on left hand side no parenthesis let a1 & a2 = 3 @@ -33,70 +33,70 @@ let d1 :: d2 = [3] let p1, p2 = 3,4 let (|C|_|) x inp = inp -// 484 declExpr -> declExpr DOLLAR declExpr -// 781 operatorName -> DOLLAR +// 484 declExpr -> declExpr DOLLAR declExpr +// 781 operatorName -> DOLLAR let ($) a b = a + b let v = 3 $ 4 -// 496 declExpr -> declExpr QMARK_QMARK declExpr +// 496 declExpr -> declExpr QMARK_QMARK declExpr //let nullThingy = "foo" ?? null //assert (nullThingy = "foo") //let nullThingy2 = null ?? "bar" //assert (nullThingy2 = "bar") -//717 topAppType -> attributes appType -//715 topAppType -> attributes appType COLON appType -//716 topAppType -> attributes QMARK ident COLON appType -//719 topAppType -> QMARK ident COLON appType -type Doc() = +//717 topAppType -> attributes appType +//715 topAppType -> attributes appType COLON appType +//716 topAppType -> attributes QMARK ident COLON appType +//719 topAppType -> QMARK ident COLON appType +type Doc() = inherit System.Attribute() - -type IFoo = + +type IFoo = interface abstract Method2 : [] p1:int * [] p2:unit -> unit abstract Method3 : [] ?p1:int -> unit abstract Method4 : ?p1:int -> unit end -//735 appType -> typar COLON_GREATER typ +//735 appType -> typar COLON_GREATER typ let constraintTest1 (x : 'a :> System.IComparable) = x -//736 appType -> UNDERSCORE COLON_GREATER typ +//736 appType -> UNDERSCORE COLON_GREATER typ let constraintTest2 (x : _ :> System.IComparable) = x -//740 arrayTypeSuffix -> LBRACK COMMA COMMA COMMA RBRACK +//740 arrayTypeSuffix -> LBRACK COMMA COMMA COMMA RBRACK let constraintTest3 (arr : int[,,,]) = arr -//789 operatorName -> AMP +//789 operatorName -> AMP let (&) v1 v2 = v1 + v2 -//790 operatorName -> AMP_AMP +//790 operatorName -> AMP_AMP let (&&) v1 v2 = v1 + v2 -//801 operatorName -> DOT LPAREN RPAREN +//801 operatorName -> DOT LPAREN RPAREN let (.()) v1 v2 = v1 + v2 -////802 operatorName -> DOT LPAREN COMMA RPAREN +////802 operatorName -> DOT LPAREN COMMA RPAREN //let (.(,)) v1 v2 = v1 + v2 -//803 operatorName -> DOT LPAREN COMMA COMMA RPAREN +//803 operatorName -> DOT LPAREN COMMA COMMA RPAREN //let (.(,,)) v1 v2 = v1 + v2 -//804 operatorName -> DOT LPAREN RPAREN LARROW +//804 operatorName -> DOT LPAREN RPAREN LARROW let (.()<-) v1 v2 = v1 + v2 -////805 operatorName -> DOT LPAREN COMMA RPAREN LARROW +////805 operatorName -> DOT LPAREN COMMA RPAREN LARROW //let (.(,)<-) v1 v2 = v1 + v2 -////806 operatorName -> DOT LPAREN COMMA COMMA RPAREN LARROW +////806 operatorName -> DOT LPAREN COMMA COMMA RPAREN LARROW //let (.(,,)<-) v1 v2 = v1 + v2 -//807 operatorName -> DOT IDENT +//807 operatorName -> DOT IDENT // ???? //808 operatorName -> SPLICE_SYMBOL //let (�) v1 v2 = v1 + v2 // � lead to syntax error? //let (��) v1 v2 = v1 + v2 -//810 operatorName -> DOT_DOT +//810 operatorName -> DOT_DOT let (..) v1 v2 = v1 + v2 -//811 operatorName -> DOT_DOT DOT_DOT +//811 operatorName -> DOT_DOT DOT_DOT let (.. ..) v1 v2 = v1 + v2 -//605 monadicExprNonEmptyNonInitialBlock -> monadicExprNonEmptyNonInitial +//605 monadicExprNonEmptyNonInitialBlock -> monadicExprNonEmptyNonInitial // ???? exit 0 diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs index 56ce63c84fd..571c2786655 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs @@ -112,7 +112,7 @@ type CompletionTests() = Assert.Equal(1, matchingCompletions.Length) Assert.Equal("``base``", matchingCompletions.[0].NameInCode) - // ``|A|_|`` is a strange name like the name of an active pattern but is still present. + // ``|A|_|`` is a strange name like the name of an active pattern but is still present. // In this case the inserted is (|A|_|) let matchingCompletions = completions |> Array.filter (fun d -> d.NameInList = "|A|_|") Assert.Equal(1, matchingCompletions.Length) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs index 041905bffb4..b0cd146d66a 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs @@ -816,7 +816,7 @@ x |> Seq.iter(fun r -> Assert.Equal(foundWrongError, false) () - + [] member _.``Verify that clear cache doesn't fail and clears the cache``() = let nativeProbingRoots () = Seq.empty diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerLineParserTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerLineParserTests.fs index 780fc0d5e44..1b7ad51d1cb 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerLineParserTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerLineParserTests.fs @@ -111,7 +111,7 @@ type DependencyManagerLineParserTests() = let prs, _, _ = [ "MyPackage, Version=1.2.3.4" "Include=MyPackage, Version=1.2.3.4" ] - |> FSharpDependencyManager.parsePackageReference ".fsx" + |> FSharpDependencyManager.parsePackageReference ".fsx" let pr = prs.Single() Assert.Equal("MyPackage", pr.Include) @@ -119,21 +119,21 @@ type DependencyManagerLineParserTests() = member _.``Timeout none is -1``() = let _, _, timeout = [ "timeout=none" ] - |> FSharpDependencyManager.parsePackageReference ".fsx" + |> FSharpDependencyManager.parsePackageReference ".fsx" Assert.Equal(timeout, Some -1) [] member _.``Timeout 1000 is 1000``() = let _, _, timeout = [ "timeout=1000" ] - |> FSharpDependencyManager.parsePackageReference ".fsx" + |> FSharpDependencyManager.parsePackageReference ".fsx" Assert.Equal(timeout, Some 1000) [] member _.``Timeout 0 is 0``() = let _, _, timeout = [ "timeout=0" ] - |> FSharpDependencyManager.parsePackageReference ".fsx" + |> FSharpDependencyManager.parsePackageReference ".fsx" Assert.Equal(timeout, Some 0) [] @@ -144,7 +144,7 @@ type DependencyManagerLineParserTests() = "timeout=10" "timeout=100" ] - |> FSharpDependencyManager.parsePackageReference ".fsx" + |> FSharpDependencyManager.parsePackageReference ".fsx" Assert.Equal(timeout, Some 100) [] @@ -155,7 +155,7 @@ type DependencyManagerLineParserTests() = "timeout=100" "timeout=10" ] - |> FSharpDependencyManager.parsePackageReference ".fsx" + |> FSharpDependencyManager.parsePackageReference ".fsx" Assert.Equal(timeout, Some 10) [] @@ -172,7 +172,7 @@ type DependencyManagerLineParserTests() = member _.``Timeout invalid timeout=``() = try [ "timeout=" ] - |> FSharpDependencyManager.parsePackageReference ".fsx" |> ignore + |> FSharpDependencyManager.parsePackageReference ".fsx" |> ignore Assert.True(false, "ArgumentException expected") //Assert.Fail with | :? ArgumentException -> () diff --git a/tests/FSharp.Compiler.Service.Tests/AssemblyContentProviderTests.fs b/tests/FSharp.Compiler.Service.Tests/AssemblyContentProviderTests.fs index 1adcd9969db..5df4bf71912 100644 --- a/tests/FSharp.Compiler.Service.Tests/AssemblyContentProviderTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/AssemblyContentProviderTests.fs @@ -8,7 +8,7 @@ open FSharp.Test let private filePath = "C:\\test.fs" -let private projectOptions : FSharpProjectOptions = +let private projectOptions : FSharpProjectOptions = { ProjectFileName = "C:\\test.fsproj" ProjectId = None SourceFiles = [| filePath |] @@ -27,9 +27,9 @@ let private assertAreEqual (expected, actual) = if actual <> expected then failwithf "\n\nExpected\n\n%A\n\nbut was\n\n%A" expected actual -let private checkFile (source: string) = - let _, checkFileAnswer = - checker.ParseAndCheckFileInProject(filePath, 0, FSharp.Compiler.Text.SourceText.ofString source, projectOptions) +let private checkFile (source: string) = + let _, checkFileAnswer = + checker.ParseAndCheckFileInProject(filePath, 0, FSharp.Compiler.Text.SourceText.ofString source, projectOptions) |> Async.RunSynchronouslyImmediate match checkFileAnswer with @@ -47,7 +47,7 @@ let private getTopRequireQualifiedAccessParentName (symbol: AssemblySymbol) = let private (=>) (source: string) (expected: string list) = let checkFileResults = checkFile source - let actual = + let actual = checkFileResults.PartialAssemblySignature |> AssemblyContent.GetAssemblySignatureContent AssemblyContentType.Full |> List.map getCleanedFullName @@ -74,7 +74,7 @@ module MyType = "Test.MyType" "Test.MyType" "Test.MyType.func123"] - + [] let ``Module suffix added by an explicitly applied ModuleSuffix attribute is removed``() = """ @@ -120,8 +120,8 @@ let ``TopRequireQualifiedAccessParent property should be valid``() = let v1211 = 1 """ - let expectedResult = - [ + let expectedResult = + [ "Test", ""; "Test.M1", ""; "Test.M1.v1", ""; @@ -191,8 +191,8 @@ module Test = let (++) s s2 = s + "/" + s2 """ - let expectedResult = - [ + let expectedResult = + [ "1 2 3.Test", "open ``1 2 3`` - Test"; "1 2 3.Test.M1", "open ``1 2 3`` - Test.M1"; "1 2 3.Test.M1.(++)", "open ``1 2 3`` - Test.M1.``(++)``"; @@ -222,7 +222,7 @@ module Test = ] |> Map.ofList - let actual = source |> getSymbolMap (fun i -> + let actual = source |> getSymbolMap (fun i -> let ns = i.UnresolvedSymbol.Namespace |> String.concat "." $"open {ns} - {i.UnresolvedSymbol.DisplayName}") diff --git a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs index f67f32d98bb..6bd2a15585b 100644 --- a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs @@ -13,13 +13,13 @@ open Internal.Utilities.Library open FSharp.Compiler.Diagnostics module BuildGraphTests = - + [] let private createNode () = let o = obj () - GraphNode(async { + GraphNode(async { Assert.shouldBeTrue (o <> null) - return 1 + return 1 }), WeakReference(o) [] @@ -33,11 +33,11 @@ module BuildGraphTests = let resetEvent = new ManualResetEvent(false) let resetEventInAsync = new ManualResetEvent(false) - let graphNode = - GraphNode(async { + let graphNode = + GraphNode(async { resetEventInAsync.Set() |> ignore let! _ = Async.AwaitWaitHandle(resetEvent) - return 1 + return 1 }) let task1 = @@ -66,10 +66,10 @@ module BuildGraphTests = let requests = 10000 let mutable computationCount = 0 - let graphNode = - GraphNode(async { + let graphNode = + GraphNode(async { computationCount <- computationCount + 1 - return 1 + return 1 }) let work = Async.Parallel(Array.init requests (fun _ -> graphNode.GetOrComputeValue() )) @@ -116,7 +116,7 @@ module BuildGraphTests = let graphNode, weak = createNode () GC.Collect(2, GCCollectionMode.Forced, true) - + Assert.shouldBeTrue weak.IsAlive Async.RunSynchronouslyImmediate(Async.Parallel(Array.init requests (fun _ -> graphNode.GetOrComputeValue() ))) @@ -128,9 +128,9 @@ module BuildGraphTests = [] let ``A request can cancel``() = - let graphNode = - GraphNode(async { - return 1 + let graphNode = + GraphNode(async { + return 1 }) use cts = new CancellationTokenSource() @@ -156,10 +156,10 @@ module BuildGraphTests = let ``A request can cancel 2``() = let resetEvent = new ManualResetEvent(false) - let graphNode = - GraphNode(async { + let graphNode = + GraphNode(async { let! _ = Async.AwaitWaitHandle(resetEvent) - return 1 + return 1 }) use cts = new CancellationTokenSource() @@ -190,18 +190,18 @@ module BuildGraphTests = let mutable computationCountBeforeSleep = 0 let mutable computationCount = 0 - let graphNode = - GraphNode(async { + let graphNode = + GraphNode(async { computationCountBeforeSleep <- computationCountBeforeSleep + 1 let! _ = Async.AwaitWaitHandle(resetEvent) computationCount <- computationCount + 1 - return 1 + return 1 }) use cts = new CancellationTokenSource() - let work = - async { + let work = + async { let! _ = graphNode.GetOrComputeValue() () } @@ -226,7 +226,7 @@ module BuildGraphTests = Assert.shouldBeTrue(computationCount >= 0) tasks - |> Seq.iter (fun x -> + |> Seq.iter (fun x -> try x.Wait(1000) |> ignore with | :? TimeoutException -> reraise() | _ -> ()) [] @@ -243,7 +243,7 @@ module BuildGraphTests = let random = let rng = Random() fun n -> rng.Next n - + let job phase i = async { do! random 10 |> Async.Sleep Assert.Equal(phase, DiagnosticsThreadStatics.BuildPhase) @@ -252,7 +252,7 @@ module BuildGraphTests = errorR (ExampleException $"job {i}") } - + let work (phase: BuildPhase) = async { let n = 8 @@ -268,7 +268,7 @@ module BuildGraphTests = Assert.Equal(phase, DiagnosticsThreadStatics.BuildPhase) } - + let phases = [| BuildPhase.DefaultPhase BuildPhase.Compile @@ -282,7 +282,7 @@ module BuildGraphTests = BuildPhase.Output BuildPhase.Interactive |] - + let pickRandomPhase _ = phases[random phases.Length] Seq.init 100 pickRandomPhase |> Seq.map work @@ -310,9 +310,9 @@ module BuildGraphTests = [] let ``AsyncLocal diagnostics context works with TPL`` () = - let task1 () = + let task1 () = List.init 20 (sprintf "ListParallel logger %d") - |> Extras.ListParallel.map (fun name -> + |> Extras.ListParallel.map (fun name -> let logger = CapturingDiagnosticsLogger(name) use _ = UseDiagnosticsLogger logger for _ in 1 .. 10 do @@ -322,12 +322,12 @@ module BuildGraphTests = loggerShouldBe logger ) |> ignore - let task2 () = + let task2 () = let commonLogger = SimpleConcurrentLogger "ListParallel concurrent logger" use _ = UseDiagnosticsLogger commonLogger [1 .. 20] - |> Extras.ListParallel.map (fun _ -> + |> Extras.ListParallel.map (fun _ -> for _ in 1 .. 10 do errorR TestException Thread.Sleep 5 @@ -500,7 +500,7 @@ module BuildGraphTests = async { // After Async.Parallel the continuation runs in the context of the last computation that finished. - do! + do! [ async { SetThreadDiagnosticsLoggerNoUnwind DiscardErrorsLogger } ] |> Async.Parallel diff --git a/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs b/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs index cae9a4dc969..4d479b2c15d 100644 --- a/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs +++ b/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs @@ -120,7 +120,7 @@ let _ = CSharpGenericOuterClass.InnerClass.StaticMember() let results, _ = getProjectReferences(content, [csharpAssembly], None, None) results.GetAllUsesOfAllSymbols() |> Array.map (fun su -> su.Symbol.ToString()) - |> shouldEqual + |> shouldEqual [|"FSharp"; "Compiler"; "Service"; "Tests"; "FSharp"; "member .ctor"; "int"; "CSharpGenericOuterClass`1"; "CSharpGenericOuterClass`1"; "int"; "CSharpGenericOuterClass`1"; "InnerEnum"; "field Case1"; diff --git a/tests/FSharp.Compiler.Service.Tests/Checker.fs b/tests/FSharp.Compiler.Service.Tests/Checker.fs index 187d0cc53bf..b3d449cf71a 100644 --- a/tests/FSharp.Compiler.Service.Tests/Checker.fs +++ b/tests/FSharp.Compiler.Service.Tests/Checker.fs @@ -189,7 +189,7 @@ module CheckResultsExtensions = member this.GetSymbolUse(context: ResolveContext) = this.GetSymbolUses(context) |> List.exactlyOne - + member this.GetTooltip(context: ResolveContext) = this.GetToolTip(context.Pos.Line, context.Pos.Column, context.LineText, context.Names, FSharpTokenTag.Identifier) diff --git a/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs b/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs index 5f151c99047..a8d9dc97c61 100644 --- a/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs @@ -513,7 +513,7 @@ type T() = let t = T() t.{caret} """ - + [] let ``Method - Static 01`` () = assertItemAllowed "Method" """ @@ -573,7 +573,7 @@ module Module2 = open Module1 do {caret} """ - + [] let ``Module - Value 05`` () = assertItemAllowed "x" """ diff --git a/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs b/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs index 0e5cf76221e..de4bdd79f2b 100644 --- a/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs @@ -16,7 +16,7 @@ let ``fsc help text is displayed correctly`` () = 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 blocks = GetCoreFscCompilerOptions builder diff --git a/tests/FSharp.Compiler.Service.Tests/EditorTests.fs b/tests/FSharp.Compiler.Service.Tests/EditorTests.fs index 7fb046be29f..091adf0ed83 100644 --- a/tests/FSharp.Compiler.Service.Tests/EditorTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/EditorTests.fs @@ -163,7 +163,7 @@ let ``GetMethodsAsSymbols should return all overloads of a method as FSharpSymbo ("Concat", [("arg0", "obj"); ("arg1", "obj"); ("arg2", "obj"); ("arg3", "obj")]); #endif ("Concat", [("str0", "string"); ("str1", "string"); ("str2", "string"); ("str3", "string")])] - + results |> shouldEqual expected | None -> failwith "No symbols returned" @@ -1212,18 +1212,18 @@ let getBreakpointLocations (input: string) (parseResult: FSharpParseFileResults) let positions = [ for i,line in Seq.indexed lines do for j, c in Seq.indexed line do yield Position.mkPos (Line.fromZ i) j, line ] [ for pos, line in positions do match parseResult.ValidateBreakpointLocation pos with - | Some r -> - let text = + | Some r -> + let text = [ if r.StartLine = r.EndLine then lines[r.StartLine-1][r.StartColumn..r.EndColumn-1] else lines[r.StartLine-1][r.StartColumn..] - for l in r.StartLine..r.EndLine-2 do + for l in r.StartLine..r.EndLine-2 do lines[l] lines[r.EndLine-1][..r.EndColumn-1] ] |> String.concat "$" ((pos.Line, pos.Column), (r.StartLine, r.StartColumn, r.EndLine, r.EndColumn, text)) - | None -> + | None -> ()] [] @@ -1313,7 +1313,7 @@ let f () = let parseResult, typeCheckResults = parseAndCheckScript(file, input) let results = getBreakpointLocations input parseResult printfn "%A" results - results |> shouldEqual + results |> shouldEqual [((3, 0), (3, 5, 3, 8, "[1]")); ((3, 1), (3, 5, 3, 8, "[1]")); ((3, 2), (3, 5, 3, 8, "[1]")); ((3, 3), (3, 5, 3, 8, "[1]")); ((3, 4), (3, 5, 3, 8, "[1]")); ((3, 5), (3, 5, 3, 8, "[1]")); @@ -1372,7 +1372,7 @@ let f () = ((6, 14), (6, 7, 6, 17, "List.unzip")); ((6, 15), (6, 7, 6, 17, "List.unzip")); ((6, 16), (6, 7, 6, 17, "List.unzip"))] - + [] let ``ValidateBreakpointLocation tests for pipe3`` () = let input = @@ -1386,7 +1386,7 @@ let f () = let parseResult, typeCheckResults = parseAndCheckScript(file, input) let results = getBreakpointLocations input parseResult printfn "%A" results - results |> shouldEqual + results |> shouldEqual [((3, 0), (3, 5, 3, 8, "[1]")); ((3, 1), (3, 5, 3, 8, "[1]")); ((3, 2), (3, 5, 3, 8, "[1]")); ((3, 3), (3, 5, 3, 8, "[1]")); ((3, 4), (3, 5, 3, 8, "[1]")); ((3, 5), (3, 5, 3, 8, "[1]")); @@ -1471,7 +1471,7 @@ let bodyWrapper () = // on line 4 and 5, and the ones actually on the interior text of the lambda. // // This is correct - results |> shouldEqual + results |> shouldEqual [((3, 0), (3, 3, 5, 10, "id (fun (A(b,c)) ->$ let x = 1$ x)")); ((3, 1), (3, 3, 5, 10, "id (fun (A(b,c)) ->$ let x = 1$ x)")); ((3, 2), (3, 3, 5, 10, "id (fun (A(b,c)) ->$ let x = 1$ x)")); @@ -1529,7 +1529,7 @@ let bodyWrapper (a, b, c) = a || b && c""" // on line 4 and 5, and the ones actually on the interior text of the lambda. // // This is correct - results |> shouldEqual + results |> shouldEqual [((2, 0), (2, 28, 2, 29, "a")); ((2, 1), (2, 28, 2, 29, "a")); ((2, 2), (2, 28, 2, 29, "a")); ((2, 3), (2, 28, 2, 29, "a")); ((2, 4), (2, 28, 2, 29, "a")); ((2, 5), (2, 28, 2, 29, "a")); @@ -1571,7 +1571,7 @@ module M = // on line 4 and 5, and the ones actually on the interior text of the lambda. // // This is correct - results |> shouldEqual + results |> shouldEqual [((2, 0), (2, 14, 2, 16, "()")); ((2, 1), (2, 14, 2, 16, "()")); ((2, 2), (2, 14, 2, 16, "()")); ((2, 3), (2, 14, 2, 16, "()")); ((2, 4), (2, 14, 2, 16, "()")); ((2, 5), (2, 14, 2, 16, "()")); @@ -1993,7 +1993,7 @@ let hasRecordType (recordTypeName: string) (symbolUses: FSharpSymbolUse list) = | _ -> false ) |> fun exists -> Assert.True(exists, $"Record type {recordTypeName} not found.") - + [] let ``Record fields are completed via type name usage`` () = let parseResults, checkResults = @@ -2024,7 +2024,7 @@ let x = EndColumn = 13 LastDotPos = Some 13 PartialIdent = "" - QualifyingIdents = [ "Entry" ] + QualifyingIdents = [ "Entry" ] }, fun _ -> List.empty ) @@ -2060,7 +2060,7 @@ module Module2 = EndColumn = 13 LastDotPos = Some 13 PartialIdent = "" - QualifyingIdents = [ "Module1" ] + QualifyingIdents = [ "Module1" ] }, fun _ -> List.empty ) @@ -2097,7 +2097,7 @@ module Module2 = EndColumn = 8 LastDotPos = Some 8 PartialIdent = "" - QualifyingIdents = [ "R1" ] + QualifyingIdents = [ "R1" ] }, fun _ -> List.empty ) @@ -2129,7 +2129,7 @@ module Module2 = EndColumn = 16 LastDotPos = Some 16 PartialIdent = "" - QualifyingIdents = [ "Module1"; "R1" ] + QualifyingIdents = [ "Module1"; "R1" ] }, fun _ -> List.empty ) @@ -2201,7 +2201,7 @@ let rUpdate = """ assertHasItemWithNames ["Field1"; "Field2"] info - + [] let ``No record field completion after '=' with missing value in first binding (after =;)`` () = let info = Checker.getCompletionInfo """ diff --git a/tests/FSharp.Compiler.Service.Tests/FsiTests.fs b/tests/FSharp.Compiler.Service.Tests/FsiTests.fs index f5121a2d115..152c46867a1 100644 --- a/tests/FSharp.Compiler.Service.Tests/FsiTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/FsiTests.fs @@ -661,7 +661,7 @@ module FsiTests = | Choice2Of2 e -> printfn "exception: %A" e raise e - + [] let ``LineDirectivesWork`` () = use fsiSession = createFsiSession false diff --git a/tests/FSharp.Compiler.Service.Tests/InteractiveCheckerTests.fs b/tests/FSharp.Compiler.Service.Tests/InteractiveCheckerTests.fs index d6cb91904de..82179aed496 100644 --- a/tests/FSharp.Compiler.Service.Tests/InteractiveCheckerTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/InteractiveCheckerTests.fs @@ -65,7 +65,7 @@ let input = [] let ``Test ranges - namespace`` () = - let res = parseAndExtractRanges input + let res = parseAndExtractRanges input printfn "Test ranges - namespace, res = %A" res res |> shouldEqual [("N", ((2, 14), (2, 15))); ("Sample", ((4, 9), (4, 15)))] @@ -75,7 +75,7 @@ let input2 = type Sample () = class end """ - + [] let ``Test ranges - module`` () = let res = parseAndExtractRanges input2 @@ -91,6 +91,6 @@ let input3 = [] let ``Test ranges - global namespace`` () = - let res = parseAndExtractRanges input3 + let res = parseAndExtractRanges input3 printfn "Test ranges - global namespace, res = %A" res res |> shouldEqual [("Sample", ((4, 9), (4, 15)))] diff --git a/tests/FSharp.Compiler.Service.Tests/ManglingNameOfProvidedTypes.fs b/tests/FSharp.Compiler.Service.Tests/ManglingNameOfProvidedTypes.fs index a1cb46dac3b..7f08b3301f0 100644 --- a/tests/FSharp.Compiler.Service.Tests/ManglingNameOfProvidedTypes.fs +++ b/tests/FSharp.Compiler.Service.Tests/ManglingNameOfProvidedTypes.fs @@ -13,61 +13,61 @@ open FSharp.Compiler.Xml open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeBasics -type ManglingNamesOfProvidedTypesWithSingleParameter() = - +type ManglingNamesOfProvidedTypesWithSingleParameter() = + [] - member this.MangleWithNonDefaultValue() = - let mangled = + member this.MangleWithNonDefaultValue() = + let mangled = PrettyNaming.ComputeMangledNameWithoutDefaultArgValues("MyNamespace.Test", [| "xyz" |], [| "Foo", Some "abc" |]) Assert.shouldBe "MyNamespace.Test,Foo=\"xyz\"" mangled - + [] - member this.MangleWithDefaultValue() = - let mangled = + member this.MangleWithDefaultValue() = + let mangled = PrettyNaming.ComputeMangledNameWithoutDefaultArgValues("MyNamespace.Test", [| "xyz" |], [| "Foo", Some "xyz" |]) Assert.shouldBe "MyNamespace.Test" mangled - + [] - member this.DemangleNonDefaultValue() = + member this.DemangleNonDefaultValue() = let name, parameters = PrettyNaming.DemangleProvidedTypeName "MyNamespace.Test,Foo=\"xyz\"" Assert.shouldBe "MyNamespace.Test" name Assert.shouldBeEquivalentTo [| "Foo", "xyz" |] parameters - + [] - member this.DemangleDefaultValue() = + member this.DemangleDefaultValue() = let name, parameters = PrettyNaming.DemangleProvidedTypeName "MyNamespace.Test," Assert.shouldBe "MyNamespace.Test" name Assert.shouldBeEmpty parameters [] - member this.DemangleNewDefaultValue() = + member this.DemangleNewDefaultValue() = let name, parameters = PrettyNaming.DemangleProvidedTypeName "MyNamespace.Test" Assert.shouldBe "MyNamespace.Test" name Assert.shouldBeEmpty parameters -type ManglingNamesOfProvidedTypesWithMultipleParameter() = - +type ManglingNamesOfProvidedTypesWithMultipleParameter() = + [] - member this.MangleWithNonDefaultValue() = - let mangled = - PrettyNaming.ComputeMangledNameWithoutDefaultArgValues - ("MyNamespace.Test", [| "xyz"; "abc" |], + member this.MangleWithNonDefaultValue() = + let mangled = + PrettyNaming.ComputeMangledNameWithoutDefaultArgValues + ("MyNamespace.Test", [| "xyz"; "abc" |], [| "Foo", Some "foo" "Foo2", Some "foo2" |]) Assert.shouldBe "MyNamespace.Test,Foo=\"xyz\",Foo2=\"abc\"" mangled - + [] - member this.MangleWithDefaultValue() = - let mangled = - PrettyNaming.ComputeMangledNameWithoutDefaultArgValues - ("MyNamespace.Test", [| "xyz"; "abc" |], + member this.MangleWithDefaultValue() = + let mangled = + PrettyNaming.ComputeMangledNameWithoutDefaultArgValues + ("MyNamespace.Test", [| "xyz"; "abc" |], [| "Foo", Some "xyz" "Foo2", Some "abc" |]) Assert.shouldBe "MyNamespace.Test" mangled - + [] - member this.DemangleMultiParameter() = + member this.DemangleMultiParameter() = let smashtogether arr = arr |> Seq.fold(fun acc (f,s) -> acc + $"-{f}-{s}") "" let name, parameters = PrettyNaming.DemangleProvidedTypeName "TestType,Foo=\"xyz\",Foo2=\"abc\"" Assert.shouldBe "TestType" name diff --git a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs index 8140b5717aa..967bcd07eb8 100644 --- a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs @@ -54,7 +54,7 @@ module ModuleReader = let parameters = [] let ret = mkILReturn ILType.Void let genericParams = [] - let customAttrs = mkILCustomAttrs [] + let customAttrs = mkILCustomAttrs [] let implAttributes = MethodImplAttributes.Managed let body = InterruptibleLazy.FromValue MethodBody.NotAvailable diff --git a/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs index 78feadbfe9c..f6491ca1991 100644 --- a/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs @@ -128,7 +128,7 @@ let u = Case1 3 [] let ``Test multi project 1 basic`` () = - + let wholeProjectResults = checker.ParseAndCheckProject(MultiProject1.options) |> Async.RunSynchronouslyImmediate [ for x in wholeProjectResults.AssemblySignature.Entities -> x.DisplayName ] |> shouldEqual ["MultiProject1"] @@ -821,21 +821,21 @@ module GenerativeTypeProviderFallbackTest = [] let ``In-memory cross-project references to projects using generative type provides should fallback to on-disk references`` () = - + // The type provider and its dependency are compiled as part of the solution build let csDLL = __SOURCE_DIRECTORY__ + $"/../../artifacts/bin/TestTP/{testBuildConfiguration}/netstandard2.0/CSharp_Analysis.dll" let tpDLL = __SOURCE_DIRECTORY__ + $"/../../artifacts/bin/TestTP/{testBuildConfiguration}/netstandard2.0/TestTP.dll" // These two projects should have been built before the test executes - if not (File.Exists csDLL) then + if not (File.Exists csDLL) then failwith $"expect {csDLL} to exist" - if not (File.Exists tpDLL) then + if not (File.Exists tpDLL) then failwith $"expect {tpDLL} to exist" // Dedicated checker to isolate type-provider tests from shared state races. let checker = FSharpChecker.Create(useTransparentCompiler = CompilerAssertHelpers.UseTransparentCompiler) - let optionsTestProject = + let optionsTestProject = { ProjectFileName = __SOURCE_DIRECTORY__ ++ @"../service/data/TestProject/TestProject.fsproj" ProjectId = None - SourceFiles = + SourceFiles = [| __SOURCE_DIRECTORY__ ++ @"../service/data/TestProject/TestProject.fs" |] Stamp = None OtherOptions = @@ -940,19 +940,19 @@ module GenerativeTypeProviderFallbackTest = printfn "Parse Diagnostics (TestProject2 without compiled TestProject): %A" fileParseResults.Diagnostics printfn "Check Diagnostics (TestProject2 without compiled TestProject): %A" fileCheckResults.Diagnostics - fileCheckResults.Diagnostics - |> Array.exists (fun diag -> + fileCheckResults.Diagnostics + |> Array.exists (fun diag -> diag.Severity = FSharpDiagnosticSeverity.Error && diag.Message.Contains("TestProject.dll")) |> shouldEqual true end - // Do the same check with an in-memory reference to TestProject where TestProject exists + // Do the same check with an in-memory reference to TestProject where TestProject exists // compiled to disk. In this case, we expect no error, because even though TestProject uses a generative // type provider, the in-memory cross-reference is ignored and an on-disk reference is used instead. begin let testProjectCompiledOutput = __SOURCE_DIRECTORY__ ++ @"../service/data/TestProject/netstandard2.0/TestProject.dll" - if not (File.Exists testProjectCompiledOutput) then + if not (File.Exists testProjectCompiledOutput) then failwith $"expect {testProjectCompiledOutput} to exist" let options = optionsTestProject2 testProjectCompiledOutput let fileName = __SOURCE_DIRECTORY__ ++ @"../service/data/TestProject2/TestProject2.fs" diff --git a/tests/FSharp.Compiler.Service.Tests/OverloadCacheTests.fs b/tests/FSharp.Compiler.Service.Tests/OverloadCacheTests.fs index 4abe9d9c46a..a65913ac393 100644 --- a/tests/FSharp.Compiler.Service.Tests/OverloadCacheTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/OverloadCacheTests.fs @@ -31,7 +31,7 @@ let generateRepetitiveOverloadCalls (callCount: int) = let sb = StringBuilder() sb.AppendLine("open System") |> ignore sb.AppendLine() |> ignore - + sb.AppendLine("type TestAssert =") |> ignore sb.AppendLine(" static member Equal(expected: int, actual: int) = expected = actual") |> ignore sb.AppendLine(" static member Equal(expected: string, actual: string) = expected = actual") |> ignore @@ -42,7 +42,7 @@ let generateRepetitiveOverloadCalls (callCount: int) = sb.AppendLine(" static member Equal(expected: int64, actual: int64) = expected = actual") |> ignore sb.AppendLine(" static member Equal(expected: obj, actual: obj) = obj.Equals(expected, actual)") |> ignore sb.AppendLine() |> ignore - + sb.AppendLine("let runTests() =") |> ignore sb.AppendLine(" let mutable x: int = 0") |> ignore sb.AppendLine(" let mutable y: int = 0") |> ignore @@ -50,10 +50,10 @@ let generateRepetitiveOverloadCalls (callCount: int) = sb.AppendLine(sprintf " x <- %d" i) |> ignore sb.AppendLine(sprintf " y <- %d" (i + 1)) |> ignore sb.AppendLine(" ignore (TestAssert.Equal(x, y))") |> ignore - + sb.AppendLine() |> ignore sb.AppendLine("runTests()") |> ignore - + sb.ToString() @@ -102,7 +102,7 @@ let s2 = Overloaded.Process("b") let f1 = Overloaded.Process(1.0) let f2 = Overloaded.Process(2.0) """ - + checkSourceHasNoErrors source |> ignore let after = CacheMetrics.getTotalsByName "overloadResolutionCache" @@ -312,5 +312,5 @@ let d2 = Assert.Equal(30, 40) let d3 = Assert.Equal("x", "y") let d4 = Assert.Equal("z", "w") """ - + checkSourceHasNoErrors source |> ignore diff --git a/tests/FSharp.Compiler.Service.Tests/ParserTests.fs b/tests/FSharp.Compiler.Service.Tests/ParserTests.fs index 7e7339cdb5f..87123962a63 100644 --- a/tests/FSharp.Compiler.Service.Tests/ParserTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ParserTests.fs @@ -277,7 +277,7 @@ let 1,1,1 = () SynPat.Tuple(elementPats = [SynPat.Const _ as p41; SynPat.Const _ as p42; SynPat.Wild _ as p43]) SynPat.Tuple(elementPats = [SynPat.Wild _ as p51; SynPat.Const _ as p52; SynPat.Const _ as p53]) SynPat.Tuple(elementPats = [SynPat.Const _ as p61; SynPat.Wild _ as p62; SynPat.Const _ as p63]) - + SynPat.Tuple(elementPats = [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 @@ -347,7 +347,7 @@ let (1,1,1) = () SynPat.Tuple(elementPats = [SynPat.Const _ as p41; SynPat.Const _ as p42; SynPat.Wild _ as p43]) SynPat.Tuple(elementPats = [SynPat.Wild _ as p51; SynPat.Const _ as p52; SynPat.Const _ as p53]) SynPat.Tuple(elementPats = [SynPat.Const _ as p61; SynPat.Wild _ as p62; SynPat.Const _ as p63]) - + SynPat.Tuple(elementPats = [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 diff --git a/tests/FSharp.Compiler.Service.Tests/ProductVersion.fs b/tests/FSharp.Compiler.Service.Tests/ProductVersion.fs index d74d4d52b57..e9ef08e1b1a 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProductVersion.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProductVersion.fs @@ -23,13 +23,13 @@ module FileVersionTest = let findStringAttr n = n |> Assert.shouldBe fileVersionAttrName; Some "1.2.3.4" ComputeILFileVersion findStringAttr (ILVersionInfo(1us,0us,0us,0us)) |> Assert.shouldBe (ILVersionInfo(1us,2us,3us,4us)) - [] + [] let ``should fallback if AssemblyFileVersionAttribute is not a valid version`` () = ComputeILFileVersion (fun _ -> Some "1.2a.3.3") (ILVersionInfo(3us,7us,8us,6us)) |> Assert.shouldBe (ILVersionInfo(3us,7us,8us,6us)) - [] - let ``should fallback to assemblyVersion if AssemblyFileVersionAttribute not set`` () = + [] + let ``should fallback to assemblyVersion if AssemblyFileVersionAttribute not set`` () = let findStringAttr n = n |> Assert.shouldBe fileVersionAttrName; None; ComputeILFileVersion findStringAttr (ILVersionInfo(1us,0us,0us,4us)) |> Assert.shouldBe (ILVersionInfo(1us,0us,0us,4us)) @@ -38,19 +38,19 @@ module ProductVersionTest = let informationalVersionAttrName = typeof.FullName let fileVersionAttrName = typeof.FullName - [] - let ``should use AssemblyInformationalVersionAttribute if set`` () = + [] + let ``should use AssemblyInformationalVersionAttribute if set`` () = let mutable args = [] let findStrAttr x = args <- List.append args [x]; Some "12.34.56.78" ComputeProductVersion findStrAttr (ILVersionInfo(1us,0us,0us,6us)) |> Assert.shouldBe "12.34.56.78" args |> Assert.shouldBe [ informationalVersionAttrName ] - [] + [] let ``should fallback if AssemblyInformationalVersionAttribute is not a valid version`` () = ComputeProductVersion (fun _ -> Some "1.2.3-main (build #12)") (ILVersionInfo(1us,0us,0us,6us)) |> Assert.shouldBe "1.2.3-main (build #12)" - [] + [] let ``should fallback to fileVersion if AssemblyInformationalVersionAttribute not set or empty`` () = ComputeProductVersion (fun _ -> None) (ILVersionInfo(3us,2us,1us,0us)) |> Assert.shouldBe "3.2.1.0" ComputeProductVersion (fun _ -> Some "") (ILVersionInfo(3us,2us,1us,0us)) |> Assert.shouldBe "3.2.1.0" @@ -60,13 +60,13 @@ module ProductVersionTest = [ "1.2.3.4", ILVersionInfo(1us,2us,3us,4us) "1.0.3.4", ILVersionInfo(1us,0us,3us,4us) "7.0.0.4-SomeExtraInformation", ILVersionInfo(7us,0us,0us,4us) - "0.0.0.0", ILVersionInfo(0us,0us,0us,0us) + "0.0.0.0", ILVersionInfo(0us,0us,0us,0us) "3213.57843.32382.59493", ILVersionInfo(3213us,57843us,32382us,59493us) (sprintf "%d.%d.%d.%d" max max max max), ILVersionInfo(max,max,max,max) ] [] let ``should use values if valid major.minor.revision.build version format`` () = - for v, expected in validValues() do + for v, expected in validValues() do v |> ConvertProductVersionToILVersionInfo |> Assert.shouldBe expected let internal invalidValues () = @@ -83,6 +83,6 @@ module ProductVersionTest = (sprintf "%d.70000.80000.90000" UInt16.MaxValue), ILVersionInfo(UInt16.MaxValue,0us,0us,0us) ] [] - let ``should zero starting from first invalid version part`` () = + let ``should zero starting from first invalid version part`` () = for v, expected in invalidValues() do v |> ConvertProductVersionToILVersionInfo |> Assert.shouldBe expected diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index 0076df3203b..81f7a9e4bab 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -115,7 +115,7 @@ module ClearLanguageServiceRootCachesTest = // A private checker for this test. let checker = FSharpChecker.Create() - + let test () = let _, checkFileAnswer = checker.ParseAndCheckFileInProject(Project1.fileName1, 0, Project1.fileSource1, Project1.options) |> Async.RunSynchronouslyImmediate @@ -752,10 +752,10 @@ let ``Test project2 all uses of all signature symbols`` () = ("generic parameter T", [("file1", ((22, 23), (22, 25))); ("file1", ((22, 30), (22, 32))); ("file1", ((22, 45), (22, 47))); ("file1", ((22, 50), (22, 52)))]); - ("member get_IsD", []); + ("member get_IsD", []); ("member get_IsDU1", []); ("member get_IsDU2", []); - ("property IsD", []); + ("property IsD", []); ("property IsDU1", []); ("property IsDU2", []); ("DUWithNormalFields", [("file1", ((3, 5), (3, 23)))]); @@ -5903,7 +5903,7 @@ let checkContentAsScript content = | FSharpCheckFileAnswer.Succeeded r -> r [] -module ScriptClosureCacheUse = +module ScriptClosureCacheUse = [] let ``References from #r nuget are included in script project options`` () = diff --git a/tests/FSharp.Compiler.Service.Tests/QuickParseTests.fs b/tests/FSharp.Compiler.Service.Tests/QuickParseTests.fs index 845c08f109e..54189c5a650 100644 --- a/tests/FSharp.Compiler.Service.Tests/QuickParseTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/QuickParseTests.fs @@ -12,16 +12,16 @@ open FSharp.Compiler.EditorServices [] let ``QuickParse handles optional parameter identifier extraction when cursor is on question mark``() = let lineStr = "member _.memb(?optional:string) = optional" - + // Test when cursor is exactly on the '?' character let posOnQuestionMark = 14 Assert.Equal('?', lineStr[posOnQuestionMark]) - + let island = QuickParse.GetCompleteIdentifierIsland false lineStr posOnQuestionMark - + // We expect to get "optional" as the identifier Assert.True(Option.isSome island, "Should extract identifier island when positioned on '?'") - + match island with | Some(ident, startCol, isQuoted) -> Assert.Equal("optional", ident) @@ -34,16 +34,16 @@ let ``QuickParse handles optional parameter identifier extraction when cursor is [] let ``QuickParse handles optional parameter identifier extraction when cursor is on identifier``() = let lineStr = "member _.memb(?optional:string) = optional" - + // Test when cursor is on the identifier "optional" after the '?' let posOnOptional = 17 Assert.Equal('t', lineStr[posOnOptional]) - + let island = QuickParse.GetCompleteIdentifierIsland false lineStr posOnOptional - + // We expect to get "optional" as the identifier Assert.True(Option.isSome island, "Should extract identifier island when positioned on identifier") - + match island with | Some(ident, startCol, isQuoted) -> Assert.Equal("optional", ident) @@ -54,13 +54,13 @@ let ``QuickParse handles optional parameter identifier extraction when cursor is [] let ``QuickParse does not treat question mark as identifier in other contexts``() = let lineStr = "let x = y ? z" - + // Test when cursor is on the '?' in a different context (not optional parameter) let posOnQuestionMark = 10 Assert.Equal('?', lineStr[posOnQuestionMark]) - + let island = QuickParse.GetCompleteIdentifierIsland false lineStr posOnQuestionMark - + // In this context, '?' is followed by space, not an identifier start // So we should get None or the next identifier 'z' // Let's check what we actually get diff --git a/tests/FSharp.Compiler.Service.Tests/RangeTests.fs b/tests/FSharp.Compiler.Service.Tests/RangeTests.fs index 3e810f0e7ef..35aa4d81ed1 100644 --- a/tests/FSharp.Compiler.Service.Tests/RangeTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/RangeTests.fs @@ -13,7 +13,7 @@ let ``withStartEnd Test`` () = let r = withStartEnd newStart newEnd z r.Start |> shouldEqual newStart r.End |> shouldEqual newEnd - + [] let ``withStart Test`` () = let z = range0 @@ -36,7 +36,7 @@ let ``shiftStart Test`` () = let r = shiftStart lineDelta columnDelta z r.Start.Column |> shouldEqual (z.StartColumn + columnDelta) r.Start.Line |> shouldEqual (z.StartLine + lineDelta) - + [] let ``shiftEnd Test`` () = let z = range0 diff --git a/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs b/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs index 9ee31b25b63..1c551b7c06a 100644 --- a/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs @@ -22,15 +22,15 @@ let private assertCompletionContext (checker: CompletionContext option -> bool) line <- reader.ReadLine() if source.EndsWith "\n" then yield "" |] - - let markerPos = - lines + + let markerPos = + lines |> Array.mapi (fun i x -> i, x) - |> Array.tryPick (fun (lineIdx, line) -> - match line.IndexOf Marker with - | -1 -> None + |> Array.tryPick (fun (lineIdx, line) -> + match line.IndexOf Marker with + | -1 -> None | idx -> Some (mkPos (Line.fromZ lineIdx) idx)) - + match markerPos with | None -> failwithf "Marker '%s' was not found in the source code" Marker | Some markerPos -> @@ -46,7 +46,7 @@ module AttributeCompletion = let ``at [<|, applied to nothing``() = """ [<(* marker *) -""" +""" |> assertCompletionContext (fun x -> x = Some CompletionContext.AttributeApplication) [] @@ -215,7 +215,7 @@ module TypeMemberRanges = memberDecls |> List.map (fun memberDecl -> getRangeCoords memberDecl.Range) | _ -> failwith "Could not get member" - + [] let ``Member range 01 - Simple``() = let source = """ @@ -224,7 +224,7 @@ type T = """ getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 23) ] - + [] let ``Member range 02 - Static``() = let source = """ @@ -261,7 +261,7 @@ type T = """ getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 44) ] - + [] let ``Member range 06 - Read-write property``() = let source = """ @@ -290,7 +290,7 @@ type T = """ getTypeMemberRange source |> shouldEqual [ (3, 4), (3, 43) ] - + [] let ``Member range 09 - Abstract slot``() = let source = """ @@ -646,7 +646,7 @@ let addStr x y = string x + string y | None -> failwith("No arguments found in source code") - + let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 2 28) match res with | Some res -> @@ -1117,7 +1117,7 @@ let square x = x * |> shouldEqual ("op_PipeRight", 1) | None -> failwith("No pipeline found") - + [] let ``TryIdentOfPipelineContainingPosAndNumArgsApplied - Double pipeline``() = let source = """ diff --git a/tests/FSharp.Compiler.Service.Tests/SourceTextTests.fs b/tests/FSharp.Compiler.Service.Tests/SourceTextTests.fs index 3e40a2c056b..a1c126c2f5d 100644 --- a/tests/FSharp.Compiler.Service.Tests/SourceTextTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/SourceTextTests.fs @@ -29,7 +29,7 @@ let a b c = [] let ``Inconsistent return carriage return correct text`` () = let sourceText = SourceText.ofString "let a =\r\n // foo\n 43" - let m = mkRange "Sample.fs" (Position.mkPos 1 4) (Position.mkPos 3 6) + let m = mkRange "Sample.fs" (Position.mkPos 1 4) (Position.mkPos 3 6) let v = sourceText.GetSubTextFromRange m let sanitized = v.Replace("\r", "") Assert.Equal("a =\n // foo\n 43", sanitized) @@ -39,7 +39,7 @@ let ``Zero range should return empty string`` () = let sourceText = SourceText.ofString "a" let v = sourceText.GetSubTextFromRange range0 Assert.Equal(String.Empty, v) - + [] let ``Invalid range should throw argument exception`` () = let sourceText = SourceText.ofString "a" diff --git a/tests/FSharp.Compiler.Service.Tests/StructureTests.fs b/tests/FSharp.Compiler.Service.Tests/StructureTests.fs index 13ea9af5e58..c0ae0d3fdff 100644 --- a/tests/FSharp.Compiler.Service.Tests/StructureTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/StructureTests.fs @@ -169,7 +169,7 @@ module MyModule = // 2 interface IDisposable with // 25 member __.Dispose() = (docEventListener :> IDisposable).Dispose() -""" +""" => [ (2, 0, 27, 63), (2, 15, 27, 63) (4, 4, 5, 10), (4, 13, 5, 10) (4, 8, 5, 10), (4, 13, 5, 10) @@ -185,7 +185,7 @@ module MyModule = // 2 (26, 16, 27, 63), (26, 35, 27, 63) (26, 23, 27, 63), (26, 35, 27, 63) ] - + [] let ``open statements``() = """ @@ -305,7 +305,7 @@ async { // 2 (7, 8, 11, 14), (6, 10, 11, 14) (7, 8, 11, 14), (7, 23, 11, 14) (10, 12, 11, 14), (9, 14, 11, 14) ] - + [] let ``computation expressions``() = """ @@ -343,7 +343,7 @@ let _ = => [ (2, 0, 4, 34), (2, 5, 4, 34) (2, 4, 4, 34), (2, 5, 4, 34) (3, 4, 4, 34), (3, 28, 4, 34) ] - + [] let ``try - with``() = """ @@ -454,7 +454,7 @@ for x in 0 .. 100 -> """ => [ (2, 0, 4, 14), (2, 0, 4, 14) (3, 12, 4, 14), (3, 12, 4, 14) ] - + [] let ``tuple``() = """ @@ -514,7 +514,7 @@ module M = (8, 8, 11, 19), (11, 15, 11, 19) (12, 4, 13, 15), (13, 11, 13, 15) (12, 4, 13, 15), (13, 11, 13, 15) ] - + [] let ``regular comments``() = """ @@ -536,7 +536,7 @@ module M = (5, 4, 6, 13), (5, 4, 6, 13) (7, 9, 11, 19), (7, 11, 11, 19) (8, 8, 10, 17), (8, 8, 10, 17) ] - + [] let ``XML doc and regular comments in one block``() = """ diff --git a/tests/FSharp.Compiler.Service.Tests/SuggestionBuffer.fs b/tests/FSharp.Compiler.Service.Tests/SuggestionBuffer.fs index bc5c82f0b61..feca42be3ea 100644 --- a/tests/FSharp.Compiler.Service.Tests/SuggestionBuffer.fs +++ b/tests/FSharp.Compiler.Service.Tests/SuggestionBuffer.fs @@ -6,24 +6,24 @@ open FSharp.Test module SuggestionBuffer = open FSharp.Compiler.DiagnosticResolutionHints - + [] let NewBufferShouldBeEmpty() = let buffer = SuggestionBuffer("abdef") - + Assert.shouldBeFalse buffer.Disabled Assert.shouldBeEmpty buffer - + [] let BufferShouldOnlyAcceptSimilarElements() = let buffer = SuggestionBuffer("abcd") buffer.Add("abce") buffer.Add("somethingcompletelyunrelated") - + let results = Array.ofSeq buffer - + Assert.shouldBeEquivalentTo [| "abce" |] results - + [] let SmallIdentifierShouldBeIgnored() = let buffer = SuggestionBuffer("ab") @@ -97,7 +97,7 @@ module SuggestionBuffer = buffer.Add("abc") buffer.Add("ab") buffer.Add("ad") - + let results = Array.ofSeq buffer - + Assert.shouldBeEquivalentTo [| "abc"; "abce" |] results diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index af13298d280..dd6c68ddc20 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -31,7 +31,7 @@ match "foo" with let getCaseUsages source line = let fileName, options = mkTestFileAndOptions [| |] let _, checkResults = parseAndCheckFile fileName source options - + checkResults.GetAllUsesOfAllSymbolsInFile() |> Array.ofSeq |> Array.filter (fun su -> su.Range.StartLine = line && su.Symbol :? FSharpActivePatternCase) @@ -201,7 +201,7 @@ module Mod1 = let func2 () = () """ let fileName, options = mkTestFileAndOptions [| |] - let _, checkResults = parseAndCheckFile fileName source options + let _, checkResults = parseAndCheckFile fileName source options let mod1 = checkResults.PartialAssemblySignature.FindEntityByPath ["Ns1"; "Mod1"] |> Option.get let mod2 = checkResults.PartialAssemblySignature.FindEntityByPath ["Ns1"; "Mod1"; "Mod2"] |> Option.get @@ -221,7 +221,7 @@ module Mod2 = let func2 () = () """ let fileName, options = mkTestFileAndOptions [| |] - let _, checkResults = parseAndCheckFile fileName source options + let _, checkResults = parseAndCheckFile fileName source options let mod1 = checkResults.PartialAssemblySignature.FindEntityByPath ["Mod1"] |> Option.get let mod2 = checkResults.PartialAssemblySignature.FindEntityByPath ["Mod1"; "Mod2"] |> Option.get @@ -354,7 +354,7 @@ open System """ findSymbolUseByName "IDisposable" checkResults |> ignore - + [] let ``Interface 04 - Type arg`` () = let _, checkResults = getParseAndCheckResults """ @@ -475,9 +475,9 @@ let tester2: int Group = [] [] [] [] - let ``FsharpType.Format default to arrayNd shorthands for multidimensional arrays`` rank = + let ``FsharpType.Format default to arrayNd shorthands for multidimensional arrays`` rank = let commas = System.String(',', rank - 1) - let _, checkResults = getParseAndCheckResults $""" let myArr : int[{commas}] = Unchecked.defaultOf<_>""" + let _, checkResults = getParseAndCheckResults $""" let myArr : int[{commas}] = Unchecked.defaultOf<_>""" let symbolUse = findSymbolUseByName "myArr" checkResults match symbolUse.Symbol with | :? FSharpMemberOrFunctionOrValue as v -> @@ -543,7 +543,7 @@ let f2 b1 b2 b3 b4 b5 = g b4 g b5. """ - let symbolTypes = + let symbolTypes = ["a1", Some "unit" "a2", Some "unit" "a3", Some "unit" @@ -615,7 +615,7 @@ module FSharpMemberOrFunctionOrValue = match su.Symbol with | :? FSharpMemberOrFunctionOrValue as mfv when mfv.IsProperty -> Some (mfv, su.Range) | _ -> None - + [] let ``Both Set and Get symbols are present`` () = let context, checkResults = Checker.getCheckedResolveContext """ @@ -716,7 +716,7 @@ type internal SR{caret} () = and set (b) = swallowResourceText <- b // END BOILERPLATE """ - let context = { context with Names = [""] } // Override the context to get the extra symbols + let context = { context with Names = [""] } // Override the context to get the extra symbols let symbols = checkResults.GetSymbolUses(context) |> List.map _.Symbol match symbols with | [ :? FSharpMemberOrFunctionOrValue as cctor @@ -770,7 +770,7 @@ type Foo() = Assert.True mfv.IsPropertySetterMethod assertRange (6, 16) (6, 21) mfv.SignatureLocation.Value | symbols -> failwith $"Unexpected symbols, got %A{symbols}" - + [] let ``Property with set/get has property symbol`` () = let symbolUses = Checker.getSymbolUses """ @@ -1123,7 +1123,7 @@ let f (x: {| A: int |}) = | _ -> false) Assert.Equal(2, getSymbolUses.Length) - + [] let ``Anonymous anon record copy-and-update symbols usage`` () = let _, checkResults = getParseAndCheckResults """ @@ -1140,7 +1140,7 @@ let f (x: {| A: int |}) = | _ -> false) Assert.Equal(2, getSymbolUses.Length) - + [] let ``Anonymous record copy-and-update symbols usages`` () = let _, checkResults = getParseAndCheckResults """ @@ -1159,7 +1159,7 @@ let f (r: {| A: int; C: int |}) = | _ -> false) Assert.Equal(4, getSymbolUses.Length) - + [] let ``Anonymous anon record copy-and-update symbols usages`` () = let _, checkResults = getParseAndCheckResults """ @@ -1401,7 +1401,7 @@ type T() = ) Assert.False hasPropertySymbols - + [] let ``CLIEvent is recognized as event`` () = let symbolUse = Checker.getSymbolUse """ @@ -1610,7 +1610,7 @@ let f (x: byref) = x <- 42 $"Expected parameter TypeDefinition.IsByRef = true for byref, got entity: %s{paramTy.TypeDefinition.DisplayName}" ) | symbol -> failwith $"Expected FSharpMemberOrFunctionOrValue but got %A{symbol}" - + module OperatorsWithDots = // https://github.com/dotnet/fsharp/issues/14057 [] diff --git a/tests/FSharp.Compiler.Service.Tests/TokenizerTests.fs b/tests/FSharp.Compiler.Service.Tests/TokenizerTests.fs index 566dc150ce7..805a159c8f4 100644 --- a/tests/FSharp.Compiler.Service.Tests/TokenizerTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TokenizerTests.fs @@ -12,7 +12,7 @@ let rec parseLine(line: string, state: FSharpTokenizerLexState ref, tokenizer: F yield str, tok state.Value <- nstate yield! parseLine(line, state, tokenizer) - | None, nstate -> + | None, nstate -> state.Value <- nstate } let tokenizeLines (lines:string[]) = @@ -36,15 +36,15 @@ let scanTokens (defines: string list) (source: string) = [] let ``Tokenizer test - simple let with string``() = - let tokenizedLines = + let tokenizedLines = tokenizeLines [| "// Sets the hello world variable" "let hello = \"Hello world\" " |] - let actual = + let actual = [ for lineNo, lineToks in tokenizedLines do yield lineNo, [ for str, info in lineToks do yield info.TokenName, str ] ] - let expected = + let expected = [(0, [("LINE_COMMENT", "//"); ("LINE_COMMENT", " "); ("LINE_COMMENT", "Sets"); ("LINE_COMMENT", " "); ("LINE_COMMENT", "the"); ("LINE_COMMENT", " "); @@ -57,14 +57,14 @@ let ``Tokenizer test - simple let with string``() = ("STRING_TEXT", "\""); ("STRING_TEXT", "Hello"); ("STRING_TEXT", " "); ("STRING_TEXT", "world"); ("STRING", "\""); ("WHITESPACE", " ")])] - if actual <> expected then + if actual <> expected then printfn "actual = %A" actual printfn "expected = %A" expected actual |> Assert.shouldBeEqualWith expected (sprintf "actual and expected did not match,actual =\n%A\nexpected=\n%A\n" actual expected) [] let ``Tokenizer test 2 - single line non-nested string interpolation``() = - let tokenizedLines = + let tokenizedLines = tokenizeLines [| "// Tests tokenizing string interpolation" "let hello0 = $\"\"" @@ -74,10 +74,10 @@ let ``Tokenizer test 2 - single line non-nested string interpolation``() = "let hello1v = @$\"Hello world\" " "let hello2v = @$\"Hello world {1+1} = {2}\" " |] - let actual = + let actual = [ for lineNo, lineToks in tokenizedLines do yield lineNo, [ for str, info in lineToks do yield info.TokenName, str ] ] - let expected = + let expected = [(0, [("LINE_COMMENT", "//"); ("LINE_COMMENT", " "); ("LINE_COMMENT", "Tests"); ("LINE_COMMENT", " "); ("LINE_COMMENT", "tokenizing"); ("LINE_COMMENT", " "); @@ -121,23 +121,23 @@ let ``Tokenizer test 2 - single line non-nested string interpolation``() = ("STRING_TEXT", "="); ("STRING_TEXT", " "); ("INTERP_STRING_PART", "{"); ("INT32", "2"); ("STRING_TEXT", "}"); ("INTERP_STRING_END", "\""); ("WHITESPACE", " ")]);] - - if actual <> expected then + + if actual <> expected then printfn "actual = %A" actual printfn "expected = %A" expected actual |> Assert.shouldBeEqualWith expected (sprintf "actual and expected did not match,actual =\n%A\nexpected=\n%A\n" actual expected) [] let ``Tokenizer test - multiline non-nested string interpolation``() = - let tokenizedLines = + let tokenizedLines = tokenizeLines [| "let hello1t = $\"\"\"abc {1+" " 1} def\"\"\"" |] - let actual = + let actual = [ for lineNo, lineToks in tokenizedLines do yield lineNo, [ for str, info in lineToks do yield info.TokenName, str ] ] - let expected = + let expected = [(0, [("LET", "let"); ("WHITESPACE", " "); ("IDENT", "hello1t"); ("WHITESPACE", " "); ("EQUALS", "="); ("WHITESPACE", " "); @@ -146,8 +146,8 @@ let ``Tokenizer test - multiline non-nested string interpolation``() = (1, [("WHITESPACE", " "); ("INT32", "1"); ("STRING_TEXT", "}"); ("STRING_TEXT", " "); ("STRING_TEXT", "def"); ("INTERP_STRING_END", "\"\"\"")])] - - if actual <> expected then + + if actual <> expected then printfn "actual = %A" actual printfn "expected = %A" expected actual |> Assert.shouldBeEqualWith expected (sprintf "actual and expected did not match,actual =\n%A\nexpected=\n%A\n" actual expected) @@ -155,7 +155,7 @@ let ``Tokenizer test - multiline non-nested string interpolation``() = [] // checks nested '{' and nested single-quote strings let ``Tokenizer test - multi-line nested string interpolation``() = - let tokenizedLines = + let tokenizedLines = tokenizeLines [| "let hello1t = $\"\"\"abc {\"a\" + " " { " @@ -163,10 +163,10 @@ let ``Tokenizer test - multi-line nested string interpolation``() = " }.contents " " } def\"\"\"" |] - let actual = + let actual = [ for lineNo, lineToks in tokenizedLines do yield lineNo, [ for str, info in lineToks do yield info.TokenName, str ] ] - let expected = + let expected = [(0, [("LET", "let"); ("WHITESPACE", " "); ("IDENT", "hello1t"); ("WHITESPACE", " "); ("EQUALS", "="); ("WHITESPACE", " "); @@ -188,22 +188,22 @@ let ``Tokenizer test - multi-line nested string interpolation``() = (4, [("WHITESPACE", " "); ("STRING_TEXT", "}"); ("STRING_TEXT", " "); ("STRING_TEXT", "def"); ("INTERP_STRING_END", "\"\"\"")])] - - if actual <> expected then + + if actual <> expected then printfn "actual = %A" actual printfn "expected = %A" expected actual |> Assert.shouldBeEqualWith expected (sprintf "actual and expected did not match,actual =\n%A\nexpected=\n%A\n" actual expected) [] let ``Tokenizer test - single-line nested string interpolation``() = - let tokenizedLines = + let tokenizedLines = tokenizeLines [| " $\"abc { { contents = 1 } }\" " |] - let actual = + let actual = [ for lineNo, lineToks in tokenizedLines do yield lineNo, [ for str, info in lineToks do yield info.TokenName, str ] ] - let expected = + let expected = [(0, [("WHITESPACE", " "); ("STRING_TEXT", "$\""); ("STRING_TEXT", "abc"); ("STRING_TEXT", " "); ("INTERP_STRING_BEGIN_PART", "{"); ("WHITESPACE", " "); @@ -211,8 +211,8 @@ let ``Tokenizer test - single-line nested string interpolation``() = ("WHITESPACE", " "); ("EQUALS", "="); ("WHITESPACE", " "); ("INT32", "1"); ("WHITESPACE", " "); ("RBRACE", "}"); ("WHITESPACE", " "); ("STRING_TEXT", "}"); ("INTERP_STRING_END", "\""); ("WHITESPACE", " ")])] - - if actual <> expected then + + if actual <> expected then printfn "actual = %A" actual printfn "expected = %A" expected actual |> Assert.shouldBeEqualWith expected (sprintf "actual and expected did not match,actual =\n%A\nexpected=\n%A\n" actual expected) @@ -291,7 +291,7 @@ let ``Tokenizer test - optional parameters with question mark``() = let actual = [ for lineNo, lineToks in tokenizedLines do yield lineNo, [ for str, info in lineToks do yield info.TokenName, str ] ] - + let expected = [(0, [("MEMBER", "member"); ("WHITESPACE", " "); ("UNDERSCORE", "_"); ("DOT", "."); @@ -299,7 +299,7 @@ let ``Tokenizer test - optional parameters with question mark``() = ("IDENT", "optional"); ("COLON", ":"); ("IDENT", "string"); ("RPAREN", ")"); ("WHITESPACE", " "); ("EQUALS", "="); ("WHITESPACE", " "); ("IDENT", "optional")])] - + if actual <> expected then printfn "actual = %A" actual printfn "expected = %A" expected diff --git a/tests/FSharp.Compiler.Service.Tests/Tooltip/TooltipTests.Types.fs b/tests/FSharp.Compiler.Service.Tests/Tooltip/TooltipTests.Types.fs index 1a669b7980b..c7b1b470f89 100644 --- a/tests/FSharp.Compiler.Service.Tests/Tooltip/TooltipTests.Types.fs +++ b/tests/FSharp.Compiler.Service.Tests/Tooltip/TooltipTests.Types.fs @@ -50,7 +50,7 @@ let ``QuickInfoForTypesWithHiddenRepresentation`` () = // on netstandard2.0, Await doesn't have ValueTask overloads |> _.Replace("static member Await: task: Task<'T> -> Async<'T> + 3 overloads", "static member Await: task: Task<'T> -> Async<'T> + 1 overload") -#endif +#endif assertTooltipContainsInOrder [ signatureListing; "Full name: Microsoft.FSharp.Control.Async" ] (markAtEndOfMarker "let x = Async.AsBeginEnd\n1" "Asyn") diff --git a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs index 14d0b7adb90..8144f93bf50 100644 --- a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs @@ -67,7 +67,7 @@ let bar{caret} a b = a - b """ testXmlDocFallbackToSigFileWhileInImplFile sigSource implSource "Comment" - + [] let ``Display XML doc of signature file for partial AP if implementation doesn't have one`` () = @@ -87,7 +87,7 @@ let (|IsThr{caret}ee|_|) x = if x = 3 then Some x else None """ testXmlDocFallbackToSigFileWhileInImplFile sigSource implSource "Comment" - + [] let ``Display XML doc of signature file for DU if implementation doesn't have one`` () = @@ -100,7 +100,7 @@ type Bar = | Case1 of int * string | Case2 of string """ - + let implSource = """ module Foo @@ -197,7 +197,7 @@ type Bar = new: unit -> Bar member Foo: string """ - + let implSource = """ module Foo @@ -244,7 +244,7 @@ module Foo val a: int """ - + let implSource = """ module Fo{caret}o @@ -258,7 +258,7 @@ let a = 23 let testToolTipSquashing source = let context = Checker.getResolveContext source let files = Map.ofArray [| "A.fs", SourceText.ofString context.Source |] - + let documentSource fileName = Map.tryFind fileName files |> async.Return let projectOptions = @@ -423,7 +423,7 @@ let exists() = System.IO.Path.Exist{caret}s(null:string) """ |> assertAndGetSingleToolTipText |> Assert.shouldBeEquivalentTo "System.IO.Path.Exists([] path: string | null) : bool" - + [] let ``Should display xml doc on a nullable BLC method`` () = Checker.getTooltipWithOptions [|"--checknulls+";"--langversion:preview"|] """ @@ -438,7 +438,7 @@ let exists() = System.IO.Path.Exi{caret}sts(null:string) | FSharpXmlDoc.FromXmlFile (_dll,sigPath) -> sigPath |> Assert.shouldBeEquivalentTo "M:System.IO.Path.Exists(System.String)" | _ -> failwith $"Xml wrong type %A{xml}" - + [] let ``Should display xml doc on fsharp hosted nullable function`` () = Checker.getTooltipWithOptions [|"--checknulls+";"--langversion:preview"|] """ @@ -455,7 +455,7 @@ let exists() = myFu{caret}nc(null) | FSharpXmlDoc.FromXmlText t -> t.UnprocessedLines |> Assert.shouldBeEquivalentTo [|" This is a xml doc above myFunc"|] | _ -> failwith $"xml was %A{xml}" - text |> Assert.shouldBeEquivalentTo "val myFunc: x: (string | null) -> string | null" + text |> Assert.shouldBeEquivalentTo "val myFunc: x: (string | null) -> string | null" remarks |> Assert.shouldBeEquivalentTo (Some "Full name: Foo.myFunc") @@ -471,7 +471,7 @@ let getPath() = System.IO.Path.GetFile{caret}Name(null:string) System.IO.Path.GetFileName(path: string | null) : string | null""" |> normalize) [] -let ``Should display nullable Csharp code analysis annotations on TryParse pattern`` () = +let ``Should display nullable Csharp code analysis annotations on TryParse pattern`` () = Checker.getTooltipWithOptions [|"--checknulls+";"--langversion:preview"|] """ module Foo @@ -481,7 +481,7 @@ let success,version = System.Version.TryPar{caret}se(null) |> Assert.shouldBeEquivalentTo """System.Version.TryParse([] input: string | null, [] result: byref) : bool""" [] -let ``Display with nullable annotations can be squashed`` () = +let ``Display with nullable annotations can be squashed`` () = Checker.getTooltipWithOptions [|"--checknulls+";"--langversion:preview"|] """ module Foo @@ -489,9 +489,9 @@ let success,version = System.Version.Try{caret}Parse(null) """ |> assertAndGetSingleToolTipText |> Assert.shouldBeEquivalentTo ("""System.Version.TryParse([] input: string | null, [] result: byref) : bool""" |> normalize) - + [] -let ``Allows ref struct is shown on BCL interface declaration`` () = +let ``Allows ref struct is shown on BCL interface declaration`` () = Checker.getTooltipWithOptions [|"--checknulls+";"--langversion:preview"|] """ module Foo @@ -500,9 +500,9 @@ let myAction : Acti{caret}on | null = null """ |> assertAndGetSingleToolTipText |> Assert.shouldStartWith ("""type Action<'T (allows ref struct)>""" |> normalize) - + [] -let ``Allows ref struct is shown for each T on BCL interface declaration`` () = +let ``Allows ref struct is shown for each T on BCL interface declaration`` () = Checker.getTooltipWithOptions [|"--checknulls+";"--langversion:preview"|] """ module Foo @@ -511,7 +511,7 @@ let myAction : Acti{caret}on | null = null """ |> assertAndGetSingleToolTipText |> Assert.shouldStartWith ("""type Action<'T1,'T2,'T3,'T4 (allows ref struct and allows ref struct and allows ref struct and allows ref struct)>""" |> normalize) - + [] let ``Allows ref struct is shown on BCL method usage`` () = Checker.getTooltip """ @@ -523,9 +523,9 @@ let doIt (dict:Dictionary<'a,'b>) = dict.GetAltern{caret}ateLookup<'a,'b,ReadOnl """ |> assertAndGetSingleToolTipText |> Assert.shouldContain ("""'TAlternateKey (allows ref struct)""" |> normalize) - + [] -let ``Allows ref struct is not shown on BCL interface usage`` () = +let ``Allows ref struct is not shown on BCL interface usage`` () = Checker.getTooltip """ module Foo diff --git a/tests/FSharp.Compiler.Service.Tests/VisualStudioVersusConsoleContextTests.fs b/tests/FSharp.Compiler.Service.Tests/VisualStudioVersusConsoleContextTests.fs index 229e2a62bf5..e3146153517 100644 --- a/tests/FSharp.Compiler.Service.Tests/VisualStudioVersusConsoleContextTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/VisualStudioVersusConsoleContextTests.fs @@ -13,7 +13,7 @@ let private getOptionsFromOptionBlocks blocks = match block with | PublicOptions (_, opts) -> opts | PrivateOptions opts -> opts - + List.collect GetOptionsOfBlock blocks [] // controls https://github.com/dotnet/fsharp/issues/13549 @@ -26,14 +26,14 @@ let ``Console-only options are filtered out for fsc in the VS context`` () = // this is a very whitebox testing but arguably better than nothing Assert.False( - options - |> List.exists (function + options + |> List.exists (function | CompilerOption (_, _, OptionConsoleOnly _, _, _) -> true | _ -> false)) - + // and a couple of shots in the dark Assert.False( - options + options |> List.exists (function // ignore deprecated options // one of them actually allows specifying the compiler version @@ -41,6 +41,6 @@ let ``Console-only options are filtered out for fsc in the VS context`` () = | _ -> false)) Assert.False( - options - |> List.exists (function + options + |> List.exists (function | CompilerOption (name, _, _, _, _) -> name = "help")) diff --git a/tests/FSharp.Compiler.Service.Tests/WarnScopeTests.fs b/tests/FSharp.Compiler.Service.Tests/WarnScopeTests.fs index 74712103faa..61984538e52 100644 --- a/tests/FSharp.Compiler.Service.Tests/WarnScopeTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/WarnScopeTests.fs @@ -15,9 +15,9 @@ module N.M #nowarn "40" let rec f = new System.EventHandler(fun _ _ -> f.Invoke(null,null)) """ - + let createOptions() = createProjectOptions [fileSource1] [] - + [] let ``Test NoWarn HashDirective`` () = let options = ProjectForNoWarnHashDirective.createOptions() @@ -34,7 +34,7 @@ module N.M #nowarn 0xy () """ - + [] let ``RegressionTestForMissingParseError(TransparentCompiler)`` () = let options = createProjectOptions [sourceForParseError] [] @@ -122,7 +122,7 @@ let ParseAndCheckProjectTest langVersion = let options, checker = mkProjectOptionsAndChecker langVersion let wholeProjectResults = checker.ParseAndCheckProject(options) |> Async.RunSynchronouslyImmediate checkDiagnostics onOffTest.errors[langVersion] (Array.toList wholeProjectResults.Diagnostics) - + [] [] [] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/ComparersRegression.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/ComparersRegression.fs index a8e42790090..2d6ce671b0e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/ComparersRegression.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/ComparersRegression.fs @@ -4,7 +4,7 @@ namespace FSharp.Core.UnitTests open System -open System.Numerics +open System.Numerics open FSharp.Core.UnitTests.LibraryTestFx open Xunit @@ -96,11 +96,11 @@ module ComparersRegression = type TestType = bool let Values : TestType array = [| true; false|] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -133,11 +133,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Bools.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -172,11 +172,11 @@ module ComparersRegression = type TestType = sbyte let Values : TestType array = [| SByte.MinValue; SByte.MaxValue; -1y; 0y; +1y |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -211,11 +211,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables SBytes.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -250,11 +250,11 @@ module ComparersRegression = type TestType = int16 let Values : TestType array = [| Int16.MaxValue; Int16.MaxValue; -1s; 0s; +1s |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -289,11 +289,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Int16s.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -328,11 +328,11 @@ module ComparersRegression = type TestType = int32 let Values : TestType array = [| Int32.MinValue; Int32.MaxValue; -1; 0; +1 |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -367,11 +367,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Int32s.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -406,11 +406,11 @@ module ComparersRegression = type TestType = int64 let Values : TestType array = [| Int64.MinValue; Int64.MaxValue; -1L; 0L; +1L |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -445,11 +445,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Int64s.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -484,11 +484,11 @@ module ComparersRegression = type TestType = nativeint let Values : TestType array = [| -1n; 0n; +1n |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -523,11 +523,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables NativeInts.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -562,11 +562,11 @@ module ComparersRegression = type TestType = byte let Values : TestType array = [| Byte.MinValue; Byte.MaxValue; 0uy; 1uy; 2uy |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -601,11 +601,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Bytes.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -640,11 +640,11 @@ module ComparersRegression = type TestType = uint16 let Values : TestType array = [| UInt16.MinValue; UInt16.MaxValue; 0us; 1us; 2us |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -679,11 +679,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Uint16s.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -718,11 +718,11 @@ module ComparersRegression = type TestType = uint32 let Values : TestType array = [| UInt32.MinValue; UInt32.MaxValue; 0u; 1u; 2u|] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -757,11 +757,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables UInt32s.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -796,11 +796,11 @@ module ComparersRegression = type TestType = uint64 let Values : TestType array = [| UInt64.MinValue; UInt64.MaxValue; 0UL; 1UL; 2UL|] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -835,11 +835,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables UInt64s.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -874,11 +874,11 @@ module ComparersRegression = type TestType = unativeint let Values : TestType array = [| 0un; 1un; 2un |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -913,11 +913,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables UNativeInts.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -952,11 +952,11 @@ module ComparersRegression = type TestType = char let Values : TestType array = [| Char.MinValue; Char.MaxValue; '0'; '1'; '2' |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -991,11 +991,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Chars.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1030,11 +1030,11 @@ module ComparersRegression = type TestType = string let Values : TestType array = [| null; String.Empty; "Hello, world!"; String('\u0000', 3); "\u0061\u030a"; "\u00e5" |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1069,11 +1069,11 @@ module ComparersRegression = type TestType = decimal let Values : TestType array = [| Decimal.MinValue; Decimal.MaxValue; Decimal.MinusOne; Decimal.Zero; Decimal.One |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1108,11 +1108,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Decimals.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1147,11 +1147,11 @@ module ComparersRegression = type TestType = float let Values : TestType array = [| Double.MinValue; Double.MaxValue; Double.Epsilon; Double.NaN; Double.NegativeInfinity; Double.PositiveInfinity; -1.; 0.; 1. |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1186,11 +1186,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Floats.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1225,11 +1225,11 @@ module ComparersRegression = type TestType = float32 let Values : TestType array = [| Single.MinValue; Single.MaxValue; Single.Epsilon; Single.NaN; Single.NegativeInfinity; Single.PositiveInfinity; -1.f; 0.f; 1.f |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1264,11 +1264,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables Float32s.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1303,11 +1303,11 @@ module ComparersRegression = type TestType = System.DateTime let Values : TestType array = [| DateTime.MinValue; DateTime.MaxValue; DateTime(2015, 10, 8, 5, 39, 23) |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1342,11 +1342,11 @@ module ComparersRegression = type TestType = Nullable let Values : TestType array = createNullables DateTimes.Values - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1381,11 +1381,11 @@ module ComparersRegression = type TestType = float*float let Values : TestType array = [| (nan, nan); (nan, 0.0); (0.0, nan); (0.0, 0.0) |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1421,11 +1421,11 @@ module ComparersRegression = let Values : TestType array = [| (nan, nan, nan); (nan, nan, 0.0); (nan, 0.0, nan); (nan, 0.0, 0.0); (0.0, nan, nan); (0.0, nan, 0.0); (0.0, 0.0, nan); (0.0, 0.0, 0.0) |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1465,11 +1465,11 @@ module ComparersRegression = (0.0, nan, nan, nan); (0.0, nan, nan, 0.0); (0.0, nan, 0.0, nan); (0.0, nan, 0.0, 0.0); (0.0, 0.0, nan, nan); (0.0, 0.0, nan, 0.0); (0.0, 0.0, 0.0, nan); (0.0, 0.0, 0.0, 0.0); |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1513,11 +1513,11 @@ module ComparersRegression = (0.0, 0.0, nan, nan, nan); (0.0, 0.0, nan, nan, 0.0); (0.0, 0.0, nan, 0.0, nan); (0.0, 0.0, nan, 0.0, 0.0); (0.0, 0.0, 0.0, nan, nan); (0.0, 0.0, 0.0, nan, 0.0); (0.0, 0.0, 0.0, 0.0, nan); (0.0, 0.0, 0.0, 0.0, 0.0); |] - + type RefType = { Item : TestType } - + [] type ValueType = val Item : TestType @@ -1557,7 +1557,7 @@ module ComparersRegression = for i = 0 to items.Length-1 do for j = 0 to items.Length-1 do let index = i * items.Length + j - let lhs = items.[i] + let lhs = items.[i] let rhs = items.[j] let result = f.Exec lhs rhs @@ -1588,7 +1588,7 @@ module ComparersRegression = member inline _.greater_or_equal = { new IOperation<'a> with member _.Exec lhs rhs = toint (lhs >= rhs) } type NoninlinableEqualityOperations<'a when 'a : equality>() = - let operations = + let operations = let underlyingType = typedefof>.MakeGenericType [| typeof<'a> |] match System.Activator.CreateInstance underlyingType with | :? EqualityOperations<'a> as operations -> operations @@ -1599,7 +1599,7 @@ module ComparersRegression = member _.not_equal = operations.not_equal type NoninlinableComparisonOperations<'a when 'a : comparison>() = - let operations = + let operations = let underlyingType = typedefof>.MakeGenericType [| typeof<'a> |] match System.Activator.CreateInstance underlyingType with | :? ComparisonOperations<'a> as operations -> operations @@ -1624,11 +1624,11 @@ module ComparersRegression = type C<'a when 'a : comparison>() = static let inlinable = ComparisonOperations<'a> () static let noninlinable = NoninlinableComparisonOperations<'a> () - + static member I = inlinable static member N = noninlinable - module TestGenerationMethods = + module TestGenerationMethods = let create<'a,'b when 'b : equality> name operation (f:IOperation<'a>) (items: 'a array) = printf """ [] member _.``%s %s``() = @@ -1636,7 +1636,7 @@ module ComparersRegression = make_result_set f items None |> Seq.iteri (fun n result -> - if n = 0 + if n = 0 then printf "[|" else printf ";" if n % 40 = 0 then printf "\n " diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/DiscriminatedUnionType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/DiscriminatedUnionType.fs index 3d493dee4cf..2f1f3e2eb73 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/DiscriminatedUnionType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/DiscriminatedUnionType.fs @@ -11,67 +11,67 @@ open Xunit open FsCheck open FsCheck.PropOperators -type EnumUnion = +type EnumUnion = | A | B -type UseUnionsAsEnums() = +type UseUnionsAsEnums() = [] - member this.CanCompare() = + member this.CanCompare() = Assert.AreEqual(EnumUnion.B, EnumUnion.B) Assert.AreNotEqual(EnumUnion.A, EnumUnion.B) [] -type FlagsUnion = +type FlagsUnion = | One = 1 | Two = 2 | Four = 4 -type UseUnionsAsFlags() = - +type UseUnionsAsFlags() = + [] - member this.CanCompareWithInts() = + member this.CanCompareWithInts() = Assert.AreEqual(int FlagsUnion.One, 1) Assert.AreEqual(int FlagsUnion.Two, 2) Assert.AreEqual(int FlagsUnion.Four, 4) - + [] - member this.CanCastFromInts() = + member this.CanCastFromInts() = let four : FlagsUnion = enum 4 Assert.AreEqual(four, FlagsUnion.Four) - + [] - member this.CanCreateValuesWithoutName() = + member this.CanCreateValuesWithoutName() = let unknown : FlagsUnion = enum 99 // strange, but valid Assert.AreEqual(int unknown, 99) - + [] - member this.CanParseViaBCL() = + member this.CanParseViaBCL() = let values = System.Enum.GetValues(typeof) let fourFromString = System.Enum.Parse(typeof, "Four", false) :?> FlagsUnion // downcast needed Assert.AreEqual(fourFromString, FlagsUnion.Four) - + [] - member this.CanUseBinaryOr() = + member this.CanUseBinaryOr() = Assert.AreEqual(int (FlagsUnion.One ||| FlagsUnion.Two), 3) Assert.AreEqual(int (FlagsUnion.One ||| FlagsUnion.One), 1) - + [] - member this.CanCompareWithFlags() = + member this.CanCompareWithFlags() = Assert.AreEqual(FlagsUnion.Two, FlagsUnion.Two) Assert.AreNotEqual(FlagsUnion.Two, FlagsUnion.One) -type UnionsWithData = +type UnionsWithData = | Alpha of int | Beta of string * float -type UseUnionsWithData() = +type UseUnionsWithData() = let a1 = Alpha 1 let a2 = Alpha 2 let b1 = Beta("win", 8.1) - + [] - member this.CanAccessTheData() = + member this.CanAccessTheData() = match a1 with | Alpha 1 -> () | _ -> Assert.Fail() @@ -85,13 +85,13 @@ type UseUnionsWithData() = | Beta("win", 8.1) -> () | _ -> Assert.Fail() match b1 with - | Beta(x, y) -> + | Beta(x, y) -> Assert.AreEqual(x, "win") Assert.AreEqual(y, 8.1) | _ -> Assert.Fail() - + [] - member this.CanAccessTheDataInGuards() = + member this.CanAccessTheDataInGuards() = match a1 with | Alpha x when x = 1 -> () | _ -> Assert.Fail() @@ -105,7 +105,7 @@ type StructUnion = SU of C : int * D : int [] [] type ComparisonStructUnion = - | SU2 of int * int + | SU2 of int * int member x.C1 = (match x with SU2(a,b) -> a) member x.C2 = (match x with SU2(a,b) -> b) override self.Equals other = @@ -156,9 +156,9 @@ type UnionsFSCheckTests () = let sr1 = SU(i1, i2) (match sr1 with | SU(c,d) when c = i1 && d = i2 -> true - | _ -> false) + | _ -> false) |@ "with pattern match on struct union" .&. - (sr1 |> function + (sr1 |> function | SU(c,d) when c = i1 && d = i2 -> true | _ -> false) |@ "function pattern match on struct union" @@ -188,12 +188,12 @@ type UnionsFSCheckTests () = fun (i1:int) (i2:int) -> let sr1 = SU2(i1,i2) let sr2 = SU2(i1,i2) - (sr1.Equals sr2) + (sr1.Equals sr2) [] member _.``struct unions support []`` () = Check.QuickThrowOnFailure <| - fun (i1:int) (i2:int) (k1:int) (k2:int) -> + fun (i1:int) (i2:int) (k1:int) (k2:int) -> let sr1 = SU2(i1,i2) let sr2 = SU2(k1,k2) if sr1 > sr2 then compare sr1 sr2 = 1 @@ -220,7 +220,7 @@ type UnionsFSCheckTests () = let case = cases.[0] Assert.AreEqual ("SU", case.Name) - + let structUnion = Microsoft.FSharp.Reflection.FSharpValue.MakeUnion (case, [|box 1234; box 3456|]) Assert.True (structUnion.GetType().IsValueType) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs index b68336b3064..3cbf586831a 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs @@ -21,62 +21,62 @@ Make sure each method works on: type Array2Module() = - let shouldBeEmpty arr = - if Array2D.length2 arr <> 0 - && Array2D.length1 arr <> 0 then + let shouldBeEmpty arr = + if Array2D.length2 arr <> 0 + && Array2D.length1 arr <> 0 then Assert.Fail("Array2D is not empty.") [] member this.Base1() = - // integer array - let intArr = + // integer array + let intArr = Array2D.init 2 10 - (fun i j -> - let arg = (System.Math.PI / 10.0) * float j + (fun i j -> + let arg = (System.Math.PI / 10.0) * float j if i = 0 then System.Math.Sin(arg) else System.Math.Cos(arg)) let resultInt = Array2D.base1 intArr if resultInt <> 0 then Assert.Fail() - // string array - let strArr = Array2D.createBased 0 0 2 3 "goodboy" + // string array + let strArr = Array2D.createBased 0 0 2 3 "goodboy" let resultStr = Array2D.base1 strArr if resultStr <> 0 then Assert.Fail() - // empty array + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.base1 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsNullRefException (fun () -> Array2D.base1 nullArr |> ignore) - + let nullArr = null:string[,] + CheckThrowsNullRefException (fun () -> Array2D.base1 nullArr |> ignore) + () [] member this.Base2() = - // integer array - let intArr = + // integer array + let intArr = Array2D.init 2 10 - (fun i j -> - let arg = (System.Math.PI / 10.0) * float j + (fun i j -> + let arg = (System.Math.PI / 10.0) * float j if i = 0 then System.Math.Sin(arg) else System.Math.Cos(arg)) let resultInt = Array2D.base2 intArr if resultInt <> 0 then Assert.Fail() - - // string array - let strArr = Array2D.createBased 0 0 2 3 "goodboy" + + // string array + let strArr = Array2D.createBased 0 0 2 3 "goodboy" let resultStr = Array2D.base2 strArr if resultStr <> 0 then Assert.Fail() - // empty array + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.base2 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsNullRefException (fun () -> Array2D.base2 nullArr |> ignore) + let nullArr = null:string[,] + CheckThrowsNullRefException (fun () -> Array2D.base2 nullArr |> ignore) // Verify printing format of non-zero based arrays let v : int[,] = Array2D.createBased 10 1 3 4 2 @@ -87,48 +87,48 @@ type Array2Module() = [] member this.Blit() = - // integer array - let intArr = + // integer array + let intArr = Array2D.init 2 3 (fun i j -> - let arg = (System.Math.PI / 10.0) * float j + let arg = (System.Math.PI / 10.0) * float j if i = 0 then System.Math.Sin(arg) else System.Math.Cos(arg)) let intArr2 = Array2D.create 2 3 8.8 let resultInt = Array2D.blit intArr 0 0 intArr2 0 0 2 2 if intArr2.[1,1] <> 0.95105651629515353 then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 3 (fun i j -> i.ToString() + "-" + j.ToString()) - let strArr2 = Array2D.create 2 3 "" + let strArr2 = Array2D.create 2 3 "" let resultStr = Array2D.blit strArr 0 0 strArr2 0 0 2 3 if strArr2.[1,1] <> "1-1" then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.create 0 0 1 let eptArr2 = Array2D.create 0 0 1 - let resultEpt = Array2D.blit eptArr 0 0 eptArr2 0 0 0 0 + let resultEpt = Array2D.blit eptArr 0 0 eptArr2 0 0 0 0 if eptArr2 <> eptArr then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsArgumentNullException (fun () -> Array2D.blit nullArr 0 0 nullArr 0 0 0 0 |> ignore) + let nullArr = null:string[,] + CheckThrowsArgumentNullException (fun () -> Array2D.blit nullArr 0 0 nullArr 0 0 0 0 |> ignore) // src1 < 0 - CheckThrowsArgumentException(fun () -> Array2D.blit intArr -1 1 intArr2 1 1 2 2 |> ignore) + CheckThrowsArgumentException(fun () -> Array2D.blit intArr -1 1 intArr2 1 1 2 2 |> ignore) // src2 < 0 - CheckThrowsArgumentException(fun () -> Array2D.blit intArr 1 -1 intArr2 1 1 2 2 |> ignore) + CheckThrowsArgumentException(fun () -> Array2D.blit intArr 1 -1 intArr2 1 1 2 2 |> ignore) // dest1 < 0 - CheckThrowsArgumentException(fun () -> Array2D.blit intArr 1 1 intArr2 -1 1 2 2 |> ignore) + CheckThrowsArgumentException(fun () -> Array2D.blit intArr 1 1 intArr2 -1 1 2 2 |> ignore) // dest2 < 0 CheckThrowsArgumentException(fun () -> Array2D.blit intArr 1 1 intArr2 1 -1 2 2 |> ignore) // src1 + len1 > Length1 src - CheckThrowsArgumentException(fun () -> Array2D.blit intArr 10 0 intArr2 0 0 2 2 |> ignore) + CheckThrowsArgumentException(fun () -> Array2D.blit intArr 10 0 intArr2 0 0 2 2 |> ignore) // src2 + len2 > Length2 src - CheckThrowsArgumentException(fun () ->Array2D.blit intArr 0 10 intArr2 0 0 2 2 |> ignore) + CheckThrowsArgumentException(fun () ->Array2D.blit intArr 0 10 intArr2 0 0 2 2 |> ignore) // dest1 + len1 > Length1 dest - CheckThrowsArgumentException(fun () -> Array2D.blit intArr 0 0 intArr2 10 0 2 2 |> ignore) + CheckThrowsArgumentException(fun () -> Array2D.blit intArr 0 0 intArr2 10 0 2 2 |> ignore) // dest2 + len2 > Length2 dest - CheckThrowsArgumentException(fun () -> Array2D.blit intArr 0 0 intArr2 0 10 2 2 |> ignore) + CheckThrowsArgumentException(fun () -> Array2D.blit intArr 0 0 intArr2 0 10 2 2 |> ignore) () [] @@ -186,85 +186,85 @@ type Array2Module() = [] member this.Copy() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) - let resultInt = Array2D.copy intArr + let resultInt = Array2D.copy intArr if resultInt <> intArr then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 3 (fun i j -> i.ToString() + "-" + j.ToString()) let resultStr = Array2D.copy strArr if resultStr <> strArr then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.copy eptArr if resultEpt <> eptArr then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsArgumentNullException (fun () -> Array2D.copy nullArr |> ignore) - - () - + let nullArr = null:string[,] + CheckThrowsArgumentNullException (fun () -> Array2D.copy nullArr |> ignore) + + () + [] member this.Create() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> 100) - let resultInt = Array2D.create 2 3 100 + let resultInt = Array2D.create 2 3 100 if resultInt <> intArr then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 3 (fun i j -> "goodboy") let resultStr = Array2D.create 2 3 "goodboy" if resultStr <> strArr then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.create 0 0 1 if resultEpt <> eptArr then Assert.Fail() - - () + + () [] member this.createBased() = - // integer array + // integer array let intArr = Array2D.create 2 3 100 let resultInt = Array2D.createBased 0 0 2 3 100 if resultInt <> intArr then Assert.Fail() - - // string array + + // string array let strArr = Array2D.create 2 3 "goodboy" let resultStr = Array2D.createBased 0 0 2 3 "goodboy" if resultStr <> strArr then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.createBased 0 0 0 0 1 if resultEpt <> eptArr then Assert.Fail() - () + () [] member this.Get() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) let resultInt = intArr.[1,1] if resultInt <> 101 then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 3 (fun i j -> i.ToString() + "-" + j.ToString()) let resultStr = strArr.[1,1] if resultStr <> "1-1" then Assert.Fail() // null array - let nullArr = null:string[,] + let nullArr = null:string[,] CheckThrowsNullRefException (fun () -> nullArr.[2,2] |> ignore) () - + [] member this.GetAndSetAPI() = let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) @@ -274,52 +274,52 @@ type Array2Module() = let resultInt = Array2D.get intArr 1 1 Assert.AreEqual(1, resultInt) () - + [] member this.Init() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) if intArr.[1,1] <> 101 then Assert.Fail() - // string array + // string array let strArr = Array2D.init 2 3 (fun i j -> i.ToString() + "-" + j.ToString()) if strArr.[1,1] <> "1-1" then Assert.Fail() - () + () [] member this.Init_Based() = - // integer array + // integer array let intArr = Array2D.initBased 1 1 2 3 (fun i j -> i*100 + j) if intArr.[2,2] <> 202 then Assert.Fail() - // string array + // string array let strArr = Array2D.initBased 1 1 2 3 (fun i j -> i.ToString() + "-" + j.ToString()) - if strArr.[2,2] <> "2-2" then Assert.Fail() - () + if strArr.[2,2] <> "2-2" then Assert.Fail() + () [] member this.Iter() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) - let mutable resultInt = 0 - let funInt (x:int) = - resultInt <- resultInt + x - () - Array2D.iter funInt intArr + let mutable resultInt = 0 + let funInt (x:int) = + resultInt <- resultInt + x + () + Array2D.iter funInt intArr if resultInt <> 306 then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 3 (fun i j -> i.ToString() + "-" + j.ToString()) let mutable resultStr = "" let funStr (x:string) = - resultStr <- resultStr + x + "," + resultStr <- resultStr + x + "," () - Array2D.iter funStr strArr + Array2D.iter funStr strArr if resultStr <> "0-0,0-1,0-2,1-0,1-1,1-2," then Assert.Fail() - + // null array - let nullArr = null:string[,] - CheckThrowsArgumentNullException (fun () -> Array2D.iter funStr nullArr |> ignore) + let nullArr = null:string[,] + CheckThrowsArgumentNullException (fun () -> Array2D.iter funStr nullArr |> ignore) () [] @@ -335,191 +335,191 @@ type Array2Module() = [] member this.Iteri() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) - let mutable resultInt = 0 - let funInt (x:int) (y:int) (z:int) = - resultInt <- resultInt + x + y + z - () - Array2D.iteri funInt intArr + let mutable resultInt = 0 + let funInt (x:int) (y:int) (z:int) = + resultInt <- resultInt + x + y + z + () + Array2D.iteri funInt intArr if resultInt <> 315 then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 3 (fun i j -> i.ToString() + "-" + j.ToString()) let mutable resultStr = "" let funStr (x:int) (y:int) (z:string) = - resultStr <- resultStr + "[" + x.ToString() + "," + y.ToString() + "]" + "=" + z + "; " + resultStr <- resultStr + "[" + x.ToString() + "," + y.ToString() + "]" + "=" + z + "; " () - Array2D.iteri funStr strArr + Array2D.iteri funStr strArr if resultStr <> "[0,0]=0-0; [0,1]=0-1; [0,2]=0-2; [1,0]=1-0; [1,1]=1-1; [1,2]=1-2; " then Assert.Fail() - + // null array - let nullArr = null:string[,] - CheckThrowsArgumentNullException (fun () -> Array2D.iteri funStr nullArr |> ignore) - - () + let nullArr = null:string[,] + CheckThrowsArgumentNullException (fun () -> Array2D.iteri funStr nullArr |> ignore) + + () [] member this.Length1() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) - let resultInt = Array2D.length1 intArr + let resultInt = Array2D.length1 intArr if resultInt <> 2 then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 10 3 (fun i j -> i.ToString() + "-" + j.ToString()) let resultStr = Array2D.length1 strArr if resultStr <> 10 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.length1 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsNullRefException (fun () -> Array2D.length1 nullArr |> ignore) - - () + let nullArr = null:string[,] + CheckThrowsNullRefException (fun () -> Array2D.length1 nullArr |> ignore) + + () [] member this.Length2() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) - let resultInt = Array2D.length2 intArr + let resultInt = Array2D.length2 intArr if resultInt <> 3 then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 8 (fun i j -> i.ToString() + "-" + j.ToString()) let resultStr = Array2D.length2 strArr if resultStr <> 8 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.length2 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsNullRefException (fun () -> Array2D.length2 nullArr |> ignore) - - () + let nullArr = null:string[,] + CheckThrowsNullRefException (fun () -> Array2D.length2 nullArr |> ignore) + + () [] member this.Map() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) let funInt x = x.ToString() - let resultInt = Array2D.map funInt intArr + let resultInt = Array2D.map funInt intArr if resultInt <> (Array2D.init 2 3 (fun i j -> (i*100 + j).ToString())) then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 3 (fun i j -> "goodboy") let funStr (x:string) = x.ToUpper() let resultStr = Array2D.map funStr strArr if resultStr <> Array2D.create 2 3 "GOODBOY" then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.map funInt eptArr if resultEpt <> Array2D.create 0 0 "" then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsArgumentNullException (fun () -> Array2D.map funStr nullArr |> ignore) - - () + let nullArr = null:string[,] + CheckThrowsArgumentNullException (fun () -> Array2D.map funStr nullArr |> ignore) + + () [] member this.Mapi() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) let funInt x y z = x+y+z - let resultInt = Array2D.mapi funInt intArr + let resultInt = Array2D.mapi funInt intArr if resultInt <> (Array2D.init 2 3 (fun i j -> i*100 + j + i + j)) then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 3 (fun i j -> "goodboy") let funStr (x:int) (y:int) (z:string) = x.ToString() + y.ToString() + z.ToUpper() let resultStr = Array2D.mapi funStr strArr if resultStr <> Array2D.init 2 3 (fun i j -> i.ToString() + j.ToString() + "GOODBOY") then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.create 0 0 1 let resultEpt = Array2D.mapi funInt eptArr if resultEpt <> Array2D.create 0 0 1 then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsArgumentNullException (fun () -> Array2D.mapi funStr nullArr |> ignore) - - () + let nullArr = null:string[,] + CheckThrowsArgumentNullException (fun () -> Array2D.mapi funStr nullArr |> ignore) + + () [] member this.Rebase() = - // integer array + // integer array let intArr = Array2D.createBased 2 3 2 3 168 - let resultInt = Array2D.rebase intArr + let resultInt = Array2D.rebase intArr if resultInt <> Array2D.createBased 0 0 2 3 168 then Assert.Fail() - - // string array + + // string array let strArr = Array2D.createBased 2 3 2 3 "gorilla" let resultStr = Array2D.rebase strArr if resultStr <> Array2D.createBased 0 0 2 3 "gorilla" then Assert.Fail() - - // empty array + + // empty array let eptArr = Array2D.createBased 2 3 0 0 1 let resultEpt = Array2D.rebase eptArr if resultEpt <> Array2D.createBased 0 0 0 0 1 then Assert.Fail() // null array - let nullArr = null:string[,] - CheckThrowsArgumentNullException (fun () -> Array2D.rebase nullArr |> ignore) - + let nullArr = null:string[,] + CheckThrowsArgumentNullException (fun () -> Array2D.rebase nullArr |> ignore) + () - + [] member this.Set() = - // integer array + // integer array let intArr = Array2D.init 2 3 (fun i j -> i*100 + j) intArr.[1,1] <- 8888 if intArr.[1,1] <> 8888 then Assert.Fail() - - // string array + + // string array let strArr = Array2D.init 2 8 (fun i j -> i.ToString() + "-" + j.ToString()) strArr.[1,1] <- "grape" if strArr.[1,1] <> "grape" then Assert.Fail() - + // null array - let nullArr = null:string[,] - CheckThrowsNullRefException (fun () -> (nullArr.[0,0] <- "") |> ignore) - - () - + let nullArr = null:string[,] + CheckThrowsNullRefException (fun () -> (nullArr.[0,0] <- "") |> ignore) + + () + [] member this.ZeroCreate() = - // integer array - let intArr = Array2D.zeroCreate 2 3 + // integer array + let intArr = Array2D.zeroCreate 2 3 if intArr <> Array2D.create 2 3 0 then Assert.Fail() - // string array + // string array let strArr = Array2D.zeroCreate 2 3 if strArr <> Array2D.create 2 3 null then Assert.Fail() - + // invalid arguments CheckThrowsArgumentException (fun () -> Array2D.zeroCreate -1 2 |> ignore) CheckThrowsArgumentException (fun () -> Array2D.zeroCreate 1 -2 |> ignore) - - () + + () // Note: This is a top level primitive, not in the Array2D module [] - member this.array2D() = + member this.array2D() = let m1 : int[,] = array2D [] if m1.GetLength(0) <> 0 then Assert.Fail() @@ -527,15 +527,15 @@ type Array2Module() = let m1arr :int[,] = array2D [||] if m1 <> m1arr then Assert.Fail() - + let m2 : int[,] = array2D [[]] if m2.GetLength(0) <> 1 then Assert.Fail() if m2.GetLength(1) <> 0 then Assert.Fail() let m2arr :int[,] = array2D [|[||]|] if m2 <> m2arr then Assert.Fail() - - + + let m3 = array2D [[1]] if m3.GetLength(0) <> 1 then Assert.Fail() if m3.GetLength(1) <> 1 then Assert.Fail() @@ -543,67 +543,67 @@ type Array2Module() = let m3arr = array2D [[1]] if m3 <> m3arr then Assert.Fail() - - let m6lislis = array2D [[1;2]; + + let m6lislis = array2D [[1;2]; [3;4]] - let m6arrarr = array2D [|[|1;2|]; + let m6arrarr = array2D [|[|1;2|]; [|3;4|]|] - let m6arrlis = array2D [|[1;2]; + let m6arrlis = array2D [|[1;2]; [3;4]|] - let m6lisarr = array2D [[|1;2|]; + let m6lisarr = array2D [[|1;2|]; [|3;4|]] if m6lislis <> m6arrarr then Assert.Fail() if m6lislis <> m6arrlis then Assert.Fail() if m6lislis <> m6lisarr then Assert.Fail() - + let m7 = array2D [for i in 0..1000 do yield [for j in 0..1000 do yield i*j] ] - let matrix :int[,] = array2D [[1;2;3]; + let matrix :int[,] = array2D [[1;2;3]; [2;3;4]] if matrix.GetLength(0) <> 2 then Assert.Fail() if matrix.GetLength(1) <> 3 then Assert.Fail() if matrix.[0,0] <> 1 then Assert.Fail() if matrix.[1,2] <> 4 then Assert.Fail() - + CheckThrowsArgumentException( fun () -> ignore (array2D [[1;2]; [2]])) CheckThrowsArgumentException( fun () -> ignore (array2D [[1;2]; [2;3]; [4]])) CheckThrowsArgumentNullException( fun () -> ignore (array2D null)) CheckThrowsArgumentException( fun () -> ignore (array2D [null])) CheckThrowsArgumentException( fun () -> ignore (array2D [[|1|];null])) - + let m16 :string[,] = array2D [[null]] if m16.[0,0] <> null then Assert.Fail() [] - member this.``Slicing with reverse index in one slice expr behaves as expected``() = + member this.``Slicing with reverse index in one slice expr behaves as expected``() = let arr = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] Assert.Equal(arr.[*, ^1..^0], arr.[*, 3..4]) [] - member this.``Slicing with reverse index in both slice expr behaves as expected``() = + member this.``Slicing with reverse index in both slice expr behaves as expected``() = let arr = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] Assert.Equal(arr.[..^1, ^1..^0], arr.[..0, 3..4]) [] - member this.``Slicing with reverse index in fixed index behaves as expected``() = + member this.``Slicing with reverse index in fixed index behaves as expected``() = let arr = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] Assert.AreEqual(arr.[^1, ^1..^0], arr.[0, 3..4]) [] - member this.``Slicing with reverse index and non reverse fixed index behaves as expected``() = + member this.``Slicing with reverse index and non reverse fixed index behaves as expected``() = let arr = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] Assert.AreEqual(arr.[1, ^1..^0], arr.[1, 3..4]) [] - member this.``Set slice with reverse index in one slice expr behaves as expected``() = + member this.``Set slice with reverse index in one slice expr behaves as expected``() = let arr1 = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] let arr2 = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] @@ -614,7 +614,7 @@ type Array2Module() = Assert.Equal(arr1, arr2) [] - member this.``Set slice with reverse index in both slice expr behaves as expected``() = + member this.``Set slice with reverse index in both slice expr behaves as expected``() = let arr1 = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] let arr2 = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] @@ -625,7 +625,7 @@ type Array2Module() = Assert.Equal(arr1, arr2) [] - member this.``Set slice with reverse index in fixed index behaves as expected``() = + member this.``Set slice with reverse index in fixed index behaves as expected``() = let arr1 = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] let arr2 = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] @@ -636,7 +636,7 @@ type Array2Module() = Assert.Equal(arr1, arr2) [] - member this.``Set slice with reverse index in and non reverse fixed index behaves as expected``() = + member this.``Set slice with reverse index in and non reverse fixed index behaves as expected``() = let arr1 = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] let arr2 = array2D [[ 1;2;3;4;5 ]; [ 5;4;3;2;1 ]] @@ -680,81 +680,81 @@ type Array2Module() = shouldEqual m1.[*,*] m1 shouldEqual m1.[0..,*] (array2D [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 10.0;20.0;30.0;40.0;50.0;60.0 |] |]) - shouldEqual m1.[1..,*] (array2D [| + shouldEqual m1.[1..,*] (array2D [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |] |]) shouldEqual m1.[..0,*] (array2D [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; |]) shouldEqual m1.[*,0..] (array2D [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; - [| 10.0;20.0;30.0;40.0;50.0;60.0 |] + [| 10.0;20.0;30.0;40.0;50.0;60.0 |] |]) shouldEqual m1.[*,1..] (array2D [| [| 2.0;3.0;4.0;5.0;6.0 |]; - [| 20.0;30.0;40.0;50.0;60.0 |] + [| 20.0;30.0;40.0;50.0;60.0 |] |]) shouldEqual m1.[*,2..] (array2D [| [| 3.0;4.0;5.0;6.0 |]; - [| 30.0;40.0;50.0;60.0 |] + [| 30.0;40.0;50.0;60.0 |] |]) shouldEqual m1.[*,3..] (array2D [| [| 4.0;5.0;6.0 |]; - [| 40.0;50.0;60.0 |] + [| 40.0;50.0;60.0 |] |]) shouldEqual m1.[*,4..] (array2D [| [| 5.0;6.0 |]; - [| 50.0;60.0 |] + [| 50.0;60.0 |] |]) shouldEqual m1.[*,5..] (array2D [| [| 6.0 |]; - [| 60.0 |] + [| 60.0 |] |]) shouldEqual m1.[*, 0] [| 1.0; 10.0 |] shouldEqual m1.[1.., 3] [| 40.0 |] shouldEqual m1.[1, *] [| 10.0;20.0;30.0;40.0;50.0;60.0 |] shouldEqual m1.[0, ..3] [| 1.0;2.0;3.0;4.0 |] - + [] - member this.SlicingUnboundedEnd() = + member this.SlicingUnboundedEnd() = let arr = array2D [ [1;2;3;4;5;6]; [6;5;4;3;2;1]] shouldEqual arr.[(-1).., *] arr shouldEqual arr.[0.., 1..] (array2D [ [2;3;4;5;6]; [5;4;3;2;1] ]) shouldEqual arr.[1.., ..3] (array2D [ [6;5;4;3] ]) - shouldBeEmpty arr.[2.., 6..] + shouldBeEmpty arr.[2.., 6..] [] - member this.SlicingUnboundedStart() = + member this.SlicingUnboundedStart() = let arr = array2D [ [1;2;3;4;5;6]; [6;5;4;3;2;1]] - shouldBeEmpty arr.[..(-1), *] + shouldBeEmpty arr.[..(-1), *] shouldEqual arr.[..0, ..4] (array2D [ [1;2;3;4;5] ]) shouldEqual arr.[..1, ..3] (array2D [ [1;2;3;4]; [6;5;4;3] ]) shouldEqual arr.[..2, ..6] arr [] - member this.SlicingOutOfBounds() = + member this.SlicingOutOfBounds() = let arr = array2D [ [1;2;3;4;5;6]; [6;5;4;3;2;1]] - + shouldEqual arr.[*, ..6] arr - shouldBeEmpty arr.[*, 6..] + shouldBeEmpty arr.[*, 6..] shouldEqual arr.[..2, *] arr - shouldBeEmpty arr.[2.., *] + shouldBeEmpty arr.[2.., *] - shouldBeEmpty arr.[1..0, *] - shouldBeEmpty arr.[1..0, (-1)..0] + shouldBeEmpty arr.[1..0, *] + shouldBeEmpty arr.[1..0, (-1)..0] - shouldBeEmpty arr.[0..(-1), *] - shouldBeEmpty arr.[1..(-1), *] - shouldBeEmpty arr.[1..0, *] + shouldBeEmpty arr.[0..(-1), *] + shouldBeEmpty arr.[1..(-1), *] + shouldBeEmpty arr.[1..0, *] shouldEqual arr.[0..6, (-1)..9] arr shouldEqual arr.[*, 1..6] (array2D [ [2;3;4;5;6]; [5;4;3;2;1] ]) - shouldEqual arr.[1, 3..1] [| |] - shouldEqual arr.[3..1, 1] [| |] - shouldEqual arr.[10.., 1] [| |] - shouldEqual arr.[1, 10..] [| |] - shouldEqual arr.[1, .. -1] [| |] - shouldEqual arr.[.. -1, 1] [| |] + shouldEqual arr.[1, 3..1] [| |] + shouldEqual arr.[3..1, 1] [| |] + shouldEqual arr.[10.., 1] [| |] + shouldEqual arr.[1, 10..] [| |] + shouldEqual arr.[1, .. -1] [| |] + shouldEqual arr.[.. -1, 1] [| |] [] - member this.SlicingMutation() = + member this.SlicingMutation() = let arr2D1 = array2D [| [| 1.; 2.; 3.; 4. |]; [| 5.; 6.; 7.; 8. |]; [| 9.; 10.; 11.; 12. |] |] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs index e8b0894ebae..c770eaae67e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs @@ -30,13 +30,13 @@ type Array3Module() = if Array3D.length3 arr <> z then Assert.Fail("Expected length3 to be " + (Array3D.length3 arr).ToString() + " but got " + x.ToString()) () - let shouldBeEmpty arr = - if Array3D.length3 arr <> 0 + let shouldBeEmpty arr = + if Array3D.length3 arr <> 0 && Array3D.length2 arr <> 0 - && Array3D.length1 arr <> 0 then + && Array3D.length1 arr <> 0 then Assert.Fail("Array3D is not empty.") - let m1 = (array3d [| + let m1 = (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; @@ -44,33 +44,33 @@ type Array3Module() = [] member this.Create() = - // integer array + // integer array let intArr = Array3D.create 3 4 5 168 if intArr.[1,2,1] <> 168 then Assert.Fail() VerifyDimensions intArr 3 4 5 - - // string array + + // string array let strArr = Array3D.create 2 3 4 "foo" if strArr.[1,2,3] <> "foo" then Assert.Fail() VerifyDimensions strArr 2 3 4 - - // empty array + + // empty array let eptArr1 = Array3D.create 0 0 0 'a' let eptArr2 = Array3D.create 0 0 0 'b' if eptArr1 <> eptArr2 then Assert.Fail() - - () - + + () + [] member this.Init() = - - // integer array + + // integer array let intArr = Array3D.init 3 3 3 (fun i j k -> i*100 + j*10 + k) if intArr.[1,1,1] <> 111 then Assert.Fail() if intArr.[2,2,2] <> 222 then Assert.Fail() VerifyDimensions intArr 3 3 3 - - // ref array + + // ref array let strArr = Array3D.init 3 3 3 (fun i j k-> (i, j, k)) if strArr.[2,0,1] <> (2, 0, 1) then Assert.Fail() if strArr.[0,1,2] <> (0, 1, 2) then Assert.Fail() @@ -79,22 +79,22 @@ type Array3Module() = [] member this.Get() = - - // integer array + + // integer array let intArr = Array3D.init 2 3 2 (fun i j k -> i*100 + j*10 + k) let resultInt = Array3D.get intArr 1 2 0 if resultInt <> 120 then Assert.Fail() - - // string array + + // string array let strArr = Array3D.init 2 3 2 (fun i j k-> i.ToString() + "-" + j.ToString() + "-" + k.ToString()) let resultStr = Array3D.get strArr 0 2 1 if resultStr <> "0-2-1" then Assert.Fail() - + CheckThrowsIndexOutRangException(fun () -> Array3D.get strArr 2 0 0 |> ignore) CheckThrowsIndexOutRangException(fun () -> Array3D.get strArr 0 3 0 |> ignore) CheckThrowsIndexOutRangException(fun () -> Array3D.get strArr 0 0 2 |> ignore) - - // empty array + + // empty array let emptyArray = Array3D.init 0 0 0 (fun i j k -> Assert.Fail()) CheckThrowsIndexOutRangException (fun () -> Array3D.get emptyArray 1 0 0 |> ignore) CheckThrowsIndexOutRangException (fun () -> Array3D.get emptyArray 0 1 0 |> ignore) @@ -102,207 +102,207 @@ type Array3Module() = // null array let nullArr : string[,,] = null - CheckThrowsNullRefException (fun () -> Array3D.get nullArr 1 1 1 |> ignore) + CheckThrowsNullRefException (fun () -> Array3D.get nullArr 1 1 1 |> ignore) () - + [] member this.Iter() = - // integer array + // integer array let intArr = Array3D.init 2 3 2 (fun i j k -> i*100 + j*10 + k) - - let mutable resultInt = 0 - let addToTotal x = resultInt <- resultInt + x - - Array3D.iter addToTotal intArr + + let mutable resultInt = 0 + let addToTotal x = resultInt <- resultInt + x + + Array3D.iter addToTotal intArr Assert.True((resultInt = 726)) - - // string array + + // string array let strArr = Array3D.init 2 3 2 (fun i j k-> i.ToString() + "-" + j.ToString() + "-" + k.ToString()) - + let mutable resultStr = "" - let addElement (x:string) = resultStr <- resultStr + x + "," + let addElement (x:string) = resultStr <- resultStr + x + "," - Array3D.iter addElement strArr + Array3D.iter addElement strArr Assert.True((resultStr = "0-0-0,0-0-1,0-1-0,0-1-1,0-2-0,0-2-1,1-0-0,1-0-1,1-1-0,1-1-1,1-2-0,1-2-1,")) - + // empty array let emptyArray = Array3D.create 0 0 0 0 Array3D.iter (fun x -> Assert.Fail()) emptyArray - + // null array let nullArr : string[,,] = null CheckThrowsArgumentNullException(fun () -> Array3D.iter (fun x -> Assert.Fail("Shouldn't be called")) nullArr) - () + () [] member this.Iteri() = - // integer array + // integer array let intArr = Array3D.init 2 3 2 (fun i j k -> i*100 + j*10 + k) - let mutable resultInt = 0 - let funInt (x:int) (y:int) (z:int) (a:int) = - resultInt <- resultInt + x + y + z + a - () - - Array3D.iteri funInt intArr + let mutable resultInt = 0 + let funInt (x:int) (y:int) (z:int) (a:int) = + resultInt <- resultInt + x + y + z + a + () + + Array3D.iteri funInt intArr if resultInt <> 750 then Assert.Fail() - - // string array + + // string array let strArr = Array3D.init 2 3 2 (fun i j k-> i.ToString() + "-" + j.ToString() + "-" + k.ToString()) let mutable resultStr = "" let funStr (x:int) (y:int) (z:int) (a:string)= - resultStr <- resultStr + "[" + x.ToString() + "," + y.ToString()+"," + z.ToString() + "]" + "=" + a + "; " + resultStr <- resultStr + "[" + x.ToString() + "," + y.ToString()+"," + z.ToString() + "]" + "=" + a + "; " () - Array3D.iteri funStr strArr + Array3D.iteri funStr strArr if resultStr <> "[0,0,0]=0-0-0; [0,0,1]=0-0-1; [0,1,0]=0-1-0; [0,1,1]=0-1-1; [0,2,0]=0-2-0; [0,2,1]=0-2-1; [1,0,0]=1-0-0; [1,0,1]=1-0-1; [1,1,0]=1-1-0; [1,1,1]=1-1-1; [1,2,0]=1-2-0; [1,2,1]=1-2-1; " then Assert.Fail() - - // empty array + + // empty array let emptyArray = Array3D.create 0 0 0 0 Array3D.iter (fun x -> Assert.Fail()) emptyArray - + // null array - let nullArr = null:string[,,] - CheckThrowsArgumentNullException (fun () -> Array3D.iteri funStr nullArr |> ignore) - () + let nullArr = null:string[,,] + CheckThrowsArgumentNullException (fun () -> Array3D.iteri funStr nullArr |> ignore) + () [] member this.Length1() = - - // integer array + + // integer array let intArr = Array3D.create 2 3 2 168 let resultInt = Array3D.length1 intArr if resultInt <> 2 then Assert.Fail() - - // string array + + // string array let strArr = Array3D.create 2 3 2 "enmity" let resultStr = Array3D.length1 strArr if resultStr <> 2 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array3D.create 0 0 0 1 let resultEpt = Array3D.length1 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[,,] - CheckThrowsNullRefException (fun () -> Array3D.length1 nullArr |> ignore) - () + let nullArr = null : string[,,] + CheckThrowsNullRefException (fun () -> Array3D.length1 nullArr |> ignore) + () [] member this.Length2() = - - // integer array + + // integer array let intArr = Array3D.create 2 3 2 168 let resultInt = Array3D.length2 intArr if resultInt <> 3 then Assert.Fail() - - // string array + + // string array let strArr = Array3D.create 2 3 2 "enmity" let resultStr = Array3D.length2 strArr if resultStr <> 3 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array3D.create 0 0 0 1 let resultEpt = Array3D.length2 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[,,] - CheckThrowsNullRefException (fun () -> Array3D.length2 nullArr |> ignore) - () + let nullArr = null : string[,,] + CheckThrowsNullRefException (fun () -> Array3D.length2 nullArr |> ignore) + () [] - member this.Length3() = - - // integer array + member this.Length3() = + + // integer array let intArr = Array3D.create 2 3 5 168 let resultInt = Array3D.length3 intArr if resultInt <> 5 then Assert.Fail() - - // string array + + // string array let strArr = Array3D.create 2 3 5 "enmity" let resultStr = Array3D.length3 strArr if resultStr <> 5 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array3D.create 0 0 0 1 let resultEpt = Array3D.length3 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[,,] - CheckThrowsNullRefException (fun () -> Array3D.length3 nullArr |> ignore) - () + let nullArr = null : string[,,] + CheckThrowsNullRefException (fun () -> Array3D.length3 nullArr |> ignore) + () [] member this.Map() = - - // integer array + + // integer array let intArr = Array3D.create 2 3 5 168 let funInt x = x.ToString() - let resultInt = Array3D.map funInt intArr + let resultInt = Array3D.map funInt intArr if resultInt <> Array3D.create 2 3 5 "168" then Assert.Fail() - - // string array + + // string array let strArr = Array3D.create 2 2 2 "value" let funStr (x:string) = x.ToUpper() - + let resultStr = Array3D.map funStr strArr resultStr |> Array3D.iter (fun x -> if x <> "VALUE" then Assert.Fail()) - - // empty array + + // empty array let eptArr = Array3D.create 0 0 0 1 let resultEpt = Array3D.map (fun x -> Assert.Fail()) eptArr // null array - let nullArr = null : string[,,] - CheckThrowsArgumentNullException (fun () -> Array3D.map funStr nullArr |> ignore) - () + let nullArr = null : string[,,] + CheckThrowsArgumentNullException (fun () -> Array3D.map funStr nullArr |> ignore) + () [] member this.Mapi() = - // integer array + // integer array let intArr = Array3D.init 2 3 2 (fun i j k -> i*100 + j*10 + k) let funInt x y z a = x+y+z+a - let resultInt = Array3D.mapi funInt intArr - if resultInt <> (Array3D.init 2 3 2(fun i j k-> i*100 + j*10 + k + i + j + k)) then + let resultInt = Array3D.mapi funInt intArr + if resultInt <> (Array3D.init 2 3 2(fun i j k-> i*100 + j*10 + k + i + j + k)) then Assert.Fail() - - // string array + + // string array let strArr = Array3D.init 2 3 2(fun i j k-> "goodboy") let funStr (x:int) (y:int) (z:int) (a:string) = x.ToString() + y.ToString() + z.ToString() + a.ToUpper() let resultStr = Array3D.mapi funStr strArr - if resultStr <> Array3D.init 2 3 2(fun i j k-> i.ToString() + j.ToString() + k.ToString() + "GOODBOY") then + if resultStr <> Array3D.init 2 3 2(fun i j k-> i.ToString() + j.ToString() + k.ToString() + "GOODBOY") then Assert.Fail() - - // empty array + + // empty array let eptArr = Array3D.create 0 0 0 1 let resultEpt = Array3D.mapi (fun i j k x -> Assert.Fail()) eptArr - + // null array - let nullArr = null : string[,,] - CheckThrowsArgumentNullException (fun () -> Array3D.mapi (fun i j k x -> Assert.Fail("shouldn't execute this")) nullArr |> ignore) - () + let nullArr = null : string[,,] + CheckThrowsArgumentNullException (fun () -> Array3D.mapi (fun i j k x -> Assert.Fail("shouldn't execute this")) nullArr |> ignore) + () [] member this.Set() = - // integer array + // integer array let intArr = Array3D.init 2 3 2(fun i j k -> i*100 + j*10 + k) - + Assert.False(intArr.[1,1,1] = -1) Array3D.set intArr 1 1 1 -1 Assert.True(intArr.[1,1,1] = -1) - // string array + // string array let strArr = Array3D.init 2 3 2 (fun i j k-> i.ToString() + "-" + j.ToString()+ "-" + k.ToString()) - + Assert.False(strArr.[1,1,1] = "custom") Array3D.set strArr 1 1 1 "custom" Assert.True(strArr.[1,1,1] = "custom") @@ -311,23 +311,23 @@ type Array3Module() = CheckThrowsIndexOutRangException(fun () -> Array3D.set strArr 2 0 0 "out of bounds") CheckThrowsIndexOutRangException(fun () -> Array3D.set strArr 0 3 0 "out of bounds") CheckThrowsIndexOutRangException(fun () -> Array3D.set strArr 0 0 2 "out of bounds") - - // empty array + + // empty array let emptArr = Array3D.create 0 0 0 'z' CheckThrowsIndexOutRangException(fun () -> Array3D.set emptArr 0 0 0 'a') // null array - let nullArr = null : string[,,] - CheckThrowsNullRefException (fun () -> Array3D.set nullArr 0 0 0 "") - () + let nullArr = null : string[,,] + CheckThrowsNullRefException (fun () -> Array3D.set nullArr 0 0 0 "") + () [] member this.ZeroCreate() = - + let intArr : int[,,] = Array3D.zeroCreate 2 3 2 - if Array3D.get intArr 1 1 1 <> 0 then + if Array3D.get intArr 1 1 1 <> 0 then Assert.Fail() - + let structArray : DateTime[,,] = Array3D.zeroCreate 1 1 1 let defaultVal = new DateTime() Assert.True(Array3D.get structArray 0 0 0 = defaultVal) @@ -337,22 +337,22 @@ type Array3Module() = for j in 0 .. 2 do for k in 0 .. 1 do Assert.AreEqual(null, strArr.[i, j, k]) - + // Test invalid values CheckThrowsArgumentException(fun () -> Array3D.zeroCreate -1 1 1 |> ignore) CheckThrowsArgumentException(fun () -> Array3D.zeroCreate 1 -1 1 |> ignore) CheckThrowsArgumentException(fun () -> Array3D.zeroCreate 1 1 -1 |> ignore) - + () [] - member this.``Slicing with reverse index in all 3 slice expr behaves as expected``() = + member this.``Slicing with reverse index in all 3 slice expr behaves as expected``() = let arr = Array3D.init 5 5 5 (fun i j k -> i*100 + j*10 + k) Assert.Equal(arr.[..^1, ^1..^0, ^2..], arr.[..3, 3..4, 2..]) [] - member this.``Set slice with reverse index in all 3 slice expr behaves as expected``() = + member this.``Set slice with reverse index in all 3 slice expr behaves as expected``() = let arr1 = Array3D.init 5 5 5 (fun i j k -> i*100 + j*10 + k) let arr2 = Array3D.init 5 5 5 (fun i j k -> i*100 + j*10 + k) @@ -364,88 +364,88 @@ type Array3Module() = Assert.Equal(arr1, arr2) [] - member this.``Indexer with reverse index in one dim behaves as expected``() = + member this.``Indexer with reverse index in one dim behaves as expected``() = let arr1 = Array3D.init 5 5 5 (fun i j k -> i*100 + j*10 + k) - + Assert.AreEqual(arr1.[^1,0,0], 300) [] - member this.``Indexer with reverse index in all dim behaves as expected``() = + member this.``Indexer with reverse index in all dim behaves as expected``() = let arr1 = Array3D.init 5 5 5 (fun i j k -> i*100 + j*10 + k) - + Assert.AreEqual(arr1.[^0,^1,^0], 434) [] - member this.``Set item with reverse index in all dims behave as expected``() = + member this.``Set item with reverse index in all dims behave as expected``() = let arr1 = Array3D.create 5 5 5 2 arr1.[^1,^0,^0] <- 9 Assert.AreEqual(arr1.[3,4,4], 9) [] - member this.SlicingBoundedStartEnd() = + member this.SlicingBoundedStartEnd() = shouldEqual m1.[*,*,*] m1 - shouldEqual m1.[0..,*,*] - (array3d [| + shouldEqual m1.[0..,*,*] + (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |]) - shouldEqual m1.[0..0,*,*] - (array3d [| + shouldEqual m1.[0..0,*,*] + (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] |]) - shouldEqual m1.[1..1,*,*] - (array3d [| + shouldEqual m1.[1..1,*,*] + (array3d [| [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] ) - shouldEqual m1.[*,1..1,*] - (array3d [| + shouldEqual m1.[*,1..1,*] + (array3d [| [| [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] ) - shouldEqual m1.[..1,*,*] - (array3d [| + shouldEqual m1.[..1,*,*] + (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] ) - shouldEqual m1.[*,0..0,*] - (array3d [| + shouldEqual m1.[*,0..0,*] + (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; |] |] ) - shouldEqual m1.[*,0..1,*] - (array3d [| + shouldEqual m1.[*,0..1,*] + (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] ) - shouldEqual m1.[*,*,0..0] - (array3d [| + shouldEqual m1.[*,*,0..0] + (array3d [| [| [| 1.0|]; [| 11.0|] |] [| [| 10.0|]; [| 100.0 |] |] |] ) - shouldEqual m1.[*,*,0..5] - (array3d [| + shouldEqual m1.[*,*,0..5] + (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] ) [] - member this.SlicingOutOfBounds() = - shouldBeEmpty m1.[*,*,7..] - shouldBeEmpty m1.[*,*,.. -1] + member this.SlicingOutOfBounds() = + shouldBeEmpty m1.[*,*,7..] + shouldBeEmpty m1.[*,*,.. -1] - shouldBeEmpty m1.[*,3..,*] + shouldBeEmpty m1.[*,3..,*] shouldBeEmpty m1.[*,.. -1,*] - shouldBeEmpty m1.[3..,*,*] - shouldBeEmpty m1.[.. -1,*,*] + shouldBeEmpty m1.[3..,*,*] + shouldBeEmpty m1.[.. -1,*,*] member this.SlicingSingleFixed1() = - let m1 = (array3d [| + let m1 = (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; @@ -455,10 +455,10 @@ type Array3Module() = m1.[0,0,*] <- newSlice Assert.AreEqual(m1.[1,0,0], 10.0) Assert.AreEqual(m1.[0,0,*], newSlice) - + [] member this.SlicingSingleFixed2() = - let m1 = (array3d [| + let m1 = (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; @@ -471,7 +471,7 @@ type Array3Module() = [] member this.SlicingSingleFixed3() = - let m1 = (array3d [| + let m1 = (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; @@ -484,7 +484,7 @@ type Array3Module() = [] member this.SlicingDoubleFixed1() = - let m1 = (array3d [| + let m1 = (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; @@ -494,10 +494,10 @@ type Array3Module() = m1.[0,*,*] <- newSlice Assert.AreEqual(m1.[1,0,0], 10.0) shouldEqual m1.[0,*,*] newSlice - + [] member this.SlicingDoubleFixed2() = - let m1 = (array3d [| + let m1 = (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; @@ -510,7 +510,7 @@ type Array3Module() = [] member this.SlicingDoubleFixed3() = - let m1 = (array3d [| + let m1 = (array3d [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array4Module.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array4Module.fs index 1d6276e4259..219f443b929 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array4Module.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array4Module.fs @@ -32,22 +32,22 @@ type Array4Module() = let array4d (arrs: 'a array array array array) = Array4D.init arrs.Length arrs.[0].Length arrs.[0].[0].Length arrs.[0].[0].[0].Length (fun i j k m -> arrs.[i].[j].[k].[m]) let array3d (arrs: 'a array array array ) = Array3D.init arrs.Length arrs.[0].Length arrs.[0].[0].Length (fun i j k -> arrs.[i].[j].[k]) - - let shouldBeEmpty arr = - if Array4D.length4 arr <> 0 + + let shouldBeEmpty arr = + if Array4D.length4 arr <> 0 && Array4D.length3 arr <> 0 && Array4D.length2 arr <> 0 - && Array4D.length1 arr <> 0 then - Assert.Fail("Array3D is not empty.") + && Array4D.length1 arr <> 0 then + Assert.Fail("Array3D is not empty.") - let m1 = array4d + let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -56,32 +56,32 @@ type Array4Module() = [] member this.Create() = - // integer array + // integer array let intArr = Array4D.create 3 4 5 6 168 if intArr.[1,2,1,1] <> 168 then Assert.Fail() VerifyDimensions intArr 3 4 5 6 - - // string array + + // string array let strArr = Array4D.create 2 3 4 5 "foo" if strArr.[1,2,3,2] <> "foo" then Assert.Fail() VerifyDimensions strArr 2 3 4 5 - - // empty array + + // empty array let eptArr1 = Array4D.create 0 0 0 0 'a' let eptArr2 = Array4D.create 0 0 0 0 'b' if eptArr1 <> eptArr2 then Assert.Fail() - () - + () + [] member this.Init() = - - // integer array + + // integer array let intArr = Array4D.init 3 3 3 3 (fun i j k l -> i*1000 + j*100 + k*10 + l) if intArr.[1,1,1,1] <> 1111 then Assert.Fail() if intArr.[2,2,2,2] <> 2222 then Assert.Fail() VerifyDimensions intArr 3 3 3 3 - - // ref array + + // ref array let strArr = Array4D.init 3 3 3 3 (fun i j k l -> (i, j, k, l)) if strArr.[2,0,1,2] <> (2, 0, 1, 2) then Assert.Fail() if strArr.[0,1,2,1] <> (0, 1, 2,1) then Assert.Fail() @@ -90,23 +90,23 @@ type Array4Module() = [] member this.Get() = - - // integer array + + // integer array let intArr = Array4D.init 2 3 2 2 (fun i j k l -> i*1000 + j*100 + k*10 + l) let resultInt = Array4D.get intArr 0 1 1 0 if resultInt <> 110 then Assert.Fail() - - // string array + + // string array let strArr = Array4D.init 2 3 2 2 (fun i j k l -> i.ToString() + "-" + j.ToString() + "-" + k.ToString() + "-" + l.ToString()) let resultStr = Array4D.get strArr 0 2 1 0 if resultStr <> "0-2-1-0" then Assert.Fail() - + CheckThrowsIndexOutRangException(fun () -> Array4D.get strArr 2 0 0 0 |> ignore) CheckThrowsIndexOutRangException(fun () -> Array4D.get strArr 0 3 0 0 |> ignore) CheckThrowsIndexOutRangException(fun () -> Array4D.get strArr 0 0 2 0 |> ignore) CheckThrowsIndexOutRangException(fun () -> Array4D.get strArr 0 0 0 2 |> ignore) - - // empty array + + // empty array let emptyArray = Array4D.init 0 0 0 0 (fun i j k l -> Assert.Fail()) CheckThrowsIndexOutRangException (fun () -> Array4D.get emptyArray 1 0 0 0 |> ignore) CheckThrowsIndexOutRangException (fun () -> Array4D.get emptyArray 0 1 0 0 |> ignore) @@ -115,116 +115,116 @@ type Array4Module() = // null array let nullArr : string[,,,] = null - CheckThrowsNullRefException (fun () -> Array4D.get nullArr 1 1 1 1 |> ignore) + CheckThrowsNullRefException (fun () -> Array4D.get nullArr 1 1 1 1 |> ignore) () - + [] member this.Length1() = - - // integer array + + // integer array let intArr = Array4D.create 2 3 2 2 168 let resultInt = Array4D.length1 intArr if resultInt <> 2 then Assert.Fail() - - // string array + + // string array let strArr = Array4D.create 2 3 2 2 "enmity" let resultStr = Array4D.length1 strArr if resultStr <> 2 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array4D.create 0 0 0 0 1 let resultEpt = Array4D.length1 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[,,,] - CheckThrowsNullRefException (fun () -> Array4D.length1 nullArr |> ignore) - () + let nullArr = null : string[,,,] + CheckThrowsNullRefException (fun () -> Array4D.length1 nullArr |> ignore) + () [] member this.Length2() = - - // integer array + + // integer array let intArr = Array4D.create 2 3 2 2 168 let resultInt = Array4D.length2 intArr if resultInt <> 3 then Assert.Fail() - - // string array + + // string array let strArr = Array4D.create 2 3 2 2 "enmity" let resultStr = Array4D.length2 strArr if resultStr <> 3 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array4D.create 0 0 0 0 1 let resultEpt = Array4D.length2 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[,,,] - CheckThrowsNullRefException (fun () -> Array4D.length2 nullArr |> ignore) - () + let nullArr = null : string[,,,] + CheckThrowsNullRefException (fun () -> Array4D.length2 nullArr |> ignore) + () [] - member this.Length3() = - - // integer array + member this.Length3() = + + // integer array let intArr = Array4D.create 2 3 5 0 168 let resultInt = Array4D.length3 intArr if resultInt <> 5 then Assert.Fail() - - // string array + + // string array let strArr = Array4D.create 2 3 5 0 "enmity" let resultStr = Array4D.length3 strArr if resultStr <> 5 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array4D.create 0 0 0 0 1 let resultEpt = Array4D.length3 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[,,,] - CheckThrowsNullRefException (fun () -> Array4D.length3 nullArr |> ignore) - () - + let nullArr = null : string[,,,] + CheckThrowsNullRefException (fun () -> Array4D.length3 nullArr |> ignore) + () + [] - member this.Length4() = - - // integer array + member this.Length4() = + + // integer array let intArr = Array4D.create 2 3 5 5 168 let resultInt = Array4D.length4 intArr if resultInt <> 5 then Assert.Fail() - - // string array + + // string array let strArr = Array4D.create 2 3 5 5 "enmity" let resultStr = Array4D.length4 strArr if resultStr <> 5 then Assert.Fail() - - // empty array + + // empty array let eptArr = Array4D.create 0 0 0 0 1 let resultEpt = Array4D.length4 eptArr if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[,,,] - CheckThrowsNullRefException (fun () -> Array4D.length4 nullArr |> ignore) - () + let nullArr = null : string[,,,] + CheckThrowsNullRefException (fun () -> Array4D.length4 nullArr |> ignore) + () [] member this.Set() = - // integer array + // integer array let intArr = Array4D.init 2 3 2 2 (fun i j k l -> i*1000 + j*100 + k*10 + l) - + Assert.False(intArr.[1,1,1,1] = -1) Array4D.set intArr 1 1 1 1 -1 Assert.True(intArr.[1,1,1,1] = -1) - // string array + // string array let strArr = Array4D.init 2 3 2 2 (fun i j k l -> i.ToString() + "-" + j.ToString()+ "-" + k.ToString() + "-" + l.ToString()) - + Assert.False(strArr.[1,1,1,1] = "custom") Array4D.set strArr 1 1 1 1 "custom" Assert.True(strArr.[1,1,1,1] = "custom") @@ -234,23 +234,23 @@ type Array4Module() = CheckThrowsIndexOutRangException(fun () -> Array4D.set strArr 0 3 0 0 "out of bounds") CheckThrowsIndexOutRangException(fun () -> Array4D.set strArr 0 0 2 0 "out of bounds") CheckThrowsIndexOutRangException(fun () -> Array4D.set strArr 0 0 0 2 "out of bounds") - - // empty array + + // empty array let emptArr = Array4D.create 0 0 0 0 'z' CheckThrowsIndexOutRangException(fun () -> Array4D.set emptArr 0 0 0 0 'a') // null array - let nullArr = null : string[,,,] - CheckThrowsNullRefException (fun () -> Array4D.set nullArr 0 0 0 0 "") - () + let nullArr = null : string[,,,] + CheckThrowsNullRefException (fun () -> Array4D.set nullArr 0 0 0 0 "") + () [] member this.ZeroCreate() = - + let intArr : int[,,,] = Array4D.zeroCreate 2 3 2 2 - if Array4D.get intArr 1 1 1 1 <> 0 then + if Array4D.get intArr 1 1 1 1 <> 0 then Assert.Fail() - + let structArray : DateTime[,,,] = Array4D.zeroCreate 1 1 1 1 let defaultVal = new DateTime() Assert.True(Array4D.get structArray 0 0 0 0 = defaultVal) @@ -261,24 +261,24 @@ type Array4Module() = for k in 0 .. 1 do for l in 0 .. 1 do Assert.AreEqual(null, strArr.[i, j, k, l]) - + // Test invalid values CheckThrowsArgumentException(fun () -> Array4D.zeroCreate -1 1 1 1 |> ignore) CheckThrowsArgumentException(fun () -> Array4D.zeroCreate 1 -1 1 1 |> ignore) CheckThrowsArgumentException(fun () -> Array4D.zeroCreate 1 1 -1 1 |> ignore) CheckThrowsArgumentException(fun () -> Array4D.zeroCreate 1 1 1 -1 |> ignore) - + () [] - member this.SlicingTripleFixed1() = + member this.SlicingTripleFixed1() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -291,14 +291,14 @@ type Array4Module() = Assert.AreEqual(m1.[0,0,0,*], newSlice) [] - member this.SlicingTripleFixed2() = + member this.SlicingTripleFixed2() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -311,14 +311,14 @@ type Array4Module() = Assert.AreEqual(m1.[0,0,*,0], newSlice) [] - member this.SlicingTripleFixed3() = + member this.SlicingTripleFixed3() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -331,14 +331,14 @@ type Array4Module() = Assert.AreEqual(m1.[0,*,0,0], newSlice) [] - member this.SlicingTripleFixed4() = + member this.SlicingTripleFixed4() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -351,21 +351,21 @@ type Array4Module() = Assert.AreEqual(m1.[*,0,0,0], newSlice) [] - member this.SlicingDoubleFixed1() = + member this.SlicingDoubleFixed1() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |] |] |] |] - let newSlice = array2D [| + let newSlice = array2D [| [|0.;0.;0.;0.;0.;0.|] [|0.;0.;0.;0.;0.;0.|] |] @@ -374,21 +374,21 @@ type Array4Module() = if m1.[0,0,*,*] <> newSlice then Assert.Fail() [] - member this.SlicingDoubleFixed2() = + member this.SlicingDoubleFixed2() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |] |] |] |] - let newSlice = array2D [| + let newSlice = array2D [| [|0.;0.;0.;0.;0.;0.|] [|0.;0.;0.;0.;0.;0.|] |] @@ -397,21 +397,21 @@ type Array4Module() = if m1.[0,*,0,*] <> newSlice then Assert.Fail() [] - member this.SlicingDoubleFixed3() = + member this.SlicingDoubleFixed3() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |] |] |] |] - let newSlice = array2D [| + let newSlice = array2D [| [|0.; 0.|] [|0.; 0.|] |] @@ -420,14 +420,14 @@ type Array4Module() = if m1.[0,*,*,0] <> newSlice then Assert.Fail() [] - member this.SlicingDoubleFixed4() = + member this.SlicingDoubleFixed4() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -445,14 +445,14 @@ type Array4Module() = [] - member this.SlicingDoubleFixed5() = + member this.SlicingDoubleFixed5() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -469,14 +469,14 @@ type Array4Module() = if m1.[*,0,*,0] <> newSlice then Assert.Fail() [] - member this.SlicingDoubleFixed6() = + member this.SlicingDoubleFixed6() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -491,16 +491,16 @@ type Array4Module() = m1.[*,*,0,0] <- newSlice Assert.AreEqual(m1.[0,0,1,1], 21.0) if m1.[*,*,0,0] <> newSlice then Assert.Fail() - + [] - member this.SlicingSingleFixed1() = + member this.SlicingSingleFixed1() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -519,14 +519,14 @@ type Array4Module() = if m1.[*,*,*,0] <> newSlice then Assert.Fail() [] - member this.SlicingSingleFixed2() = + member this.SlicingSingleFixed2() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -536,7 +536,7 @@ type Array4Module() = let newSlice = array3d [| [| [|0.;0.;0.;0.;0.;0.|]; [|0.;0.;0.;0.;0.;0.|] |]; - [| + [| [|0.;0.;0.;0.;0.;0.|]; [|0.;0.;0.;0.;0.;0.|] |] |] @@ -546,14 +546,14 @@ type Array4Module() = if m1.[*,*,0,*] <> newSlice then Assert.Fail() [] - member this.SlicingSingleFixed3() = + member this.SlicingSingleFixed3() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -563,7 +563,7 @@ type Array4Module() = let newSlice = array3d [| [| [|0.;0.;0.;0.;0.;0.|]; [|0.;0.;0.;0.;0.;0.|] |]; - [| + [| [|0.;0.;0.;0.;0.;0.|]; [|0.;0.;0.;0.;0.;0.|] |] |] @@ -573,14 +573,14 @@ type Array4Module() = if m1.[*,0,*,*] <> newSlice then Assert.Fail() [] - member this.SlicingSingleFixed4() = + member this.SlicingSingleFixed4() = let m1 = array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; @@ -590,7 +590,7 @@ type Array4Module() = let newSlice = array3d [| [| [|0.;0.;0.;0.;0.;0.|]; [|0.;0.;0.;0.;0.;0.|] |]; - [| + [| [|0.;0.;0.;0.;0.;0.|]; [|0.;0.;0.;0.;0.;0.|] |] |] @@ -600,13 +600,13 @@ type Array4Module() = if m1.[0,*,*,*] <> newSlice then Assert.Fail() [] - member this.``Slicing with reverse index in all slice expr behaves as expected``() = + member this.``Slicing with reverse index in all slice expr behaves as expected``() = let arr = Array4D.init 5 5 5 5 (fun i j k l -> i*1000 + j*100 + k*10 + l) Assert.Equal(arr.[..^1, ^1..^0, ^2.., ^1..], arr.[..3, 3..4, 2.., 3..]) [] - member this.``Set slice with reverse index in all slice expr behaves as expected``() = + member this.``Set slice with reverse index in all slice expr behaves as expected``() = let arr1 = Array4D.init 5 5 5 5 (fun i j k l -> i*1000 + j*100 + k*10 + l) let arr2 = Array4D.init 5 5 5 5 (fun i j k l -> i*1000 + j*100 + k*10 + l) @@ -618,114 +618,114 @@ type Array4Module() = Assert.Equal(arr1, arr2) [] - member this.``Indexer with reverse index in one dim behaves as expected``() = - let arr1 = Array4D.init 5 5 5 5 (fun i j k l -> i*1000 + j*100 + k*10 + l) + member this.``Indexer with reverse index in one dim behaves as expected``() = + let arr1 = Array4D.init 5 5 5 5 (fun i j k l -> i*1000 + j*100 + k*10 + l) Assert.AreEqual(arr1.[^1,0,0,0], 3000) [] - member this.``Indexer with reverse index in all dim behaves as expected``() = - let arr1 = Array4D.init 5 5 5 5 (fun i j k l -> i*1000 + j*100 + k*10 + l) - + member this.``Indexer with reverse index in all dim behaves as expected``() = + let arr1 = Array4D.init 5 5 5 5 (fun i j k l -> i*1000 + j*100 + k*10 + l) + Assert.AreEqual(arr1.[^0,^0,^1,^0], 4434) [] - member this.``Set item with reverse index in all dims behave as expected``() = + member this.``Set item with reverse index in all dims behave as expected``() = let arr1 = Array4D.create 5 5 5 5 2 arr1.[^1,^0,^0,^0] <- 9 Assert.AreEqual(arr1.[3,4,4,4], 9) [] - member this.SlicingBoundedStartEnd() = + member this.SlicingBoundedStartEnd() = shouldEqual m1.[*,*,*,*] m1 shouldEqual m1.[0..,*,*,*] m1 - shouldEqual m1.[0..0,*,*,*] - (array4d + shouldEqual m1.[0..0,*,*,*] + (array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |] |]) - shouldEqual m1.[1..1,*,*,*] - (array4d + shouldEqual m1.[1..1,*,*,*] + (array4d [| - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |] |] |] |]) - - shouldEqual m1.[*,0..0,*,*] - (array4d + + shouldEqual m1.[*,0..0,*,*] + (array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; [| 11.0;21.0;31.0;41.0;51.0;61.0 |] |] |]; - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; [| 119.0;219.0;319.0;419.0;519.0;619.0 |] |] |] |]) shouldEqual m1.[..1,*,*,*] m1 - shouldEqual m1.[*,1..,*,*] - (array4d + shouldEqual m1.[*,1..,*,*] + (array4d [| - [| + [| [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; [| 100.0;200.0;300.0;400.0;500.0;600.0 |] |] |]; - [| + [| [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; - [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |] |] + [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |] |] |] |]) shouldEqual m1.[*,0..1,*,*] m1 - shouldEqual m1.[*,*,0..0,*] - (array4d + shouldEqual m1.[*,*,0..0,*] + (array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |]; |] [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |]; |] |]; - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |]; |] [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |]; |] |] |]) shouldEqual m1.[*,*,*,0..5] m1 - - shouldEqual m1.[*,*,*,0..4] - (array4d + + shouldEqual m1.[*,*,*,0..4] + (array4d [| - [| + [| [| [| 1.0;2.0;3.0;4.0;5.0 |]; [| 11.0;21.0;31.0;41.0;51.0 |] |] [| [| 10.0;20.0;30.0;40.0;50.0 |]; [| 100.0;200.0;300.0;400.0;500.0 |] |] |]; - [| + [| [| [| 19.0;29.0;39.0;49.0;59.0 |]; [| 119.0;219.0;319.0;419.0;519.0 |] |] [| [| 109.0;209.0;309.0;409.0;509.0 |]; - [| 1009.0;2009.0;3009.0;4009.0;5009.0 |] |] + [| 1009.0;2009.0;3009.0;4009.0;5009.0 |] |] |] |]) [] - member this.SlicingOutOfBounds() = - shouldBeEmpty m1.[*,*,*,7..] - shouldBeEmpty m1.[*,*,*,.. -1] - - shouldBeEmpty m1.[*,*,3..,*] - shouldBeEmpty m1.[*,*,.. -1,*] - - shouldBeEmpty m1.[*,3..,*,*] - shouldBeEmpty m1.[*,.. -1,*,*] - - shouldBeEmpty m1.[3..,*,*,*] - shouldBeEmpty m1.[.. -1,*,*,*] + member this.SlicingOutOfBounds() = + shouldBeEmpty m1.[*,*,*,7..] + shouldBeEmpty m1.[*,*,*,.. -1] + + shouldBeEmpty m1.[*,*,3..,*] + shouldBeEmpty m1.[*,*,.. -1,*] + + shouldBeEmpty m1.[*,3..,*,*] + shouldBeEmpty m1.[*,.. -1,*,*] + + shouldBeEmpty m1.[3..,*,*,*] + shouldBeEmpty m1.[.. -1,*,*,*] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs index ba6e001fd31..da6c19f00d8 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs @@ -23,11 +23,11 @@ type ArrayModule() = [] member _.Empty() = let emptyArray = Array.empty - if Array.length emptyArray <> 0 then Assert.Fail() - + if Array.length emptyArray <> 0 then Assert.Fail() + let c : int[] = Array.empty Assert.True( (c = [| |]) ) - + let d : string[] = Array.empty Assert.True( (d = [| |]) ) () @@ -74,54 +74,54 @@ type ArrayModule() = // empty array let emptyArray : int[] = [| |] let singleArray : int[] = [| 1 |] - + let appEmptySingle = Array.append emptyArray singleArray let appSingleEmpty = Array.append singleArray emptyArray - + Assert.True( (appEmptySingle = [| 1 |]) ) Assert.True( (appSingleEmpty = [| 1 |]) ) - + // null array let nullArray = null:int[] let validArray = [| 1 |] - CheckThrowsArgumentNullException (fun () -> Array.append validArray nullArray |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.append nullArray validArray |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.append validArray nullArray |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.append nullArray validArray |> ignore) () [] - member _.Average() = - + member _.Average() = + // empty float32 array - let emptyFloatArray = Array.empty + let emptyFloatArray = Array.empty CheckThrowsArgumentException(fun () -> Array.average emptyFloatArray |> ignore) - + // empty double array - let emptyDoubleArray = Array.empty + let emptyDoubleArray = Array.empty CheckThrowsArgumentException(fun () -> Array.average emptyDoubleArray |> ignore) - + // empty decimal array - let emptyDecimalArray = Array.empty + let emptyDecimalArray = Array.empty CheckThrowsArgumentException (fun () -> Array.average emptyDecimalArray |>ignore ) // float32 array let floatArray: float32[] = [| 1.2f; 3.5f; 6.7f |] let averageOfFloat = Array.average floatArray if averageOfFloat <> 3.8000000000000003f then Assert.Fail() - + // double array let doubleArray: System.Double[] = [| 1.0;8.0 |] let averageOfDouble = Array.average doubleArray if averageOfDouble <> 4.5 then Assert.Fail() - + // decimal array let decimalArray: decimal[] = [| 0M; 19M; 19.03M |] let averageOfDecimal = Array.average decimalArray - if averageOfDecimal <> 12.676666666666666666666666667M then Assert.Fail() - + if averageOfDecimal <> 12.676666666666666666666666667M then Assert.Fail() + // null array - let nullArr = null : double[] - CheckThrowsArgumentNullException (fun () -> Array.average nullArr |> ignore) + let nullArr = null : double[] + CheckThrowsArgumentNullException (fun () -> Array.average nullArr |> ignore) () @@ -233,7 +233,7 @@ type ArrayModule() = Assert.AreEqual([|null|], Array.distinct [|null|]) let list = new System.Collections.Generic.List() Assert.AreEqual([|null, list|], Array.distinct [|null, list|]) - + [] member _.distinctBy() = // distinctBy should work on empty array @@ -300,7 +300,7 @@ type ArrayModule() = CheckThrowsArgumentException (fun () -> Array.take -1 [|0;1|] |> ignore) CheckThrowsInvalidOperationExn (fun () -> Array.take 5 [|"str1";"str2";"str3";"str4"|] |> ignore) CheckThrowsArgumentNullException (fun () -> Array.take 5 null |> ignore) - + [] member _.takeWhile() = Assert.AreEqual([||],Array.takeWhile (fun x -> failwith "should not be used") [||]) @@ -312,15 +312,15 @@ type ArrayModule() = Assert.AreEqual([|"a"|],Array.takeWhile (fun _ -> true) [|"a"|]) Assert.AreEqual([|"a"|],Array.takeWhile (fun x -> x <> "ab") [|"a"; "ab"; "abc"; "abcd"; "abcde"|]) - CheckThrowsArgumentNullException (fun () -> Array.takeWhile (fun _ -> failwith "should not be used") null |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.takeWhile (fun _ -> failwith "should not be used") null |> ignore) [] - member _.splitAt() = - Assert.AreEqual([||], Array.splitAt 0 [||] |> fst) + member _.splitAt() = + Assert.AreEqual([||], Array.splitAt 0 [||] |> fst) Assert.AreEqual([||], Array.splitAt 0 [||] |> snd) - Assert.AreEqual([|1..4|], Array.splitAt 4 [|1..10|] |> fst) - Assert.AreEqual([|5..10|], Array.splitAt 4 [|1..10|] |> snd) + Assert.AreEqual([|1..4|], Array.splitAt 4 [|1..10|] |> fst) + Assert.AreEqual([|5..10|], Array.splitAt 4 [|1..10|] |> snd) Assert.AreEqual([||], Array.splitAt 0 [|1..2|] |> fst) Assert.AreEqual([|1..2|], Array.splitAt 0 [|1..2|] |> snd) @@ -338,7 +338,7 @@ type ArrayModule() = CheckThrowsInvalidOperationExn (fun () -> Array.splitAt 1 [||] |> ignore) CheckThrowsArgumentException (fun () -> Array.splitAt -1 [|0;1|] |> ignore) CheckThrowsInvalidOperationExn (fun () -> Array.splitAt 5 [|"str1";"str2";"str3";"str4"|] |> ignore) - + CheckThrowsArgumentNullException (fun () -> Array.splitAt 0 null |> ignore) CheckThrowsArgumentNullException (fun () -> Array.splitAt 1 null |> ignore) @@ -351,25 +351,25 @@ type ArrayModule() = Assert.AreEqual([|"1";"1"|],Array.replicate 2 "1") CheckThrowsArgumentException (fun () -> Array.replicate -1 null |> ignore) - + [] - member _.Blit() = - // int array + member _.Blit() = + // int array let intSrc = [| 1..10 |] - let intDes:int[] = Array.zeroCreate 10 + let intDes:int[] = Array.zeroCreate 10 Array.blit intSrc 0 intDes 0 5 if intDes.[4] <> 5 then Assert.Fail() if intDes.[5] <> 0 then Assert.Fail() - + // string array let strSrc = [| "a";"b";"c";"d";"e";"j"|] let strDes = Array.create 10 "w" Array.blit strSrc 1 strDes 2 3 if strDes.[3] <> "c" || Array.get strDes 4 = "w" then Assert.Fail() - + // null array let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.blit nullArr 1 strDes 2 3 |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.blit nullArr 1 strDes 2 3 |> ignore) // bounds check CheckThrowsArgumentOutOfRangeException (fun () -> Array.blit intSrc -1 intDes 1 3 |> ignore) @@ -377,86 +377,86 @@ type ArrayModule() = CheckThrowsArgumentOutOfRangeException (fun () -> Array.blit intSrc 1 intDes 1 -3 |> ignore) CheckThrowsArgumentException (fun () -> Array.blit intSrc 1 intDes 1 300 |> ignore) CheckThrowsArgumentException (fun () -> Array.blit intSrc 1 intDes 5 8 |> ignore) - + () - - member private this.ChooseTester chooseInt chooseString = + + member private this.ChooseTester chooseInt chooseString = // int array - let intSrc:int [] = [| 1..100 |] - let funcInt x = if (x%5=0) then Some x else None + let intSrc:int [] = [| 1..100 |] + let funcInt x = if (x%5=0) then Some x else None let intChosen : int[] = chooseInt funcInt intSrc if intChosen.[1] <> 10 then Assert.Fail() - + // string array let stringSrc: string [] = "Lists are a commonly used data structure. They are not mutable, i.e., you can't delete an element of a list – instead you create a new list with the element deleted. List values often share storage under the hood, i.e., a list value only allocate more memory when you actually execute construction operations.".Split([|' '|], System.StringSplitOptions.RemoveEmptyEntries) let funcString x = match x with | "list"-> Some x | "List" -> Some x | _ -> None - let strChosen : string[] = chooseString funcString stringSrc + let strChosen : string[] = chooseString funcString stringSrc if strChosen.[1].ToLower() <> "list" then Assert.Fail() - + // empty array let emptySrc :int[] = [| |] let emptyChosen = chooseInt funcInt emptySrc Assert.True( (emptyChosen = [| |]) ) // null array - let nullArr = null:int[] - CheckThrowsArgumentNullException (fun () -> chooseInt funcInt nullArr |> ignore) - - () - + let nullArr = null:int[] + CheckThrowsArgumentNullException (fun () -> chooseInt funcInt nullArr |> ignore) + + () + [] - member this.Choose() = + member this.Choose() = this.ChooseTester Array.choose Array.choose [] - member this.``Parallel.Choose`` () = + member this.``Parallel.Choose`` () = this.ChooseTester Array.Parallel.choose Array.Parallel.choose member private this.CollectTester collectInt collectString = - + // int array - checking ordering let intSrc = [| 1..3 |] let func = fun i -> [| 1..i |] let result : int[] = collectInt func intSrc Assert.AreEqual ([| 1; 1; 2; 1; 2; 3 |], result) - + // string array let stringSrc = [| "foo"; "bar" |] let func = fun s -> [| s |] let result : string[] = collectString func stringSrc Assert.AreEqual(stringSrc, result) - + // empty array let emptyArray : string [] = [| |] let result = collectString func emptyArray Assert.AreEqual(emptyArray,result) - + // null array let nullArr = null:int[] CheckThrowsArgumentNullException (fun () -> collectInt func nullArr |> ignore) - + () [] member this.Collect () = this.CollectTester Array.collect Array.collect - + [] member _.CollectWithSideEffects () = let mutable stamp = 0 let f x = stamp <- stamp + 1; [| x |] - + Array.collect f [| |] |> ignore Assert.AreEqual(0, stamp) - + stamp <- 0 Array.collect f [|1;2;3|] |> ignore Assert.AreEqual(3, stamp) - + [] member this.``Parallel.Collect`` () = this.CollectTester Array.Parallel.collect Array.Parallel.collect @@ -468,10 +468,10 @@ type ArrayModule() = Assert.AreEqual(-1,Array.compareWith (fun _ -> failwith "should not be executed") [||] [|1|]) Assert.AreEqual(1,Array.compareWith (fun _ -> failwith "should not be executed") [|"1"|] [||]) - // compareWith should not work on null arrays + // compareWith should not work on null arrays CheckThrowsArgumentNullException(fun () -> Array.compareWith (fun _ -> failwith "should not be executed") null [||] |> ignore) CheckThrowsArgumentNullException(fun () -> Array.compareWith (fun _ -> failwith "should not be executed") [||] null |> ignore) - + // compareWith should work on longer arrays Assert.AreEqual(-1,Array.compareWith compare [|"1";"2"|] [|"1";"3"|]) Assert.AreEqual(1,Array.compareWith compare [|1;2;43|] [|1;2;1|]) @@ -485,38 +485,38 @@ type ArrayModule() = Assert.AreEqual(0,Array.compareWith (fun x y -> 0) [|"1";"2"|] [|"1";"3"|]) Assert.AreEqual(1,Array.compareWith (fun x y -> 1) [|"1";"2"|] [|"1";"3"|]) Assert.AreEqual(-1,Array.compareWith (fun x y -> -1) [|"1";"2"|] [|"1";"3"|]) - + [] member this.Concat() = // integer array - let seqInt = - seq { for i in 1..10 do + let seqInt = + seq { for i in 1..10 do yield [|i; i*10|] } - + let conIntArr = Array.concat seqInt if Array.length conIntArr <> 20 then Assert.Fail() - + // string array - let strSeq = + let strSeq = seq { for a in 'a'..'c' do for b in 'a'..'c' do yield [|a.ToString();b.ToString() |]} - + let conStrArr = Array.concat strSeq if Array.length conStrArr <> 18 then Assert.Fail() - + // Empty array let emptyArrays = [| [| |]; [| 0 |]; [| 1 |]; [| |]; [| |] |] let result2 = Array.concat emptyArrays Assert.True(result2.[0] = 0 && result2.[1] = 1) - if result2.[0] <> 0 && result2.[1] <> 1 then Assert.Fail() + if result2.[0] <> 0 && result2.[1] <> 1 then Assert.Fail() // null array let nullArray = null:int[] let nullArrays = Array.create 2 nullArray - CheckThrowsNullRefException (fun () -> Array.concat nullArrays |> ignore) - - () + CheckThrowsNullRefException (fun () -> Array.concat nullArrays |> ignore) + + () [] member this.countBy() = @@ -533,68 +533,68 @@ type ArrayModule() = [] member this.Copy() = // int array - let intSrc:int [] = [| 3;5;7 |] + let intSrc:int [] = [| 3;5;7 |] let intCopied = Array.copy intSrc if intCopied <> [| 3;5;7 |] then Assert.Fail() - + // string array let stringSrc: string [] = [|"Lists"; "are"; "commonly" |] - - let strCopied = Array.copy stringSrc + + let strCopied = Array.copy stringSrc if strCopied <> [|"Lists"; "are"; "commonly" |] then Assert.Fail() - + // empty array let emptySrc :int[] = [| |] let emptyCopied = Array.copy emptySrc if emptyCopied <> [| |] then Assert.Fail() // null array - let nullArr = null:int[] - CheckThrowsArgumentNullException (fun () -> Array.copy nullArr |> ignore) - + let nullArr = null:int[] + CheckThrowsArgumentNullException (fun () -> Array.copy nullArr |> ignore) + () [] member this.Create() = // int array - let intArr = Array.create 3 8 + let intArr = Array.create 3 8 if intArr <> [| 8;8;8 |] then Assert.Fail() - + // string array let strArr = Array.create 3 "good" Assert.True( (strArr = [|"good"; "good"; "good"|]) ) - + // empty array - let emptyArr = Array.create 0 "empty" + let emptyArr = Array.create 0 "empty" if emptyArr <> [| |] then Assert.Fail() // array with null elements - let nullStr = null:string + let nullStr = null:string let nullArr = Array.create 3 nullStr Assert.True( (nullArr = [|null; null; null|]) ) - + () - + [] member this.TryHead() = // integer array - let resultInt = Array.tryHead [|2..2..20|] + let resultInt = Array.tryHead [|2..2..20|] Assert.AreEqual(2, resultInt.Value) - + // string array - let resultStr = Array.tryHead [|"a";"b";"c";"d"|] + let resultStr = Array.tryHead [|"a";"b";"c";"d"|] Assert.AreEqual("a", resultStr.Value) - // empty array + // empty array let resultNone = Array.tryHead [||] Assert.AreEqual(None, resultNone) // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.tryHead nullArr |> ignore) + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.tryHead nullArr |> ignore) () - + [] member this.Exists() = // integer array @@ -602,24 +602,24 @@ type ArrayModule() = let funcInt x = if (x%2 = 0) then true else false let resultInt = Array.exists funcInt intArr if resultInt <> true then Assert.Fail() - + // string array let strArr = [|"Lists"; "are"; "commonly" |] let funcStr (x:string) = if (x.Length >15) then true else false let resultStr = Array.exists funcStr strArr if resultStr <> false then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] let resultEpt = Array.exists funcInt emptyArr if resultEpt <> false then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.exists funcStr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.exists funcStr nullArr |> ignore) + () - + [] member this.Exists2() = // integer array @@ -628,14 +628,14 @@ type ArrayModule() = let funcInt x y = if (x%y = 0) then true else false let resultInt = Array.exists2 funcInt intFir intSec if resultInt <> true then Assert.Fail() - + // string array let strFir = [|"Lists"; "are"; "commonly" |] let strSec = [|"good"; "good"; "good" |] let funcStr (x:string) (y:string) = if (x = y) then true else false let resultStr = Array.exists2 funcStr strFir strSec if resultStr <> false then Assert.Fail() - + // empty array let eptFir:int[] = [| |] let eptSec:int[] = [| |] @@ -643,14 +643,14 @@ type ArrayModule() = if resultEpt <> false then Assert.Fail() // null array - let nullFir = null:string[] - let validArray = [| "a" |] - CheckThrowsArgumentNullException (fun () -> Array.exists2 funcStr nullFir validArray |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.exists2 funcStr validArray nullFir |> ignore) - + let nullFir = null:string[] + let validArray = [| "a" |] + CheckThrowsArgumentNullException (fun () -> Array.exists2 funcStr nullFir validArray |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.exists2 funcStr validArray nullFir |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.exists2 funcInt [|1..10|] [|2..20|] |> ignore) - + () [] @@ -659,70 +659,70 @@ type ArrayModule() = let intArr = [|1..5|] Array.fill intArr 0 3 21 if intArr <> [|21;21;21;4;5|] then Assert.Fail() - + // string array let strArr = [|"Lists"; "are"; "a"; "commonly"; "data";"structor" |] Array.fill strArr 1 5 "a" - + if strArr <> [|"Lists"; "a"; "a"; "a"; "a";"a" |] then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] Array.fill emptyArr 0 0 8 if emptyArr <> [| |] then Assert.Fail() // null array - let nullArr = null:string[] + let nullArr = null:string[] CheckThrowsArgumentNullException (fun () -> Array.fill nullArr 0 1 "good" |> ignore) - + // start < 0 CheckThrowsArgumentException(fun () -> Array.fill intArr -1 3 21) - - // len < 0 + + // len < 0 CheckThrowsArgumentException(fun () -> Array.fill intArr 1 -2 21) - - + + () - [] + [] member this.Filter() = // integer array let intArr = [| 1..20 |] let funcInt x = if (x%5 = 0) then true else false let resultInt = Array.filter funcInt intArr if resultInt <> [|5;10;15;20|] then Assert.Fail() - + // string array let strArr = [|"Lists"; "are"; "a"; "commonly"; "data";"structor" |] let funcStr (x:string) = if (x.Length > 4) then true else false let resultStr = Array.filter funcStr strArr if resultStr <> [|"Lists"; "commonly"; "structor" |] then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] let resultEpt = Array.filter funcInt emptyArr if resultEpt <> [| |] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.filter funcStr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.filter funcStr nullArr |> ignore) + () [] - member this.ParallelFilter () = + member this.ParallelFilter () = let assertSameBehavior predicate arr = let sequentialZip = Array.filter predicate arr let paraZip = Array.Parallel.filter predicate arr Assert.AreEqual(sequentialZip, paraZip) [| 1..20 |] |> assertSameBehavior (fun x -> x%5 = 0) - [|"Lists"; "are"; "a"; "commonly"; "data";"structor" |] |> assertSameBehavior (fun x -> x.Length > 4) + [|"Lists"; "are"; "a"; "commonly"; "data";"structor" |] |> assertSameBehavior (fun x -> x.Length > 4) [| |] |> assertSameBehavior (fun x -> x%5 = 0) - let nullArr = null:int[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.filter (fun x -> x%5 = 0) nullArr |> ignore) + let nullArr = null:int[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.filter (fun x -> x%5 = 0) nullArr |> ignore) + - [] member this.Filter2 () = // The Array.filter algorithm uses a bitmask as a temporary storage mechanism @@ -775,7 +775,7 @@ type ArrayModule() = // this could probably be a bit smaller, but needs to at least be > 64 to test chunk copying // of data, and > 96 gives a safer feel, so settle on a nice decimal rounding of one hundred // to appease those with digits. - let suitableTestMaxLength = 100 + let suitableTestMaxLength = 100 checkCombinations Array.filter suitableTestMaxLength @@ -788,23 +788,23 @@ type ArrayModule() = let funcInt x = if (x%5 = 0) then true else false let resultInt = Array.where funcInt intArr if resultInt <> [|5;10;15;20|] then Assert.Fail() - + // string array let strArr = [|"Lists"; "are"; "a"; "commonly"; "data";"structor" |] let funcStr (x:string) = if (x.Length > 4) then true else false let resultStr = Array.where funcStr strArr if resultStr <> [|"Lists"; "commonly"; "structor" |] then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] let resultEpt = Array.where funcInt emptyArr if resultEpt <> [| |] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.where funcStr nullArr |> ignore) - - () + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.where funcStr nullArr |> ignore) + + () [] member this.``where should work like filter``() = @@ -819,25 +819,25 @@ type ArrayModule() = let funcInt x = if (x%5 = 0) then true else false let resultInt = Array.find funcInt intArr if resultInt <> 5 then Assert.Fail() - + // string array let strArr = [|"Lists"; "are"; "a"; "commonly"; "data";"structor" |] let funcStr (x:string) = if (x.Length >7) then true else false let resultStr = Array.find funcStr strArr if resultStr <> "commonly" then Assert.Fail() - + // empty array - let emptyArr:int[] = [| |] + let emptyArr:int[] = [| |] CheckThrowsKeyNotFoundException (fun () -> Array.find (fun _ -> true) emptyArr |> ignore) // not found CheckThrowsKeyNotFoundException (fun () -> Array.find (fun _ -> false) intArr |> ignore) // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.find funcStr nullArr |> ignore) - - () + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.find funcStr nullArr |> ignore) + + () [] member this.FindBack() = @@ -872,26 +872,26 @@ type ArrayModule() = let funcInt x = if (x%5 = 0) then true else false let resultInt = Array.findIndex funcInt intArr if resultInt <> 4 then Assert.Fail() - + // string array let strArr = [|"Lists"; "are"; "a"; "commonly"; "data";"structor" |] let funcStr (x:string) = if (x.Length >7) then true else false let resultStr = Array.findIndex funcStr strArr if resultStr <> 3 then Assert.Fail() - + // empty array - let emptyArr:int[] = [| |] + let emptyArr:int[] = [| |] CheckThrowsKeyNotFoundException(fun() -> Array.findIndex (fun _ -> true) emptyArr |> ignore) - + // not found CheckThrowsKeyNotFoundException(fun() -> Array.findIndex (fun _ -> false) intArr |> ignore) // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.findIndex funcStr nullArr |> ignore) - - () - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.findIndex funcStr nullArr |> ignore) + + () + [] member this.FindIndexBack() = // integer array @@ -927,7 +927,7 @@ type ArrayModule() = else None let resultInt = Array.pick matchFunc intArr Assert.AreEqual("3", resultInt) - + // make it not found CheckThrowsKeyNotFoundException (fun () -> Array.pick (fun n -> None) intArr |> ignore) @@ -943,62 +943,62 @@ type ArrayModule() = Assert.AreEqual(1, Array.last [|1|]) Assert.AreEqual("2", Array.last [|"1"; "3"; "2"|]) Assert.AreEqual(["4"], Array.last [|["1"; "3"]; []; ["4"]|]) - + [] member this.TryLast() = // integers array let IntSeq = [| 1..9 |] let intResult = Array.tryLast IntSeq Assert.AreEqual(9, intResult.Value) - + // string array let strResult = Array.tryLast [|"first"; "second"; "third"|] Assert.AreEqual("third", strResult.Value) - + // Empty array let emptyResult = Array.tryLast Array.empty Assert.True(emptyResult.IsNone) - + // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () ->Array.tryLast nullArr |> ignore) - () + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () ->Array.tryLast nullArr |> ignore) + () [] member this.ToSeq() = let intArr = [| 1..10 |] let seq = Array.toSeq intArr let sum = Seq.sum seq - Assert.AreEqual(55, sum) + Assert.AreEqual(55, sum) member private _.TryPickTester tryPickInt tryPickString = // integer array - let intArr = [| 1..10 |] - let funcInt x = + let intArr = [| 1..10 |] + let funcInt x = match x with - | _ when x % 3 = 0 -> Some (x.ToString()) + | _ when x % 3 = 0 -> Some (x.ToString()) | _ -> None let resultInt = tryPickInt funcInt intArr if resultInt <> Some "3" then Assert.Fail() - + // string array let strArr = [|"Lists"; "are"; "commonly" ; "list" |] - let funcStr x = + let funcStr x = match x with - | "good" -> Some (x.ToString()) + | "good" -> Some (x.ToString()) | _ -> None let resultStr = tryPickString funcStr strArr if resultStr <> None then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] let resultEpt = tryPickInt funcInt emptyArr if resultEpt <> None then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> tryPickString funcStr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> tryPickString funcStr nullArr |> ignore) + () [] @@ -1010,41 +1010,41 @@ type ArrayModule() = [] member this.Fold() = // integer array - let intArr = [| 1..5 |] + let intArr = [| 1..5 |] let funcInt x y = x+"+"+y.ToString() let resultInt = Array.fold funcInt "x" intArr if resultInt <> "x+1+2+3+4+5" then Assert.Fail() - + // string array let strArr = [|"A"; "B"; "C" ; "D" |] let funcStr x y = x+y - + let resultStr = Array.fold funcStr "X" strArr if resultStr <> "XABCD" then Assert.Fail() - + // empty array let emptyArr : int[] = [| |] let resultEpt = Array.fold funcInt "x" emptyArr if resultEpt <> "x" then Assert.Fail() // null array - let nullArr = null : string[] - CheckThrowsArgumentNullException (fun () -> Array.fold funcStr "begin" nullArr |> ignore) - + let nullArr = null : string[] + CheckThrowsArgumentNullException (fun () -> Array.fold funcStr "begin" nullArr |> ignore) + () [] member this.Fold2() = - // integer array + // integer array let funcInt x y z = x + y.ToString() + z.ToString() let resultInt = Array.fold2 funcInt "x" [| 1;3;5 |] [|2;4;6|] if resultInt <> "x123456" then Assert.Fail() - + // string array - let funcStr x y z= x + y + z + let funcStr x y z= x + y + z let resultStr = Array.fold2 funcStr "X" [|"A"; "B"; "C" ; "D" |] [|"H"; "I"; "J" ; "K" |] if resultStr <> "XAHBICJDK" then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] let resultEpt = Array.fold2 funcInt "x" emptyArr emptyArr @@ -1053,66 +1053,66 @@ type ArrayModule() = // null array let nullArr = null:string[] let validArray = [| "a" |] - CheckThrowsArgumentNullException (fun () -> Array.fold2 funcStr "begin" validArray nullArr |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.fold2 funcStr "begin" nullArr validArray |> ignore) - + CheckThrowsArgumentNullException (fun () -> Array.fold2 funcStr "begin" validArray nullArr |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.fold2 funcStr "begin" nullArr validArray |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.fold2 funcInt "x" [| 1;3;5 |] [|2;4;6;8|] |> ignore) - + () [] member this.FoldBack() = // integer array - let intArr = [| 1..5 |] + let intArr = [| 1..5 |] let funcInt x y = x.ToString()+y let resultInt = Array.foldBack funcInt intArr "x" if resultInt <> "12345x" then Assert.Fail() - + // string array let strArr = [|"A"; "B"; "C" ; "D" |] let funcStr x y = x+y - - let resultStr = Array.foldBack funcStr strArr "X" + + let resultStr = Array.foldBack funcStr strArr "X" if resultStr <> "ABCDX" then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] - let resultEpt = Array.foldBack funcInt emptyArr "x" + let resultEpt = Array.foldBack funcInt emptyArr "x" if resultEpt <> "x" then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.foldBack funcStr nullArr "begin" |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.foldBack funcStr nullArr "begin" |> ignore) + () [] member this.FoldBack2() = - // integer array + // integer array let funcInt x y z = x.ToString() + y.ToString() + z let resultInt = Array.foldBack2 funcInt [| 1;3;5 |] [|2;4;6|] "x" if resultInt <> "123456x" then Assert.Fail() - + // string array - let funcStr x y z= x + y + z + let funcStr x y z= x + y + z let resultStr = Array.foldBack2 funcStr [|"A"; "B"; "C" ; "D" |] [|"H"; "I"; "J" ; "K" |] "X" if resultStr <> "AHBICJDKX" then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] let resultEpt = Array.foldBack2 funcInt emptyArr emptyArr "x" if resultEpt <> "x" then Assert.Fail() // null array - let nullArr = null : string[] - let validArray = [| "a" |] - CheckThrowsArgumentNullException (fun () -> Array.foldBack2 funcStr nullArr validArray "begin" |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.foldBack2 funcStr validArray nullArr "begin" |> ignore) - + let nullArr = null : string[] + let validArray = [| "a" |] + CheckThrowsArgumentNullException (fun () -> Array.foldBack2 funcStr nullArr validArray "begin" |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.foldBack2 funcStr validArray nullArr "begin" |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.foldBack2 funcInt [|1..10|] [|2..20|] "x" |> ignore) - + () [] @@ -1120,102 +1120,102 @@ type ArrayModule() = // integer array let resultInt = Array.forall (fun x -> x > 2) [| 3..2..10 |] if resultInt <> true then Assert.Fail() - + // string array let resultStr = Array.forall (fun (x:string) -> x.Contains("a")) [|"Lists"; "are"; "commonly" ; "list" |] if resultStr <> false then Assert.Fail() - - // empty array - let resultEpt = Array.forall (fun (x:string) -> x.Contains("a")) [||] + + // empty array + let resultEpt = Array.forall (fun (x:string) -> x.Contains("a")) [||] if resultEpt <> true then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.forall (fun x -> true) nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.forall (fun x -> true) nullArr |> ignore) + () [] member this.ParallelForAll() = let inline assertSame predicate array = let seq = Array.forall predicate array - let para = Array.Parallel.forall predicate array + let para = Array.Parallel.forall predicate array Assert.AreEqual(seq, para, sprintf "%A" array) [| 3..2..10 |] |> assertSame (fun x -> x > 15) [| 3..2..10 |] |> assertSame (fun x -> x < 15) - [|"Lists"; "are"; "commonly" ; "list" |] |> assertSame (fun (x:string) -> x.Contains("a")) + [|"Lists"; "are"; "commonly" ; "list" |] |> assertSame (fun (x:string) -> x.Contains("a")) [||] |> assertSame (fun (x:string) -> x.Contains("a")) [||] |> assertSame (fun (x:string) -> x.Contains("a") |> not) - - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.forall (fun x -> true) nullArr |> ignore) - + + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.forall (fun x -> true) nullArr |> ignore) + () [] member this.ParallelExists() = let inline assertSame predicate array = let seq = Array.exists predicate array - let para = Array.Parallel.exists predicate array + let para = Array.Parallel.exists predicate array Assert.AreEqual(seq, para, sprintf "%A" array) [| 3..2..10 |] |> assertSame (fun x -> x > 2) - [|"Lists"; "are"; "commonly" ; "list" |] |> assertSame (fun (x:string) -> x.Contains("a")) + [|"Lists"; "are"; "commonly" ; "list" |] |> assertSame (fun (x:string) -> x.Contains("a")) [||] |> assertSame (fun (x:string) -> x.Contains("a")) [||] |> assertSame (fun (x:string) -> x.Contains("a") |> not) - - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.exists (fun x -> true) nullArr |> ignore) - + + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.exists (fun x -> true) nullArr |> ignore) + () - + [] member this.ForAll2() = // integer array let resultInt = Array.forall2 (fun x y -> x < y) [| 1..10 |] [|2..2..20|] if resultInt <> true then Assert.Fail() - + // string array let resultStr = Array.forall2 (fun (x:string) (y:string) -> x.Length < y.Length) [|"Lists"; "are"; "commonly" ; "list" |] [|"Listslong"; "arelong"; "commonlylong" ; "listlong" |] if resultStr <> true then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.forall2 (fun x y -> x>y) [||] [||] if resultEpt <> true then Assert.Fail() // null array let nullArr = null:string[] - let validArray = [| "a" |] - CheckThrowsArgumentNullException (fun () -> Array.forall2 (fun x y-> true) nullArr validArray |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.forall2 (fun x y-> true) validArray nullArr |> ignore) - + let validArray = [| "a" |] + CheckThrowsArgumentNullException (fun () -> Array.forall2 (fun x y-> true) nullArr validArray |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.forall2 (fun x y-> true) validArray nullArr |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.forall2 (fun x y -> x < y) [|1..10|] [|2..20|] |> ignore) - + () - + [] member this.Get() = // integer array - let intArr = [| 3;4;7;8;10 |] + let intArr = [| 3;4;7;8;10 |] let resultInt = Array.get intArr 3 if resultInt <> 8 then Assert.Fail() - + // string array let strArr = [|"Lists"; "are"; "commonly" ; "list" |] - + let resultStr = Array.get strArr 2 if resultStr <> "commonly" then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] CheckThrowsIndexOutRangException (fun () -> Array.get emptyArr -1 |> ignore) // null array - let nullArr = null:string[] - CheckThrowsNullRefException (fun () -> Array.get nullArr 0 |> ignore) - + let nullArr = null:string[] + CheckThrowsNullRefException (fun () -> Array.get nullArr 0 |> ignore) + () [] @@ -1257,28 +1257,28 @@ type ArrayModule() = [] member this.GroupBy() = let funcInt x = x%5 - + let IntArray = [| 0 .. 9 |] - + let group_byInt = Array.groupBy funcInt IntArray - - let expectedIntArray = + + let expectedIntArray = [| for i in 0..4 -> i, [|i; i+5|] |] if group_byInt <> expectedIntArray then Assert.Fail() - + // string array let funcStr (x:string) = x.Length let strArray = [|"l1ngth7"; "length 8"; "l2ngth7" ; "length 9"|] - + let group_byStr = Array.groupBy funcStr strArray - let expectedStrArray = + let expectedStrArray = [| 7, [|"l1ngth7"; "l2ngth7"|] 8, [|"length 8"|] 9, [|"length 9"|] |] - + if group_byStr <> expectedStrArray then Assert.Fail() // Empty array @@ -1301,9 +1301,9 @@ type ArrayModule() = seqGroup |> Array.iter (snd >> Array.sortInPlace) paraGroup |> Array.iter (snd >> Array.sortInPlace) - if seqGroup.Length <> paraGroup.Length then + if seqGroup.Length <> paraGroup.Length then Assert.Fail($"{opName} produced different lengths of results. Seq={seqGroup.Length};Para={paraGroup.Length}.") - + let seqKeys = seqGroup |> Array.map fst let paraKeys = paraGroup |> Array.map fst if(seqKeys <> paraKeys) then @@ -1316,7 +1316,7 @@ type ArrayModule() = Assert.Fail($"{opName} produced different results for key={seqKey}. Seq=%A{seqGroup};Para=%A{paraGroup}.")) Assert.True((seqGroup=paraGroup), $"{opName} produced different results. Seq=%A{seqGroup};Para=%A{paraGroup}.") - + let compareAndAssert opName array projection = let seqGroup = array |> Array.groupBy projection @@ -1324,15 +1324,15 @@ type ArrayModule() = assertEqualityOfGroupings opName seqGroup paraGroup // int array - let funcInt x = x%5 + let funcInt x = x%5 let IntArray = [| 0 .. 250 |] - compareAndAssert "Int grouping" IntArray funcInt + compareAndAssert "Int grouping" IntArray funcInt + - // string array let funcStr (x:string) = x.Length - let strArray = Array.init 177 (fun i -> string i) - compareAndAssert "String grouping" strArray funcStr + let strArray = Array.init 177 (fun i -> string i) + compareAndAssert "String grouping" strArray funcStr // Empty array @@ -1362,25 +1362,25 @@ type ArrayModule() = CheckThrowsArgumentNullException(fun () -> Array.Parallel.groupBy funcInt (null : int array) |> ignore) () - member private this.InitTester initInt initString = + member private this.InitTester initInt initString = // integer array - let resultInt : int[] = initInt 3 (fun x -> x + 3) + let resultInt : int[] = initInt 3 (fun x -> x + 3) if resultInt <> [|3;4;5|] then Assert.Fail() - + // string array - let funStr (x:int) = + let funStr (x:int) = match x with | 0 -> "Lists" | 1 -> "are" | 2 -> "commonly" - | _ -> "end" + | _ -> "end" let resultStr = initString 3 funStr if resultStr <> [|"Lists"; "are"; "commonly" |] then Assert.Fail() - - // empty array + + // empty array let resultEpt = initInt 0 (fun x -> x+1) if resultEpt <> [| |] then Assert.Fail() - + () [] @@ -1388,193 +1388,193 @@ type ArrayModule() = // integer array let resultInt = Array.head [|2..2..20|] Assert.AreEqual(2, resultInt) - + // string array - let resultStr = Array.head [|"a";"b";"c";"d"|] + let resultStr = Array.head [|"a";"b";"c";"d"|] Assert.AreEqual("a", resultStr) - - CheckThrowsArgumentException(fun () -> Array.head [||] |> ignore) + + CheckThrowsArgumentException(fun () -> Array.head [||] |> ignore) CheckThrowsArgumentNullException(fun () -> Array.head null |> ignore) - () + () [] - member this.Init() = + member this.Init() = this.InitTester Array.init Array.init - + [] member this.InitWithSideEffects () = let mutable stamp = 0 - let f i = + let f i = stamp <- stamp + 1 - i + i Array.init 0 f |> ignore Assert.AreEqual (0, stamp) - + stamp <- 0 Array.init 10 f |> ignore Assert.AreEqual (10, stamp) - + [] - member this.``Parallel.Init``() = + member this.``Parallel.Init``() = this.InitTester Array.Parallel.init Array.Parallel.init [] member this.IsEmpty() = // integer array - let intArr = [| 3;4;7;8;10 |] - let resultInt = Array.isEmpty intArr + let intArr = [| 3;4;7;8;10 |] + let resultInt = Array.isEmpty intArr if resultInt <> false then Assert.Fail() - + // string array - let strArr = [|"Lists"; "are"; "commonly" ; "list" |] - let resultStr = Array.isEmpty strArr + let strArr = [|"Lists"; "are"; "commonly" ; "list" |] + let resultStr = Array.isEmpty strArr if resultStr <> false then Assert.Fail() - - // empty array + + // empty array let emptyArr:int[] = [| |] - let resultEpt = Array.isEmpty emptyArr + let resultEpt = Array.isEmpty emptyArr if resultEpt <> true then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.isEmpty nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.isEmpty nullArr |> ignore) + () [] member this.Iter() = // integer array - let intArr = [| 1..10 |] - let mutable resultInt = 0 - let funInt (x:int) = - resultInt <- resultInt + x - () - Array.iter funInt intArr - if resultInt <> 55 then Assert.Fail() - + let intArr = [| 1..10 |] + let mutable resultInt = 0 + let funInt (x:int) = + resultInt <- resultInt + x + () + Array.iter funInt intArr + if resultInt <> 55 then Assert.Fail() + // string array let strArr = [|"Lists"; "are"; "commonly" ; "list" |] let mutable resultStr = "" let funStr (x: string) = - resultStr <- resultStr + x + resultStr <- resultStr + x () - Array.iter funStr strArr - if resultStr <> "Listsarecommonlylist" then Assert.Fail() - - // empty array + Array.iter funStr strArr + if resultStr <> "Listsarecommonlylist" then Assert.Fail() + + // empty array let emptyArr : int[] = [| |] let mutable resultEpt = 0 - Array.iter funInt emptyArr - if resultEpt <> 0 then Assert.Fail() + Array.iter funInt emptyArr + if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[] - CheckThrowsArgumentNullException (fun () -> Array.iter funStr nullArr |> ignore) - + let nullArr = null : string[] + CheckThrowsArgumentNullException (fun () -> Array.iter funStr nullArr |> ignore) + () - + [] member this.Iter2() = // integer array - let mutable resultInt = 0 - let funInt (x:int) (y:int) = - resultInt <- resultInt + x + y - () - Array.iter2 funInt [| 1..10 |] [|2..2..20|] - if resultInt <> 165 then Assert.Fail() - + let mutable resultInt = 0 + let funInt (x:int) (y:int) = + resultInt <- resultInt + x + y + () + Array.iter2 funInt [| 1..10 |] [|2..2..20|] + if resultInt <> 165 then Assert.Fail() + // string array let mutable resultStr = "" let funStr (x:string) (y:string) = - resultStr <- resultStr + x + y + resultStr <- resultStr + x + y () - Array.iter2 funStr [|"A"; "B"; "C" ; "D" |] [|"a"; "b"; "c"; "d"|] - if resultStr <> "AaBbCcDd" then Assert.Fail() - - // empty array + Array.iter2 funStr [|"A"; "B"; "C" ; "D" |] [|"a"; "b"; "c"; "d"|] + if resultStr <> "AaBbCcDd" then Assert.Fail() + + // empty array let emptyArr:int[] = [| |] let mutable resultEpt = 0 - Array.iter2 funInt emptyArr emptyArr - if resultEpt <> 0 then Assert.Fail() + Array.iter2 funInt emptyArr emptyArr + if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null:string[] - let validArray = [| "a" |] - CheckThrowsArgumentNullException (fun () -> Array.iter2 funStr nullArr validArray |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.iter2 funStr validArray nullArr |> ignore) - - // len1 <> len2 + let nullArr = null:string[] + let validArray = [| "a" |] + CheckThrowsArgumentNullException (fun () -> Array.iter2 funStr nullArr validArray |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.iter2 funStr validArray nullArr |> ignore) + + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.iter2 funInt [| 1..10 |] [|2..20|]) - + () - - + + [] member this.Iteri() = // integer array - let intArr = [| 1..10 |] - let mutable resultInt = 0 - let funInt (x:int) y = - resultInt <- resultInt + x + y - () - Array.iteri funInt intArr - if resultInt <> 100 then Assert.Fail() - + let intArr = [| 1..10 |] + let mutable resultInt = 0 + let funInt (x:int) y = + resultInt <- resultInt + x + y + () + Array.iteri funInt intArr + if resultInt <> 100 then Assert.Fail() + // string array let strArr = [|"Lists"; "are"; "commonly" ; "list" |] let mutable resultStr = 0 let funStr (x:int) (y:string) = resultStr <- resultStr + x + y.Length () - Array.iteri funStr strArr - if resultStr <> 26 then Assert.Fail() - - // empty array + Array.iteri funStr strArr + if resultStr <> 26 then Assert.Fail() + + // empty array let emptyArr:int[] = [| |] let mutable resultEpt = 0 - Array.iteri funInt emptyArr - if resultEpt <> 0 then Assert.Fail() + Array.iteri funInt emptyArr + if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.iteri funStr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.iteri funStr nullArr |> ignore) + () - + [] member this.Iteri2() = // integer array - let mutable resultInt = 0 - let funInt (x:int) (y:int) (z:int) = - resultInt <- resultInt + x + y + z - () - Array.iteri2 funInt [| 1..10 |] [|2..2..20|] - if resultInt <> 210 then Assert.Fail() - + let mutable resultInt = 0 + let funInt (x:int) (y:int) (z:int) = + resultInt <- resultInt + x + y + z + () + Array.iteri2 funInt [| 1..10 |] [|2..2..20|] + if resultInt <> 210 then Assert.Fail() + // string array let mutable resultStr = "" let funStr (x:int) (y:string) (z:string) = resultStr <- resultStr + x.ToString() + y + z () - Array.iteri2 funStr [|"A"; "B"; "C" ; "D" |] [|"a"; "b"; "c"; "d"|] - if resultStr <> "0Aa1Bb2Cc3Dd" then Assert.Fail() - - // empty array + Array.iteri2 funStr [|"A"; "B"; "C" ; "D" |] [|"a"; "b"; "c"; "d"|] + if resultStr <> "0Aa1Bb2Cc3Dd" then Assert.Fail() + + // empty array let emptyArr:int[] = [| |] let mutable resultEpt = 0 - Array.iteri2 funInt emptyArr emptyArr - if resultEpt <> 0 then Assert.Fail() + Array.iteri2 funInt emptyArr emptyArr + if resultEpt <> 0 then Assert.Fail() // null array let nullArr = null:string[] - let validArray = [| "a" |] - CheckThrowsArgumentNullException (fun () -> Array.iteri2 funStr nullArr validArray |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.iteri2 funStr validArray nullArr |> ignore) - + let validArray = [| "a" |] + CheckThrowsArgumentNullException (fun () -> Array.iteri2 funStr nullArr validArray |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.iteri2 funStr validArray nullArr |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.iteri2 funInt [| 1..10 |] [|2..20|] |> ignore) - - () + + () [] member this.``pairwise should return pairs of the input array``() = @@ -1589,188 +1589,188 @@ type ArrayModule() = CheckThrowsArgumentNullException(fun () -> Array.pairwise null |> ignore) member private this.MapTester mapInt (mapString : (string -> int) -> string array -> int array) = - // empty array + // empty array let f x = x + 1 let result = mapInt f [| |] if result <> [| |] then Assert.Fail () - + // int array let result = mapInt f [| 1..100 |] if result <> [| 2..101 |] then Assert.Fail () - + // string array - let result = [| "a"; "aa"; "aaa" |] |> mapString (fun s -> s.Length) + let result = [| "a"; "aa"; "aaa" |] |> mapString (fun s -> s.Length) if result <> [| 1..3 |] then Assert.Fail () - + // null array let nullArg : int [] = null CheckThrowsArgumentNullException (fun () -> mapInt f nullArg |> ignore) - + () - - [] + + [] member this.Map () = this.MapTester Array.map Array.map - + [] member _.MapWithSideEffects () = let mutable stamp = 0 let f x = stamp <- stamp + 1; x + 1 - + Array.map f [| |] |> ignore Assert.AreEqual(0,stamp) - + stamp <- 0 Array.map f [| 1..100 |] |> ignore Assert.AreEqual(100,stamp) - + [] member this.``Parallel.Map`` () = this.MapTester Array.Parallel.map Array.Parallel.map member private _.MapiTester mapiInt mapiString = - // empty array + // empty array let f i x = (i, x + 1) let result = mapiInt f [| |] if result <> [| |] then Assert.Fail () - + // int array let result : (int*int) array = mapiInt f [| 1..2 |] if result <> [| (0,2); (1,3) |] then Assert.Fail () - + // string array - let result : (int*int) array = [| "a"; "aa"; "aaa" |] |> mapiString (fun i (s:string) -> i, s.Length) + let result : (int*int) array = [| "a"; "aa"; "aaa" |] |> mapiString (fun i (s:string) -> i, s.Length) if result <> [| (0,1); (1,2); (2,3) |] then Assert.Fail () - + // null array let nullArg : int [] = null - CheckThrowsArgumentNullException (fun () -> mapiInt f nullArg |> ignore) + CheckThrowsArgumentNullException (fun () -> mapiInt f nullArg |> ignore) () [] member this.Mapi () = this.MapiTester Array.mapi Array.mapi - + [] member _.MapiWithSideEffects () = let mutable stamp = 0 let f i x = stamp <- stamp + 1; (i, x + 1) - + Array.mapi f [| |] |> ignore Assert.AreEqual(0,stamp) - + stamp <- 0 Array.mapi f [| 1..100 |] |> ignore Assert.AreEqual(100,stamp) () - + [] member this.``Parallel.Mapi`` () = this.MapiTester Array.Parallel.mapi Array.Parallel.mapi () - + [] member _.``Parallel.Iter``() = // integer array - let intArr = [| 1..10 |] + let intArr = [| 1..10 |] let lockObj = obj() - let mutable resultInt = 0 - let funInt (x:int) = + let mutable resultInt = 0 + let funInt (x:int) = lock lockObj (fun () -> resultInt <- resultInt + x) - () - Array.Parallel.iter funInt intArr - if resultInt <> 55 then Assert.Fail() - + () + Array.Parallel.iter funInt intArr + if resultInt <> 55 then Assert.Fail() + // string array let strArr = [|"Lists"; "are"; "commonly" ; "list" |] let mutable resultStr = 0 let funStr (x : string) = lock lockObj (fun () -> resultStr <- resultStr + x.Length) () - Array.Parallel.iter funStr strArr - if resultStr <> 20 then Assert.Fail() - - // empty array + Array.Parallel.iter funStr strArr + if resultStr <> 20 then Assert.Fail() + + // empty array let emptyArr : int[] = [| |] let mutable resultEpt = 0 - Array.Parallel.iter funInt emptyArr - if resultEpt <> 0 then Assert.Fail() + Array.Parallel.iter funInt emptyArr + if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null : string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.iter funStr nullArr |> ignore) - + let nullArr = null : string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.iter funStr nullArr |> ignore) + () - + [] - member _.``Parallel.Iteri``() = + member _.``Parallel.Iteri``() = // integer array - let intArr = [| 1..10 |] - + let intArr = [| 1..10 |] + let lockObj = obj() - let mutable resultInt = 0 - let funInt (x:int) y = + let mutable resultInt = 0 + let funInt (x:int) y = lock lockObj (fun () -> resultInt <- resultInt + x + y) - () - Array.Parallel.iteri funInt intArr - if resultInt <> 100 then Assert.Fail() - + () + Array.Parallel.iteri funInt intArr + if resultInt <> 100 then Assert.Fail() + // string array let strArr = [|"Lists"; "are"; "commonly" ; "list" |] let mutable resultStr = 0 let funStr (x:int) (y:string) = lock lockObj (fun () -> resultStr <- resultStr + x + y.Length) () - Array.Parallel.iteri funStr strArr - if resultStr <> 26 then Assert.Fail() - - // empty array + Array.Parallel.iteri funStr strArr + if resultStr <> 26 then Assert.Fail() + + // empty array let emptyArr:int[] = [| |] let mutable resultEpt = 0 - Array.Parallel.iteri funInt emptyArr - if resultEpt <> 0 then Assert.Fail() + Array.Parallel.iteri funInt emptyArr + if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.iteri funStr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.iteri funStr nullArr |> ignore) + () - + member private this.PartitionTester partInt partString = // int array - let intSrc:int [] = [| 1..100 |] + let intSrc:int [] = [| 1..100 |] let funcInt x = if (x%2=1) then true else false let intPartitioned : int[] * int[] = partInt funcInt intSrc if ([|1..2..100|],[|2..2..100|]) <> intPartitioned then Assert.Fail () - + let allLeft = partInt (fun _ -> true) intSrc if (intSrc, [||]) <> allLeft then Assert.Fail() let allRight = partInt (fun _ -> false) intSrc if ([||], intSrc) <> allRight then Assert.Fail() - + // string array let stringSrc: string [] = "List 1 list 2 3 4 5".Split([|' '|], System.StringSplitOptions.RemoveEmptyEntries) let funcString x = match x with | "list"-> true | "List" -> true | _ -> false - let strPartitioned : string[] * string[] = partString funcString stringSrc + let strPartitioned : string[] * string[] = partString funcString stringSrc if strPartitioned <> ([|"List";"list"|], [| "1";"2"; "3"; "4"; "5"|]) then Assert.Fail () - + // empty array let emptySrc :int[] = [| |] let emptyPartitioned = partInt funcInt emptySrc if emptyPartitioned <> ([| |], [| |]) then Assert.Fail() - + // null array - let nullArr = null:string[] + let nullArr = null:string[] CheckThrowsArgumentNullException (fun () -> partString funcString nullArr |> ignore) - - + + [] member this.Partition () = - this.PartitionTester Array.partition Array.partition + this.PartitionTester Array.partition Array.partition member private this.PartitionWithTester (partWithIntStr: (int -> Choice) -> int array -> int array * string array) @@ -1867,7 +1867,7 @@ type ArrayModule() = [] member this.``Parallel.Partition`` () = - this.PartitionTester Array.Parallel.partition Array.Parallel.partition + this.PartitionTester Array.Parallel.partition Array.Parallel.partition [] member this.``Parallel.PartitionWith``() = @@ -1929,21 +1929,21 @@ type ArrayModule() = CheckThrowsArgumentNullException (fun () -> Array.contains "empty" nullArr |> ignore) [] - member _.``Slicing with first index reverse behaves as expected``() = + member _.``Slicing with first index reverse behaves as expected``() = let arr = [| 1;2;3;4;5 |] Assert.AreEqual(arr.[^3..], arr.[1..]) - + [] - member _.``Slicing with second index reverse behaves as expected``() = + member _.``Slicing with second index reverse behaves as expected``() = let arr = [| 1;2;3;4;5 |] Assert.AreEqual(arr.[..^1], arr.[..3]) - + [] - member _.``Slicing with both index reverse behaves as expected``() = + member _.``Slicing with both index reverse behaves as expected``() = let arr = [| 1;2;3;4;5 |] Assert.AreEqual(arr.[^3..^1], arr.[1..3]) @@ -1961,7 +1961,7 @@ type ArrayModule() = Assert.AreEqual(arr.[3..^0], arr.[3..4]) [] - member _.``Set slice with first index reverse behaves as expected``() = + member _.``Set slice with first index reverse behaves as expected``() = let arr1 = [| 1;2;3;4;5 |] let arr2 = [| 1;2;3;4;5 |] @@ -1971,7 +1971,7 @@ type ArrayModule() = Assert.AreEqual(arr1, arr2) [] - member _.``Set slice with second index reverse behaves as expected``() = + member _.``Set slice with second index reverse behaves as expected``() = let arr1 = [| 1;2;3;4;5 |] let arr2 = [| 1;2;3;4;5 |] @@ -1981,7 +1981,7 @@ type ArrayModule() = Assert.AreEqual(arr1, arr2) [] - member _.``Set slice with both index reverse behaves as expected``() = + member _.``Set slice with both index reverse behaves as expected``() = let arr1 = [| 1;2;3;4;5 |] let arr2 = [| 1;2;3;4;5 |] @@ -1991,19 +1991,19 @@ type ArrayModule() = Assert.AreEqual(arr1, arr2) [] - member _.``Get item with reverse index behaves as expected``() = + member _.``Get item with reverse index behaves as expected``() = let arr = [|1;2;3;4;5|] Assert.AreEqual(arr.[^1], 4) [] - member _.``Set item with reverse index behaves as expected``() = + member _.``Set item with reverse index behaves as expected``() = let arr = [|1;2;3;4;5|] arr.[^0] <- 9 Assert.AreEqual(arr.[4], 9) - [] - member _.SlicingUnboundedEnd() = + [] + member _.SlicingUnboundedEnd() = let arr = [|1;2;3;4;5;6|] Assert.AreEqual(arr.[-1..], arr) @@ -2014,9 +2014,9 @@ type ArrayModule() = Assert.AreEqual(arr.[6..], ([||]: int array)) Assert.AreEqual(arr.[7..], ([||]: int array)) - - [] - member _.SlicingUnboundedStart() = + + [] + member _.SlicingUnboundedStart() = let arr = [|1;2;3;4;5;6|] Assert.AreEqual(arr.[..(-1)], ([||]: int array)) @@ -2057,7 +2057,7 @@ type ArrayModule() = [] - member _.SlicingEmptyArray() = + member _.SlicingEmptyArray() = let empty : obj array = Array.empty Assert.AreEqual(empty.[*], ([||]: obj array)) @@ -2069,9 +2069,9 @@ type ArrayModule() = [] - member _.SlicingOutOfBounds() = + member _.SlicingOutOfBounds() = let arr = [|1;2;3;4;5;6|] - + Assert.AreEqual(arr.[..6], [|1;2;3;4;5;6|]) Assert.AreEqual(arr.[6..], ([||]: int array)) @@ -2093,14 +2093,14 @@ type ArrayModule() = Assert.False(Object.ReferenceEquals(arr[1..3], arr[1..3])) Assert.False(Object.ReferenceEquals(arr[0..], arr[0..])) Assert.False(Object.ReferenceEquals(arr[..^1], arr[..^1])) - + [] member _.``Empty slices are referentially equivalent`` () = let arr = [|1;2;3;4;5;6|] Assert.AreEqual(arr[1..-1].Length, 0) Assert.True(Object.ReferenceEquals(arr[1..-1], arr[1..-1])) - + Assert.True(Object.ReferenceEquals(arr[1..-1], ([||]: int array))) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs index 837574aefdc..96ded93d3bf 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs @@ -30,26 +30,26 @@ type ArrayModule2() = [] member this.Length() = - // integer array + // integer array let resultInt = Array.length [|1..8|] if resultInt <> 8 then Assert.Fail() - - // string array + + // string array let resultStr = Array.length [|"Lists"; "are"; "commonly" ; "list" |] if resultStr <> 4 then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.length [| |] if resultEpt <> 0 then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.length nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.length nullArr |> ignore) + // null array, argument name showing up try Array.length nullArr |> ignore - with + with | :? ArgumentNullException as e -> Assert.Equal("array", e.ParamName) |> ignore () @@ -77,42 +77,42 @@ type ArrayModule2() = () [] - member this.Map() = + member this.Map() = // integer array - let funcInt x = + let funcInt x = match x with - | _ when x % 2 = 0 -> 10*x + | _ when x % 2 = 0 -> 10*x | _ -> x let resultInt = Array.map funcInt [| 1..10 |] if resultInt <> [|1;20;3;40;5;60;7;80;9;100|] then Assert.Fail() - + // string array let funcStr (x:string) = x.ToLower() let resultStr = Array.map funcStr [|"Lists"; "Are"; "Commonly" ; "List" |] if resultStr <> [|"lists"; "are"; "commonly" ; "list" |] then Assert.Fail() - + // empty array let resultEpt = Array.map funcInt [| |] if resultEpt <> [| |] then Assert.Fail() // null array - let nullArr = null:string[] + let nullArr = null:string[] CheckThrowsArgumentNullException (fun () -> Array.map funcStr nullArr |> ignore) - + () [] - member this.Map2() = - // integer array + member this.Map2() = + // integer array let funcInt x y = x+y let resultInt = Array.map2 funcInt [|1..10|] [|2..2..20|] if resultInt <> [|3;6;9;12;15;18;21;24;27;30|] then Assert.Fail() - + // string array let funcStr (x:int) (y:string) = x+ y.Length let resultStr = Array.map2 funcStr [|3;6;9;11|] [|"Lists"; "Are"; "Commonly" ; "List" |] if resultStr <> [|8;9;17;15|] then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] let resultEpt = Array.map2 funcInt emptyArr emptyArr @@ -120,13 +120,13 @@ type ArrayModule2() = // null array let nullArr = null:int[] - let validArray = [| 1 |] - CheckThrowsArgumentNullException (fun () -> Array.map2 funcInt nullArr validArray |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.map2 funcInt validArray nullArr |> ignore) - + let validArray = [| 1 |] + CheckThrowsArgumentNullException (fun () -> Array.map2 funcInt nullArr validArray |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.map2 funcInt validArray nullArr |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.map2 funcInt [|1..10|] [|2..20|] |> ignore) - + () [] @@ -142,7 +142,7 @@ type ArrayModule2() = CheckThrowsArgumentException (fun () -> Array.map3 funcInt [| 1..8 |] [| 2..6 |] [| 3..10 |] |> ignore) // Third array is shorter CheckThrowsArgumentException (fun () -> Array.map3 funcInt [| 1..8 |] [| 2..9 |] [| 3..6 |] |> ignore) - + // String array let funcStr a b c = a + b + c let resultStr = Array.map3 funcStr [| "A";"B";"C";"D" |] [| "a";"b";"c";"d" |] [| "1";"2";"3";"4" |] @@ -212,351 +212,351 @@ type ArrayModule2() = () [] - member this.Mapi() = - // integer array + member this.Mapi() = + // integer array let funcInt x y = x+y let resultInt = Array.mapi funcInt [|10..2..20|] if resultInt <> [|10;13;16;19;22;25|] then Assert.Fail() - + // string array let funcStr (x:int) (y:string) = x+ y.Length let resultStr = Array.mapi funcStr [|"Lists"; "Are"; "Commonly" ; "List" |] if resultStr <> [|5;4;10;7|] then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] - let resultEpt = Array.mapi funcInt emptyArr + let resultEpt = Array.mapi funcInt emptyArr if resultEpt <> [| |] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.mapi funcStr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.mapi funcStr nullArr |> ignore) + () [] - member this.mapi2() = - // integer array + member this.mapi2() = + // integer array let funcInt x y z = x+y+z let resultInt = Array.mapi2 funcInt [|1..10|] [|2..2..20|] if resultInt <> [|3;7;11;15;19;23;27;31;35;39|] then Assert.Fail() - + // string array - let funcStr z (x:int) (y:string) =z + x+ y.Length + let funcStr z (x:int) (y:string) =z + x+ y.Length let resultStr = Array.mapi2 funcStr [|3;6;9;11|] [|"Lists"; "Are"; "Commonly" ; "List" |] if resultStr <> [|8;10;19;18|] then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] let resultEpt = Array.mapi2 funcInt emptyArr emptyArr if resultEpt <> [| |] then Assert.Fail() // null array - let nullArr = null:int[] - let validArray = [| 1 |] - CheckThrowsArgumentNullException (fun () -> Array.mapi2 funcInt validArray nullArr |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.mapi2 funcInt nullArr validArray |> ignore) - + let nullArr = null:int[] + let validArray = [| 1 |] + CheckThrowsArgumentNullException (fun () -> Array.mapi2 funcInt validArray nullArr |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.mapi2 funcInt nullArr validArray |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.mapi2 funcInt [|1..10|] [|2..20|] |> ignore) - + () [] - member this.Max() = - // integer array + member this.Max() = + // integer array let resultInt = Array.max [|2..2..20|] if resultInt <> 20 then Assert.Fail() - + // string array let resultStr = Array.max [|"t"; "ahe"; "Lists"; "Are"; "Commonly" ; "List";"a" |] if resultStr <> "t" then Assert.Fail() - - // empty array -- argumentexception - + + // empty array -- argumentexception + // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.max nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.max nullArr |> ignore) + // len = 0 CheckThrowsArgumentException(fun() -> Array.max [||] |> ignore) - + () [] - member this.MaxBy()= - // integer array + member this.MaxBy()= + // integer array let funcInt x = x%8 let resultInt = Array.maxBy funcInt [|2..2..20|] if resultInt <> 6 then Assert.Fail() - + // string array - let funcStr (x:string) = x.Length + let funcStr (x:string) = x.Length let resultStr = Array.maxBy funcStr [|"Lists"; "Are"; "Commonly" ; "List"|] - if resultStr <> "Commonly" then Assert.Fail() - - // empty array -- argumentexception + if resultStr <> "Commonly" then Assert.Fail() + + // empty array -- argumentexception // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.maxBy funcStr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.maxBy funcStr nullArr |> ignore) + // len = 0 CheckThrowsArgumentException(fun() -> Array.maxBy funcInt (Array.empty) |> ignore) - + // returns first maximal element let max = Array.maxBy fst [|1, "a"; 2, "b"; 3, "c"; 2, "d"; 3, "e"; 1, "f" |] if snd max <> "c" then Assert.Fail() - + () [] member this.Min() = - // integer array + // integer array let resultInt = Array.min [|3;7;8;9;4;1;1;2|] if resultInt <> 1 then Assert.Fail() - + // string array - let resultStr = Array.min [|"a"; "Lists"; "Commonly" ; "List" |] + let resultStr = Array.min [|"a"; "Lists"; "Commonly" ; "List" |] if resultStr <> "Commonly" then Assert.Fail() - - // empty array -- argumentexception - + + // empty array -- argumentexception + // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.min nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.min nullArr |> ignore) + // len = 0 CheckThrowsArgumentException(fun () -> Array.min [||] |> ignore) - - () + + () [] - member this.MinBy()= - // integer array + member this.MinBy()= + // integer array let funcInt x = x%8 let resultInt = Array.minBy funcInt [|3;7;9;4;8;1;1;2|] if resultInt <> 8 then Assert.Fail() - + // string array - let funcStr (x:string) = x.Length + let funcStr (x:string) = x.Length let resultStr = Array.minBy funcStr [|"Lists"; "Are"; "Commonly" ; "List"|] - if resultStr <> "Are" then Assert.Fail() - - // empty array -- argumentexception + if resultStr <> "Are" then Assert.Fail() + + // empty array -- argumentexception // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.minBy funcStr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.minBy funcStr nullArr |> ignore) + // len = 0 CheckThrowsArgumentException(fun () -> Array.minBy funcInt (Array.empty) |> ignore) - + // returns first minimal element let min = Array.minBy fst [|3, "a"; 2, "b"; 1, "c"; 2, "d"; 1, "e"; 3, "f" |] if snd min <> "c" then Assert.Fail() - + () - + [] member this.Of_List() = - // integer array + // integer array let resultInt = Array.ofList [1..10] if resultInt <> [|1..10|] then Assert.Fail() - - // string array + + // string array let resultStr = Array.ofList ["Lists"; "are"; "commonly" ; "list" ] if resultStr <> [| "Lists"; "are"; "commonly" ; "list" |] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.ofList [] if resultEpt <> [||] then Assert.Fail() // null array - + () [] member this.Of_Seq() = - // integer array + // integer array let resultInt = Array.ofSeq (seq {1..10}) if resultInt <> [|1..10|] then Assert.Fail() - - // string array + + // string array let resultStr = Array.ofSeq (seq {for x in 'a'..'f' -> x.ToString()}) if resultStr <> [| "a";"b";"c";"d";"e";"f" |] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.ofSeq [] if resultEpt <> [| |] then Assert.Fail() // null array - + () [] member this.Partition() = - // integer array + // integer array let resultInt = Array.partition (fun x -> x%3 = 0) [|1..10|] if resultInt <> ([|3;6;9|], [|1;2;4;5;7;8;10|]) then Assert.Fail() - - // string array + + // string array let resultStr = Array.partition (fun (x:string) -> x.Length >4) [|"Lists"; "are"; "commonly" ; "list" |] if resultStr <> ([|"Lists";"commonly"|],[|"are"; "list"|]) then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.partition (fun x -> x%3 = 0) [||] if resultEpt <> ([||],[||]) then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.partition (fun (x:string) -> x.Length >4) nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.partition (fun (x:string) -> x.Length >4) nullArr |> ignore) + () [] member this.Permute() = - // integer array + // integer array let resultInt = Array.permute (fun i -> (i+1) % 4) [|1;2;3;4|] if resultInt <> [|4;1;2;3|] then Assert.Fail() - - // string array + + // string array let resultStr = Array.permute (fun i -> (i+1) % 4) [|"Lists"; "are"; "commonly" ; "list" |] if resultStr <> [|"list";"Lists"; "are"; "commonly" |] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.permute (fun i -> (i+1) % 4) [||] if resultEpt <> [||] then Assert.Fail() - + // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.permute (fun i -> (i+1) % 4) nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.permute (fun i -> (i+1) % 4) nullArr |> ignore) + () [] member this.Reduce() = - // integer array + // integer array let resultInt = Array.reduce (fun x y -> x/y) [|5*4*3*2; 4;3;2;1|] if resultInt <> 5 then Assert.Fail() - - // string array + + // string array let resultStr = Array.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) [|"ABCDE";"A"; "B"; "C" ; "D" |] if resultStr <> "E" then Assert.Fail() - - // empty array + + // empty array CheckThrowsArgumentException (fun () -> Array.reduce (fun x y -> x/y) [||] |> ignore) // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullArr |> ignore) + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullArr |> ignore) [] member this.ParallelReduce() = - let assertSameBehavior reduction arr = + let assertSameBehavior reduction arr = Assert.AreEqual(Array.reduce reduction arr, Array.Parallel.reduce reduction arr) [|5;4;3;2;1|] |> assertSameBehavior (fun x y -> x+y) [|"A"; "B"; "C" ; "D" |] |> assertSameBehavior (fun x y -> if x < y then x else y) - CheckThrowsArgumentException (fun () -> Array.Parallel.reduce (fun x y -> x/y) [||] |> ignore) - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullArr |> ignore) + CheckThrowsArgumentException (fun () -> Array.Parallel.reduce (fun x y -> x/y) [||] |> ignore) + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullArr |> ignore) [] member this.ParallelReduceBy() = - let assertSameBehavior projection reduction arr = + let assertSameBehavior projection reduction arr = Assert.AreEqual(arr |> Array.map projection |> Array.reduce reduction, Array.Parallel.reduceBy projection reduction arr) [|5;4;3;2;1|] |> assertSameBehavior (fun x -> x * 2)(fun x y -> x+y) [|"ABCD"; "B"; "C" ; "D" |] |> assertSameBehavior (fun x -> x.Length) (Operators.Checked.(+)) - CheckThrowsArgumentException (fun () -> Array.Parallel.reduceBy id (fun x y -> x/y) [||] |> ignore) - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.reduceBy id (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullArr |> ignore) - + CheckThrowsArgumentException (fun () -> Array.Parallel.reduceBy id (fun x y -> x/y) [||] |> ignore) + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.reduceBy id (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullArr |> ignore) + [] member this.ReduceBack() = - // integer array + // integer array let resultInt = Array.reduceBack (fun x y -> x/y) [|5*4*3*2; 4;3;2;1|] if resultInt <> 30 then Assert.Fail() - - // string array + + // string array let resultStr = Array.reduceBack (fun (x:string) (y:string) -> x.Remove(0,y.Length)) [|"ABCDE";"A"; "B"; "C" ; "D" |] if resultStr <> "ABCDE" then Assert.Fail() - - // empty array + + // empty array CheckThrowsArgumentException (fun () -> Array.reduceBack (fun x y -> x/y) [||] |> ignore) // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.reduceBack (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.reduceBack (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullArr |> ignore) + () - + [] member this.Rev() = - // integer array + // integer array let resultInt = Array.rev [|1..10|] if resultInt <> [|10;9;8;7;6;5;4;3;2;1|] then Assert.Fail() - - // string array + + // string array let resultStr = Array.rev [|"Lists"; "are"; "commonly" ; "list" |] if resultStr <> [|"list"; "commonly"; "are"; "Lists" |] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.rev [||] if resultEpt <> [||] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.rev nullArr |> ignore) + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.rev nullArr |> ignore) () - [] + [] member this.Scan() = // integer array let funcInt x y = x+y let resultInt = Array.scan funcInt 9 [| 1..10 |] if resultInt <> [|9;10;12;15;19;24;30;37;45;54;64|] then Assert.Fail() - + // string array - let funcStr x y = x+y + let funcStr x y = x+y let resultStr = Array.scan funcStr "x" [|"A"; "B"; "C" ; "D" |] if resultStr <> [|"x";"xA";"xAB";"xABC";"xABCD"|] then Assert.Fail() - + // empty array let resultEpt = Array.scan funcInt 5 [| |] if resultEpt <> [|5|] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.scan funcStr "begin" nullArr |> ignore) - - () - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.scan funcStr "begin" nullArr |> ignore) + + () + [] member this.ScanBack() = - // integer array + // integer array let funcInt x y = x+y let resultInt = Array.scanBack funcInt [| 1..10 |] 9 if resultInt <> [|64;63;61;58;54;49;43;36;28;19;9|] then Assert.Fail() - + // string array - let funcStr x y = x+y - let resultStr = Array.scanBack funcStr [|"A"; "B"; "C" ; "D" |] "X" + let funcStr x y = x+y + let resultStr = Array.scanBack funcStr [|"A"; "B"; "C" ; "D" |] "X" if resultStr <> [|"ABCDX";"BCDX";"CDX";"DX";"X"|] then Assert.Fail() - + // empty array - let resultEpt = Array.scanBack funcInt [| |] 5 + let resultEpt = Array.scanBack funcInt [| |] 5 if resultEpt <> [|5|] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.scanBack funcStr nullArr "begin" |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.scanBack funcStr nullArr "begin" |> ignore) + () [] @@ -564,10 +564,10 @@ type ArrayModule2() = // integer array let resultInt = Array.skip 2 [|1..10|] if resultInt <> [|3..10|] then Assert.Fail() - + let resultInt2 = Array.skip 0 [|1..10|] if resultInt2 <> [|1..10|] then Assert.Fail() - + let resultInt3 = Array.skip -5 [|1..10|] if resultInt3 <> [|1..10|] then Assert.Fail() @@ -618,193 +618,193 @@ type ArrayModule2() = [] member this.Set() = - // integer array + // integer array let intArr = [|10;9;8;7|] Array.set intArr 3 600 - if intArr <> [|10;9;8;600|] then Assert.Fail() - + if intArr <> [|10;9;8;600|] then Assert.Fail() + // string array - let strArr = [|"Lists"; "are"; "commonly" ; "list" |] + let strArr = [|"Lists"; "are"; "commonly" ; "list" |] Array.set strArr 2 "always" if strArr <> [|"Lists"; "are"; "always" ; "list" |] then Assert.Fail() - + // empty array -- outofbundaryexception - + // null array - let nullArr = null:string[] + let nullArr = null:string[] CheckThrowsNullRefException (fun () -> Array.set nullArr 0 "null" |> ignore) - - () + + () [] member this.sortInPlaceWith() = - // integer array + // integer array let intArr = [|3;5;7;2;4;8|] - Array.sortInPlaceWith compare intArr - if intArr <> [|2;3;4;5;7;8|] then Assert.Fail() + Array.sortInPlaceWith compare intArr + if intArr <> [|2;3;4;5;7;8|] then Assert.Fail() // Sort backwards let intArr = [|3;5;7;2;4;8|] - Array.sortInPlaceWith (fun a b -> -1 * compare a b) intArr - if intArr <> [|8;7;5;4;3;2|] then Assert.Fail() - + Array.sortInPlaceWith (fun a b -> -1 * compare a b) intArr + if intArr <> [|8;7;5;4;3;2|] then Assert.Fail() + // string array - let strArr = [|"Lists"; "are"; "a"; "commonly"; "used"; "data"; "structure"|] - Array.sortInPlaceWith compare strArr + let strArr = [|"Lists"; "are"; "a"; "commonly"; "used"; "data"; "structure"|] + Array.sortInPlaceWith compare strArr if strArr <> [| "Lists"; "a"; "are"; "commonly"; "data"; "structure"; "used"|] then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] Array.sortInPlaceWith compare emptyArr if emptyArr <> [||] then Assert.Fail() - + // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.sortInPlaceWith compare nullArr |> ignore) - - // len = 2 - let len2Arr = [|8;3|] + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.sortInPlaceWith compare nullArr |> ignore) + + // len = 2 + let len2Arr = [|8;3|] Array.sortInPlaceWith compare len2Arr Assert.AreEqual([|3;8|], len2Arr) - + // Equal elements - let eights = [|8; 8;8|] + let eights = [|8; 8;8|] Array.sortInPlaceWith compare eights Assert.AreEqual([|8;8;8|], eights) - - () + () - member private _.MultiplyArray(template:_[],repetitions:int) = - Array.zeroCreate repetitions |> Array.collect (fun _ -> template) - member private _.CompareTwoMethods<'TIn,'TOut when 'TOut: equality> (regularArrayFunc:'TIn[]->'TOut[]) (arrayParaFunc:'TIn[]->'TOut[]) (initialData:'TIn[]) = + member private _.MultiplyArray(template:_[],repetitions:int) = + Array.zeroCreate repetitions |> Array.collect (fun _ -> template) + + member private _.CompareTwoMethods<'TIn,'TOut when 'TOut: equality> (regularArrayFunc:'TIn[]->'TOut[]) (arrayParaFunc:'TIn[]->'TOut[]) (initialData:'TIn[]) = let first,second = initialData, Array.copy initialData let whenSequential = regularArrayFunc second let whenParallel = arrayParaFunc first if(whenSequential <> whenParallel) then Assert.AreEqual(whenSequential.Length, whenParallel.Length, "Lengths are different") - let diffsAt = + let diffsAt = Array.zip whenSequential whenParallel |> Array.mapi (fun idx (a,b) -> if(a <> b) then Some(idx,(a,b)) else None) |> Array.choose id |> dict - + Assert.Empty(diffsAt) Assert.Equal<'TOut>(whenSequential, whenParallel) [] - member this.sortInPlaceWithParallel() = + member this.sortInPlaceWithParallel() = let tee f x = f x; x - // integer array - this.MultiplyArray([|3;5;7;2;4;8|],1_000) + // integer array + this.MultiplyArray([|3;5;7;2;4;8|],1_000) |> this.CompareTwoMethods (tee (Array.sortInPlaceWith compare)) (tee (Array.Parallel.sortInPlaceWith compare)) // Sort backwards - this.MultiplyArray([|3;5;7;2;4;8|],1_000) + this.MultiplyArray([|3;5;7;2;4;8|],1_000) |> this.CompareTwoMethods (tee (Array.sortInPlaceWith (fun a b -> -1 * compare a b))) (tee (Array.Parallel.sortInPlaceWith (fun a b -> -1 * compare a b))) - + // string array - let strArr = [|"Lists"; "are"; "a"; "commonly"; "used"; "data"; "structure"|] - this.MultiplyArray(strArr,1_000) + let strArr = [|"Lists"; "are"; "a"; "commonly"; "used"; "data"; "structure"|] + this.MultiplyArray(strArr,1_000) |> this.CompareTwoMethods (tee (Array.sortInPlaceWith compare)) (tee (Array.Parallel.sortInPlaceWith compare)) - + // empty array [| |] - |> this.CompareTwoMethods (tee (Array.sortInPlaceWith compare)) (tee (Array.Parallel.sortInPlaceWith compare)) - + |> this.CompareTwoMethods (tee (Array.sortInPlaceWith compare)) (tee (Array.Parallel.sortInPlaceWith compare)) + // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.sortInPlaceWith compare nullArr |> ignore) + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.sortInPlaceWith compare nullArr |> ignore) - // Equal elements - this.MultiplyArray([|8; 8;8|],1_000) + // Equal elements + this.MultiplyArray([|8; 8;8|],1_000) |> this.CompareTwoMethods (tee (Array.sortInPlaceWith compare)) (tee (Array.Parallel.sortInPlaceWith compare)) - - () + + () [] member this.sortInPlaceBy() = - // integer array + // integer array let intArr = [|3;5;7;2;4;8|] - Array.sortInPlaceBy int intArr - if intArr <> [|2;3;4;5;7;8|] then Assert.Fail() - + Array.sortInPlaceBy int intArr + if intArr <> [|2;3;4;5;7;8|] then Assert.Fail() + // string array - let strArr = [|"Lists"; "are"; "a"; "commonly"; "used"; "data"; "structure"|] - Array.sortInPlaceBy (fun (x:string) -> x.Length) strArr + let strArr = [|"Lists"; "are"; "a"; "commonly"; "used"; "data"; "structure"|] + Array.sortInPlaceBy (fun (x:string) -> x.Length) strArr // note: Array.sortInPlaceBy is not stable, so we allow 2 results. if strArr <> [| "a"; "are";"data"; "used";"Lists"; "commonly";"structure"|] && strArr <> [| "a"; "are"; "used"; "data"; "Lists"; "commonly";"structure"|] then Assert.Fail() - + // empty array let emptyArr:int[] = [| |] Array.sortInPlaceBy int emptyArr if emptyArr <> [||] then Assert.Fail() - + // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.sortInPlaceBy (fun (x:string) -> x.Length) nullArr |> ignore) - - // len = 2 - let len2Arr = [|8;3|] + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.sortInPlaceBy (fun (x:string) -> x.Length) nullArr |> ignore) + + // len = 2 + let len2Arr = [|8;3|] Array.sortInPlaceBy int len2Arr - if len2Arr <> [|3;8|] then Assert.Fail() - Assert.AreEqual([|3;8|],len2Arr) - - () + if len2Arr <> [|3;8|] then Assert.Fail() + Assert.AreEqual([|3;8|],len2Arr) + + () [] member this.sortInPlaceByParallel() = let tee f x = f x; x - // integer array - this.MultiplyArray([|3;5;7;2;4;8|],50) + // integer array + this.MultiplyArray([|3;5;7;2;4;8|],50) |> this.CompareTwoMethods (tee (Array.sortInPlaceBy int)) (tee (Array.Parallel.sortInPlaceBy int)) - + // string array - let strArr = [|"Lists"; "are"; "a"; "commonly"; "used"; "datastructure"|] - this.MultiplyArray(strArr,1_000) + let strArr = [|"Lists"; "are"; "a"; "commonly"; "used"; "datastructure"|] + this.MultiplyArray(strArr,1_000) |> this.CompareTwoMethods (tee (Array.sortInPlaceBy (fun (x:string) -> x.Length))) (tee (Array.Parallel.sortInPlaceBy (fun (x:string) -> x.Length))) - - + + // empty array let emptyArr:int[] = [| |] Array.Parallel.sortInPlaceBy int emptyArr if emptyArr <> [||] then Assert.Fail() - + // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.sortInPlaceBy (fun (x:string) -> x.Length) nullArr |> ignore) + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.sortInPlaceBy (fun (x:string) -> x.Length) nullArr |> ignore) + + () - () - [] member this.SortDescending() = - // integer array + // integer array let intArr = [|3;5;7;2;4;8|] - let resultInt = Array.sortDescending intArr + let resultInt = Array.sortDescending intArr Assert.AreEqual([|8;7;5;4;3;2|], resultInt) - + // string Array - let strArr = [|"Z";"a";"d"; ""; "Y"; null; "c";"b";"X"|] - let resultStr = Array.sortDescending strArr + let strArr = [|"Z";"a";"d"; ""; "Y"; null; "c";"b";"X"|] + let resultStr = Array.sortDescending strArr Assert.AreEqual([|"d"; "c"; "b"; "a"; "Z"; "Y"; "X"; ""; null|], resultStr) - + // empty array let emptyArr:int[] = [| |] let resultEmpty = Array.sortDescending emptyArr if resultEmpty <> [||] then Assert.Fail() - + // tuple array - let tupArr = [|(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")|] - let resultTup = Array.sortDescending tupArr + let tupArr = [|(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")|] + let resultTup = Array.sortDescending tupArr Assert.AreEqual([|(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")|], resultTup) // date array - let dateArr = [|DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2015,1,1);DateTime(2013,12,31);DateTime(2014,1,1)|] - let resultDate = Array.sortDescending dateArr + let dateArr = [|DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2015,1,1);DateTime(2013,12,31);DateTime(2014,1,1)|] + let resultDate = Array.sortDescending dateArr Assert.AreEqual([|DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2015,1,1);DateTime(2013,12,31);DateTime(2014,1,1)|], dateArr) Assert.AreEqual([|DateTime(2015,1,1);DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2014,1,1);DateTime(2013,12,31)|], resultDate) @@ -814,70 +814,70 @@ type ArrayModule2() = let resultFloat = Array.sortDescending floatArr Assert.AreEqual([| maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; |], resultFloat) - () + () [] member this.SortDescendingParallel() = - // integer array - this.MultiplyArray([|3;5;7;2;4;8|],1_000) + // integer array + this.MultiplyArray([|3;5;7;2;4;8|],1_000) |> this.CompareTwoMethods (Array.sortDescending) (Array.Parallel.sortDescending) - + // string array - this.MultiplyArray([|"Z";"a";"d"; ""; "Y"; null; "c";"b";"X"|] ,1_000) + this.MultiplyArray([|"Z";"a";"d"; ""; "Y"; null; "c";"b";"X"|] ,1_000) |> this.CompareTwoMethods (Array.sortDescending) (Array.Parallel.sortDescending) - + // empty array let emptyArr:int[] = [| |] let resultEmpty = Array.Parallel.sortDescending emptyArr if resultEmpty <> [||] then Assert.Fail() - + // tuple array - let tupArr = [|(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")|] - this.MultiplyArray(tupArr,1_000) - |> this.CompareTwoMethods (Array.sortDescending) (Array.Parallel.sortDescending) + let tupArr = [|(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")|] + this.MultiplyArray(tupArr,1_000) + |> this.CompareTwoMethods (Array.sortDescending) (Array.Parallel.sortDescending) // date array - let dateArr = [|DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2015,1,1);DateTime(2013,12,31);DateTime(2014,1,1)|] - this.MultiplyArray(dateArr,1_000) - |> this.CompareTwoMethods (Array.sortDescending) (Array.Parallel.sortDescending) + let dateArr = [|DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2015,1,1);DateTime(2013,12,31);DateTime(2014,1,1)|] + this.MultiplyArray(dateArr,1_000) + |> this.CompareTwoMethods (Array.sortDescending) (Array.Parallel.sortDescending) Assert.AreEqual([|DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2015,1,1);DateTime(2013,12,31);DateTime(2014,1,1)|], dateArr) // float array let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon let floatArr = [| 0.0; 0.5; 2.0; 1.5; 1.0; minFloat; maxFloat; epsilon; -epsilon |] - this.MultiplyArray(floatArr,1_000) - |> this.CompareTwoMethods (Array.sortDescending) (Array.Parallel.sortDescending) + this.MultiplyArray(floatArr,1_000) + |> this.CompareTwoMethods (Array.sortDescending) (Array.Parallel.sortDescending) + + () - () - [] member this.SortByDescending() = - // integer array + // integer array let intArr = [|3;5;7;2;4;8|] - let resultInt = Array.sortByDescending int intArr + let resultInt = Array.sortByDescending int intArr Assert.AreEqual([|3;5;7;2;4;8|], intArr) Assert.AreEqual([|8;7;5;4;3;2|], resultInt) - + // string array - let strArr = [|".."; ""; "..."; "."; "...."|] - let resultStr = Array.sortByDescending (fun (x:string) -> x.Length) strArr + let strArr = [|".."; ""; "..."; "."; "...."|] + let resultStr = Array.sortByDescending (fun (x:string) -> x.Length) strArr Assert.AreEqual([|".."; ""; "..."; "."; "...."|], strArr) Assert.AreEqual([|"....";"...";"..";"."; ""|], resultStr) - + // empty array let emptyArr:int[] = [| |] - let resultEmpty = Array.sortByDescending int emptyArr - if resultEmpty <> [||] then Assert.Fail() - + let resultEmpty = Array.sortByDescending int emptyArr + if resultEmpty <> [||] then Assert.Fail() + // tuple array let tupArr = [|(2,"a");(1,"d");(1,"b");(2,"x")|] - let sndTup = Array.sortByDescending snd tupArr + let sndTup = Array.sortByDescending snd tupArr Assert.AreEqual( [|(2,"a");(1,"d");(1,"b");(2,"x")|] , tupArr) Assert.AreEqual( [|(2,"x");(1,"d");(1,"b");(2,"a")|] , sndTup) - + // date array let dateArr = [|DateTime(2013,12,31);DateTime(2014,2,1);DateTime(2015,1,1);DateTime(2014,3,1)|] - let resultDate = Array.sortByDescending (fun (d:DateTime) -> d.Month) dateArr + let resultDate = Array.sortByDescending (fun (d:DateTime) -> d.Month) dateArr Assert.AreEqual([|DateTime(2013,12,31);DateTime(2014,2,1);DateTime(2015,1,1);DateTime(2014,3,1)|], dateArr) Assert.AreEqual([|DateTime(2013,12,31);DateTime(2014,3,1);DateTime(2014,2,1);DateTime(2015,1,1)|], resultDate) @@ -887,39 +887,39 @@ type ArrayModule2() = let resultFloat = Array.sortByDescending id floatArr Assert.AreEqual([| maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; |], resultFloat) - () + () [] member this.SortByDescendingParallel() = - // integer array + // integer array let intArr = [|3;5;7;2;4;8|] this.MultiplyArray(intArr,1_000) - |> this.CompareTwoMethods(Array.sortByDescending int) (Array.Parallel.sortByDescending int) + |> this.CompareTwoMethods(Array.sortByDescending int) (Array.Parallel.sortByDescending int) Assert.AreEqual([|3;5;7;2;4;8|], intArr) - + // string array - let strArr = [|".."; ""; "..."; "."; "...."|] + let strArr = [|".."; ""; "..."; "."; "...."|] this.MultiplyArray(strArr,1_000) - |> this.CompareTwoMethods(Array.sortByDescending (fun (x:string) -> x.Length)) (Array.Parallel.sortByDescending (fun (x:string) -> x.Length)) + |> this.CompareTwoMethods(Array.sortByDescending (fun (x:string) -> x.Length)) (Array.Parallel.sortByDescending (fun (x:string) -> x.Length)) Assert.AreEqual([|".."; ""; "..."; "."; "...."|], strArr) - + // empty array let emptyArr:int[] = [| |] - let resultEmpty = Array.Parallel.sortByDescending int emptyArr - if resultEmpty <> [||] then Assert.Fail() - + let resultEmpty = Array.Parallel.sortByDescending int emptyArr + if resultEmpty <> [||] then Assert.Fail() + // tuple array let tupArr = [|(2,"a");(1,"d");(1,"b");(2,"x")|] this.MultiplyArray(tupArr,1_000) - |> this.CompareTwoMethods(Array.sortByDescending snd) (Array.Parallel.sortByDescending snd) - Assert.AreEqual( [|(2,"a");(1,"d");(1,"b");(2,"x")|] , tupArr) - + |> this.CompareTwoMethods(Array.sortByDescending snd) (Array.Parallel.sortByDescending snd) + Assert.AreEqual( [|(2,"a");(1,"d");(1,"b");(2,"x")|] , tupArr) + // date array let dateArr = [|DateTime(2013,12,31);DateTime(2014,2,1);DateTime(2015,1,1);DateTime(2014,3,1)|] this.MultiplyArray(dateArr,1_000) - |> this.CompareTwoMethods(Array.sortByDescending (fun (d:DateTime) -> d.Month)) (Array.Parallel.sortByDescending (fun (d:DateTime) -> d.Month)) - Assert.AreEqual([|DateTime(2013,12,31);DateTime(2014,2,1);DateTime(2015,1,1);DateTime(2014,3,1)|], dateArr) + |> this.CompareTwoMethods(Array.sortByDescending (fun (d:DateTime) -> d.Month)) (Array.Parallel.sortByDescending (fun (d:DateTime) -> d.Month)) + Assert.AreEqual([|DateTime(2013,12,31);DateTime(2014,2,1);DateTime(2015,1,1);DateTime(2014,3,1)|], dateArr) // float array let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon @@ -927,76 +927,76 @@ type ArrayModule2() = this.MultiplyArray(floatArr,1_000) |> this.CompareTwoMethods(Array.sortByDescending id) (Array.Parallel.sortByDescending id) - () - + () + [] member this.Sub() = - // integer array + // integer array let resultInt = Array.sub [|1..8|] 3 3 if resultInt <> [|4;5;6|] then Assert.Fail() - - // string array + + // string array let resultStr = Array.sub [|"Lists"; "are"; "commonly" ; "list" |] 1 2 if resultStr <> [|"are"; "commonly" |] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.sub [| |] 0 0 if resultEpt <> [||] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.sub nullArr 1 1 |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.sub nullArr 1 1 |> ignore) + // bounds CheckThrowsArgumentException (fun () -> Array.sub resultInt -1 2 |> ignore) CheckThrowsArgumentException (fun () -> Array.sub resultInt 1 -2 |> ignore) CheckThrowsArgumentException (fun () -> Array.sub resultInt 1 20 |> ignore) - + () [] member this.Sum() = - // empty integer array - let resultEptInt = Array.sum ([||]:int[]) + // empty integer array + let resultEptInt = Array.sum ([||]:int[]) if resultEptInt <> 0 then Assert.Fail(sprintf "int: should 0 but is %i" resultEptInt) - + // empty float32 array - let emptyFloatArray = Array.empty - let resultEptFloat = Array.sum emptyFloatArray + let emptyFloatArray = Array.empty + let resultEptFloat = Array.sum emptyFloatArray if resultEptFloat <> 0.0f then Assert.Fail(sprintf "float32: should be 0 but is %.10f" resultEptFloat) - + // empty double array - let emptyDoubleArray = Array.empty - let resultEptDouble = Array.sum emptyDoubleArray + let emptyDoubleArray = Array.empty + let resultEptDouble = Array.sum emptyDoubleArray if resultEptDouble <> 0.0 then Assert.Fail(sprintf "float: should be 0 but is %.10f" resultEptDouble) - + // empty decimal array - let emptyDecimalArray = Array.empty - let resultEptDec = Array.sum emptyDecimalArray + let emptyDecimalArray = Array.empty + let resultEptDec = Array.sum emptyDecimalArray if resultEptDec <> 0M then Assert.Fail(sprintf "decimal: should be 0 but is %M" resultEptDec) - // integer array - let resultInt = Array.sum [|1..10|] + // integer array + let resultInt = Array.sum [|1..10|] if resultInt <> 55 then Assert.Fail(sprintf "int: should 55 but is %i" resultInt) - + // float32 array let floatArray: float32[] = [| 1.1f; 1.1f; 1.1f |] let resultFloat = Array.sum floatArray if abs (resultFloat - 3.3f) > 0.000001f then Assert.Fail(sprintf "float32: should be 3.3 but is %.10f" resultFloat) - + // double array let doubleArray: System.Double[] = [| 1.0; 8.0 |] let resultDouble = Array.sum doubleArray if resultDouble <> 9.0 then Assert.Fail(sprintf "float: should be 9.0 but is %.10f" resultDouble) - + // decimal array let decimalArray: decimal[] = [| 0M; 19M; 19.03M |] let resultDecimal = Array.sum decimalArray if resultDecimal <> 38.03M then Assert.Fail(sprintf "decimal: should be 38.03 but is %M" resultDecimal) - + // null array - let nullArr = null:double[] - CheckThrowsArgumentNullException (fun () -> Array.sum nullArr |> ignore) + let nullArr = null:double[] + CheckThrowsArgumentNullException (fun () -> Array.sum nullArr |> ignore) () [] @@ -1004,17 +1004,17 @@ type ArrayModule2() = // empty integer array let resultEptInt = Array.sumBy int ([||]:int[]) if resultEptInt <> 0 then Assert.Fail(sprintf "int: should 0 but is %i" resultEptInt) - + // empty float32 array let emptyFloatArray = Array.empty let resultEptFloat = Array.sumBy float32 emptyFloatArray if resultEptFloat <> 0.0f then Assert.Fail(sprintf "float32: should be 0 but is %.10f" resultEptFloat) - + // empty double array let emptyDoubleArray = Array.empty let resultEptDouble = Array.sumBy float emptyDoubleArray if resultEptDouble <> 0.0 then Assert.Fail(sprintf "float: should be 0 but is %.10f" resultEptDouble) - + // empty decimal array let emptyDecimalArray = Array.empty let resultEptDec = Array.sumBy decimal emptyDecimalArray @@ -1023,17 +1023,17 @@ type ArrayModule2() = // integer array let resultInt = Array.sumBy int [|1..10|] if resultInt <> 55 then Assert.Fail(sprintf "int: should 55 but is %i" resultInt) - + // float32 array let floatArray: string[] = [| "1.2";"3.5";"6.7" |] let resultFloat = Array.sumBy float32 floatArray if abs (resultFloat - 11.4f) > 0.000001f then Assert.Fail(sprintf "float32: should be 11.4 but is %.10f" resultFloat) - + // double array let doubleArray: System.Double[] = [| 1.0;8.0 |] let resultDouble = Array.sumBy float doubleArray if resultDouble <> 9.0 then Assert.Fail(sprintf "float: should be 9.0 but is %.10f" resultDouble) - + // decimal array let decimalArray: decimal[] = [| 0M;19M;19.03M |] let resultDecimal = Array.sumBy decimal decimalArray @@ -1043,7 +1043,7 @@ type ArrayModule2() = CheckThrowsArgumentNullException (fun () -> Array.sumBy float32 nullArr |> ignore) () - member private _.TestOperation opName (actual:'T) (expected:'T) = + member private _.TestOperation opName (actual:'T) (expected:'T) = Assert.AreEqual(expected, actual, sprintf "%s: should be %A but is %A" opName expected actual) [] @@ -1057,7 +1057,7 @@ type ArrayModule2() = this.TestOperation "sum nan" (Array.Parallel.sum [|infinity;nan|] |> Double.IsNaN) (true) [] - member this.ParallelSumBy() = + member this.ParallelSumBy() = this.TestOperation "sum_by empty" (Array.Parallel.sumBy int [||]) (0) this.TestOperation "sum_by single" (Array.Parallel.sumBy int [|42|]) (42) this.TestOperation "sum_by two" (Array.Parallel.sumBy int [|42;-21|]) (21) @@ -1075,7 +1075,7 @@ type ArrayModule2() = this.TestOperation "average of two" (Array.Parallel.average [|4.;6.|]) (5.) [] - member this.ParallelAverageBy() = + member this.ParallelAverageBy() = CheckThrowsArgumentException (fun () -> Array.Parallel.averageBy float [||] |> ignore) this.TestOperation "average_by of 0" (Array.Parallel.averageBy id [|0.|]) (0.) this.TestOperation "average_by of single" (Array.Parallel.averageBy id [|4.|]) (4.) @@ -1084,21 +1084,21 @@ type ArrayModule2() = this.TestOperation "average_by string.Length" (Array.Parallel.averageBy (String.length >> float) [|"ab";"cdef"|]) (3.) [] - member this.ParallelMin() = + member this.ParallelMin() = CheckThrowsArgumentException (fun () -> Array.Parallel.min [||] |> ignore) this.TestOperation "min single" (Array.Parallel.min [|42|]) (42) this.TestOperation "min many" (Array.Parallel.min [|1..100|]) (1) this.TestOperation "min floats" (Array.Parallel.min [|1.0;-1.0;nan;infinity;-infinity|]) (-infinity) [] - member this.ParallelMax() = + member this.ParallelMax() = CheckThrowsArgumentException (fun () -> Array.Parallel.max [||] |> ignore) this.TestOperation "max single" (Array.Parallel.max [|42|]) (42) this.TestOperation "max many" (Array.Parallel.max [|1..100|]) (100) this.TestOperation "max floats" (Array.Parallel.max [|1.0;-1.0;nan;infinity;-infinity|]) (infinity) [] - member this.ParallelMinBy() = + member this.ParallelMinBy() = CheckThrowsArgumentException (fun () -> Array.Parallel.minBy string [||] |> ignore) this.TestOperation "minBy single" (Array.Parallel.minBy string [|42|]) (42) this.TestOperation "minBy int->string" (Array.Parallel.minBy string [|5..25|]) (10) @@ -1106,7 +1106,7 @@ type ArrayModule2() = this.TestOperation "minBy floats" (Array.Parallel.minBy (fun x -> 1./float x) [|1..100|]) (100) [] - member this.ParallelMaxBy() = + member this.ParallelMaxBy() = CheckThrowsArgumentException (fun () -> Array.Parallel.maxBy int [||] |> ignore) this.TestOperation "maxBy single" (Array.Parallel.maxBy string [|42|]) (42) this.TestOperation "maxBy many" (Array.Parallel.maxBy (fun x -> -x) [|1..100|]) (1) @@ -1115,16 +1115,16 @@ type ArrayModule2() = [] member this.Tl() = - // integer array - let resultInt = Array.tail [|1..10|] + // integer array + let resultInt = Array.tail [|1..10|] Assert.AreEqual([|2..10|], resultInt) - - // string array - let resultStr = Array.tail [| "a"; "b"; "c"; "d" |] + + // string array + let resultStr = Array.tail [| "a"; "b"; "c"; "d" |] Assert.AreEqual([| "b"; "c" ; "d" |], resultStr) - - // 1-element array - let resultStr2 = Array.tail [| "a" |] + + // 1-element array + let resultStr2 = Array.tail [| "a" |] Assert.AreEqual([| |], resultStr2) CheckThrowsArgumentException(fun () -> Array.tail [||] |> ignore) @@ -1134,43 +1134,43 @@ type ArrayModule2() = [] member this.To_List() = - // integer array + // integer array let resultInt = Array.toList [|1..10|] if resultInt <> [1..10] then Assert.Fail() - - // string array + + // string array let resultStr = Array.toList [|"Lists"; "are"; "commonly" ; "list" |] if resultStr <> ["Lists"; "are"; "commonly" ; "list"] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.toList [||] if resultEpt <> [] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.toList nullArr |> ignore) - - () - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.toList nullArr |> ignore) + + () + [] member this.To_Seq() = - // integer array + // integer array let resultInt = [|1..10|] |> Array.toSeq |> Array.ofSeq if resultInt <> [|1..10|] then Assert.Fail() - - // string array + + // string array let resultStr = [|"Lists"; "are"; "commonly" ; "list" |] |> Array.toSeq |> Array.ofSeq if resultStr <> [|"Lists"; "are"; "commonly" ; "list" |] then Assert.Fail() - - // empty array + + // empty array let resultEpt =[||] |> Array.toSeq |> Array.ofSeq if resultEpt <> [||] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> nullArr |> Array.toSeq |> ignore) - - () + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> nullArr |> Array.toSeq |> ignore) + + () [] member this.Transpose() = @@ -1221,22 +1221,22 @@ type ArrayModule2() = () member private _.TryFindTester tryFindInts tryFindStrings = - // integer array - let resultInt = [|1..10|] |> tryFindInts (fun x -> x%7 = 0) + // integer array + let resultInt = [|1..10|] |> tryFindInts (fun x -> x%7 = 0) if resultInt <> Some 7 then Assert.Fail() - - // string array + + // string array let resultStr = [|"Lists"; "are"; "commonly" ; "list" |] |> tryFindStrings (fun (x:string) -> x.Length > 4) if resultStr <> Some "Lists" then Assert.Fail() - - // empty array - let resultEpt =[||] |> tryFindInts (fun x -> x%7 = 0) + + // empty array + let resultEpt =[||] |> tryFindInts (fun x -> x%7 = 0) if resultEpt <> None then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> tryFindStrings (fun (x:string) -> x.Length > 4) nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> tryFindStrings (fun (x:string) -> x.Length > 4) nullArr |> ignore) + () [] @@ -1244,8 +1244,8 @@ type ArrayModule2() = [] member this.ParallelTryFind() = this.TryFindTester Array.Parallel.tryFind Array.Parallel.tryFind - - + + [] member this.TryFindBack() = // integer array @@ -1271,22 +1271,22 @@ type ArrayModule2() = () member private _.TryFindIndexTester tryFindIdxInt tryFindIdxString = - // integer array - let resultInt = [|1..10|] |> tryFindIdxInt (fun x -> x%7 = 0) + // integer array + let resultInt = [|1..10|] |> tryFindIdxInt (fun x -> x%7 = 0) if resultInt <> Some 6 then Assert.Fail() - - // string array + + // string array let resultStr = [|"Lists"; "are"; "commonly" ; "list" |] |> tryFindIdxString (fun (x:string) -> x.Length > 4) if resultStr <> Some 0 then Assert.Fail() - - // empty array - let resultEpt =[||] |> tryFindIdxInt (fun x -> x % 7 = 0) + + // empty array + let resultEpt =[||] |> tryFindIdxInt (fun x -> x % 7 = 0) if resultEpt <> None then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> tryFindIdxString (fun (x:string) -> x.Length > 4) nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> tryFindIdxString (fun (x:string) -> x.Length > 4) nullArr |> ignore) + () [] @@ -1336,39 +1336,39 @@ type ArrayModule2() = [] member this.Unzip() = - // integer array - let resultInt = Array.unzip [|(1,2);(2,4);(3,6)|] + // integer array + let resultInt = Array.unzip [|(1,2);(2,4);(3,6)|] if resultInt <> ([|1..3|], [|2..2..6|]) then Assert.Fail() - - // string array + + // string array let resultStr = Array.unzip [|("A","a");("B","b");("C","c");("D","d")|] let str = resultStr.ToString() if resultStr <> ([|"A"; "B"; "C" ; "D" |],[|"a";"b";"c";"d"|]) then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.unzip [||] if resultEpt <> ([||],[||]) then Assert.Fail() // null array - + () [] member this.Unzip3() = - // integer array + // integer array let resultInt = Array.unzip3 [|(1,2,3);(2,4,6);(3,6,9)|] if resultInt <> ([|1;2;3|], [|2;4;6|], [|3;6;9|]) then Assert.Fail() - - // string array + + // string array let resultStr = Array.unzip3 [|("A","1","a");("B","2","b");("C","3","c");("D","4","d")|] if resultStr <> ([|"A"; "B"; "C" ; "D" |], [|"1";"2";"3";"4"|], [|"a"; "b"; "c"; "d"|]) then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.unzip3 [||] if resultEpt <> ([||], [||], [||]) then Assert.Fail() // null array - + () [] @@ -1463,22 +1463,22 @@ type ArrayModule2() = [] member this.Zero_Create() = - + // Check for bogus input CheckThrowsArgumentException(fun () -> Array.zeroCreate -1 |> ignore) - - // integer array - let resultInt = Array.zeroCreate 8 + + // integer array + let resultInt = Array.zeroCreate 8 if resultInt <> [|0;0;0;0;0;0;0;0|] then Assert.Fail() - - // string array - let resultStr = Array.zeroCreate 3 + + // string array + let resultStr = Array.zeroCreate 3 if resultStr <> [|null;null;null|] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.zeroCreate 0 if resultEpt <> [||] then Assert.Fail() - + () [] @@ -1488,66 +1488,66 @@ type ArrayModule2() = [] member this.Zip() = - // integer array - let resultInt = Array.zip [|1..3|] [|2..2..6|] + // integer array + let resultInt = Array.zip [|1..3|] [|2..2..6|] if resultInt <> [|(1,2);(2,4);(3,6)|] then Assert.Fail() - - // string array + + // string array let resultStr = Array.zip [|"A"; "B"; "C" ; "D" |] [|"a";"b";"c";"d"|] if resultStr <> [|("A","a");("B","b");("C","c");("D","d")|] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.zip [||] [||] if resultEpt <> [||] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.zip nullArr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.zip nullArr nullArr |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.zip [|1..10|] [|2..20|] |> ignore) - + [] member this.ParallelZip() = let assertSameBehaviour arr1 arr2 = let sequentialZip = Array.zip arr1 arr2 let paraZip = Array.Parallel.zip arr1 arr2 Assert.AreEqual(sequentialZip, paraZip) - - assertSameBehaviour [|1..3|] [|2..2..6|] + + assertSameBehaviour [|1..3|] [|2..2..6|] assertSameBehaviour[|"A"; "B"; "C" ; "D" |] [|"a";"b";"c";"d"|] - assertSameBehaviour[||] [||] + assertSameBehaviour[||] [||] // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.Parallel.zip nullArr nullArr |> ignore) + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.Parallel.zip nullArr nullArr |> ignore) // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.Parallel.zip [|1..10|] [|2..20|] |> ignore) [] member this.Zip3() = - // integer array + // integer array let resultInt = Array.zip3 [|1..3|] [|2..2..6|] [|3;6;9|] if resultInt <> [|(1,2,3);(2,4,6);(3,6,9)|] then Assert.Fail() - - // string array + + // string array let resultStr = Array.zip3 [|"A"; "B"; "C" ; "D" |] [|"1";"2";"3";"4"|] [|"a"; "b"; "c"; "d"|] let str = resultStr.ToString() if resultStr <> [|("A","1","a");("B","2","b");("C","3","c");("D","4","d")|] then Assert.Fail() - - // empty array + + // empty array let resultEpt = Array.zip3 [||] [||] [||] if resultEpt <> [||] then Assert.Fail() // null array - let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.zip3 nullArr nullArr nullArr |> ignore) - + let nullArr = null:string[] + CheckThrowsArgumentNullException (fun () -> Array.zip3 nullArr nullArr nullArr |> ignore) + // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.zip3 [|1..10|] [|2..20|] [|1..10|] |> ignore) // len1 <> len3 CheckThrowsArgumentException(fun () -> Array.zip3 [|1..10|] [|1..10|] [|2..20|] |> ignore) - + () [] @@ -1603,92 +1603,92 @@ type ArrayModule2() = // Index greater than length let resultIndexGreater = Array.tryItem 14 [| 3;1;6;2 |] Assert.AreEqual(None, resultIndexGreater) - + [] member this.RemoveAt() = // integer list Assert.AreEqual([|2; 3; 4; 5|], (Array.removeAt 0 [|1..5|])) Assert.AreEqual([|1; 2; 4; 5|], (Array.removeAt 2 [|1..5|])) Assert.AreEqual([|1; 2; 3; 4|], (Array.removeAt 4 [|1..5|])) - + //string list Assert.AreEqual([|"2"; "3"; "4"; "5"|], (Array.removeAt 0 [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "4"; "5"|], (Array.removeAt 2 [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "3"; "4"|], (Array.removeAt 4 [|"1"; "2"; "3"; "4"; "5"|])) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> Array.removeAt 0 [||] |> ignore) CheckThrowsArgumentException (fun () -> Array.removeAt -1 [|1|] |> ignore) CheckThrowsArgumentException (fun () -> Array.removeAt 2 [|1|] |> ignore) - + [] member this.RemoveManyAt() = // integer list Assert.AreEqual([|3; 4; 5|], (Array.removeManyAt 0 2 [|1..5|])) Assert.AreEqual([|1; 2; 5|], (Array.removeManyAt 2 2 [|1..5|])) Assert.AreEqual([|1; 2; 3|], (Array.removeManyAt 3 2 [|1..5|])) - + //string list Assert.AreEqual([|"3"; "4"; "5"|], (Array.removeManyAt 0 2 [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "5"|], (Array.removeManyAt 2 2 [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "3"|], (Array.removeManyAt 3 2 [|"1"; "2"; "3"; "4"; "5"|])) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> Array.removeManyAt 0 2 [||] |> ignore) CheckThrowsArgumentException (fun () -> Array.removeManyAt -1 2 [|1|] |> ignore) CheckThrowsArgumentException (fun () -> Array.removeManyAt 2 2 [|1|] |> ignore) - + [] member this.UpdateAt() = // integer list Assert.AreEqual([|0; 2; 3; 4; 5|], (Array.updateAt 0 0 [|1..5|])) Assert.AreEqual([|1; 2; 0; 4; 5|], (Array.updateAt 2 0 [|1..5|])) Assert.AreEqual([|1; 2; 3; 4; 0|], (Array.updateAt 4 0 [|1..5|])) - + //string list Assert.AreEqual([|"0"; "2"; "3"; "4"; "5"|], (Array.updateAt 0 "0" [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "0"; "4"; "5"|], (Array.updateAt 2 "0" [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "3"; "4"; "0"|], (Array.updateAt 4 "0" [|"1"; "2"; "3"; "4"; "5"|])) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> Array.updateAt 0 0 [||] |> ignore) CheckThrowsArgumentException (fun () -> Array.updateAt -1 0 [|1|] |> ignore) CheckThrowsArgumentException (fun () -> Array.updateAt 2 0 [|1|] |> ignore) - + [] member this.InsertAt() = // integer list Assert.AreEqual([|0; 1; 2; 3; 4; 5|], (Array.insertAt 0 0 [|1..5|])) Assert.AreEqual([|1; 2; 0; 3; 4; 5|], (Array.insertAt 2 0 [|1..5|])) Assert.AreEqual([|1; 2; 3; 4; 0; 5|], (Array.insertAt 4 0 [|1..5|])) - + //string list Assert.AreEqual([|"0"; "1"; "2"; "3"; "4"; "5"|], (Array.insertAt 0 "0" [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "0"; "3"; "4"; "5"|], (Array.insertAt 2 "0" [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "3"; "4"; "0"; "5"|], (Array.insertAt 4 "0" [|"1"; "2"; "3"; "4"; "5"|])) - + // empty list & out of bounds Assert.AreEqual([0], Array.insertAt 0 0 [||]) CheckThrowsArgumentException (fun () -> Array.insertAt -1 0 [|1|] |> ignore) CheckThrowsArgumentException (fun () -> Array.insertAt 2 0 [|1|] |> ignore) - + [] member this.InsertManyAt() = // integer list Assert.AreEqual([|0; 0; 1; 2; 3; 4; 5|], (Array.insertManyAt 0 [0; 0] [|1..5|])) Assert.AreEqual([|1; 2; 0; 0; 3; 4; 5|], (Array.insertManyAt 2 [0; 0] [|1..5|])) Assert.AreEqual([|1; 2; 3; 4; 0; 0; 5|], (Array.insertManyAt 4 [0; 0] [|1..5|])) - + //string list Assert.AreEqual([|"0"; "0"; "1"; "2"; "3"; "4"; "5"|], (Array.insertManyAt 0 ["0"; "0"] [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "0"; "0"; "3"; "4"; "5"|], (Array.insertManyAt 2 ["0"; "0"] [|"1"; "2"; "3"; "4"; "5"|])) Assert.AreEqual([|"1"; "2"; "3"; "4"; "0"; "0"; "5"|], (Array.insertManyAt 4 ["0"; "0"] [|"1"; "2"; "3"; "4"; "5"|])) - + // empty list & out of bounds Assert.AreEqual([0; 0], Array.insertManyAt 0 [0; 0] [||]) CheckThrowsArgumentException (fun () -> Array.insertManyAt -1 [0; 0] [|1|] |> ignore) CheckThrowsArgumentException (fun () -> Array.insertManyAt 2 [0; 0] [|1|] |> ignore) - + // Do not return the original array when inserting an empty array let originalArr = [| 1; 2; 3 |] let insertionEmptyResultArr = Array.insertManyAt 3 [| |] originalArr diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayProperties.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayProperties.fs index ea97945dccf..7e7a4788e54 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayProperties.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayProperties.fs @@ -24,12 +24,12 @@ type ArrayProperties() = let a = runAndCheckIfAnyError (fun () -> Array.blit source sourceIndex target1 targetIndex count) let b = runAndCheckIfAnyError (fun () -> Array.Copy(source, sourceIndex, target2, targetIndex, count)) a = b && target1 = target2 - + [] member this.``Array.distinctBy is stable`` () = Check.QuickThrowOnFailure this.distinctByStable Check.QuickThrowOnFailure this.distinctByStable - + [] member this.``Array.blit works like Array.Copy`` () = Check.QuickThrowOnFailure this.blitWorksLikeCopy diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs index 13dac6240db..683ac45b227 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs @@ -12,17 +12,17 @@ let bigSizeCheck testable = Check.One({ Config.QuickThrowOnFailure with StartSiz /// helper function that creates labeled FsCheck properties for equality comparisons let consistency name sqs ls arr = - (sqs = arr) |@ (sprintf "Seq.%s = '%A', Array.%s = '%A'" name sqs name arr) .&. + (sqs = arr) |@ (sprintf "Seq.%s = '%A', Array.%s = '%A'" name sqs name arr) .&. (ls = arr) |@ (sprintf "List.%s = '%A', Array.%s = '%A'" name ls name arr) -let consistencyIncludingParallel name sqs ls arr paraArr = +let consistencyIncludingParallel name sqs ls arr paraArr = consistency name sqs ls arr .&. (paraArr = arr) |@ (sprintf "Parallel.%s = '%A', Array.%s = '%A'" name paraArr name arr) let allPairs<'a when 'a : equality> (xs : list<'a>) (xs2 : list<'a>) = let s = xs |> Seq.allPairs xs2 |> Seq.toArray let l = xs |> List.allPairs xs2 |> List.toArray - let a = xs |> List.toArray |> Array.allPairs (List.toArray xs2) + let a = xs |> List.toArray |> Array.allPairs (List.toArray xs2) consistency "allPairs" s l a [] @@ -90,7 +90,7 @@ let choose<'a when 'a : equality> (xs : 'a []) f = let l = xs |> List.ofArray |> List.choose f |> List.toArray let a = xs |> Array.choose f let pa = xs |> Array.Parallel.choose f - + consistencyIncludingParallel "contains" s l a pa [] @@ -101,10 +101,10 @@ let ``choose is consistent`` () = let chunkBySize<'a when 'a : equality> (xs : 'a []) size = let ls = List.ofArray xs - if size <= 0 then + if size <= 0 then Prop.throws (lazy Seq.chunkBySize size xs) .&. Prop.throws (lazy Array.chunkBySize size xs) .&. - Prop.throws (lazy List.chunkBySize size ls) + Prop.throws (lazy List.chunkBySize size ls) else let s = xs |> Seq.chunkBySize size |> Seq.map Seq.toArray |> Seq.toArray let l = ls |> List.chunkBySize size |> Seq.map Seq.toArray |> Seq.toArray @@ -146,7 +146,7 @@ let ``compareWith is consistent`` () = smallerSizeCheck compareWith smallerSizeCheck compareWith smallerSizeCheck compareWith - + let concat<'a when 'a : equality> (xs : 'a [][]) = let s = xs |> Seq.concat |> Seq.toArray let l = xs |> List.ofArray |> List.map List.ofArray |> List.concat |> List.toArray @@ -174,7 +174,7 @@ let ``countBy is consistent`` () = let distinct<'a when 'a : comparison> (xs : 'a []) = let s = xs |> Seq.distinct |> Seq.toArray let l = xs |> List.ofArray |> List.distinct |> List.toArray - let a = xs |> Array.distinct + let a = xs |> Array.distinct consistency "distinct" s l a [] @@ -186,7 +186,7 @@ let ``distinct is consistent`` () = let distinctBy<'a when 'a : equality> (xs : 'a []) f = let s = xs |> Seq.distinctBy f |> Seq.toArray let l = xs |> List.ofArray |> List.distinctBy f |> List.toArray - let a = xs |> Array.distinctBy f + let a = xs |> Array.distinctBy f consistency "distinctBy" s l a [] @@ -244,14 +244,14 @@ let ``exists is consistent`` () = smallerSizeCheck exists smallerSizeCheck exists -let exists2<'a when 'a : equality> (xs':('a*'a) []) f = +let exists2<'a when 'a : equality> (xs':('a*'a) []) f = let xs = Array.map fst xs' let xs2 = Array.map snd xs' let s = runAndCheckErrorType (fun () -> Seq.exists2 f xs xs2) let l = runAndCheckErrorType (fun () -> List.exists2 f (List.ofSeq xs) (List.ofSeq xs2)) let a = runAndCheckErrorType (fun () -> Array.exists2 f (Array.ofSeq xs) (Array.ofSeq xs2)) consistency "exists2" s l a - + [] let ``exists2 is consistent for collections with equal length`` () = smallerSizeCheck exists2 @@ -392,14 +392,14 @@ let ``forall is consistent`` () = smallerSizeCheck forall smallerSizeCheck forall -let forall2<'a when 'a : equality> (xs':('a*'a) []) f = +let forall2<'a when 'a : equality> (xs':('a*'a) []) f = let xs = Array.map fst xs' let xs2 = Array.map snd xs' let s = runAndCheckErrorType (fun () -> Seq.forall2 f xs xs2) let l = runAndCheckErrorType (fun () -> List.forall2 f (List.ofSeq xs) (List.ofSeq xs2)) let a = runAndCheckErrorType (fun () -> Array.forall2 f (Array.ofSeq xs) (Array.ofSeq xs2)) consistency "forall2" s l a - + [] let ``forall2 is consistent for collections with equal length`` () = smallerSizeCheck forall2 @@ -612,7 +612,7 @@ let map2<'a when 'a : equality> (xs' : ('a*'a) []) f' = let l = List.map2 f (xs |> List.ofArray) (xs2 |> List.ofArray) let a = Array.map2 f xs xs2 - let xs = Seq.toList xs' + let xs = Seq.toList xs' Seq.toArray s = a && List.toArray l = a && list |> Seq.toList = (xs @ xs @ xs) @@ -697,7 +697,7 @@ let mapi2<'a when 'a : equality> (xs' : ('a*'a) []) f' = let l = List.mapi2 f (xs |> List.ofArray) (xs2 |> List.ofArray) let a = Array.mapi2 f xs xs2 - let xs = Seq.toList xs' + let xs = Seq.toList xs' Seq.toArray s = a && List.toArray l = a && list |> Seq.toList = (xs @ xs @ xs) && (Seq.toList indices = [0..xs.Length-1] @ [0..xs.Length-1] @ [0..xs.Length-1]) @@ -733,7 +733,7 @@ let ``maxBy is consistent`` () = smallerSizeCheck maxBy smallerSizeCheck maxBy smallerSizeCheck maxBy - + let min<'a when 'a : comparison> (xs : 'a []) = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.min) let l = runAndCheckIfAnyError (fun () -> xs |> List.ofArray |> List.min) @@ -857,8 +857,8 @@ let ``partitionWith heterogeneous is consistent for Set`` () = let permute<'a when 'a : comparison> (xs' : list) = let xs = List.map snd xs' - - let permutations = + + let permutations = List.map fst xs' |> List.indexed |> List.sortBy snd @@ -894,8 +894,8 @@ let ``pick is consistent`` () = let reduce<'a when 'a : equality> (xs : 'a []) f = let s = runAndCheckErrorType (fun () -> xs |> Seq.reduce f) let l = runAndCheckErrorType (fun () -> xs |> List.ofArray |> List.reduce f) - let a = runAndCheckErrorType (fun () -> xs |> Array.reduce f) - consistency "reduce" s l a + let a = runAndCheckErrorType (fun () -> xs |> Array.reduce f) + consistency "reduce" s l a [] let ``reduce is consistent`` () = @@ -1030,7 +1030,7 @@ let ``sortBy actually sorts (but is inconsistent in regards of stability)`` () = smallerSizeCheck sortBy let sortWith<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a []) = - let f x y = + let f x y = if x = y then 0 else if x = Unchecked.defaultof<_> && y <> Unchecked.defaultof<_> then -1 else if y = Unchecked.defaultof<_> && x <> Unchecked.defaultof<_> then 1 else @@ -1107,12 +1107,12 @@ let ``sumBy is consistent`` () = let splitAt<'a when 'a : equality> (xs : 'a []) index = let ls = List.ofArray xs - if index < 0 then + if index < 0 then Prop.throws (lazy List.splitAt index ls) .&. - Prop.throws (lazy Array.splitAt index xs) + Prop.throws (lazy Array.splitAt index xs) elif index > xs.Length then Prop.throws (lazy List.splitAt index ls) .&. - Prop.throws (lazy Array.splitAt index xs) + Prop.throws (lazy Array.splitAt index xs) else // no seq version let l = run (fun () -> ls |> List.splitAt index |> fun (a,b) -> List.toArray a,List.toArray b) @@ -1127,10 +1127,10 @@ let ``splitAt is consistent`` () = let splitInto<'a when 'a : equality> (xs : 'a []) count = let ls = List.ofArray xs - if count < 1 then + if count < 1 then Prop.throws (lazy List.splitInto count ls) .&. Prop.throws (lazy Array.splitInto count xs) .&. - Prop.throws (lazy Seq.splitInto count xs) + Prop.throws (lazy Seq.splitInto count xs) else let s = run (fun () -> xs |> Seq.splitInto count |> Seq.map Seq.toArray |> Seq.toArray) let l = run (fun () -> ls |> List.splitInto count |> Seq.map Seq.toArray |> Seq.toArray) @@ -1293,7 +1293,7 @@ let ``tryPick is consistent`` () = let unfold<'a,'b when 'b : equality> f (start:'a) = let f() = let mutable c = 0 - fun x -> + fun x -> if c > 100 then None else // prevent infinity seqs c <- c + 1 f x @@ -1316,24 +1316,24 @@ let ``unfold is consistent full`` () = smallerSizeCheck unfold #endif -let unzip<'a when 'a : equality> (xs:('a*'a) []) = +let unzip<'a when 'a : equality> (xs:('a*'a) []) = // no seq version let l = runAndCheckErrorType (fun () -> List.unzip (List.ofSeq xs) |> fun (a,b) -> List.toArray a, List.toArray b) let a = runAndCheckErrorType (fun () -> Array.unzip xs) l = a - + [] let ``unzip is consistent`` () = smallerSizeCheck unzip smallerSizeCheck unzip smallerSizeCheck unzip -let unzip3<'a when 'a : equality> (xs:('a*'a*'a) []) = +let unzip3<'a when 'a : equality> (xs:('a*'a*'a) []) = // no seq version let l = runAndCheckErrorType (fun () -> List.unzip3 (List.ofSeq xs) |> fun (a,b,c) -> List.toArray a, List.toArray b, List.toArray c) let a = runAndCheckErrorType (fun () -> Array.unzip3 xs) l = a - + [] let ``unzip3 is consistent`` () = smallerSizeCheck unzip3 @@ -1354,7 +1354,7 @@ let ``where is consistent`` () = let windowed<'a when 'a : equality> (xs : 'a []) windowSize = let ls = List.ofArray xs - if windowSize < 1 then + if windowSize < 1 then Prop.throws (lazy Seq.windowed windowSize xs) .&. Prop.throws (lazy Array.windowed windowSize xs) .&. Prop.throws (lazy List.windowed windowSize ls) @@ -1370,7 +1370,7 @@ let ``windowed is consistent`` () = smallerSizeCheck windowed smallerSizeCheck windowed -let zip<'a when 'a : equality> (xs':('a*'a) []) = +let zip<'a when 'a : equality> (xs':('a*'a) []) = let xs = Array.map fst xs' let xs2 = Array.map snd xs' let s = runAndCheckErrorType (fun () -> Seq.zip xs xs2 |> Seq.toArray) @@ -1378,14 +1378,14 @@ let zip<'a when 'a : equality> (xs':('a*'a) []) = let a = runAndCheckErrorType (fun () -> Array.zip xs xs2) let pa = runAndCheckErrorType (fun () -> Array.Parallel.zip xs xs2) consistencyIncludingParallel "zip" s l a pa - + [] let ``zip is consistent for collections with equal length`` () = smallerSizeCheck zip smallerSizeCheck zip smallerSizeCheck zip -let zip3<'a when 'a : equality> (xs':('a*'a*'a) []) = +let zip3<'a when 'a : equality> (xs':('a*'a*'a) []) = let xs = Array.map (fun (x,y,z) -> x) xs' let xs2 = Array.map (fun (x,y,z) -> y) xs' let xs3 = Array.map (fun (x,y,z) -> z) xs' @@ -1393,7 +1393,7 @@ let zip3<'a when 'a : equality> (xs':('a*'a*'a) []) = let l = runAndCheckErrorType (fun () -> List.zip3 (List.ofSeq xs) (List.ofSeq xs2) (List.ofSeq xs3) |> List.toArray) let a = runAndCheckErrorType (fun () -> Array.zip3 (Array.ofSeq xs) (Array.ofSeq xs2) (Array.ofSeq xs3)) consistency "zip3" s l a - + [] let ``zip3 is consistent for collections with equal length`` () = smallerSizeCheck zip3 @@ -1401,7 +1401,7 @@ let ``zip3 is consistent for collections with equal length`` () = smallerSizeCheck zip3 -module ArrayParallelVsArray = +module ArrayParallelVsArray = let sort<'a when 'a : comparison> (xs : 'a []) = let a = xs |> Array.sort let pa = xs |> Array.Parallel.sort @@ -1432,7 +1432,7 @@ module ArrayParallelVsArray = bigSizeCheck sortBy let sortWith<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a []) = - let f x y = + let f x y = if x = y then 0 else if x = Unchecked.defaultof<_> && y <> Unchecked.defaultof<_> then -1 else if y = Unchecked.defaultof<_> && x <> Unchecked.defaultof<_> then 1 else diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ComparisonIdentityModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ComparisonIdentityModule.fs index 582996516ad..852746c1d3a 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ComparisonIdentityModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ComparisonIdentityModule.fs @@ -21,39 +21,39 @@ Make sure each method works on: type ComparisonIdentityModule() = [] member this.FromFunction() = - // integer array + // integer array let intArr = [|1;5;8;2;6;3;7;4|] System.Array.Sort(intArr, ComparisonIdentity.FromFunction compare) Assert.AreEqual([|1;2;3;4;5;6;7;8|],intArr) - // string array + // string array let strArr = [|"A";"C";"B"|] System.Array.Sort(strArr, ComparisonIdentity.FromFunction (compare)) Assert.AreEqual([|"A";"B";"C"|],strArr) - // empty array + // empty array let eptArr = [||] System.Array.Sort(eptArr, ComparisonIdentity.FromFunction (compare)) - Assert.AreEqual([||], eptArr) - + Assert.AreEqual([||], eptArr) + () - + [] member this.Structural() = - // integer array + // integer array let intArr = [|1;5;8;2;6;3;7;4|] System.Array.Sort(intArr, ComparisonIdentity.Structural ) Assert.AreEqual([|1;2;3;4;5;6;7;8|],intArr) - // string array + // string array let strArr = [|"A";"C";"B"|] System.Array.Sort(strArr, ComparisonIdentity.Structural ) Assert.AreEqual([|"A";"B";"C"|],strArr) - // empty array + // empty array let eptArr = [||] System.Array.Sort(eptArr, ComparisonIdentity.Structural ) - Assert.AreEqual([||],eptArr) - + Assert.AreEqual([||],eptArr) + () - + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/HashIdentityModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/HashIdentityModule.fs index c00a9a3af8b..c144d559a79 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/HashIdentityModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/HashIdentityModule.fs @@ -21,7 +21,7 @@ type HashIdentityModule() = Assert.AreEqual(valueDict.Count,0) valueDict.Add(3,"C") Assert.AreEqual(1, valueDict.Count) - Assert.True(valueDict.ContainsValue("C")) + Assert.True(valueDict.ContainsValue("C")) // reference type let refDict = new Dictionary(HashIdentity.Structural) @@ -33,10 +33,10 @@ type HashIdentityModule() = // empty type let eptDict = new Dictionary(HashIdentity.Structural) Assert.AreEqual(0, eptDict.Count) - Assert.False(eptDict.ContainsKey(3)) + Assert.False(eptDict.ContainsKey(3)) () - + [] member this.Reference() = @@ -54,19 +54,19 @@ type HashIdentityModule() = // empty table let eptDict = new Dictionary(HashIdentity.Reference) Assert.AreEqual(0,eptDict.Count) - Assert.False(eptDict.ContainsKey("3")) - + Assert.False(eptDict.ContainsKey("3")) + () - + [] member this.FromFunctions() = - + // value type let valueDict = new Dictionary(HashIdentity.FromFunctions (fun x -> 1) (fun x y -> x > y)) Assert.AreEqual(0,valueDict.Count) valueDict.Add(3,"C") Assert.AreEqual(1,valueDict.Count) - Assert.True(valueDict.ContainsValue("C")) + Assert.True(valueDict.ContainsValue("C")) // reference type let refDict = new Dictionary(HashIdentity.FromFunctions (fun x -> 1) (fun x y -> x > y)) @@ -75,9 +75,9 @@ type HashIdentityModule() = Assert.AreEqual(1,refDict.Count) Assert.True(refDict.ContainsValue(3)) - // empty type + // empty type let eptDict = new Dictionary(HashIdentity.FromFunctions (fun x -> 1) (fun x y -> x > y)) Assert.AreEqual(0,eptDict.Count) Assert.False(eptDict.ContainsKey(3)) - + () \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs index 90faa5842cc..8664b223d37 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs @@ -22,11 +22,11 @@ type ListModule() = member _.Empty() = let emptyList = List.empty let resultEpt = List.length emptyList - Assert.AreEqual(0, resultEpt) - + Assert.AreEqual(0, resultEpt) + let c : int list = List.empty let d : string list = List.empty - + () [] @@ -56,7 +56,7 @@ type ListModule() = // integer List let intList = List.append [ 1; 2 ] [ 3; 4 ] Assert.AreEqual([ 1; 2; 3; 4 ],intList) - + // string List let strList = List.append [ "a"; "b" ] [ "c"; "d" ] Assert.AreEqual([ "a"; "b" ;"c"; "d" ],strList) @@ -67,34 +67,34 @@ type ListModule() = () [] - member _.Average() = + member _.Average() = // empty float32 List - let emptyFloatList = List.empty + let emptyFloatList = List.empty CheckThrowsArgumentException(fun () -> List.average emptyFloatList |> ignore) - + // empty double List - let emptyDoubleList = List.empty + let emptyDoubleList = List.empty CheckThrowsArgumentException(fun () -> List.average emptyDoubleList |> ignore) - + // empty decimal List - let emptyDecimalList = List.empty + let emptyDecimalList = List.empty CheckThrowsArgumentException (fun () -> List.average emptyDecimalList |>ignore ) // float32 List let floatList: float32 list = [ 1.2f;3.5f;6.7f ] - let averageOfFloat = List.average floatList + let averageOfFloat = List.average floatList Assert.AreEqual(3.8000000000000003f, averageOfFloat) - + // double List let doubleList: List = [ 1.0;8.0 ] - let averageOfDouble = List.average doubleList + let averageOfDouble = List.average doubleList Assert.AreEqual(4.5, averageOfDouble) - + // decimal List let decimalList: decimal list = [ 0M;19M;19.03M ] - let averageOfDecimal = List.average decimalList + let averageOfDecimal = List.average decimalList Assert.AreEqual(12.676666666666666666666666667M, averageOfDecimal) - + () @@ -173,7 +173,7 @@ type ListModule() = () [] - member _.distinct() = + member _.distinct() = // distinct should work on empty list Assert.AreEqual([], List.distinct []) @@ -181,7 +181,7 @@ type ListModule() = Assert.AreEqual([1], List.distinct [1]) Assert.AreEqual([1], List.distinct [1; 1]) Assert.AreEqual([1; 2; 3], List.distinct [1; 2; 3; 1]) - Assert.AreEqual([[1;2]; [1;3]], List.distinct [[1;2]; [1;3]; [1;2]; [1;3]]) + Assert.AreEqual([[1;2]; [1;3]], List.distinct [[1;2]; [1;3]; [1;2]; [1;3]]) Assert.AreEqual([[1;1]; [1;2]; [1;3]; [1;4]], List.distinct [[1;1]; [1;2]; [1;3]; [1;4]]) Assert.AreEqual([[1;1]; [1;4]], List.distinct [[1;1]; [1;1]; [1;1]; [1;4]]) @@ -193,7 +193,7 @@ type ListModule() = member _.distinctBy() = // distinctBy should work on empty list Assert.AreEqual([], List.distinctBy (fun _ -> failwith "should not be executed") []) - + // distinctBy should filter out simple duplicates Assert.AreEqual([1], List.distinctBy id [1]) Assert.AreEqual([1], List.distinctBy id [1; 1]) @@ -218,38 +218,38 @@ type ListModule() = CheckThrowsInvalidOperationExn (fun () -> List.take 1 [] |> ignore) CheckThrowsArgumentException (fun () -> List.take -1 [0;1] |> ignore) CheckThrowsInvalidOperationExn (fun () -> List.take 5 ["str1";"str2";"str3";"str4"] |> ignore) - + [] - member _.Choose() = + member _.Choose() = // int List - let intSrc:int list = [ 1..100 ] - let funcInt x = if (x%5=0) then Some (x*x) else None - let intChosen = List.choose funcInt intSrc + let intSrc:int list = [ 1..100 ] + let funcInt x = if (x%5=0) then Some (x*x) else None + let intChosen = List.choose funcInt intSrc Assert.AreEqual(25, intChosen.[0]) Assert.AreEqual(100, intChosen.[1]) Assert.AreEqual(225, intChosen.[2]) - + // string List let stringSrc: string list = [ "List"; "this"; "is" ;"str"; "list" ] let funcString x = match x with | "list" -> Some x | "List" -> Some x | _ -> None - let strChosen = List.choose funcString stringSrc + let strChosen = List.choose funcString stringSrc Assert.AreEqual("list", strChosen.[0].ToLower()) Assert.AreEqual("list", strChosen.[1].ToLower()) - - // always None + + // always None let emptySrc :int list = [ ] - let emptyChosen = List.choose (fun i -> Option.None) intSrc + let emptyChosen = List.choose (fun i -> Option.None) intSrc Assert.AreEqual(emptySrc, emptyChosen) // empty List let emptySrc :int list = [ ] - let emptyChosen = List.choose funcInt emptySrc + let emptyChosen = List.choose funcInt emptySrc Assert.AreEqual(emptySrc, emptyChosen) - () + () [] member _.compareWith() = @@ -257,7 +257,7 @@ type ListModule() = Assert.AreEqual(0,List.compareWith (fun _ -> failwith "should not be executed") [] []) Assert.AreEqual(-1,List.compareWith (fun _ -> failwith "should not be executed") [] [1]) Assert.AreEqual(1,List.compareWith (fun _ -> failwith "should not be executed") ["1"] []) - + // compareWith should work on longer lists Assert.AreEqual(-1,List.compareWith compare ["1";"2"] ["1";"3"]) Assert.AreEqual(1,List.compareWith compare [1;2;43] [1;2;1]) @@ -271,12 +271,12 @@ type ListModule() = Assert.AreEqual(0,List.compareWith (fun x y -> 0) ["1";"2"] ["1";"3"]) Assert.AreEqual(1,List.compareWith (fun x y -> 1) ["1";"2"] ["1";"3"]) Assert.AreEqual(-1,List.compareWith (fun x y -> -1) ["1";"2"] ["1";"3"]) - + [] member _.takeWhile() = Assert.AreEqual(([] : int list),List.takeWhile (fun x -> failwith "should not be used") ([] : int list)) Assert.AreEqual([1;2;4;5],List.takeWhile (fun x -> x < 6) [1;2;4;5;6;7]) - Assert.AreEqual(["a"; "ab"; "abc"],List.takeWhile (fun (x:string) -> x.Length < 4) ["a"; "ab"; "abc"; "abcd"; "abcde"]) + Assert.AreEqual(["a"; "ab"; "abc"],List.takeWhile (fun (x:string) -> x.Length < 4) ["a"; "ab"; "abc"; "abcd"; "abcde"]) Assert.AreEqual(["a"; "ab"; "abc"; "abcd"; "abcde"],List.takeWhile (fun _ -> true) ["a"; "ab"; "abc"; "abcd"; "abcde"]) Assert.AreEqual(([] : string list),List.takeWhile (fun _ -> false) ["a"; "ab"; "abc"; "abcd"; "abcde"]) Assert.AreEqual(([] : string list),List.takeWhile (fun _ -> false) ["a"]) @@ -286,35 +286,35 @@ type ListModule() = [] member _.Concat() = // integer List - let seqInt = - seq { for i in 1..10 do + let seqInt = + seq { for i in 1..10 do yield [i;i*10]} - let conIntArr = List.concat seqInt + let conIntArr = List.concat seqInt Assert.AreEqual(20, List.length conIntArr) - + // string List - let strSeq = + let strSeq = seq { for a in 'a'..'c' do for b in 'a'..'c' do yield [a.ToString();b.ToString() ]} - - let conStrArr = List.concat strSeq + + let conStrArr = List.concat strSeq Assert.AreEqual(18, List.length conStrArr) - + // Empty List let emptyLists = [ [ ]; [ 0 ]; [ 1 ]; [ ]; [ ] ] let result2 = List.concat emptyLists - Assert.AreEqual(2, result2.Length) + Assert.AreEqual(2, result2.Length) Assert.AreEqual(0, result2.[0]) Assert.AreEqual(1, result2.[1]) - () + () [] - member _.splitAt() = + member _.splitAt() = Assert.AreEqual((([] : int list),([] : int list)), List.splitAt 0 ([] : int list)) - Assert.AreEqual([1..4], List.splitAt 4 [1..10] |> fst) - Assert.AreEqual([5..10], List.splitAt 4 [1..10] |> snd) + Assert.AreEqual([1..4], List.splitAt 4 [1..10] |> fst) + Assert.AreEqual([5..10], List.splitAt 4 [1..10] |> snd) Assert.AreEqual(([]: int list), List.splitAt 0 [1..2] |> fst) Assert.AreEqual([1..2], List.splitAt 0 [1..2] |> snd) @@ -377,20 +377,20 @@ type ListModule() = // integer List let intArr = [ 2;4;6;8 ] let funcInt x = if (x%2 = 0) then true else false - let resultInt = List.exists funcInt intArr + let resultInt = List.exists funcInt intArr Assert.True(resultInt) - + // string List - let strArr = ["."; ".."; "..."; "...."] + let strArr = ["."; ".."; "..."; "...."] let funcStr (x:string) = if (x.Length >15) then true else false - let resultStr = List.exists funcStr strArr + let resultStr = List.exists funcStr strArr Assert.False(resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.exists funcInt emptyArr + let resultEpt = List.exists funcInt emptyArr Assert.False(resultEpt) - + () [] member _.Exists2() = @@ -398,22 +398,22 @@ type ListModule() = let intFir = [ 2;4;6;8 ] let intSec = [ 1;2;3;4 ] let funcInt x y = if (x%y = 0) then true else false - let resultInt = List.exists2 funcInt intFir intSec + let resultInt = List.exists2 funcInt intFir intSec Assert.True(resultInt) - + // string List let strFir = ["Lists"; "are"; "commonly" ] let strSec = ["good"; "good"; "good" ] let funcStr (x:string) (y:string) = if (x = y) then true else false - let resultStr = List.exists2 funcStr strFir strSec + let resultStr = List.exists2 funcStr strFir strSec Assert.False(resultStr) - + // empty List let eptFir:int list = [ ] let eptSec:int list = [ ] - let resultEpt = List.exists2 funcInt eptFir eptSec + let resultEpt = List.exists2 funcInt eptFir eptSec Assert.False(resultEpt) - + () [] @@ -421,42 +421,42 @@ type ListModule() = // integer List let intArr = [ 1..20 ] let funcInt x = if (x%5 = 0) then true else false - let resultInt = List.filter funcInt intArr + let resultInt = List.filter funcInt intArr Assert.AreEqual([5;10;15;20], resultInt) - + // string List - let strArr = ["."; ".."; "..."; "...."] + let strArr = ["."; ".."; "..."; "...."] let funcStr (x:string) = if (x.Length >2) then true else false - let resultStr = List.filter funcStr strArr + let resultStr = List.filter funcStr strArr Assert.AreEqual(["..."; "...."], resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.filter funcInt emptyArr + let resultEpt = List.filter funcInt emptyArr Assert.AreEqual(emptyArr, resultEpt) - - () + + () [] member _.Where() = // integer List let intArr = [ 1..20 ] let funcInt x = if (x%5 = 0) then true else false - let resultInt = List.where funcInt intArr + let resultInt = List.where funcInt intArr Assert.AreEqual([5;10;15;20], resultInt) - + // string List - let strArr = ["."; ".."; "..."; "...."] + let strArr = ["."; ".."; "..."; "...."] let funcStr (x:string) = if (x.Length >2) then true else false - let resultStr = List.where funcStr strArr + let resultStr = List.where funcStr strArr Assert.AreEqual(["..."; "...."], resultStr) - + // empty List let emptyList:int list = [ ] let resultEpt = List.where funcInt emptyList Assert.AreEqual(emptyList, resultEpt) - - () + + () [] member _.``where should work like filter``() = @@ -471,26 +471,26 @@ type ListModule() = // integer List let intArr = [ 1..20 ] let funcInt x = if (x%5 = 0) then true else false - let resultInt = List.find funcInt intArr + let resultInt = List.find funcInt intArr Assert.AreEqual(5, resultInt) - + // string List - let strArr = ["."; ".."; "..."; "...."] + let strArr = ["."; ".."; "..."; "...."] let funcStr (x:string) = if (x.Length >2) then true else false - let resultStr = List.find funcStr strArr + let resultStr = List.find funcStr strArr Assert.AreEqual("...", resultStr) - + // empty List - let emptyArr:int list = [ ] + let emptyArr:int list = [ ] CheckThrowsKeyNotFoundException (fun () -> List.find (fun _ -> true) emptyArr |> ignore) - + // not found CheckThrowsKeyNotFoundException (fun () -> List.find (fun _ -> false) intArr |> ignore) - () + () [] - member _.replicate() = + member _.replicate() = // replicate should create multiple copies of the given value Assert.AreEqual(0,List.replicate 0 null |> List.length) Assert.AreEqual(0,List.replicate 0 1 |> List.length) @@ -527,24 +527,24 @@ type ListModule() = // integer List let intArr = [ 1..20 ] let funcInt x = if (x%5 = 0) then true else false - let resultInt = List.findIndex funcInt intArr + let resultInt = List.findIndex funcInt intArr Assert.AreEqual(4, resultInt) - + // string List - let strArr = ["."; ".."; "..."; "...."] + let strArr = ["."; ".."; "..."; "...."] let funcStr (x:string) = if (x.Length > 2) then true else false - let resultStr = List.findIndex funcStr strArr + let resultStr = List.findIndex funcStr strArr Assert.AreEqual(2, resultStr) - + // empty List - let emptyArr:int list = [ ] + let emptyArr:int list = [ ] CheckThrowsKeyNotFoundException (fun () -> List.findIndex (fun _ -> true) emptyArr |> ignore) - + // not found CheckThrowsKeyNotFoundException (fun () -> List.findIndex (fun _ -> false) intArr |> ignore) - () - + () + [] member _.FindIndexBack() = // integer List @@ -570,102 +570,102 @@ type ListModule() = [] member _.TryPick() = // integer List - let intArr = [ 1..10 ] - let funcInt x = + let intArr = [ 1..10 ] + let funcInt x = match x with - | _ when x % 3 = 0 -> Some (x.ToString()) + | _ when x % 3 = 0 -> Some (x.ToString()) | _ -> None - let resultInt = List.tryPick funcInt intArr + let resultInt = List.tryPick funcInt intArr Assert.AreEqual(Some "3", resultInt) - + // string List let strArr = ["a";"b";"c";"d"] - let funcStr x = + let funcStr x = match x with - | "good" -> Some (x.ToString()) + | "good" -> Some (x.ToString()) | _ -> None - let resultStr = List.tryPick funcStr strArr + let resultStr = List.tryPick funcStr strArr Assert.AreEqual(None, resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.tryPick funcInt emptyArr + let resultEpt = List.tryPick funcInt emptyArr Assert.AreEqual(None, resultEpt) - + () [] member _.Fold() = // integer List - let intArr = [ 1..10 ] + let intArr = [ 1..10 ] let funcInt x y = x+y - let resultInt = List.fold funcInt 9 intArr + let resultInt = List.fold funcInt 9 intArr Assert.AreEqual(64, resultInt) - + // string List - let funcStr x y = x+y - let resultStr = List.fold funcStr "*" ["a";"b";"c";"d"] + let funcStr x y = x+y + let resultStr = List.fold funcStr "*" ["a";"b";"c";"d"] Assert.AreEqual("*abcd", resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.fold funcInt 5 emptyArr + let resultEpt = List.fold funcInt 5 emptyArr Assert.AreEqual(5, resultEpt) - + () [] member _.Fold2() = - // integer List + // integer List let funcInt x y z = x + y + z - let resultInt = List.fold2 funcInt 9 [ 1..10 ] [1..2..20] + let resultInt = List.fold2 funcInt 9 [ 1..10 ] [1..2..20] Assert.AreEqual(164, resultInt) - - // string List - let funcStr x y z= x + y + z - let resultStr = List.fold2 funcStr "*" ["a"; "b"; "c" ; "d" ] ["A"; "B"; "C" ; "D" ] + + // string List + let funcStr x y z= x + y + z + let resultStr = List.fold2 funcStr "*" ["a"; "b"; "c" ; "d" ] ["A"; "B"; "C" ; "D" ] Assert.AreEqual("*aAbBcCdD", resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.fold2 funcInt 5 emptyArr emptyArr + let resultEpt = List.fold2 funcInt 5 emptyArr emptyArr Assert.AreEqual(5, resultEpt) - + () [] member _.FoldBack() = // integer List - let intArr = [ 1..10 ] + let intArr = [ 1..10 ] let funcInt x y = x+y - let resultInt = List.foldBack funcInt intArr 9 + let resultInt = List.foldBack funcInt intArr 9 Assert.AreEqual(64, resultInt) - + // string List let strArr = ["a"; "b"; "c" ; "d" ] let funcStr x y = x+y - - let resultStr = List.foldBack funcStr strArr "*" + + let resultStr = List.foldBack funcStr strArr "*" Assert.AreEqual("abcd*", resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.foldBack funcInt emptyArr 5 + let resultEpt = List.foldBack funcInt emptyArr 5 Assert.AreEqual(5, resultEpt) - + // 1 element let result1Element = List.foldBack funcInt [1] 0 Assert.AreEqual(1, result1Element) - + // 2 elements let result2Element = List.foldBack funcInt [1;2] 0 Assert.AreEqual(3, result2Element) - + // 3 elements let result3Element = List.foldBack funcInt [1;2;3] 0 Assert.AreEqual(6, result3Element) - + // 4 elements let result4Element = List.foldBack funcInt [1;2;3;4] 0 Assert.AreEqual(10, result4Element) @@ -674,38 +674,38 @@ type ListModule() = [] member _.FoldBack2() = - // integer List + // integer List let funcInt x y z = x + y + z - let resultInt = List.foldBack2 funcInt [ 1..10 ] [1..2..20] 9 + let resultInt = List.foldBack2 funcInt [ 1..10 ] [1..2..20] 9 Assert.AreEqual(164, resultInt) - + // string List - let funcStr x y z= x + y + z - let resultStr = List.foldBack2 funcStr ["A";"B";"C";"D"] ["a";"b";"c";"d"] "*" + let funcStr x y z= x + y + z + let resultStr = List.foldBack2 funcStr ["A";"B";"C";"D"] ["a";"b";"c";"d"] "*" Assert.AreEqual("AaBbCcDd*", resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.foldBack2 funcInt emptyArr emptyArr 5 + let resultEpt = List.foldBack2 funcInt emptyArr emptyArr 5 Assert.AreEqual(5, resultEpt) - + //1 element let result1Element = List.foldBack2 funcInt [1] [1] 0 Assert.AreEqual(2, result1Element) - + //2 element let result2Element = List.foldBack2 funcInt [1;2] [1;2] 0 Assert.AreEqual(6, result2Element) - + //3 element let result3Element = List.foldBack2 funcInt [1;2;3] [1;2;3] 0 Assert.AreEqual(12, result3Element) - + //4 element let result4Element = List.foldBack2 funcInt [1;2;3;4] [1;2;3;4] 0 Assert.AreEqual(20, result4Element) () - + //unequal length list let funcUnequal x y () = () CheckThrowsArgumentException( fun () -> (List.foldBack2 funcUnequal [ 1..10 ] [1..9] ())) @@ -715,60 +715,60 @@ type ListModule() = [] member _.ForAll() = // integer List - let resultInt = List.forall (fun x -> x > 2) [ 3..2..10 ] + let resultInt = List.forall (fun x -> x > 2) [ 3..2..10 ] Assert.True(resultInt) - + // string List - let resultStr = List.forall (fun (x:string) -> x.Contains("a")) ["a";"b";"c";"d"] + let resultStr = List.forall (fun (x:string) -> x.Contains("a")) ["a";"b";"c";"d"] Assert.False(resultStr) - - // empty List - let resultEpt = List.forall (fun (x:string) -> x.Contains("a")) [] + + // empty List + let resultEpt = List.forall (fun (x:string) -> x.Contains("a")) [] Assert.True(resultEpt) - + () - + [] member _.ForAll2() = // integer List - let resultInt = List.forall2 (fun x y -> x < y) [ 1..10 ] [2..2..20] + let resultInt = List.forall2 (fun x y -> x < y) [ 1..10 ] [2..2..20] Assert.True(resultInt) - + // string List - let resultStr = List.forall2 (fun (x:string) (y:string) -> x.Length > y.Length) ["a";"b";"c";"d"] ["A";"B";"C";"D"] + let resultStr = List.forall2 (fun (x:string) (y:string) -> x.Length > y.Length) ["a";"b";"c";"d"] ["A";"B";"C";"D"] Assert.False(resultStr) - - // empty List - let resultEpt = List.forall2 (fun x y -> x > y) [] [] + + // empty List + let resultEpt = List.forall2 (fun x y -> x > y) [] [] Assert.True(resultEpt) - + () [] member _.GroupBy() = let funcInt x = x%5 - + let IntList = [ 0 .. 9 ] - + let group_byInt = List.groupBy funcInt IntList - - let expectedIntList = + + let expectedIntList = [ for i in 0..4 -> i, [i; i+5] ] Assert.AreEqual(expectedIntList, group_byInt) - + // string list let funcStr (x:string) = x.Length let strList = ["l1ngth7"; "length 8"; "l2ngth7" ; "length 9"] - + let group_byStr = List.groupBy funcStr strList - let expectedStrList = + let expectedStrList = [ 7, ["l1ngth7"; "l2ngth7"] 8, ["length 8"] 9, ["length 9"] ] - + Assert.AreEqual(expectedStrList, group_byStr) // Empty list @@ -783,15 +783,15 @@ type ListModule() = [] member _.Hd() = // integer List - let resultInt = List.head [2..2..20] + let resultInt = List.head [2..2..20] Assert.AreEqual(2, resultInt) - + // string List - let resultStr = List.head ["a";"b";"c";"d"] + let resultStr = List.head ["a";"b";"c";"d"] Assert.AreEqual("a", resultStr) - + CheckThrowsArgumentException(fun () -> List.head [] |> ignore) - () + () [] member _.``exactlyOne should return the element from singleton lists``() = @@ -800,7 +800,7 @@ type ListModule() = () [] - member _.``exactlyOne should fail on empty list``() = + member _.``exactlyOne should fail on empty list``() = CheckThrowsArgumentException(fun () -> List.exactlyOne [] |> ignore) [] @@ -824,13 +824,13 @@ type ListModule() = [] member _.TryHead() = // integer List - let resultInt = List.tryHead [2..2..20] + let resultInt = List.tryHead [2..2..20] Assert.AreEqual(2, resultInt.Value) - + // string List - let resultStr = List.tryHead ["a";"b";"c";"d"] + let resultStr = List.tryHead ["a";"b";"c";"d"] Assert.AreEqual("a", resultStr.Value) - + let resultNone = List.tryHead [] Assert.AreEqual(None, resultNone) @@ -839,15 +839,15 @@ type ListModule() = // integer List let intResult = List.tryLast [1..9] Assert.AreEqual(9, intResult.Value) - + // string List let strResult = List.tryLast (["first"; "second"; "third"]) Assert.AreEqual("third", strResult.Value) - + // Empty List let emptyResult = List.tryLast List.empty Assert.True(emptyResult.IsNone) - () + () [] member _.last() = @@ -860,153 +860,153 @@ type ListModule() = Assert.AreEqual(["4"], List.last [["1"; "3"]; []; ["4"]]) [] - member _.Init() = + member _.Init() = // integer List - let resultInt = List.init 3 (fun x -> x + 3) + let resultInt = List.init 3 (fun x -> x + 3) Assert.AreEqual([3;4;5], resultInt) - + // string List - let funStr (x:int) = + let funStr (x:int) = match x with | 0 -> "Lists" | 1 -> "are" | 2 -> "commonly" | _ -> "end" - - let resultStr = List.init 3 funStr + + let resultStr = List.init 3 funStr Assert.AreEqual(["Lists"; "are"; "commonly" ], resultStr) - - // empty List - let resultEpt = List.init 0 (fun x -> x+1) + + // empty List + let resultEpt = List.init 0 (fun x -> x+1) Assert.AreEqual(([] : int list), resultEpt) - + () [] member _.IsEmpty() = // integer List - let intArr = [ 3;4;7;8;10 ] - let resultInt = List.isEmpty intArr + let intArr = [ 3;4;7;8;10 ] + let resultInt = List.isEmpty intArr Assert.False(resultInt) - + // string List - let strArr = ["a";"b";"c";"d"] - let resultStr = List.isEmpty strArr + let strArr = ["a";"b";"c";"d"] + let resultStr = List.isEmpty strArr Assert.False(resultStr) - - // empty List + + // empty List let emptyArr:int list = [ ] - let resultEpt = List.isEmpty emptyArr + let resultEpt = List.isEmpty emptyArr Assert.True(resultEpt) () [] member _.Iter() = // integer List - let intArr = [ 1..10 ] - let mutable resultInt = 0 - let funInt (x:int) = - resultInt <- resultInt + x - () - List.iter funInt intArr + let intArr = [ 1..10 ] + let mutable resultInt = 0 + let funInt (x:int) = + resultInt <- resultInt + x + () + List.iter funInt intArr Assert.AreEqual(55, resultInt) - + // string List let strArr = ["a";"b";"c";"d"] let mutable resultStr = "" let funStr (x:string) = - resultStr <- resultStr + x + resultStr <- resultStr + x () - List.iter funStr strArr + List.iter funStr strArr Assert.AreEqual("abcd", resultStr) - - // empty List + + // empty List let emptyArr:int list = [ ] let mutable resultEpt = 0 - List.iter funInt emptyArr + List.iter funInt emptyArr Assert.AreEqual(0, resultEpt) - + () - + [] member _.Iter2() = // integer List - let mutable resultInt = 0 - let funInt (x:int) (y:int) = - resultInt <- resultInt + x + y - () - List.iter2 funInt [ 1..10 ] [2..2..20] + let mutable resultInt = 0 + let funInt (x:int) (y:int) = + resultInt <- resultInt + x + y + () + List.iter2 funInt [ 1..10 ] [2..2..20] Assert.AreEqual(165, resultInt) - + // string List let mutable resultStr = "" let funStr (x:string) (y:string) = - resultStr <- resultStr + x + y + resultStr <- resultStr + x + y () - List.iter2 funStr ["a";"b";"c";"d"] ["A";"B";"C";"D"] + List.iter2 funStr ["a";"b";"c";"d"] ["A";"B";"C";"D"] Assert.AreEqual("aAbBcCdD", resultStr) - - // empty List + + // empty List let emptyArr:int list = [ ] let mutable resultEpt = 0 - List.iter2 funInt emptyArr emptyArr + List.iter2 funInt emptyArr emptyArr Assert.AreEqual(0, resultEpt) - + () - + [] member _.Iteri() = // integer List - let intArr = [ 1..10 ] - let mutable resultInt = 0 - let funInt (x:int) y = - resultInt <- resultInt + x + y - () - List.iteri funInt intArr + let intArr = [ 1..10 ] + let mutable resultInt = 0 + let funInt (x:int) y = + resultInt <- resultInt + x + y + () + List.iteri funInt intArr Assert.AreEqual(100, resultInt) - + // string List let strArr = ["a";"b";"c";"d"] let mutable resultStr = 0 let funStr (x:int) (y:string) = resultStr <- resultStr + x + y.Length () - List.iteri funStr strArr + List.iteri funStr strArr Assert.AreEqual(10, resultStr) - - // empty List + + // empty List let emptyArr:int list = [ ] let mutable resultEpt = 0 - List.iteri funInt emptyArr + List.iteri funInt emptyArr Assert.AreEqual(0, resultEpt) - + () - + [] member _.Iteri2() = // integer List - let mutable resultInt = 0 - let funInt (x:int) (y:int) (z:int) = - resultInt <- resultInt + x + y + z - () - List.iteri2 funInt [ 1..10 ] [2..2..20] + let mutable resultInt = 0 + let funInt (x:int) (y:int) (z:int) = + resultInt <- resultInt + x + y + z + () + List.iteri2 funInt [ 1..10 ] [2..2..20] Assert.AreEqual(210, resultInt) - + // string List let mutable resultStr = "" let funStr (x:int) (y:string) (z:string) = resultStr <- resultStr + x.ToString() + y + z () - List.iteri2 funStr ["a";"b";"c";"d"] ["A";"B";"C";"D"] + List.iteri2 funStr ["a";"b";"c";"d"] ["A";"B";"C";"D"] Assert.AreEqual("0aA1bB2cC3dD", resultStr) - - // empty List + + // empty List let emptyArr:int list = [ ] let mutable resultEpt = 0 - List.iteri2 funInt emptyArr emptyArr + List.iteri2 funInt emptyArr emptyArr Assert.AreEqual(0, resultEpt) - - () + + () [] member _.Contains() = @@ -1021,7 +1021,7 @@ type ListModule() = Assert.False(resultStr) // float List - let flList = [nan;infinity;5.0;-0.] + let flList = [nan;infinity;5.0;-0.] Assert.False(List.contains nan flList) Assert.False(List.contains 4.99 flList) Assert.True(List.contains infinity flList) @@ -1036,11 +1036,11 @@ type ListModule() = let emptyList:int list = [ ] let resultEpt = List.contains 4 emptyList Assert.False(resultEpt) - + [] member _.Singleton() = Assert.AreEqual([null],List.singleton null) - Assert.AreEqual(["1"],List.singleton "1") + Assert.AreEqual(["1"],List.singleton "1") Assert.AreEqual([[]],List.singleton []) Assert.AreEqual([[||]],List.singleton [||]) () @@ -1053,19 +1053,19 @@ type ListModule() = Assert.AreEqual(["H","E"; "E","L"; "L","L"; "L","O"], List.pairwise ["H";"E";"L";"L";"O"]) [] - member _.``Slicing with first index reverse behaves as expected``() = + member _.``Slicing with first index reverse behaves as expected``() = let list = [ 1;2;3;4;5 ] Assert.AreEqual(list.[^3..], list.[1..]) [] - member _.``Slicing with second index reverse behaves as expected``() = + member _.``Slicing with second index reverse behaves as expected``() = let list = [ 1;2;3;4;5 ] Assert.AreEqual(list.[..^1], list.[..3]) [] - member _.``Slicing with both index reverse behaves as expected``() = + member _.``Slicing with both index reverse behaves as expected``() = let list = [ 1;2;3;4;5 ] Assert.AreEqual(list.[^3..^1], list.[1..3]) @@ -1083,7 +1083,7 @@ type ListModule() = Assert.AreEqual(list.[3..^0], list.[3..4]) [] - member _.``Get item with reverse index behaves as expected``() = + member _.``Get item with reverse index behaves as expected``() = let list = [1;2;3;4;5] Assert.AreEqual(list.[^1], 4) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs index ab3b0365d69..99a11e43ada 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs @@ -28,71 +28,71 @@ type ListWindowedTestInput<'t> = type ListModule02() = [] member this.Length() = - // integer List - let resultInt = List.length [1..8] + // integer List + let resultInt = List.length [1..8] Assert.AreEqual(8, resultInt) - - // string List - let resultStr = List.length ["a";"b";"c";"d"] + + // string List + let resultStr = List.length ["a";"b";"c";"d"] Assert.AreEqual(4, resultStr) - - // empty List - let resultEpt = List.length [ ] + + // empty List + let resultEpt = List.length [ ] Assert.AreEqual(0, resultEpt) - + () [] - member this.Map() = + member this.Map() = // integer List - let funcInt x = + let funcInt x = match x with - | _ when x % 2 = 0 -> 10*x + | _ when x % 2 = 0 -> 10*x | _ -> x - let resultInt = List.map funcInt [ 1..10 ] + let resultInt = List.map funcInt [ 1..10 ] Assert.AreEqual([1;20;3;40;5;60;7;80;9;100], resultInt) - + // string List let funcStr (x:string) = x.ToLower() - let resultStr = List.map funcStr ["A";"B";"C";"D"] + let resultStr = List.map funcStr ["A";"B";"C";"D"] Assert.AreEqual(["a";"b";"c";"d"], resultStr) - + // empty List - let resultEpt = List.map funcInt [ ] + let resultEpt = List.map funcInt [ ] Assert.AreEqual(List.empty, resultEpt) - + () [] - member this.Map2() = - // integer List + member this.Map2() = + // integer List let funcInt x y = x+y - let resultInt = List.map2 funcInt [1..10] [2..2..20] + let resultInt = List.map2 funcInt [1..10] [2..2..20] Assert.AreEqual([3;6;9;12;15;18;21;24;27;30], resultInt) - + // string List let funcStr (x:int) (y:string) = x+ y.Length - let resultStr = List.map2 funcStr [3;6;9;11] ["a";"b";"c";"d"] + let resultStr = List.map2 funcStr [3;6;9;11] ["a";"b";"c";"d"] Assert.AreEqual([4;7;10;12], resultStr ) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.map2 funcInt emptyArr emptyArr + let resultEpt = List.map2 funcInt emptyArr emptyArr Assert.AreEqual(List.empty, resultEpt) - + () - + [] member this.Map3 () = - // integer List + // integer List let funcInt x y z = (x + y) / z let resultInt = List.map3 funcInt [ 1..10 ] [2..2..20] [3..3..30] - let expectedInt = List.init 10 (fun x -> 1) + let expectedInt = List.init 10 (fun x -> 1) Assert.AreEqual(expectedInt, resultInt) - + // string List - let funcStr x y z = x + y + z + let funcStr x y z = x + y + z let resultStr = List.map3 funcStr ["A";"B";"C";"D"] ["a";"b";"c";"d"] ["1";"2";"3";"4"] Assert.AreEqual(["Aa1";"Bb2";"Cc3";"Dd4"], resultStr) @@ -109,30 +109,30 @@ type ListModule02() = [] member this.Collect() = // integer List - let funcInt x = + let funcInt x = match x with - | _ when x % 3 = 0 -> [999;999] + | _ when x % 3 = 0 -> [999;999] | _ -> [168;168] let resultInt = List.collect funcInt [ 1..5 ] - let resultList = List.toArray resultInt + let resultList = List.toArray resultInt Assert.AreEqual([168;168;168;168;999;999;168;168;168;168;], resultInt ) - + // string List - let funcStr (x:string) = + let funcStr (x:string) = match x with | _ when x.Length>3 -> ["long"] | _ -> ["short"] - let resultStr = List.collect funcStr ["a";"b";"c";"d"] + let resultStr = List.collect funcStr ["a";"b";"c";"d"] Assert.AreEqual(["short"; "short"; "short" ; "short" ], resultStr) - + // empty List - let resultEpt = List.collect funcInt [ ] + let resultEpt = List.collect funcInt [ ] Assert.AreEqual(List.empty, resultEpt) - + () [] - member this.Collect2() = + member this.Collect2() = // The collect implementation uses mutation to create the result list; this test // helps verify that lists created by the user are never mutated let lists = [| [1] @@ -148,45 +148,45 @@ type ListModule02() = () [] - member this.Mapi() = - // integer List + member this.Mapi() = + // integer List let funcInt x y = x+y - let resultInt = List.mapi funcInt [10..2..20] + let resultInt = List.mapi funcInt [10..2..20] Assert.AreEqual([10;13;16;19;22;25], resultInt) - + // string List let funcStr (x:int) (y:string) = x+ y.Length - let resultStr = List.mapi funcStr ["a";"b";"c";"d"] + let resultStr = List.mapi funcStr ["a";"b";"c";"d"] Assert.AreEqual([1;2;3;4], resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.mapi funcInt emptyArr + let resultEpt = List.mapi funcInt emptyArr Assert.AreEqual(List.empty, resultEpt) - + () [] - member this.Mapi2() = - // integer List + member this.Mapi2() = + // integer List let funcInt x y z = x + y + z - let resultInt = List.mapi2 funcInt [1..10] [2..2..20] + let resultInt = List.mapi2 funcInt [1..10] [2..2..20] Assert.AreEqual([3;7;11;15;19;23;27;31;35;39], resultInt) - + // string List - let funcStr z (x:int) (y:string) = z + x+ y.Length - let resultStr = List.mapi2 funcStr [3;6;9;11] ["a";"b";"c";"d"] + let funcStr z (x:int) (y:string) = z + x+ y.Length + let resultStr = List.mapi2 funcStr [3;6;9;11] ["a";"b";"c";"d"] Assert.AreEqual([4;8;12;15], resultStr) - + // lists of different length let shortList = [1] - let longerList = [1; 2] + let longerList = [1; 2] CheckThrowsArgumentException (fun () -> List.mapi2 funcInt shortList longerList |> ignore) CheckThrowsArgumentException (fun () -> List.mapi2 funcInt longerList shortList |> ignore) // empty List let emptyArr:int list = [ ] - let resultEpt = List.mapi2 funcInt emptyArr emptyArr + let resultEpt = List.mapi2 funcInt emptyArr emptyArr Assert.AreEqual(List.empty, resultEpt) () @@ -262,76 +262,76 @@ type ListModule02() = () [] - member this.Max() = - // integer List - let resultInt = List.max [2..2..20] + member this.Max() = + // integer List + let resultInt = List.max [2..2..20] Assert.AreEqual(20, resultInt) - + // string List - let resultStr = List.max ["a";"b";"c";"d"] + let resultStr = List.max ["a";"b";"c";"d"] Assert.AreEqual("d", resultStr) - + // empty List - CheckThrowsArgumentException ( fun() -> List.max List.empty) - + CheckThrowsArgumentException ( fun() -> List.max List.empty) + () [] - member this.MaxBy() = - // integer List + member this.MaxBy() = + // integer List let funcInt x = x%8 - let resultInt = List.maxBy funcInt [2..2..20] + let resultInt = List.maxBy funcInt [2..2..20] Assert.AreEqual(resultInt , 6) - + // string List - let funcStr (x:string) =x.Length - let resultStr = List.maxBy funcStr ["a";"b";"c";"d"] + let funcStr (x:string) =x.Length + let resultStr = List.maxBy funcStr ["a";"b";"c";"d"] Assert.AreEqual("a", resultStr) - - // empty List + + // empty List CheckThrowsArgumentException ( fun() -> List.maxBy (fun () -> 1) List.empty ) // returns first maximal element let max = List.maxBy fst [1, "a"; 2, "b"; 3, "c"; 2, "d"; 3, "e"; 1, "f" ] if snd max <> "c" then Assert.Fail() - + () [] member this.Min() = - // integer List - let resultInt = List.min [3;7;8;9;4;1;1;2] + // integer List + let resultInt = List.min [3;7;8;9;4;1;1;2] Assert.AreEqual(1, resultInt) - + // string List - let resultStr = List.min ["a";"b";"c";"d"] + let resultStr = List.min ["a";"b";"c";"d"] Assert.AreEqual("a", resultStr) - - // empty List + + // empty List CheckThrowsArgumentException ( fun() -> List.min List.empty) - - () + + () [] - member this.MinBy() = - // integer List + member this.MinBy() = + // integer List let funcInt x = x%8 - let resultInt = List.minBy funcInt [3;7;9;4;8;1;1;2] + let resultInt = List.minBy funcInt [3;7;9;4;8;1;1;2] Assert.AreEqual(8, resultInt) - + // string List - let funcStr (x:string) = x.Length - let resultStr = List.minBy funcStr ["a";"b";"c";"d"] + let funcStr (x:string) = x.Length + let resultStr = List.minBy funcStr ["a";"b";"c";"d"] Assert.AreEqual("a", resultStr) - + // empty List let funcEpt () = 1 CheckThrowsArgumentException ( fun() -> List.minBy funcEpt List.empty) - + // returns first minimal element let min = List.minBy fst [ 3, "a"; 2, "b"; 1, "c"; 2, "d"; 1, "e"; 3, "f" ] if snd min <> "c" then Assert.Fail() - + () [] @@ -358,161 +358,161 @@ type ListModule02() = [] member this.Of_Array() = - // integer List - let resultInt = List.ofArray [|1..10|] + // integer List + let resultInt = List.ofArray [|1..10|] Assert.AreEqual([1..10], resultInt) - - // string List - let resultStr = List.ofArray [|"a";"b";"c";"d"|] + + // string List + let resultStr = List.ofArray [|"a";"b";"c";"d"|] Assert.AreEqual(["a";"b";"c";"d"], resultStr) - - // empty List - let resultEpt = List.ofArray [||] + + // empty List + let resultEpt = List.ofArray [||] Assert.AreEqual(List.empty, resultEpt) - + () [] member this.Of_Seq() = - // integer List - let resultInt = List.ofSeq (seq {1..10}) + // integer List + let resultInt = List.ofSeq (seq {1..10}) Assert.AreEqual([1..10], resultInt) - - // string List - let resultStr = List.ofSeq (seq {for x in 'a'..'f' -> x.ToString()}) + + // string List + let resultStr = List.ofSeq (seq {for x in 'a'..'f' -> x.ToString()}) Assert.AreEqual([ "a";"b";"c";"d";"e";"f" ], resultStr) - - // empty List - let resultEpt = List.ofSeq [] + + // empty List + let resultEpt = List.ofSeq [] Assert.AreEqual(List.empty, resultEpt) - + () [] member this.Partition() = - // integer List - let resultInt = List.partition (fun x -> x % 3 = 0) [1..10] + // integer List + let resultInt = List.partition (fun x -> x % 3 = 0) [1..10] Assert.AreEqual(([3;6;9], [1;2;4;5;7;8;10]), resultInt ) - - // string List - let resultStr = List.partition (fun (x:string) -> x.Length > 4) ["a";"b";"c";"d"] + + // string List + let resultStr = List.partition (fun (x:string) -> x.Length > 4) ["a";"b";"c";"d"] Assert.AreEqual(List.empty, fst resultStr) Assert.AreEqual(["a";"b";"c";"d"] |> Array.ofList, (snd resultStr) |> Array.ofList) - - // empty List - let resultEpt = List.partition (fun x -> x % 3 = 0) [] + + // empty List + let resultEpt = List.partition (fun x -> x % 3 = 0) [] Assert.AreEqual(List.empty, fst resultEpt) Assert.AreEqual(List.empty, snd resultEpt) - + () [] member this.Permute() = - // integer List + // integer List let resultInt = List.permute (fun i -> (i+1) % 4) [1;2;3;4] Assert.AreEqual([4;1;2;3], resultInt) - - // string List - let resultStr = List.permute (fun i -> (i+1) % 4) ["a";"b";"c";"d"] + + // string List + let resultStr = List.permute (fun i -> (i+1) % 4) ["a";"b";"c";"d"] Assert.AreEqual(["d";"a";"b";"c"], resultStr) - - // empty List - let resultEpt = List.permute (fun i -> (i+1) % 4) [] - Assert.AreEqual([], resultEpt) - + + // empty List + let resultEpt = List.permute (fun i -> (i+1) % 4) [] + Assert.AreEqual([], resultEpt) + () [] member this.Reduce() = - // integer List + // integer List let resultInt = List.reduce (fun x y -> x/y) [5*4*3*2; 4;3;2;1] - Assert.AreEqual(5, resultInt) - - // string List + Assert.AreEqual(5, resultInt) + + // string List let resultStr = List.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) ["ABCDE";"A"; "B"; "C" ; "D"] - Assert.AreEqual("E", resultStr) - - // empty List + Assert.AreEqual("E", resultStr) + + // empty List CheckThrowsArgumentException (fun () -> List.reduce (fun x y -> x/y) [] |> ignore) - + () - + [] member this.ReduceBack() = - // integer List + // integer List let resultInt = List.reduceBack (fun x y -> x/y) [5*4*3*2; 4;3;2;1] - Assert.AreEqual(30, resultInt) - - // string List + Assert.AreEqual(30, resultInt) + + // string List let resultStr = List.reduceBack (fun (x:string) (y:string) -> x.Remove(0,y.Length)) ["ABCDE";"A"; "B"; "C" ; "D"] - Assert.AreEqual("ABCDE",resultStr) - - // empty List + Assert.AreEqual("ABCDE",resultStr) + + // empty List CheckThrowsArgumentException (fun () -> List.reduceBack (fun x y -> x/y) [] |> ignore) - + () [] member this.Rev() = - // integer List - let resultInt = List.rev [1..10] + // integer List + let resultInt = List.rev [1..10] Assert.AreEqual(resultInt , [10;9;8;7;6;5;4;3;2;1]) - - // string List - let resultStr = List.rev ["a";"b";"c";"d"] + + // string List + let resultStr = List.rev ["a";"b";"c";"d"] Assert.AreEqual( ["d";"c";"b";"a"], resultStr) - - // empty List - let resultEpt = List.rev [] + + // empty List + let resultEpt = List.rev [] Assert.AreEqual([], resultEpt) - + () [] member this.Scan() = // integer List let funcInt x y = x+y - let resultInt = List.scan funcInt 9 [ 1..10 ] + let resultInt = List.scan funcInt 9 [ 1..10 ] Assert.AreEqual([9;10;12;15;19;24;30;37;45;54;64], resultInt) - + // string List - let funcStr x y = x+y - let resultStr = List.scan funcStr "*" ["a";"b";"c";"d"] + let funcStr x y = x+y + let resultStr = List.scan funcStr "*" ["a";"b";"c";"d"] Assert.AreEqual(["*";"*a";"*ab";"*abc";"*abcd"], resultStr) - + // empty List - let resultEpt = List.scan funcInt 5 [ ] + let resultEpt = List.scan funcInt 5 [ ] Assert.AreEqual([5], resultEpt) - - () + + () [] member this.ScanBack() = - // integer List + // integer List let funcInt x y = x+y - let resultInt = List.scanBack funcInt [ 1..10 ] 9 + let resultInt = List.scanBack funcInt [ 1..10 ] 9 Assert.AreEqual([64;63;61;58;54;49;43;36;28;19;9], resultInt) - + // string List - let funcStr x y = x+y - let resultStr = List.scanBack funcStr ["a";"b";"c";"d"] "*" + let funcStr x y = x+y + let resultStr = List.scanBack funcStr ["a";"b";"c";"d"] "*" Assert.AreEqual(["abcd*";"bcd*";"cd*";"d*";"*"], resultStr) - + // empty List - let resultEpt = List.scanBack funcInt [ ] 5 + let resultEpt = List.scanBack funcInt [ ] 5 Assert.AreEqual([5], resultEpt) - - () + + () [] member this.Skip() = // integer List let resultInt = List.skip 2 [1..10] Assert.AreEqual([3..10], resultInt) - + let resultInt2 = List.skip 0 [1..10] Assert.AreEqual([1..10], resultInt2) - + let resultInt3 = List.skip -1 [1..10] Assert.AreEqual([1..10], resultInt3) @@ -558,75 +558,75 @@ type ListModule02() = [] member this.Sort() = - // integer List + // integer List let intArr = [3;5;7;2;4;8] - let resultInt = List.sort intArr + let resultInt = List.sort intArr Assert.AreEqual(resultInt , [2;3;4;5;7;8]) - + // string List - let strArr = ["Z";"a";"d";"Y";"c";"b";"X"] - let resultStr = List.sort strArr + let strArr = ["Z";"a";"d";"Y";"c";"b";"X"] + let resultStr = List.sort strArr Assert.AreEqual(["X"; "Y"; "Z"; "a"; "b"; "c"; "d"], resultStr) - + // empty List let emptyArr : int list = [ ] - let resultEpt = List.sort emptyArr + let resultEpt = List.sort emptyArr Assert.AreEqual(List.empty, resultEpt) // tuple List - let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")] - let resultTup = List.sort tupArr + let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")] + let resultTup = List.sort tupArr Assert.AreEqual([(1,"a");(1,"b");(1,"d");(1,"x");(2,"a");(2,"b");(2,"x")], resultTup) - - () + + () [] member this.SortBy() = - // integer List + // integer List let intArr = [3;5;7;2;4;8] - let resultInt = List.sortBy int intArr + let resultInt = List.sortBy int intArr Assert.AreEqual([2;3;4;5;7;8], resultInt) - + // string List - let strArr = [".."; "..."; "."; "...."] - let resultStr = List.sortBy (fun (x:string) -> x.Length) strArr + let strArr = [".."; "..."; "."; "...."] + let resultStr = List.sortBy (fun (x:string) -> x.Length) strArr Assert.AreEqual(["."; ".."; "..."; "...."], resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.sortBy int emptyArr + let resultEpt = List.sortBy int emptyArr Assert.AreEqual(List.empty, resultEpt) // tuple List - let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")] - let resultTup = List.sortBy snd tupArr + let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")] + let resultTup = List.sortBy snd tupArr Assert.AreEqual([(2,"a");(1,"a");(1,"b");(2,"b");(1,"d");(2,"x");(1,"x")], resultTup) - + () - + [] member this.SortDescending() = // integer List let minInt,maxInt = System.Int32.MinValue,System.Int32.MaxValue let intArr = [3;5;7;2;4;8;0;-1;1;minInt;maxInt] - let resultInt = List.sortDescending intArr + let resultInt = List.sortDescending intArr Assert.AreEqual(resultInt , [maxInt;8;7;5;4;3;2;1;0;-1;minInt]) - + // string List - let strArr = ["Z";"a";"d";"Y";"c";"b";"X"] - let resultStr = List.sortDescending strArr + let strArr = ["Z";"a";"d";"Y";"c";"b";"X"] + let resultStr = List.sortDescending strArr Assert.AreEqual(["d"; "c"; "b"; "a"; "Z"; "Y"; "X"], resultStr) - + // empty List let emptyArr : int list = [ ] - let resultEpt = List.sortDescending emptyArr + let resultEpt = List.sortDescending emptyArr Assert.AreEqual(List.empty, resultEpt) // tuple List - let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")] - let resultTup = List.sortDescending tupArr + let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")] + let resultTup = List.sortDescending tupArr Assert.AreEqual([(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")], resultTup) - + // float Seq let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon let floatArr = [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] @@ -634,28 +634,28 @@ type ListModule02() = let expectedFloat = [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] Assert.AreEqual(expectedFloat, resultFloat) - () - + () + [] member this.SortByDescending() = - // integer List + // integer List let intArr = [3;5;7;2;4;8] - let resultInt = List.sortByDescending int intArr + let resultInt = List.sortByDescending int intArr Assert.AreEqual([8;7;5;4;3;2], resultInt) - + // string List - let strArr = [".."; "..."; "."; "...."] - let resultStr = List.sortByDescending (fun (x:string) -> x.Length) strArr + let strArr = [".."; "..."; "."; "...."] + let resultStr = List.sortByDescending (fun (x:string) -> x.Length) strArr Assert.AreEqual(["...."; "..."; ".."; "."], resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = List.sortByDescending int emptyArr + let resultEpt = List.sortByDescending int emptyArr Assert.AreEqual(List.empty, resultEpt) - + // tuple List - let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")] - let resultTup = List.sortByDescending snd tupArr + let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")] + let resultTup = List.sortByDescending snd tupArr Assert.AreEqual( [(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")] , resultTup) // float Seq @@ -665,8 +665,8 @@ type ListModule02() = let expectedFloat = [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] Assert.AreEqual(expectedFloat, resultFloat) - () - + () + [] member this.SortWith() = @@ -687,134 +687,134 @@ type ListModule02() = [] member this.Sum() = - // empty integer List - let resultEptInt = List.sum ([]:int list) + // empty integer List + let resultEptInt = List.sum ([]:int list) Assert.AreEqual(0, resultEptInt) - + // empty float32 List - let emptyFloatList = List.empty - let resultEptFloat = List.sum emptyFloatList + let emptyFloatList = List.empty + let resultEptFloat = List.sum emptyFloatList Assert.AreEqual(0.0f, resultEptFloat) - + // empty double List - let emptyDoubleList = List.empty - let resultDouEmp = List.sum emptyDoubleList + let emptyDoubleList = List.empty + let resultDouEmp = List.sum emptyDoubleList Assert.AreEqual(0.0, resultDouEmp) - + // empty decimal List // currently bugged. see[FSharp Bugs 1.0] #3510 - 'List.average does not work on empty Decimals List' - let emptyDecimalList = List.empty - let resultDecEmp = List.sum emptyDecimalList + let emptyDecimalList = List.empty + let resultDecEmp = List.sum emptyDecimalList Assert.AreEqual(0M, resultDecEmp) - // integer List - let resultInt = List.sum [1..10] + // integer List + let resultInt = List.sum [1..10] Assert.AreEqual(55, resultInt) - + // float32 List let floatList: float32 list = [ 1.2f;3.5f;6.7f ] - let resultFloat = List.sum floatList + let resultFloat = List.sum floatList Assert.AreEqual(11.4f, resultFloat) - + // double List let doubleList: System.Double list = [ 1.0;8.0 ] - let resultDouble = List.sum doubleList + let resultDouble = List.sum doubleList Assert.AreEqual(9.0, resultDouble) - + // decimal List let decimalList: decimal list = [ 0M;19M;19.03M ] - let resultDecimal = List.sum decimalList + let resultDecimal = List.sum decimalList Assert.AreEqual(38.03M , resultDecimal) - + () [] member this.SumBy() = - // empty integer List - let resultEptInt = List.sumBy int ([]:int list) + // empty integer List + let resultEptInt = List.sumBy int ([]:int list) Assert.AreEqual(0, resultEptInt) - + // empty float32 List - let emptyFloatList = List.empty - let resultEptFloat = List.sumBy float32 emptyFloatList + let emptyFloatList = List.empty + let resultEptFloat = List.sumBy float32 emptyFloatList Assert.AreEqual(0.0f, resultEptFloat) - + // empty double List - let emptyDoubleList = List.empty - let resultDouEmp = List.sumBy float emptyDoubleList + let emptyDoubleList = List.empty + let resultDouEmp = List.sumBy float emptyDoubleList Assert.AreEqual(0.0, resultDouEmp) - + // empty decimal List // currently bugged. see[FSharp Bugs 1.0] #3510 - 'List.average does not work on empty Decimals List' - let emptyDecimalList = List.empty - let resultDecEmp = List.sumBy decimal emptyDecimalList + let emptyDecimalList = List.empty + let resultDecEmp = List.sumBy decimal emptyDecimalList Assert.AreEqual(0M, resultDecEmp) - // integer List - let resultInt = List.sumBy int [1..10] + // integer List + let resultInt = List.sumBy int [1..10] Assert.AreEqual(55, resultInt) - + // float32 List let floatList: string list = [ "1.2";"3.5";"6.7" ] - let resultFloat = List.sumBy float32 floatList + let resultFloat = List.sumBy float32 floatList Assert.AreEqual(11.4f, resultFloat) - + // double List let doubleList: System.Double list = [ 1.0;8.0 ] - let resultDouble = List.sumBy float doubleList + let resultDouble = List.sumBy float doubleList Assert.AreEqual(9.0, resultDouble) - + // decimal List let decimalList: decimal list = [ 0M;19M;19.03M ] - let resultDecimal = List.sumBy decimal decimalList + let resultDecimal = List.sumBy decimal decimalList Assert.AreEqual(38.03M, resultDecimal) - + () [] member this.Tl() = - // integer List - let resultInt = List.tail [1..10] + // integer List + let resultInt = List.tail [1..10] Assert.AreEqual([2..10], resultInt) - - // string List - let resultStr = List.tail ["a";"b";"c";"d"] + + // string List + let resultStr = List.tail ["a";"b";"c";"d"] Assert.AreEqual([ "b"; "c" ; "d"], resultStr) CheckThrowsArgumentException(fun () -> List.tail [] |> ignore) - () + () [] member this.To_Array() = - // integer List - let resultInt = List.toArray [1..10] + // integer List + let resultInt = List.toArray [1..10] Assert.AreEqual([|1..10|] , resultInt) - - // string List - let resultStr = List.toArray ["a";"b";"c";"d"] + + // string List + let resultStr = List.toArray ["a";"b";"c";"d"] Assert.AreEqual([|"a";"b";"c";"d"|], resultStr) - - // empty List - let resultEpt = List.toArray [] + + // empty List + let resultEpt = List.toArray [] Assert.AreEqual([| |], resultEpt) - - () - + + () + [] member this.To_Seq() = - // integer List - let resultInt = [1..10] |> List.toSeq |> List.ofSeq + // integer List + let resultInt = [1..10] |> List.toSeq |> List.ofSeq Assert.AreEqual(resultInt , [1..10]) - - // string List - let resultStr = ["a";"b";"c";"d"] |> List.toSeq |> List.ofSeq + + // string List + let resultStr = ["a";"b";"c";"d"] |> List.toSeq |> List.ofSeq Assert.AreEqual(["a";"b";"c";"d"], resultStr) - - // empty List - let resultEpt =[] |> List.toSeq |> List.ofSeq + + // empty List + let resultEpt =[] |> List.toSeq |> List.ofSeq Assert.AreEqual(List.empty, resultEpt) - - () + + () [] member this.Transpose() = @@ -862,24 +862,24 @@ type ListModule02() = [] member this.TryFind() = - // integer List - let resultInt = [1..10] |> List.tryFind (fun x -> x%7 = 0) + // integer List + let resultInt = [1..10] |> List.tryFind (fun x -> x%7 = 0) Assert.AreEqual(Some 7, resultInt) - - // string List - let resultStr = ["a";"b";"c";"d"] |> List.tryFind (fun (x:string) -> x.Contains("c")) + + // string List + let resultStr = ["a";"b";"c";"d"] |> List.tryFind (fun (x:string) -> x.Contains("c")) Assert.AreEqual(Some "c", resultStr) - - // empty List - let resultEpt =[] |> List.tryFind (fun x -> x%7 = 0) + + // empty List + let resultEpt =[] |> List.tryFind (fun x -> x%7 = 0) Assert.AreEqual(None, resultEpt) - + // Head satisfy let resultHead = [7 .. -1 .. 0] |> List.tryFind (fun x -> x % 7 = 0) Assert.AreEqual(Some 7, resultHead) () - + [] member this.TryFindBack() = // integer List @@ -905,16 +905,16 @@ type ListModule02() = [] member this.TryFindIndex() = - // integer List - let resultInt = [1..10] |> List.tryFindIndex (fun x -> x%7 = 0) + // integer List + let resultInt = [1..10] |> List.tryFindIndex (fun x -> x%7 = 0) Assert.AreEqual(Some 6, resultInt) - - // string List - let resultStr = ["a";"b";"c";"d"] |> List.tryFindIndex (fun (x:string) -> x.Length > 4) + + // string List + let resultStr = ["a";"b";"c";"d"] |> List.tryFindIndex (fun (x:string) -> x.Length > 4) Assert.AreEqual(None, resultStr) - - // empty List - let resultEpt = [] |> List.tryFindIndex (fun x -> x%7 = 0) + + // empty List + let resultEpt = [] |> List.tryFindIndex (fun x -> x%7 = 0) Assert.AreEqual(None, resultEpt) () @@ -956,39 +956,39 @@ type ListModule02() = [] member this.Unzip() = - // integer List - let resultInt = List.unzip [(1,2);(2,4);(3,6)] + // integer List + let resultInt = List.unzip [(1,2);(2,4);(3,6)] Assert.AreEqual(([1..3], [2..2..6]) , resultInt ) - - // string List + + // string List let resultStr = List.unzip [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let str = resultStr.ToString() + let str = resultStr.ToString() Assert.AreEqual(([2;3;4;5],["b";"c";"d";"e"]) , resultStr) - - // empty List - let resultEpt = List.unzip [] + + // empty List + let resultEpt = List.unzip [] Assert.AreEqual(( [], []), resultEpt) // null List - + () [] member this.Unzip3() = - // integer List - let resultInt = List.unzip3 [(1,2,3);(2,4,6);(3,6,9)] + // integer List + let resultInt = List.unzip3 [(1,2,3);(2,4,6);(3,6,9)] Assert.AreEqual(([1;2;3], [2;4;6], [3;6;9]), resultInt) - - // string List - let resultStr = List.unzip3 [(2,"b","II");(3,"c","III");(4,"d","IV");(5,"e","V")] + + // string List + let resultStr = List.unzip3 [(2,"b","II");(3,"c","III");(4,"d","IV");(5,"e","V")] Assert.AreEqual(([2;3;4;5], ["b";"c";"d";"e"], ["II"; "III"; "IV"; "V"]), resultStr) - - // empty List - let resultEpt = List.unzip3 [] + + // empty List + let resultEpt = List.unzip3 [] Assert.AreEqual(( [], [], []), resultEpt) // null List - + () [] @@ -1077,37 +1077,37 @@ type ListModule02() = [] member this.Zip() = - // integer List - let resultInt = List.zip [1..3] [2..2..6] + // integer List + let resultInt = List.zip [1..3] [2..2..6] Assert.AreEqual([(1,2);(2,4);(3,6)], resultInt) - - // string List - let resultStr = List.zip [2;3;4;5] ["b";"c";"d";"e"] + + // string List + let resultStr = List.zip [2;3;4;5] ["b";"c";"d";"e"] Assert.AreEqual([(2,"b");(3,"c");(4,"d");(5,"e")] , resultStr) - - // empty List - let resultEpt = List.zip [] [] - let empTuple:(obj*obj) list = [] + + // empty List + let resultEpt = List.zip [] [] + let empTuple:(obj*obj) list = [] Assert.AreEqual(empTuple, resultEpt) - + () [] member this.Zip3() = - // integer List - let resultInt = List.zip3 [1..3] [2..2..6] [3;6;9] + // integer List + let resultInt = List.zip3 [1..3] [2..2..6] [3;6;9] Assert.AreEqual([(1,2,3); (2,4,6); (3,6,9)], resultInt) - - // string List - let resultStr = List.zip3 [2;3;4;5] ["b";"c";"d";"e"] ["II"; "III"; "IV"; "V"] + + // string List + let resultStr = List.zip3 [2;3;4;5] ["b";"c";"d";"e"] ["II"; "III"; "IV"; "V"] Assert.AreEqual([(2,"b","II");(3,"c","III");(4,"d","IV");(5,"e","V")], resultStr) - - // empty List - let resultEpt = List.zip3 [] [] [] - let empTriple:(obj*obj*obj) list = [] + + // empty List + let resultEpt = List.zip3 [] [] [] + let empTriple:(obj*obj*obj) list = [] Assert.AreEqual(empTriple, resultEpt) - - () + + () [] member this.tryItem() = @@ -1137,80 +1137,80 @@ type ListModule02() = Assert.AreEqual([2; 3; 4; 5], (List.removeAt 0 [1..5])) Assert.AreEqual([1; 2; 4; 5], (List.removeAt 2 [1..5])) Assert.AreEqual([1; 2; 3; 4], (List.removeAt 4 [1..5])) - + //string list Assert.AreEqual(["2"; "3"; "4"; "5"], (List.removeAt 0 ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "4"; "5"], (List.removeAt 2 ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "3"; "4"], (List.removeAt 4 ["1"; "2"; "3"; "4"; "5"])) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> List.removeAt 0 [] |> ignore) CheckThrowsArgumentException (fun () -> List.removeAt -1 [1] |> ignore) CheckThrowsArgumentException (fun () -> List.removeAt 2 [1] |> ignore) - + [] member this.RemoveManyAt() = // integer list Assert.AreEqual([3; 4; 5], (List.removeManyAt 0 2 [1..5])) Assert.AreEqual([1; 2; 5], (List.removeManyAt 2 2 [1..5])) Assert.AreEqual([1; 2; 3], (List.removeManyAt 3 2 [1..5])) - + //string list Assert.AreEqual(["3"; "4"; "5"], (List.removeManyAt 0 2 ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "5"], (List.removeManyAt 2 2 ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "3"], (List.removeManyAt 3 2 ["1"; "2"; "3"; "4"; "5"])) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> List.removeManyAt 0 2 [] |> ignore) CheckThrowsArgumentException (fun () -> List.removeManyAt -1 2 [1] |> ignore) CheckThrowsArgumentException (fun () -> List.removeManyAt 2 2 [1] |> ignore) - + [] member this.UpdateAt() = // integer list Assert.AreEqual([0; 2; 3; 4; 5], (List.updateAt 0 0 [1..5])) Assert.AreEqual([1; 2; 0; 4; 5], (List.updateAt 2 0 [1..5])) Assert.AreEqual([1; 2; 3; 4; 0], (List.updateAt 4 0 [1..5])) - + //string list Assert.AreEqual(["0"; "2"; "3"; "4"; "5"], (List.updateAt 0 "0" ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "0"; "4"; "5"], (List.updateAt 2 "0" ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "3"; "4"; "0"], (List.updateAt 4 "0" ["1"; "2"; "3"; "4"; "5"])) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> List.updateAt 0 0 [] |> ignore) CheckThrowsArgumentException (fun () -> List.updateAt -1 0 [1] |> ignore) CheckThrowsArgumentException (fun () -> List.updateAt 2 0 [1] |> ignore) - + [] member this.InsertAt() = // integer list Assert.AreEqual([0; 1; 2; 3; 4; 5], (List.insertAt 0 0 [1..5])) Assert.AreEqual([1; 2; 0; 3; 4; 5], (List.insertAt 2 0 [1..5])) Assert.AreEqual([1; 2; 3; 4; 0; 5], (List.insertAt 4 0 [1..5])) - + //string list Assert.AreEqual(["0"; "1"; "2"; "3"; "4"; "5"], (List.insertAt 0 "0" ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "0"; "3"; "4"; "5"], (List.insertAt 2 "0" ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "3"; "4"; "0"; "5"], (List.insertAt 4 "0" ["1"; "2"; "3"; "4"; "5"])) - + // empty list & out of bounds Assert.AreEqual([0], List.insertAt 0 0 []) CheckThrowsArgumentException (fun () -> List.insertAt -1 0 [1] |> ignore) CheckThrowsArgumentException (fun () -> List.insertAt 2 0 [1] |> ignore) - + [] member this.InsertManyAt() = // integer list Assert.AreEqual([0; 0; 1; 2; 3; 4; 5], (List.insertManyAt 0 [0; 0] [1..5])) Assert.AreEqual([1; 2; 0; 0; 3; 4; 5], (List.insertManyAt 2 [0; 0] [1..5])) Assert.AreEqual([1; 2; 3; 4; 0; 0; 5], (List.insertManyAt 4 [0; 0] [1..5])) - + //string list Assert.AreEqual(["0"; "0"; "1"; "2"; "3"; "4"; "5"], (List.insertManyAt 0 ["0"; "0"] ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "0"; "0"; "3"; "4"; "5"], (List.insertManyAt 2 ["0"; "0"] ["1"; "2"; "3"; "4"; "5"])) Assert.AreEqual(["1"; "2"; "3"; "4"; "0"; "0"; "5"], (List.insertManyAt 4 ["0"; "0"] ["1"; "2"; "3"; "4"; "5"])) - + // empty list & out of bounds Assert.AreEqual([0; 0], List.insertManyAt 0 [0; 0] []) CheckThrowsArgumentException (fun () -> List.insertManyAt -1 [0; 0] [1] |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListProperties.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListProperties.fs index 086eaef0ac2..a581591ed24 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListProperties.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListProperties.fs @@ -48,10 +48,10 @@ type ListProperties () = Check.QuickThrowOnFailure this.windowed_and_order member _.partition_and_sort<'a when 'a : comparison> (xs : 'a list) = - let rec qsort xs = + let rec qsort xs = match xs with | [] -> [] - | (x:'a)::xs -> + | (x:'a)::xs -> let smaller,larger = List.partition (fun y -> y <= x) xs qsort smaller @ [x] @ qsort larger @@ -77,7 +77,7 @@ type ListProperties () = [] member this.``chunkBySize produces chunks exactly of size `chunkSize`, except the last one, which can be smaller, but not empty``() = - let prop (a: _ list) (PositiveInt chunkSize) = + let prop (a: _ list) (PositiveInt chunkSize) = match a |> List.chunkBySize chunkSize |> Seq.toList with | [] -> a = [] | h :: [] -> h.Length <= chunkSize @@ -181,17 +181,17 @@ type ListProperties () = Check.QuickThrowOnFailure prop member _.sort_and_sortby (xs : list) (xs2 : list) = - let a = List.sortBy id xs |> Seq.toArray + let a = List.sortBy id xs |> Seq.toArray let b = List.sort xs |> Seq.toArray let mutable result = true for i in 0 .. a.Length - 1 do if a.[i] <> b.[i] then if System.Double.IsNaN a.[i] <> System.Double.IsNaN b.[i] then result <- false - result + result [] - member this.``sort behaves like sortby id`` () = + member this.``sort behaves like sortby id`` () = Check.QuickThrowOnFailure this.sort_and_sortby member _. filter_and_except<'a when 'a : comparison> (xs : list<'a>) (itemsToExclude : Set<'a>) = @@ -200,10 +200,10 @@ type ListProperties () = a = b [] - member this.``filter and except work similar`` () = + member this.``filter and except work similar`` () = Check.QuickThrowOnFailure this.filter_and_except Check.QuickThrowOnFailure this.filter_and_except - Check.QuickThrowOnFailure this.filter_and_except + Check.QuickThrowOnFailure this.filter_and_except member _.filter_and_where<'a when 'a : comparison> (xs : list<'a>) predicate = let a = List.filter predicate xs @@ -211,7 +211,7 @@ type ListProperties () = a = b [] - member this.``filter and where work similar`` () = + member this.``filter and where work similar`` () = Check.QuickThrowOnFailure this.filter_and_where Check.QuickThrowOnFailure this.filter_and_where Check.QuickThrowOnFailure this.filter_and_where @@ -222,7 +222,7 @@ type ListProperties () = a = b [] - member this.``pick works like find`` () = + member this.``pick works like find`` () = Check.QuickThrowOnFailure this.find_and_pick Check.QuickThrowOnFailure this.find_and_pick Check.QuickThrowOnFailure this.find_and_pick @@ -233,7 +233,7 @@ type ListProperties () = a = b [] - member this.``pick works like choose + head`` () = + member this.``pick works like choose + head`` () = Check.QuickThrowOnFailure this.choose_and_pick Check.QuickThrowOnFailure this.choose_and_pick Check.QuickThrowOnFailure this.choose_and_pick @@ -245,7 +245,7 @@ type ListProperties () = xs = h :: t) [] - member this.``head and tail gives the list`` () = + member this.``head and tail gives the list`` () = Check.QuickThrowOnFailure this.head_and_tail Check.QuickThrowOnFailure this.head_and_tail Check.QuickThrowOnFailure this.head_and_tail @@ -259,7 +259,7 @@ type ListProperties () = xs = h :: t [] - member this.``tryHead and tail gives the list`` () = + member this.``tryHead and tail gives the list`` () = Check.QuickThrowOnFailure this.tryHead_and_tail Check.QuickThrowOnFailure this.tryHead_and_tail Check.QuickThrowOnFailure this.tryHead_and_tail @@ -273,7 +273,7 @@ type ListProperties () = else true [] - member this.``skip and take gives the list`` () = + member this.``skip and take gives the list`` () = Check.QuickThrowOnFailure this.skip_and_take Check.QuickThrowOnFailure this.skip_and_take Check.QuickThrowOnFailure this.skip_and_take @@ -287,7 +287,7 @@ type ListProperties () = else true [] - member this.``truncate and take work similar`` () = + member this.``truncate and take work similar`` () = Check.QuickThrowOnFailure this.truncate_and_take Check.QuickThrowOnFailure this.truncate_and_take Check.QuickThrowOnFailure this.truncate_and_take @@ -300,13 +300,13 @@ type ListProperties () = else true [] - member this.``skipWhile and takeWhile gives the list`` () = + member this.``skipWhile and takeWhile gives the list`` () = Check.QuickThrowOnFailure this.skipWhile_and_takeWhile Check.QuickThrowOnFailure this.skipWhile_and_takeWhile Check.QuickThrowOnFailure this.skipWhile_and_takeWhile member this.find_and_exists<'a when 'a : comparison> (xs : list<'a>) f = - let a = + let a = try List.find f xs |> ignore true @@ -316,7 +316,7 @@ type ListProperties () = a = b [] - member this.``find and exists work similar`` () = + member this.``find and exists work similar`` () = Check.QuickThrowOnFailure this.find_and_exists Check.QuickThrowOnFailure this.find_and_exists Check.QuickThrowOnFailure this.find_and_exists @@ -327,13 +327,13 @@ type ListProperties () = a = not b [] - member this.``exists and forall are dual`` () = + member this.``exists and forall are dual`` () = Check.QuickThrowOnFailure this.exists_and_forall Check.QuickThrowOnFailure this.exists_and_forall Check.QuickThrowOnFailure this.exists_and_forall member _.head_and_isEmpty<'a when 'a : comparison> (xs : list<'a>) = - let a = + let a = try List.head xs |> ignore true @@ -344,7 +344,7 @@ type ListProperties () = a = not b [] - member this.``head fails when list isEmpty`` () = + member this.``head fails when list isEmpty`` () = Check.QuickThrowOnFailure this.head_and_isEmpty Check.QuickThrowOnFailure this.head_and_isEmpty Check.QuickThrowOnFailure this.head_and_isEmpty @@ -355,7 +355,7 @@ type ListProperties () = a = b [] - member this.``head is the same as last of a reversed list`` () = + member this.``head is the same as last of a reversed list`` () = Check.QuickThrowOnFailure this.head_and_last Check.QuickThrowOnFailure this.head_and_last Check.QuickThrowOnFailure this.head_and_last @@ -367,7 +367,7 @@ type ListProperties () = a = b [] - member this.``head is the same as item 0`` () = + member this.``head is the same as item 0`` () = Check.QuickThrowOnFailure this.head_and_item Check.QuickThrowOnFailure this.head_and_item Check.QuickThrowOnFailure this.head_and_item @@ -381,7 +381,7 @@ type ListProperties () = | _ -> b = None [] - member this.``tryItem is safe item`` () = + member this.``tryItem is safe item`` () = Check.QuickThrowOnFailure this.item_and_tryItem Check.QuickThrowOnFailure this.item_and_tryItem Check.QuickThrowOnFailure this.item_and_tryItem @@ -395,7 +395,7 @@ type ListProperties () = | _ -> b = None [] - member this.``tryPick is safe pick`` () = + member this.``tryPick is safe pick`` () = Check.QuickThrowOnFailure this.pick_and_tryPick Check.QuickThrowOnFailure this.pick_and_tryPick Check.QuickThrowOnFailure this.pick_and_tryPick @@ -409,7 +409,7 @@ type ListProperties () = | _ -> b = None [] - member this.``tryLast is safe last`` () = + member this.``tryLast is safe last`` () = Check.QuickThrowOnFailure this.last_and_tryLast Check.QuickThrowOnFailure this.last_and_tryLast Check.QuickThrowOnFailure this.last_and_tryLast @@ -421,7 +421,7 @@ type ListProperties () = a = b [] - member this.``list isEmpty if and only if length is 0`` () = + member this.``list isEmpty if and only if length is 0`` () = Check.QuickThrowOnFailure this.length_and_isEmpty Check.QuickThrowOnFailure this.length_and_isEmpty Check.QuickThrowOnFailure this.length_and_isEmpty @@ -433,7 +433,7 @@ type ListProperties () = a = b [] - member this.``min is opposite of max`` () = + member this.``min is opposite of max`` () = Check.QuickThrowOnFailure this.min_and_max member _.minBy_and_maxBy (xs : list) f = @@ -443,7 +443,7 @@ type ListProperties () = a = b [] - member this.``minBy is opposite of maxBy`` () = + member this.``minBy is opposite of maxBy`` () = Check.QuickThrowOnFailure this.minBy_and_maxBy member _.minBy_and_min (xs : list) = @@ -453,7 +453,7 @@ type ListProperties () = a = b [] - member this.``minBy id is same as min`` () = + member this.``minBy id is same as min`` () = Check.QuickThrowOnFailure this.minBy_and_min member _.min_and_sort<'a when 'a : comparison> (xs : list<'a>) = @@ -463,35 +463,35 @@ type ListProperties () = a = b [] - member this.``head element after sort is min element`` () = + member this.``head element after sort is min element`` () = Check.QuickThrowOnFailure this.min_and_sort Check.QuickThrowOnFailure this.min_and_sort Check.QuickThrowOnFailure this.min_and_sort member _.pairwise<'a when 'a : comparison> (xs : list<'a>) = - let xs' = List.pairwise xs + let xs' = List.pairwise xs let f = xs' |> List.map fst let s = xs' |> List.map snd let a = List.length xs' let b = List.length xs - if xs = [] then + if xs = [] then xs' = [] - else + else a = b - 1 && f = (xs |> List.rev |> List.tail |> List.rev) && // all elements but last one s = (xs |> List.tail) // all elements but first one [] - member this.``pairwise works as expected`` () = + member this.``pairwise works as expected`` () = Check.QuickThrowOnFailure this.pairwise Check.QuickThrowOnFailure this.pairwise Check.QuickThrowOnFailure this.pairwise member _.permute<'a when 'a : comparison> (xs' : list) = let xs = List.map snd xs' - - let permutations = + + let permutations = List.map fst xs' |> List.indexed |> List.sortBy snd @@ -503,7 +503,7 @@ type ListProperties () = match run (fun () -> xs |> List.indexed |> List.permute permutation) with - | Ok s -> + | Ok s -> let originals = s |> List.map fst let rs = s |> List.map snd for o in originals do @@ -514,7 +514,7 @@ type ListProperties () = | _ -> true [] - member this.``permute works as expected`` () = + member this.``permute works as expected`` () = Check.QuickThrowOnFailure this.permute Check.QuickThrowOnFailure this.permute Check.QuickThrowOnFailure this.permute @@ -530,7 +530,7 @@ type ListProperties () = a = b && (Seq.toList indices = [0..xs.Length-1]) [] - member this.``mapi behaves like map with correct order`` () = + member this.``mapi behaves like map with correct order`` () = Check.QuickThrowOnFailure this.mapi_and_map Check.QuickThrowOnFailure this.mapi_and_map Check.QuickThrowOnFailure this.mapi_and_map @@ -617,41 +617,41 @@ type ListProperties () = Check.QuickThrowOnFailure this.singleton_and_replicate member _.mapFold_and_map_and_fold<'a when 'a : comparison> (xs : list<'a>) mapF foldF start = - let f s x = + let f s x = let x' = mapF x let s' = foldF s x' x',s' let a,ar = xs |> List.mapFold f start - let b = xs |> List.map mapF + let b = xs |> List.map mapF let br = b |> List.fold foldF start a = b && ar = br [] - member this.``mapFold works like map + fold`` () = + member this.``mapFold works like map + fold`` () = Check.QuickThrowOnFailure this.mapFold_and_map_and_fold Check.QuickThrowOnFailure this.mapFold_and_map_and_fold Check.QuickThrowOnFailure this.mapFold_and_map_and_fold member _.mapFoldBack_and_map_and_foldBack<'a when 'a : comparison> (xs : list<'a>) mapF foldF start = - let f x s = + let f x s = let x' = mapF x let s' = foldF x' s x',s' let a,ar = List.mapFoldBack f xs start - let b = xs |> List.map mapF + let b = xs |> List.map mapF let br = List.foldBack foldF b start a = b && ar = br [] - member this.``mapFoldBack works like map + foldBack`` () = + member this.``mapFoldBack works like map + foldBack`` () = Check.QuickThrowOnFailure this.mapFoldBack_and_map_and_foldBack Check.QuickThrowOnFailure this.mapFoldBack_and_map_and_foldBack Check.QuickThrowOnFailure this.mapFoldBack_and_map_and_foldBack member _.findBack_and_exists<'a when 'a : comparison> (xs : list<'a>) f = - let a = + let a = try List.findBack f xs |> ignore true @@ -661,7 +661,7 @@ type ListProperties () = a = b [] - member this.``findBack and exists work similar`` () = + member this.``findBack and exists work similar`` () = Check.QuickThrowOnFailure this.findBack_and_exists Check.QuickThrowOnFailure this.findBack_and_exists Check.QuickThrowOnFailure this.findBack_and_exists @@ -672,7 +672,7 @@ type ListProperties () = a = b [] - member this.``findBack and find work in reverse`` () = + member this.``findBack and find work in reverse`` () = Check.QuickThrowOnFailure this.findBack_and_find Check.QuickThrowOnFailure this.findBack_and_find Check.QuickThrowOnFailure this.findBack_and_find @@ -683,7 +683,7 @@ type ListProperties () = a = b [] - member this.``tryFindBack and tryFind work in reverse`` () = + member this.``tryFindBack and tryFind work in reverse`` () = Check.QuickThrowOnFailure this.tryFindBack_and_tryFind Check.QuickThrowOnFailure this.tryFindBack_and_tryFind Check.QuickThrowOnFailure this.tryFindBack_and_tryFind @@ -696,7 +696,7 @@ type ListProperties () = | _ -> a = b [] - member this.``tryFindIndexBack and tryIndexFind work in reverse`` () = + member this.``tryFindIndexBack and tryIndexFind work in reverse`` () = Check.QuickThrowOnFailure this.tryFindIndexBack_and_tryFindIndex Check.QuickThrowOnFailure this.tryFindIndexBack_and_tryFindIndex Check.QuickThrowOnFailure this.tryFindIndexBack_and_tryFindIndex @@ -709,7 +709,7 @@ type ListProperties () = xs |> List.rev |> List.rev = xs && Seq.toList list = List.rev xs [] - member this.``rev reverses a list`` () = + member this.``rev reverses a list`` () = Check.QuickThrowOnFailure this.rev Check.QuickThrowOnFailure this.rev Check.QuickThrowOnFailure this.rev @@ -729,7 +729,7 @@ type ListProperties () = member _.skip_and_skipWhile<'a when 'a : comparison> (xs : list<'a>) (count:NonNegativeInt) = let count = int count - count <= xs.Length ==> (lazy + count <= xs.Length ==> (lazy let ys = List.indexed xs let a = runAndCheckErrorType (fun () -> List.skip count ys) let b = runAndCheckErrorType (fun () -> List.skipWhile (fun (p,_) -> p < count) ys) @@ -737,7 +737,7 @@ type ListProperties () = a = b) [] - member this.``skip and skipWhile are consistent`` () = + member this.``skip and skipWhile are consistent`` () = Check.QuickThrowOnFailure this.skip_and_skipWhile Check.QuickThrowOnFailure this.skip_and_skipWhile Check.QuickThrowOnFailure this.skip_and_skipWhile @@ -768,7 +768,7 @@ type ListProperties () = a = b [] - member this.``sort and sortDescending work in reverse`` () = + member this.``sort and sortDescending work in reverse`` () = Check.QuickThrowOnFailure this.sort_and_sortDescending Check.QuickThrowOnFailure this.sort_and_sortDescending Check.QuickThrowOnFailure this.sort_and_sortDescending @@ -777,7 +777,7 @@ type ListProperties () = let indexed = xs |> Seq.indexed |> Seq.toList let sorted = indexed |> List.sortBy snd isStable sorted - + [] member this.``List.sortBy is stable`` () = Check.QuickThrowOnFailure this.sortByStable @@ -787,7 +787,7 @@ type ListProperties () = let indexed = xs |> Seq.indexed |> Seq.toList let sorted = indexed |> List.sortWith (fun x y -> compare (snd x) (snd y)) isStable sorted - + [] member this.``List.sortWithStable is stable`` () = Check.QuickThrowOnFailure this.sortWithStable @@ -797,18 +797,18 @@ type ListProperties () = let indexed = xs |> Seq.indexed |> Seq.toList let sorted = indexed |> List.distinctBy snd isStable sorted - + [] member this.``List.distinctBy is stable`` () = Check.QuickThrowOnFailure this.distinctByStable Check.QuickThrowOnFailure this.distinctByStable - + [] member _.``List.sum calculates the sum`` () = let sum (xs : int list) = let s = List.sum xs let mutable r = 0 - for x in xs do r <- r + x + for x in xs do r <- r + x s = r Check.QuickThrowOnFailure sum @@ -820,7 +820,7 @@ type ListProperties () = [] member this.``List.sumBy calculates the sum of the mapped list`` () = Check.QuickThrowOnFailure this.sumBy - Check.QuickThrowOnFailure this.sumBy + Check.QuickThrowOnFailure this.sumBy Check.QuickThrowOnFailure this.sumBy member _.allPairsCount<'a, 'b> (xs : 'a list) (ys : 'b list) = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs index f0eb9ff83ec..e7458b3db9e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs @@ -24,11 +24,11 @@ type ListType() = // Interfaces [] member this.IEnumerable() = - + // Legit IE let ie = ['a'; 'b'; 'c'] :> IEnumerable let enum = ie.GetEnumerator() - + let testStepping() = CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(true, enum.MoveNext()) @@ -39,26 +39,26 @@ type ListType() = Assert.AreEqual('c', enum.Current) Assert.AreEqual(false, enum.MoveNext()) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - + testStepping() enum.Reset() testStepping() - + // Empty IE let ie = [] :> IEnumerable // Note no type args let enum = ie.GetEnumerator() - + CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(false, enum.MoveNext()) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) [] member this.IEnumerable_T() = - + // Legit IE let ie = ['a'; 'b'; 'c'] :> IEnumerable let enum = ie.GetEnumerator() - + let testStepping() = CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(true, enum.MoveNext()) @@ -69,22 +69,22 @@ type ListType() = Assert.AreEqual('c', enum.Current) Assert.AreEqual(false, enum.MoveNext()) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - + testStepping() enum.Reset() testStepping() - + // Empty IE let ie = [] :> IEnumerable // Note no type args let enum = ie.GetEnumerator() - + CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(false, enum.MoveNext()) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - + [] member this.IReadOnlyCollection_T() = - + // Legit IReadOnlyCollection_T let c = ['a'; 'b'; 'c'] :> IReadOnlyCollection @@ -122,7 +122,7 @@ type ListType() = Assert.AreEqual("[]", ([] : decimal list list).ToString()) [] - member this.HashCodeNotThrowingStackOverflow() = + member this.HashCodeNotThrowingStackOverflow() = let l = 1 :: 2 :: [0.. 35_000] let hash = l.GetHashCode() @@ -132,18 +132,18 @@ type ListType() = Assert.AreEqual(hash,hash2) [] - member this.HashCodeDoesNotThrowOnListOfNullStrings() = + member this.HashCodeDoesNotThrowOnListOfNullStrings() = let l = ["1";"2";null;null] Assert.AreEqual(l.GetHashCode(),l.GetHashCode()) [] - member this.HashCodeIsDifferentForListsWithSamePrefix() = + member this.HashCodeIsDifferentForListsWithSamePrefix() = let sharedPrefix = [0..500] let l1 = sharedPrefix @ [1] - let l2 = sharedPrefix @ [2] + let l2 = sharedPrefix @ [2] Assert.AreNotEqual(l1.GetHashCode(),l2.GetHashCode()) - + [] member this.ObjectEquals() = // All three are different references, but equality has been @@ -163,58 +163,58 @@ type ListType() = let b = [] : string list Assert.False( b.Equals(a) ) Assert.False( a.Equals(b) ) - + // Co/contra variance not supported let a = [] : string list let b = [] : obj list Assert.False(a.Equals(b)) Assert.False(b.Equals(a)) - + // Self equality let a = [1] Assert.True( (a = a) ) Assert.True(a.Equals(a)) - + // Null Assert.False(a.Equals(null)) - + // Instance methods [] member this.Length() = - + let l = [1 .. 10] Assert.AreEqual(l.Length, 10) - + let e : int list list = List.empty Assert.AreEqual(e.Length, 0) - + [] member this.IsEmpty() = - + let l = [1 .. 10] Assert.False(l.IsEmpty) - + let e = Microsoft.FSharp.Collections.List.Empty : string list Assert.True(e.IsEmpty) - + Assert.True( ([] @ []).IsEmpty ) - + [] member this.Head() = - + let l = ['a'; 'e'; 'i'; 'o'; 'u'] Assert.AreEqual('a', l.Head) - + CheckThrowsInvalidOperationExn(fun () -> ([] : string list).Head |> ignore) - + [] member this.Tail() = - + let l = ['a'; 'e'; 'i'; 'o'; 'u'] Assert.AreEqual(['e'; 'i'; 'o'; 'u'], l.Tail) - + CheckThrowsInvalidOperationExn(fun () -> ([] : string list).Tail |> ignore) - + [] member this.Item() = @@ -222,41 +222,41 @@ type ListType() = Assert.AreEqual(1, l.[0]) l <- l @ l Assert.AreEqual(1, l.[1]) - + for testidx = 0 to 20 do let l = [0 .. testidx] for i = 0 to l.Length - 1 do Assert.AreEqual(i, l.[i]) Assert.AreEqual(i, l.Item(i)) - + // Invalid index let l = [1 .. 10] CheckThrowsArgumentException(fun () -> l.[ -1 ] |> ignore) CheckThrowsArgumentException(fun () -> l.[1000] |> ignore) - - + + // Static methods - + [] member this.Empty() = let emptyList = Microsoft.FSharp.Collections.List.Empty - if List.length emptyList <> 0 then Assert.Fail() - + if List.length emptyList <> 0 then Assert.Fail() + let c : int list = Microsoft.FSharp.Collections.List.Empty Assert.True( (c = []) ) - + let d : string list = Microsoft.FSharp.Collections.List.Empty Assert.True( (d = []) ) - + () [] member this.Cons() = // integer List - let intList = Microsoft.FSharp.Collections.List.Cons (1, [ 2;3; 4 ]) + let intList = Microsoft.FSharp.Collections.List.Cons (1, [ 2;3; 4 ]) if intList <> [ 1; 2; 3; 4 ] then Assert.Fail() - + // string List let strList = Microsoft.FSharp.Collections.List.Cons ( "this", [ "is";"str"; "list" ]) if strList <> [ "this"; "is" ;"str"; "list" ] then Assert.Fail() @@ -267,8 +267,8 @@ type ListType() = () - [] - member this.SlicingUnboundedEnd() = + [] + member this.SlicingUnboundedEnd() = let lst = [1;2;3;4;5;6] Assert.AreEqual(lst.[-1..], lst) @@ -278,9 +278,9 @@ type ListType() = Assert.AreEqual(lst.[5..], [6]) Assert.AreEqual(lst.[6..], ([]: int list)) - - [] - member this.SlicingUnboundedStart() = + + [] + member this.SlicingUnboundedStart() = let lst = [1;2;3;4;5;6] Assert.AreEqual(lst.[..(-1)], ([]: int list)) @@ -319,7 +319,7 @@ type ListType() = [] - member this.SlicingEmptyList() = + member this.SlicingEmptyList() = let empty : obj list = List.empty Assert.AreEqual(empty.[*], ([]: obj list)) @@ -331,9 +331,9 @@ type ListType() = [] - member this.SlicingOutOfBounds() = + member this.SlicingOutOfBounds() = let lst = [1;2;3;4;5;6] - + Assert.AreEqual(lst.[..6], [1;2;3;4;5;6]) Assert.AreEqual(lst.[6..], ([]: int list)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs index fec6af0757c..46410f1af82 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs @@ -25,10 +25,10 @@ type MapModule() = member _.Empty() = let emptyMap = Map.empty Assert.True(Map.isEmpty emptyMap) - + let a:Map = Map.empty let b : Map = Map.empty - let c : Map = Map.empty + let c : Map = Map.empty () @@ -36,30 +36,30 @@ type MapModule() = member _.Add() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.add 1 "a" valueKeyMap + let resultValueMap = Map.add 1 "a" valueKeyMap Assert.AreEqual(resultValueMap.[1], "a") - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] let resultRefMap = Map.add "" 0 refMap Assert.AreEqual(resultRefMap.[""] , 0) - + // empty Map let eptMap = Map.empty let resultEpt = Map.add 1 "a" eptMap Assert.AreEqual(resultEpt.[1], "a") - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] let resultOele = Map.add 7 "seven" oeleMap - Assert.AreEqual(resultOele.[7], "seven") - + Assert.AreEqual(resultOele.[7], "seven") + // extra test for add -- add a key which already exists in the Map let extMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultExt = Map.add 2 "dup" extMap - Assert.AreEqual(resultExt.[2], "dup") - - + let resultExt = Map.add 2 "dup" extMap + Assert.AreEqual(resultExt.[2], "dup") + + () [] @@ -100,347 +100,347 @@ type MapModule() = member _.Exists() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.exists (fun x y -> x > 3) valueKeyMap + let resultValueMap = Map.exists (fun x y -> x > 3) valueKeyMap Assert.True(resultValueMap) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] let resultRefMap = refMap |> Map.exists (fun x y -> y>2 ) Assert.True(resultRefMap) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.exists (fun x y -> (x + y.Length) % 4 = 0 ) + let resultOele = oeleMap |> Map.exists (fun x y -> (x + y.Length) % 4 = 0 ) Assert.True(resultOele) - + // empty Map let eptMap = Map.empty let resultEpt = Map.exists (fun x y -> false) eptMap Assert.False(resultEpt) - + () - + [] member _.Filter() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap =valueKeyMap |> Map.filter (fun x y -> x % 3 = 0) + let resultValueMap =valueKeyMap |> Map.filter (fun x y -> x % 3 = 0) Assert.AreEqual(resultValueMap,[3,"c"] |> Map.ofList) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.filter (fun x y -> y > 3 ) + let resultRefMap = refMap |> Map.filter (fun x y -> y > 3 ) Assert.AreEqual(resultRefMap,["....",4] |> Map.ofList) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.filter (fun x y -> x<3 ) + let resultOele = oeleMap |> Map.filter (fun x y -> x<3 ) Assert.AreEqual(resultOele,oeleMap) - + // empty Map let eptMap = Map.empty - let resultEpt = Map.filter (fun x y -> true) eptMap + let resultEpt = Map.filter (fun x y -> true) eptMap Assert.AreEqual(resultEpt,eptMap) - - () + + () [] member _.Find() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.find 5 valueKeyMap + let resultValueMap = Map.find 5 valueKeyMap Assert.AreEqual(resultValueMap,"e") - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = Map.find ".." refMap + let resultRefMap = Map.find ".." refMap Assert.AreEqual(resultRefMap,2) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = Map.find 1 oeleMap + let resultOele = Map.find 1 oeleMap Assert.AreEqual(resultOele,"one") - + // empty Map let eptMap = Map.empty CheckThrowsKeyNotFoundException (fun () -> Map.find 1 eptMap |> ignore) - - () + + () [] member _.FindIndex() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap =valueKeyMap |> Map.findKey (fun x y -> x % 3 = 0) + let resultValueMap =valueKeyMap |> Map.findKey (fun x y -> x % 3 = 0) Assert.AreEqual(resultValueMap,3) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.findKey (fun x y -> y % 3 = 0 ) + let resultRefMap = refMap |> Map.findKey (fun x y -> y % 3 = 0 ) Assert.AreEqual(resultRefMap,"...") - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.findKey (fun x y -> x = 1 ) + let resultOele = oeleMap |> Map.findKey (fun x y -> x = 1 ) Assert.AreEqual(resultOele,1) - + // empty Map let eptMap = Map.empty CheckThrowsKeyNotFoundException (fun () -> Map.findKey (fun x y -> true) eptMap |> ignore) - - () - + + () + [] member _.TryPick() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = valueKeyMap |> Map.tryPick (fun x y -> if x % 3 = 0 then Some (x) else None) + let resultValueMap = valueKeyMap |> Map.tryPick (fun x y -> if x % 3 = 0 then Some (x) else None) Assert.AreEqual(resultValueMap,Some 3) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.tryPick (fun x y -> if (y % 3 = 0 ) then Some y else None ) - + let resultRefMap = refMap |> Map.tryPick (fun x y -> if (y % 3 = 0 ) then Some y else None ) + Assert.AreEqual(resultRefMap,Some 3) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.tryPick (fun x y -> if(x + y.Length) % 4 = 0 then Some y else None ) + let resultOele = oeleMap |> Map.tryPick (fun x y -> if(x + y.Length) % 4 = 0 then Some y else None ) Assert.AreEqual(resultOele,Some "one") - + // empty Map let eptMap = Map.empty - let resultEpt = Map.tryPick (fun x y -> Some x) eptMap + let resultEpt = Map.tryPick (fun x y -> Some x) eptMap Assert.AreEqual(resultEpt,None) - - () + + () [] member _.Pick() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValue = valueKeyMap |> Map.pick (fun x y -> if x % 3 = 0 then Some (y) else None) + let resultValue = valueKeyMap |> Map.pick (fun x y -> if x % 3 = 0 then Some (y) else None) Assert.AreEqual(resultValue, "c") - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let result = refMap |> Map.pick (fun x y -> if (y % 3 = 0 ) then Some y else None ) + let result = refMap |> Map.pick (fun x y -> if (y % 3 = 0 ) then Some y else None ) Assert.AreEqual(result, 3) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.pick (fun x y -> if(x + y.Length) % 4 = 0 then Some y else None ) + let resultOele = oeleMap |> Map.pick (fun x y -> if(x + y.Length) % 4 = 0 then Some y else None ) Assert.AreEqual(resultOele, "one") - + // empty Map let eptMap = Map.empty - let resultEpt = - try + let resultEpt = + try Map.pick (fun x y -> Some x) eptMap with :? System.Collections.Generic.KeyNotFoundException -> Some 0 Assert.AreEqual(resultEpt, Some 0) - + () [] member _.Fold() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = valueKeyMap |> Map.fold (fun x y z -> x + y + z.Length) 10 + let resultValueMap = valueKeyMap |> Map.fold (fun x y z -> x + y + z.Length) 10 Assert.AreEqual(resultValueMap,28) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.fold (fun x y z -> x + y + z.ToString()) "*" + let resultRefMap = refMap |> Map.fold (fun x y z -> x + y + z.ToString()) "*" Assert.AreEqual(resultRefMap,"*.1..2...3....4") - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.fold (fun x y z -> x + y.ToString() + z) "got" + let resultOele = oeleMap |> Map.fold (fun x y z -> x + y.ToString() + z) "got" Assert.AreEqual(resultOele,"got1one") - + // empty Map let eptMap = Map.empty - let resultEpt = eptMap |> Map.fold (fun x y z -> 1) 1 + let resultEpt = eptMap |> Map.fold (fun x y z -> 1) 1 Assert.AreEqual(resultEpt,1) - + () [] member _.FoldBack() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.foldBack (fun x y z -> x.ToString() + y + z.ToString()) valueKeyMap "*" + let resultValueMap = Map.foldBack (fun x y z -> x.ToString() + y + z.ToString()) valueKeyMap "*" Assert.AreEqual(resultValueMap,"2b3c4d5e*") - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = Map.foldBack (fun x y z -> x + y.ToString() + z) refMap "right" + let resultRefMap = Map.foldBack (fun x y z -> x + y.ToString() + z) refMap "right" Assert.AreEqual(resultRefMap,".1..2...3....4right") - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = Map.foldBack (fun x y z -> x.ToString() + y + z) oeleMap "right" + let resultOele = Map.foldBack (fun x y z -> x.ToString() + y + z) oeleMap "right" Assert.AreEqual(resultOele,"1oneright") - + // empty Map let eptMap = Map.empty - let resultEpt = Map.foldBack (fun x y z -> 1) eptMap 1 + let resultEpt = Map.foldBack (fun x y z -> 1) eptMap 1 Assert.AreEqual(resultEpt,1) - + () - + [] member _.ForAll() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = valueKeyMap |> Map.forall (fun x y -> x % 3 = 0) + let resultValueMap = valueKeyMap |> Map.forall (fun x y -> x % 3 = 0) Assert.False(resultValueMap) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.forall (fun x y -> x.Length > 4 ) + let resultRefMap = refMap |> Map.forall (fun x y -> x.Length > 4 ) Assert.False(resultRefMap) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.forall (fun x y -> x<3 ) + let resultOele = oeleMap |> Map.forall (fun x y -> x<3 ) Assert.True(resultOele) - + // empty Map let eptMap = Map.empty - let resultEpt =eptMap |> Map.forall (fun x y -> true) + let resultEpt =eptMap |> Map.forall (fun x y -> true) Assert.True(resultEpt) - - () + + () [] member _.IsEmpty() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.isEmpty valueKeyMap + let resultValueMap = Map.isEmpty valueKeyMap Assert.False(resultValueMap) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = Map.isEmpty refMap + let resultRefMap = Map.isEmpty refMap Assert.False(resultRefMap) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = Map.isEmpty oeleMap + let resultOele = Map.isEmpty oeleMap Assert.False(resultOele) - + // empty Map let eptMap = Map.empty - let resultEpt = Map.isEmpty eptMap + let resultEpt = Map.isEmpty eptMap Assert.True(resultEpt) - - () + + () [] member _.Iter() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let mutable resultValueMap = 0 - let funInt (x:int) (y:string) = - resultValueMap <- resultValueMap + x + y.Length - () - Map.iter funInt valueKeyMap + let mutable resultValueMap = 0 + let funInt (x:int) (y:string) = + resultValueMap <- resultValueMap + x + y.Length + () + Map.iter funInt valueKeyMap Assert.AreEqual(resultValueMap,18) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] let mutable resultRefMap = "" - let funStr (x:string) (y:int) = + let funStr (x:string) (y:int) = resultRefMap <- resultRefMap + x + y.ToString() () - Map.iter funStr refMap + Map.iter funStr refMap Assert.AreEqual(resultRefMap,".1..2...3....4") - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] let mutable resultOele = "" let funMix (x:int) (y:string) = resultOele <- resultOele + x.ToString() + y () - Map.iter funMix oeleMap + Map.iter funMix oeleMap Assert.AreEqual(resultOele,"1one") - + // empty Map let eptMap = Map.empty - let mutable resultEpt = 0 - let funEpt (x:int) (y:int) = - resultEpt <- resultEpt + x + y - () - Map.iter funEpt eptMap + let mutable resultEpt = 0 + let funEpt (x:int) (y:int) = + resultEpt <- resultEpt + x + y + () + Map.iter funEpt eptMap Assert.AreEqual(resultEpt,0) - - () - + + () + [] member _.Map() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = valueKeyMap |> Map.map (fun x y -> x.ToString() + y ) + let resultValueMap = valueKeyMap |> Map.map (fun x y -> x.ToString() + y ) Assert.AreEqual(resultValueMap,[(2,"2b"); (3,"3c"); (4,"4d"); (5,"5e")] |> Map.ofList) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.map (fun x y -> x.Length + y ) + let resultRefMap = refMap |> Map.map (fun x y -> x.Length + y ) Assert.AreEqual(resultRefMap,[(".",2); ("..",4);( "...",6); ("....",8)] |> Map.ofList) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.map (fun x y -> x.ToString() + y ) + let resultOele = oeleMap |> Map.map (fun x y -> x.ToString() + y ) Assert.AreEqual(resultOele,[1,"1one"] |> Map.ofList) - + // empty Map let eptMap = Map.empty - let resultEpt = eptMap |> Map.map (fun x y -> x+y) + let resultEpt = eptMap |> Map.map (fun x y -> x+y) Assert.AreEqual(resultEpt,eptMap) - - () + + () [] member _.Contains() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.containsKey 2 valueKeyMap + let resultValueMap = Map.containsKey 2 valueKeyMap Assert.True(resultValueMap) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = Map.containsKey ".." refMap + let resultRefMap = Map.containsKey ".." refMap Assert.True(resultRefMap) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = Map.containsKey 1 oeleMap + let resultOele = Map.containsKey 1 oeleMap Assert.True(resultOele) - + // empty Map let eptMap = Map.empty - let resultEpt = Map.containsKey 3 eptMap + let resultEpt = Map.containsKey 3 eptMap Assert.False(resultEpt) - - () - + + () + [] member _.Of_Array_Of_List_Of_Seq() = - // value keys - let valueKeyMapOfArr = Map.ofArray [|(2,"b"); (3,"c"); (4,"d"); (5,"e")|] + // value keys + let valueKeyMapOfArr = Map.ofArray [|(2,"b"); (3,"c"); (4,"d"); (5,"e")|] let valueKeyMapOfList = Map.ofList [(2,"b"); (3,"c"); (4,"d"); (5,"e")] let valueKeyMapOfSeq = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] Assert.AreEqual(valueKeyMapOfArr,valueKeyMapOfList) Assert.AreEqual(valueKeyMapOfList,valueKeyMapOfSeq) Assert.AreEqual(valueKeyMapOfArr,valueKeyMapOfSeq) - + // reference keys let refMapOfArr = Map.ofArray [|(".",1); ("..",2);( "...",3); ("....",4)|] let refMapOfList = Map.ofList [(".",1); ("..",2);( "...",3); ("....",4)] @@ -449,7 +449,7 @@ type MapModule() = Assert.AreEqual(refMapOfArr,refMapOfList) Assert.AreEqual(refMapOfList,refMapOfSeq) Assert.AreEqual(refMapOfArr,refMapOfSeq) - + // One-element Map let oeleMapOfArr = Map.ofArray [|(1,"one")|] let oeleMapOfList = Map.ofList [(1,"one") ] @@ -458,225 +458,225 @@ type MapModule() = Assert.AreEqual(oeleMapOfArr,oeleMapOfList) Assert.AreEqual(oeleMapOfList,oeleMapOfSeq) Assert.AreEqual(oeleMapOfArr,oeleMapOfSeq) - + () [] member _.Partition() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.partition (fun x y -> x%2 = 0) valueKeyMap + let resultValueMap = Map.partition (fun x y -> x%2 = 0) valueKeyMap let chosen = [(2,"b"); (4,"d")] |> Map.ofList let notChosen = [(3,"c"); (5,"e")] |> Map.ofList Assert.AreEqual(resultValueMap,(chosen,notChosen)) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.partition (fun x y -> x.Length >2 ) + let resultRefMap = refMap |> Map.partition (fun x y -> x.Length >2 ) let chosen = [( "...",3); ("....",4)] |> Map.ofList let notChosen = [(".",1); ("..",2)] |> Map.ofList Assert.AreEqual(resultRefMap,(chosen,notChosen)) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = Map.partition (fun x y -> x<4) oeleMap + let resultOele = Map.partition (fun x y -> x<4) oeleMap let chosen = [(1,"one")] |> Map.ofList let notChosen = Map.empty Assert.AreEqual(resultOele,(chosen,notChosen)) - + // empty Map let eptMap = Map.empty - let resultEpt = Map.partition (fun x y -> true) eptMap + let resultEpt = Map.partition (fun x y -> true) eptMap Assert.AreEqual(resultEpt,(eptMap,eptMap)) - + () - - + + [] member _.Remove() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.remove 5 valueKeyMap + let resultValueMap = Map.remove 5 valueKeyMap Assert.AreEqual(resultValueMap,[(2,"b"); (3,"c"); (4,"d")] |> Map.ofList) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = Map.remove ".." refMap + let resultRefMap = Map.remove ".." refMap Assert.AreEqual(resultRefMap,[(".",1); ( "...",3); ("....",4)] |> Map.ofList) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = Map.remove 1 oeleMap + let resultOele = Map.remove 1 oeleMap Assert.AreEqual(resultOele,Map.empty) - + // Two-element Map let oeleMap = Map.ofSeq [(1, "one");(2,"Two")] - let resultOele = Map.remove 1 oeleMap + let resultOele = Map.remove 1 oeleMap let exOele = Map.ofSeq [(2, "Two")] Assert.AreEqual(resultOele, exOele) - + // Item which want to be removed not included in the map let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.remove 5 valueKeyMap + let resultValueMap = Map.remove 5 valueKeyMap Assert.AreEqual(resultValueMap,[(2,"b"); (3,"c"); (4,"d")] |> Map.ofList) - - + + () - + [] member _.To_Array() = - // value keys - let valueKeyMapOfArr = Map.ofArray [|(1,1);(2,4);(3,9)|] - let resultValueMap = Map.toArray valueKeyMapOfArr + // value keys + let valueKeyMapOfArr = Map.ofArray [|(1,1);(2,4);(3,9)|] + let resultValueMap = Map.toArray valueKeyMapOfArr Assert.AreEqual(resultValueMap,[|(1,1);(2,4);(3,9)|]) - + // reference keys let refMapOfArr = Map.ofArray [|(".",1); ("..",2);( "...",3); ("....",4)|] - let resultRefMap = Map.toArray refMapOfArr + let resultRefMap = Map.toArray refMapOfArr Assert.AreEqual(resultRefMap,[|(".",1); ("..",2);( "...",3); ("....",4)|]) - + // One-element Map let oeleMapOfArr = Map.ofArray [|(1,"one")|] - let resultOele = Map.toArray oeleMapOfArr + let resultOele = Map.toArray oeleMapOfArr Assert.AreEqual(resultOele,[|(1,"one")|]) - + // empty Map let eptMap = Map.ofArray [||] - let resultEpt = Map.toArray eptMap + let resultEpt = Map.toArray eptMap Assert.AreEqual(resultEpt,[||]) - () + () [] member _.To_List() = - // value keys - let valueKeyMapOfArr = Map.ofList [(1,1);(2,4);(3,9)] - let resultValueMap = Map.toList valueKeyMapOfArr + // value keys + let valueKeyMapOfArr = Map.ofList [(1,1);(2,4);(3,9)] + let resultValueMap = Map.toList valueKeyMapOfArr Assert.AreEqual(resultValueMap,[(1,1);(2,4);(3,9)]) - + // reference keys let refMapOfArr = Map.ofList [(".",1); ("..",2);( "...",3); ("....",4)] - let resultRefMap = Map.toList refMapOfArr + let resultRefMap = Map.toList refMapOfArr Assert.AreEqual(resultRefMap,[(".",1); ("..",2);( "...",3); ("....",4)]) - + // One-element Map let oeleMapOfArr = Map.ofList [(1,"one")] - let resultOele = Map.toList oeleMapOfArr + let resultOele = Map.toList oeleMapOfArr Assert.AreEqual(resultOele,[(1,"one")]) - + // empty Map let eptMap = Map.empty - let resultEpt = Map.toList eptMap - let eptList :(int*string) list = [] + let resultEpt = Map.toList eptMap + let eptList :(int*string) list = [] Assert.AreEqual(resultEpt,eptList) - () + () [] member _.To_Seq() = - // value keys - let valueKeyMapOfArr = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] + // value keys + let valueKeyMapOfArr = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] let resultValueMap = Map.toSeq valueKeyMapOfArr let originInt = seq { for i in 1..3 do yield (i,i*i)} VerifySeqsEqual resultValueMap [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - + // reference keys let refMapOfArr = Map.ofSeq [(".",1); ("..",2);( "...",3); ("....",4)] let resultRefMap = Map.toSeq refMapOfArr let originStr = seq { for x in [ "is" ;"lists";"str"; "this"] do yield (x,x.ToUpper())} VerifySeqsEqual resultRefMap [(".",1); ("..",2);( "...",3); ("....",4)] - + // One-element Map let oeleMapOfArr = Map.ofSeq [(1,"one")] let resultOele = Map.toSeq oeleMapOfArr let originMix = seq { for x in [ "is" ;"str"; "this" ;"lists"] do yield (x.Length,x.ToUpper())} VerifySeqsEqual resultOele [(1,"one")] - - () + + () [] member _.TryFind() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.tryFind 5 valueKeyMap + let resultValueMap = Map.tryFind 5 valueKeyMap Assert.AreEqual(resultValueMap,Some "e") - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = Map.tryFind "..." refMap + let resultRefMap = Map.tryFind "..." refMap Assert.AreEqual(resultRefMap,Some 3) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = Map.tryFind 1 oeleMap + let resultOele = Map.tryFind 1 oeleMap Assert.AreEqual(resultOele,Some "one") - + // empty Map let eptMap = Map.empty - let resultEpt = Map.tryFind 1 eptMap + let resultEpt = Map.tryFind 1 eptMap Assert.AreEqual(resultEpt,None) - - () + + () [] member _.TryFindIndex() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = valueKeyMap |> Map.tryFindKey (fun x y -> x+y.Length >30) + let resultValueMap = valueKeyMap |> Map.tryFindKey (fun x y -> x+y.Length >30) Assert.AreEqual(resultValueMap,None) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.tryFindKey (fun x y -> (x.Length+y)>6) + let resultRefMap = refMap |> Map.tryFindKey (fun x y -> (x.Length+y)>6) Assert.AreEqual(resultRefMap,Some "....") - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.tryFindKey (fun x y -> y.Contains("o")) + let resultOele = oeleMap |> Map.tryFindKey (fun x y -> y.Contains("o")) Assert.AreEqual(resultOele,Some 1) - + // empty Map let eptMap = Map.empty - let resultEpt = Map.tryFindKey (fun x y -> x+y >30) eptMap + let resultEpt = Map.tryFindKey (fun x y -> x+y >30) eptMap Assert.AreEqual(resultEpt,None) - - () + + () [] member _.Keys() = // reference keys let m = Map.ofArray [| ("1", "1"); ("2", "4"); ("3", "9") |] Assert.AreEqual(["1"; "2"; "3"], Map.keys m |> Seq.toList) - + // value keys let m = Map.ofArray [| (1, 1); (2, 4); (3, 9) |] Assert.AreEqual([1; 2; 3], Map.keys m |> Seq.toList) - - // one element + + // one element let m = Map.ofArray [| (1, 1); |] Assert.AreEqual([1], Map.keys m |> Seq.toList) - + // empty let m = Map.ofArray [| |] Assert.AreEqual([], Map.keys m |> Seq.toList) - + [] member _.Values() = // reference keys let m = Map.ofArray [| ("1", "2"); ("3", "4"); ("5", "6") |] Assert.AreEqual(["2"; "4"; "6"], Map.values m |> Seq.toList) - + // value keys, out of order, including duplicates let m = Map.ofArray [| (1, 2); (5, 6); (3, 4); (1, 2) |] Assert.AreEqual([2; 4; 6], Map.values m |> Seq.toList) - - // one element + + // one element let m = Map.ofArray [| (1, 1); |] Assert.AreEqual([1], Map.values m |> Seq.toList) - + // empty let m = Map.ofArray [| |] Assert.AreEqual([], Map.values m |> Seq.toList) @@ -685,44 +685,44 @@ type MapModule() = member _.MinKeyValue() = // value keys let valueKeyMap = Map.ofSeq [(5,"e"); (2,"b"); (3,"c"); (4,"d"); ] - let resultValueMap = Map.minKeyValue valueKeyMap + let resultValueMap = Map.minKeyValue valueKeyMap Assert.AreEqual(resultValueMap, (2, "b")) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = Map.minKeyValue refMap + let resultRefMap = Map.minKeyValue refMap Assert.AreEqual(resultRefMap, (".",1)) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] let resultOele = Map.minKeyValue oeleMap Assert.AreEqual(resultOele, (1, "one")) - + // empty Map let eptMap = Map.empty CheckThrowsKeyNotFoundException (fun () -> Map.minKeyValue eptMap |> ignore) - + () [] member _.MaxKeyValue() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (5,"e"); (3,"c"); (4,"d"); ] - let resultValueMap = Map.maxKeyValue valueKeyMap + let resultValueMap = Map.maxKeyValue valueKeyMap Assert.AreEqual(resultValueMap, (5, "e")) - + // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = Map.maxKeyValue refMap + let resultRefMap = Map.maxKeyValue refMap Assert.AreEqual(resultRefMap, ("....",4)) - + // One-element Map let oeleMap = Map.ofSeq [(1, "one")] let resultOele = Map.maxKeyValue oeleMap Assert.AreEqual(resultOele, (1, "one")) - + // empty Map let eptMap = Map.empty CheckThrowsKeyNotFoundException (fun () -> Map.maxKeyValue eptMap |> ignore) - + () \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapType.fs index fd582c6f2e6..985fcebbac1 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapType.fs @@ -42,148 +42,148 @@ type MapType() = Assert.AreEqual(enum.Current, new KeyValuePair(3,9)) Assert.AreEqual(enum.MoveNext(), false) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - + testStepping() enum.Reset() testStepping() - + // Empty IE let ie = [] |> Map.ofList :> IEnumerable // Note no type args let enum = ie.GetEnumerator() - + CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(enum.MoveNext(), false) - CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - + CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) + [] - member this.IEnumerable_T() = + member this.IEnumerable_T() = // Legit IE let ie = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> IEnumerable> let enum = ie.GetEnumerator() - + let testStepping() = CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(enum.MoveNext(), true) Assert.AreEqual(enum.Current, new KeyValuePair(1,1)) - + Assert.AreEqual(enum.MoveNext(), true) Assert.AreEqual(enum.Current, new KeyValuePair(2,4)) Assert.AreEqual(enum.MoveNext(), true) Assert.AreEqual(enum.Current, new KeyValuePair(3,9)) Assert.AreEqual(enum.MoveNext(), false) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - + testStepping() enum.Reset() testStepping() - + // Empty IE let ie = [] |> Map.ofList :> IEnumerable // Note no type args let enum = ie.GetEnumerator() - + CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(enum.MoveNext(), false) - CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - - + CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) + + [] - member this.IDictionary() = + member this.IDictionary() = // Legit ID - let id = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> IDictionary<_,_> - - Assert.True(id.ContainsKey(1)) - Assert.False(id.ContainsKey(5)) - Assert.AreEqual(id.[1], 1) - Assert.AreEqual(id.[3], 9) - Assert.AreEqual(id.Keys, [| 1; 2; 3|]) + let id = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> IDictionary<_,_> + + Assert.True(id.ContainsKey(1)) + Assert.False(id.ContainsKey(5)) + Assert.AreEqual(id.[1], 1) + Assert.AreEqual(id.[3], 9) + Assert.AreEqual(id.Keys, [| 1; 2; 3|]) Assert.AreEqual(id.Values, [| 1; 4; 9|]) - + CheckThrowsNotSupportedException(fun () -> id.[2] <-88) CheckThrowsNotSupportedException(fun () -> id.Add(new KeyValuePair(4,16))) Assert.True(id.TryGetValue(1, ref 1)) Assert.False(id.TryGetValue(100, ref 1)) CheckThrowsNotSupportedException(fun () -> id.Remove(1) |> ignore) - + // Empty ID - let id = Map.empty :> IDictionary // Note no type args + let id = Map.empty :> IDictionary // Note no type args Assert.False(id.ContainsKey(5)) - CheckThrowsKeyNotFoundException(fun () -> id.[1] |> ignore) + CheckThrowsKeyNotFoundException(fun () -> id.[1] |> ignore) Assert.AreEqual(id.Keys, [| |] ) - Assert.AreEqual(id.Values, [| |] ) + Assert.AreEqual(id.Values, [| |] ) [] member this.IReadOnlyDictionary() = - let irod = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> IReadOnlyDictionary<_,_> - - Assert.True(irod.ContainsKey(1)) - Assert.False(irod.ContainsKey(5)) - Assert.AreEqual(irod.[1], 1) - Assert.AreEqual(irod.[3], 9) - Assert.AreEqual(irod.Keys, [| 1; 2; 3|]) + let irod = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> IReadOnlyDictionary<_,_> + + Assert.True(irod.ContainsKey(1)) + Assert.False(irod.ContainsKey(5)) + Assert.AreEqual(irod.[1], 1) + Assert.AreEqual(irod.[3], 9) + Assert.AreEqual(irod.Keys, [| 1; 2; 3|]) Assert.AreEqual(irod.Values, [| 1; 4; 9|]) - + Assert.True(irod.TryGetValue(1, ref 1)) Assert.False(irod.TryGetValue(100, ref 1)) - + // Empty IROD - let irod = Map.empty :> IReadOnlyDictionary // Note no type args + let irod = Map.empty :> IReadOnlyDictionary // Note no type args Assert.False(irod.ContainsKey(5)) - CheckThrowsKeyNotFoundException(fun () -> irod.[1] |> ignore) + CheckThrowsKeyNotFoundException(fun () -> irod.[1] |> ignore) Assert.AreEqual(irod.Keys, [| |] ) - Assert.AreEqual(irod.Values, [| |] ) - + Assert.AreEqual(irod.Values, [| |] ) + [] - member this.ICollection() = + member this.ICollection() = // Legit IC let ic = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> ICollection> - + Assert.AreEqual(ic.Count, 3) - Assert.True(ic.Contains(new KeyValuePair(3,9))) + Assert.True(ic.Contains(new KeyValuePair(3,9))) let newArr = Array.create 5 (new KeyValuePair(3,9)) - ic.CopyTo(newArr,0) + ic.CopyTo(newArr,0) Assert.True(ic.IsReadOnly) - - + + // raise ReadOnlyCollection exception CheckThrowsNotSupportedException(fun () -> ic.Add(new KeyValuePair(3,9)) |> ignore) CheckThrowsNotSupportedException(fun () -> ic.Clear() |> ignore) - CheckThrowsNotSupportedException(fun () -> ic.Remove(new KeyValuePair(3,9)) |> ignore) - - + CheckThrowsNotSupportedException(fun () -> ic.Remove(new KeyValuePair(3,9)) |> ignore) + + // Empty IC - let ic = Map.empty :> ICollection> - Assert.False(ic.Contains(new KeyValuePair(3,9))) + let ic = Map.empty :> ICollection> + Assert.False(ic.Contains(new KeyValuePair(3,9))) let newArr = Array.create 5 (new KeyValuePair(0,0)) - ic.CopyTo(newArr,0) - + ic.CopyTo(newArr,0) + [] member this.IReadOnlyCollection() = // Legit IROC let iroc = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> IReadOnlyCollection> - + Assert.AreEqual(iroc.Count, 3) - + // Empty IROC let iroc = Map.empty :> IReadOnlyCollection> Assert.AreEqual(iroc.Count, 0) [] - member this.IComparable() = + member this.IComparable() = // Legit IC - let ic = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> IComparable - Assert.AreEqual(ic.CompareTo([(1,1);(2,4);(3,9)]|> Map.ofList),0) - Assert.AreEqual(ic.CompareTo([(1,1);(3,9);(2,4)]|> Map.ofList),0) - Assert.AreEqual(ic.CompareTo([(1,1);(9,81);(2,4)]|> Map.ofList),-1) - Assert.AreEqual(ic.CompareTo([(1,1);(0,0);(2,4)]|> Map.ofList),1) + let ic = (Map.ofArray [|(1,1);(2,4);(3,9)|]) :> IComparable + Assert.AreEqual(ic.CompareTo([(1,1);(2,4);(3,9)]|> Map.ofList),0) + Assert.AreEqual(ic.CompareTo([(1,1);(3,9);(2,4)]|> Map.ofList),0) + Assert.AreEqual(ic.CompareTo([(1,1);(9,81);(2,4)]|> Map.ofList),-1) + Assert.AreEqual(ic.CompareTo([(1,1);(0,0);(2,4)]|> Map.ofList),1) CheckThrowsArgumentException(fun() -> ic.CompareTo([(1,1);(2,4);(3,9)]) |> ignore) - + // Empty IC - let ic = [] |> Map.ofList :> IComparable + let ic = [] |> Map.ofList :> IComparable Assert.AreEqual(ic.CompareTo([]|> Map.ofList),0) - - + + // Base class methods [] member this.ObjectGetHashCode() = @@ -191,19 +191,19 @@ type MapType() = let e = Map.ofList (List.empty) let m = Map.ofList [ (1, -1.0M) ] Assert.AreNotEqual(e.GetHashCode(), m.GetHashCode()) - + // Should be order independent let x = Map.ofList [(1, -1.0M); (2, -2.0M)] let y = Map.ofList [(2, -2.0M); (1, -1.0M)] Assert.AreEqual(x.GetHashCode(), y.GetHashCode()) - + [] member this.ObjectToString() = Assert.AreEqual("map [(1, 1); (2, 4); (3, 9)]", (Map.ofArray [|(1,1);(2,4);(3,9)|]).ToString()) Assert.AreEqual("map []", ([] |> Map.ofList).ToString()) - Assert.AreEqual("map []", + Assert.AreEqual("map []", (([] :(decimal*decimal)list) |> Map.ofList).ToString()) - + [] member this.ObjectEquals() = // All three are different references, but equality has been @@ -219,41 +219,41 @@ type MapType() = let b = ([] : (string*string) list ) |> Map.ofList Assert.False( b.Equals(a) ) Assert.False( a.Equals(b) ) - + // Co/contra variance not supported let a = ([] : (string*string) list) |> Map.ofList let b = ([] : (System.IComparable*System.IComparable) list) |> Map.ofList Assert.False(a.Equals(b)) Assert.False(b.Equals(a)) - + // Self equality let a = [(1,1)] |> Map.ofList Assert.True( (a = a) ) Assert.True(a.Equals(a)) - + // Null Assert.False(a.Equals(null)) // Instance methods [] - member this.New() = + member this.New() = let newMap = new Map([|(1,1);(2,4);(3,9)|]) let b = newMap.Add(4,16) Assert.AreEqual(b.[4], 16) Assert.AreEqual(b.[2], 4) - + let e = new Map([]) let ae = e.Add(1,"Monday") Assert.AreEqual(ae.[1], "Monday") - + [] member this.Add() = - + let a = (Map.ofArray [|(1,1);(2,4);(3,9)|]) let b = a.Add(4,16) Assert.AreEqual(b.[4], 16) Assert.AreEqual(b.[2], 4) - + let e = Map.empty let ae = e.Add(1,"Monday") Assert.AreEqual(ae.[1], "Monday") @@ -285,35 +285,35 @@ type MapType() = Assert.AreEqual(resultRm.[2], 4) Assert.AreEqual(resultRm.[3], 9) Assert.AreEqual(resultRm.[4], 25) - + [] member this.ContainsKey() = - - let a = (Map.ofArray [|(1,1);(2,4);(3,9)|]) + + let a = (Map.ofArray [|(1,1);(2,4);(3,9)|]) Assert.True(a.ContainsKey(3)) - + let e = Map.empty - Assert.False(e.ContainsKey(3)) - - + Assert.False(e.ContainsKey(3)) + + [] member this.Count() = - + let a = (Map.ofArray [|(1,1);(2,4);(3,9)|]) Assert.AreEqual(a.Count, 3) - + let e = Map.empty - Assert.AreEqual(e.Count, 0) - + Assert.AreEqual(e.Count, 0) + [] member this.IsEmpty() = - + let l = (Map.ofArray [|(1,1);(2,4);(3,9)|]) Assert.False(l.IsEmpty) - + let e = Map.empty - Assert.True(e.IsEmpty) - + Assert.True(e.IsEmpty) + [] member this.Item() = @@ -321,53 +321,53 @@ type MapType() = Assert.AreEqual(l.[1], 1) l <- l.Add(100,8) Assert.AreEqual(l.[100], 8) - + for testidx = 0 to 20 do let l = Map.ofSeq (seq { for i in 0..testidx do yield (i,i*i)}) for i = 0 to l.Count - 1 do Assert.AreEqual(i*i, l.[i]) Assert.AreEqual(i*i, l.Item(i)) - + // Invalid index let l = (Map.ofArray [|(1,1);(2,4);(3,9)|]) CheckThrowsKeyNotFoundException(fun () -> l.[ -1 ] |> ignore) CheckThrowsKeyNotFoundException(fun () -> l.[1000] |> ignore) - + [] member this.Remove() = - + let l = (Map.ofArray [|(1,1);(2,4);(3,9)|]) let rem = l.Remove(2) - Assert.AreEqual(rem.Count, 2) + Assert.AreEqual(rem.Count, 2) CheckThrowsKeyNotFoundException(fun () -> rem.[ 2 ] |> ignore) - + let e = Map.empty let ae = e.Remove(2) Assert.AreEqual(ae.Count, 0) - + [] member this.TryFind() = - + let l = (Map.ofArray [|(1,1);(2,4);(3,9)|]) let rem = l.TryFind(2) - Assert.AreEqual(l.TryFind(2),Some 4) - + Assert.AreEqual(l.TryFind(2),Some 4) + let e = Map.empty - + Assert.AreEqual(e.TryFind(2), None) - + [] member this.Keys() = // Keys are ordered let m = Map.ofArray [| ("3", "9"); ("2", "4"); ("1", "3") |] Assert.AreEqual(["1"; "2"; "3"], m.Keys |> Seq.toList) - + let m = Map.ofArray [| (1, 1); (2, 4); (3, 9) |] Assert.AreEqual([1; 2; 3], m.Keys |> Seq.toList) - + let m = Map.ofArray [| |] Assert.AreEqual([], m.Keys |> Seq.toList) - + let m = Map.ofArray [| (1, 1); |] Assert.AreEqual([1], m.Keys |> Seq.toList) @@ -376,12 +376,12 @@ type MapType() = // values are ordered by the key let m = Map.ofArray [| ("3", "9"); ("2", "4"); ("1", "3") |] Assert.AreEqual(["3"; "4"; "9"], m.Values |> Seq.toList) - + let m = Map.ofArray [| (1, 1); (2, 4); (3, 9) |] Assert.AreEqual([1; 4; 9], m.Values |> Seq.toList) - + let m = Map.ofArray [| |] Assert.AreEqual([], m.Values |> Seq.toList) - + let m = Map.ofArray [| (1, 1); |] Assert.AreEqual([1], m.Values |> Seq.toList) \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ObsoleteListFunctions.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ObsoleteListFunctions.fs index 47c58233964..1a77082d862 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ObsoleteListFunctions.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ObsoleteListFunctions.fs @@ -9,8 +9,8 @@ open Xunit type ObsoleteListFunctions() = [] - member this.Nth() = - // integer List + member this.Nth() = + // integer List let resultInt = List.nth [3;7;9;4;8;1;1;2] 3 Assert.AreEqual(4, resultInt) @@ -18,7 +18,7 @@ type ObsoleteListFunctions() = let resultStr = List.nth ["a";"b";"c";"d"] 3 Assert.AreEqual("d", resultStr) - // empty List + // empty List CheckThrowsArgumentException ( fun() -> List.nth List.empty 1) () \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ObsoleteSeqFunctions.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ObsoleteSeqFunctions.fs index 67c5aeba747..bcf3f57495c 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ObsoleteSeqFunctions.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ObsoleteSeqFunctions.fs @@ -22,7 +22,7 @@ type ObsoleteSeqFunctions() = CheckThrowsArgumentException (fun () -> Seq.nth i (seq { 10 .. 20 }) |> ignore) // integer Seq - let resultInt = Seq.nth 3 (seq { 10..20 }) + let resultInt = Seq.nth 3 (seq { 10..20 }) Assert.AreEqual(13, resultInt) // string Seq @@ -33,7 +33,7 @@ type ObsoleteSeqFunctions() = CheckThrowsArgumentException(fun () -> Seq.nth 0 (Seq.empty : seq) |> ignore) // null Seq - let nullSeq:seq<'a> = null + let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () ->Seq.nth 3 nullSeq |> ignore) () \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs index ba70556361b..eb6b7327c70 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs @@ -50,20 +50,20 @@ type SeqModule() = [] member _.CachedSeq_Clear() = - + let mutable evaluatedItems : int list = [] - let cachedSeq = + let cachedSeq = Seq.initInfinite (fun i -> evaluatedItems <- i :: evaluatedItems; i) |> Seq.cache - + // Verify no items have been evaluated from the Seq yet Assert.AreEqual(List.length evaluatedItems, 0) - + // Force evaluation of 10 elements Seq.take 10 cachedSeq |> Seq.toList |> ignore - + // verify ref clear switch length Assert.AreEqual(List.length evaluatedItems, 10) @@ -71,66 +71,66 @@ type SeqModule() = Seq.take 10 cachedSeq |> Seq.toList |> ignore - + // Verify ref clear switch length (should be cached) Assert.AreEqual(List.length evaluatedItems, 10) - + // Clear (box cachedSeq :?> System.IDisposable) .Dispose() - + // Force evaluation of 10 elements Seq.take 10 cachedSeq |> Seq.toList |> ignore - + // Verify length of evaluatedItemList is 20 Assert.AreEqual(List.length evaluatedItems, 20) () - + [] member _.Append() = - // empty Seq + // empty Seq let emptySeq1 = Seq.empty let emptySeq2 = Seq.empty let appendEmptySeq = Seq.append emptySeq1 emptySeq2 let expectResultEmpty = Seq.empty - + VerifySeqsEqual expectResultEmpty appendEmptySeq - - // Integer Seq + + // Integer Seq let integerSeq1:seq = seq [0..4] let integerSeq2:seq = seq [5..9] - + let appendIntegerSeq = Seq.append integerSeq1 integerSeq2 - + let expectResultInteger = seq { for i in 0..9 -> i} - + VerifySeqsEqual expectResultInteger appendIntegerSeq - - + + // String Seq let stringSeq1:seq = seq ["1";"2"] let stringSeq2:seq = seq ["3";"4"] - + let appendStringSeq = Seq.append stringSeq1 stringSeq2 - + let expectedResultString = seq ["1";"2";"3";"4"] - + VerifySeqsEqual expectedResultString appendStringSeq - + // null Seq let nullSeq1 = seq [null;null] let nullSeq2 =seq [null;null] let appendNullSeq = Seq.append nullSeq1 nullSeq2 - + let expectedResultNull = seq [ null;null;null;null] - + VerifySeqsEqual expectedResultNull appendNullSeq - + () [] @@ -142,116 +142,116 @@ type SeqModule() = Assert.AreEqual(["1";"1"],Seq.replicate 2 "1" |> Seq.toList) CheckThrowsArgumentOutOfRangeException (fun () -> Seq.replicate -1 null |> ignore) - - + + [] member _.Average() = - // empty Seq + // empty Seq let emptySeq:seq = Seq.empty - + CheckThrowsArgumentException (fun () -> Seq.average emptySeq |> ignore) - - + + // double Seq let doubleSeq:seq = seq [1.0;2.2;2.5;4.3] - + let averageDouble = Seq.average doubleSeq - + Assert.False( averageDouble <> 2.5) - + // float32 Seq let floatSeq:seq = seq [ 2.0f;4.4f;5.0f;8.6f] - + let averageFloat = Seq.average floatSeq - + Assert.False( averageFloat <> 5.0f) - + // decimal Seq let decimalSeq:seq = seq [ 0M;19M;19.03M] - + let averageDecimal = Seq.average decimalSeq - + Assert.False( averageDecimal <> 12.676666666666666666666666667M ) - + // null Seq let nullSeq:seq = null - - CheckThrowsArgumentNullException (fun () -> Seq.average nullSeq |> ignore) + + CheckThrowsArgumentNullException (fun () -> Seq.average nullSeq |> ignore) () - - + + [] member _.AverageBy() = - // empty Seq + // empty Seq let emptySeq:seq = Seq.empty - + CheckThrowsArgumentException (fun () -> Seq.averageBy (fun x -> x+1.0) emptySeq |> ignore) - + // double Seq let doubleSeq:seq = seq [1.0;2.2;2.5;4.3] - + let averageDouble = Seq.averageBy (fun x -> x-2.0) doubleSeq - + Assert.False( averageDouble <> 0.5 ) - + // float32 Seq let floatSeq:seq = seq [ 2.0f;4.4f;5.0f;8.6f] - + let averageFloat = Seq.averageBy (fun x -> x*3.3f) floatSeq - + Assert.False( averageFloat <> 16.5f ) - + // decimal Seq let decimalSeq:seq = seq [ 0M;19M;19.03M] - + let averageDecimal = Seq.averageBy (fun x -> x/10.7M) decimalSeq - + Assert.False( averageDecimal <> 1.1847352024922118380062305296M ) - + // null Seq let nullSeq:seq = null - - CheckThrowsArgumentNullException (fun () -> Seq.averageBy (fun (x:double)->x+4.0) nullSeq |> ignore) + + CheckThrowsArgumentNullException (fun () -> Seq.averageBy (fun (x:double)->x+4.0) nullSeq |> ignore) () - + [] member _.Cache() = - // empty Seq + // empty Seq let emptySeq:seq = Seq.empty - + let cacheEmpty = Seq.cache emptySeq - + let expectedResultEmpty = Seq.empty - + VerifySeqsEqual expectedResultEmpty cacheEmpty - + // double Seq let doubleSeq:seq = seq [1.0;2.2;2.5;4.3] - + let cacheDouble = Seq.cache doubleSeq - + VerifySeqsEqual doubleSeq cacheDouble - - + + // float32 Seq let floatSeq:seq = seq [ 2.0f;4.4f;5.0f;8.6f] - + let cacheFloat = Seq.cache floatSeq - + VerifySeqsEqual floatSeq cacheFloat - + // decimal Seq let decimalSeq:seq = seq [ 0M; 19M; 19.03M] - + let cacheDecimal = Seq.cache decimalSeq - + VerifySeqsEqual decimalSeq cacheDecimal - + // null Seq let nullSeq = seq [null] - + let cacheNull = Seq.cache nullSeq - + VerifySeqsEqual nullSeq cacheNull () @@ -261,84 +261,84 @@ type SeqModule() = // integer Seq let integerArray = [|1;2|] let integerSeq = Seq.cast integerArray - + let expectedIntegerSeq = seq [1;2] - + VerifySeqsEqual expectedIntegerSeq integerSeq - + // string Seq let stringArray = [|"a";"b"|] let stringSeq = Seq.cast stringArray - + let expectedStringSeq = seq ["a";"b"] - + VerifySeqsEqual expectedStringSeq stringSeq - + // empty Seq let emptySeq = Seq.cast Seq.empty let expectedEmptySeq = Seq.empty - + VerifySeqsEqual expectedEmptySeq Seq.empty - + // null Seq let nullArray = [|null;null|] let NullSeq = Seq.cast nullArray let expectedNullSeq = seq [null;null] - + VerifySeqsEqual expectedNullSeq NullSeq - CheckThrowsExn(fun () -> - let strings = - integerArray - |> Seq.cast - for o in strings do ()) - - CheckThrowsExn(fun () -> - let strings = - integerArray + CheckThrowsExn(fun () -> + let strings = + integerArray + |> Seq.cast + for o in strings do ()) + + CheckThrowsExn(fun () -> + let strings = + integerArray |> Seq.cast :> System.Collections.IEnumerable // without this upcast the for loop throws, so it should with this upcast too - for o in strings do ()) - + for o in strings do ()) + () - + [] member _.Choose() = - + // int Seq - let intSeq = seq [1..20] - let funcInt x = if (x%5=0) then Some x else None + let intSeq = seq [1..20] + let funcInt x = if (x%5=0) then Some x else None let intChosen = Seq.choose funcInt intSeq let expectedIntChosen = seq { for i = 1 to 4 do yield i*5} - - - + + + VerifySeqsEqual expectedIntChosen intChosen - + // string Seq let stringSrc = seq ["list";"List"] let funcString x = match x with | "list"-> Some x | "List" -> Some x | _ -> None - let strChosen = Seq.choose funcString stringSrc + let strChosen = Seq.choose funcString stringSrc let expectedStrChoose = seq ["list";"List"] - + VerifySeqsEqual expectedStrChoose strChosen - + // empty Seq let emptySeq = Seq.empty let emptyChosen = Seq.choose funcInt emptySeq - + let expectedEmptyChoose = Seq.empty - + VerifySeqsEqual expectedEmptyChoose emptySeq - + // null Seq - let nullSeq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.choose funcInt nullSeq |> ignore) + let nullSeq:seq<'a> = null + + CheckThrowsArgumentNullException (fun () -> Seq.choose funcInt nullSeq |> ignore) () [] @@ -410,15 +410,15 @@ type SeqModule() = [] member _.Compare() = - + // int Seq - let intSeq1 = seq [1;3;7;9] - let intSeq2 = seq [2;4;6;8] + let intSeq1 = seq [1;3;7;9] + let intSeq2 = seq [2;4;6;8] let funcInt x y = if (x>y) then x else 0 let intcompared = Seq.compareWith funcInt intSeq1 intSeq2 - + Assert.False( intcompared <> 7 ) - + // string Seq let stringSeq1 = seq ["a"; "b"] let stringSeq2 = seq ["c"; "d"] @@ -426,162 +426,162 @@ type SeqModule() = | "a", "c" -> 0 | "b", "d" -> 1 |_ -> -1 - let strcompared = Seq.compareWith funcString stringSeq1 stringSeq2 + let strcompared = Seq.compareWith funcString stringSeq1 stringSeq2 Assert.False( strcompared <> 1 ) - + // empty Seq let emptySeq = Seq.empty let emptycompared = Seq.compareWith funcInt emptySeq emptySeq - + Assert.False( emptycompared <> 0 ) - + // null Seq - let nullSeq:seq = null - - CheckThrowsArgumentNullException (fun () -> Seq.compareWith funcInt nullSeq emptySeq |> ignore) - CheckThrowsArgumentNullException (fun () -> Seq.compareWith funcInt emptySeq nullSeq |> ignore) - CheckThrowsArgumentNullException (fun () -> Seq.compareWith funcInt nullSeq nullSeq |> ignore) + let nullSeq:seq = null + + CheckThrowsArgumentNullException (fun () -> Seq.compareWith funcInt nullSeq emptySeq |> ignore) + CheckThrowsArgumentNullException (fun () -> Seq.compareWith funcInt emptySeq nullSeq |> ignore) + CheckThrowsArgumentNullException (fun () -> Seq.compareWith funcInt nullSeq nullSeq |> ignore) () - + [] member _.Concat() = // integer Seq - let seqInt = - seq { for i in 0..9 do + let seqInt = + seq { for i in 0..9 do yield seq {for j in 0..9 do yield i*10+j}} let conIntSeq = Seq.concat seqInt let expectedIntSeq = seq { for i in 0..99 do yield i} - + VerifySeqsEqual expectedIntSeq conIntSeq - + // string Seq - let strSeq = + let strSeq = seq { for a in 'a' .. 'b' do for b in 'a' .. 'b' do yield seq [a; b] } - + let conStrSeq = Seq.concat strSeq let expectedStrSeq = seq ['a';'a';'a';'b';'b';'a';'b';'b';] VerifySeqsEqual expectedStrSeq conStrSeq - + // Empty Seq let emptySeqs = seq [seq [ Seq.empty;Seq.empty];seq [ Seq.empty;Seq.empty]] let conEmptySeq = Seq.concat emptySeqs let expectedEmptySeq =seq { for i in 1..4 do yield Seq.empty} - - VerifySeqsEqual expectedEmptySeq conEmptySeq + + VerifySeqsEqual expectedEmptySeq conEmptySeq // null Seq let nullSeq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.concat nullSeq |> ignore) - - () - + + CheckThrowsArgumentNullException (fun () -> Seq.concat nullSeq |> ignore) + + () + [] member _.CountBy() = // integer Seq - let funcIntCount_by (x:int) = x%3 - let seqInt = - seq { for i in 0..9 do + let funcIntCount_by (x:int) = x%3 + let seqInt = + seq { for i in 0..9 do yield i} let countIntSeq = Seq.countBy funcIntCount_by seqInt - + let expectedIntSeq = seq [0,4;1,3;2,3] - + VerifySeqsEqual expectedIntSeq countIntSeq - + // string Seq let funcStrCount_by (s:string) = s.IndexOf("key") let strSeq = seq [ "key";"blank key";"key";"blank blank key"] - + let countStrSeq = Seq.countBy funcStrCount_by strSeq let expectedStrSeq = seq [0,2;6,1;12,1] VerifySeqsEqual expectedStrSeq countStrSeq - + // Empty Seq let emptySeq = Seq.empty let countEmptySeq = Seq.countBy funcIntCount_by emptySeq let expectedEmptySeq =seq [] - - VerifySeqsEqual expectedEmptySeq countEmptySeq + + VerifySeqsEqual expectedEmptySeq countEmptySeq // null Seq let nullSeq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.countBy funcIntCount_by nullSeq |> ignore) - () - + + CheckThrowsArgumentNullException (fun () -> Seq.countBy funcIntCount_by nullSeq |> ignore) + () + [] member _.Distinct() = - + // integer Seq - let IntDistinctSeq = - seq { for i in 0..9 do + let IntDistinctSeq = + seq { for i in 0..9 do yield i % 3 } - + let DistinctIntSeq = Seq.distinct IntDistinctSeq - + let expectedIntSeq = seq [0;1;2] - + VerifySeqsEqual expectedIntSeq DistinctIntSeq - + // string Seq let strDistinctSeq = seq ["elementDup"; "ele1"; "ele2"; "elementDup"] - + let DistinctStrSeq = Seq.distinct strDistinctSeq let expectedStrSeq = seq ["elementDup"; "ele1"; "ele2"] VerifySeqsEqual expectedStrSeq DistinctStrSeq - + // Empty Seq let emptySeq : seq = Seq.empty let distinctEmptySeq : seq = Seq.distinct emptySeq let expectedEmptySeq : seq = seq [] - + VerifySeqsEqual expectedEmptySeq distinctEmptySeq // null Seq let nullSeq:seq = null - - CheckThrowsArgumentNullException(fun () -> Seq.distinct nullSeq |> ignore) - () - + + CheckThrowsArgumentNullException(fun () -> Seq.distinct nullSeq |> ignore) + () + [] member _.DistinctBy () = // integer Seq - let funcInt x = x % 3 - let IntDistinct_bySeq = - seq { for i in 0..9 do + let funcInt x = x % 3 + let IntDistinct_bySeq = + seq { for i in 0..9 do yield i } - + let distinct_byIntSeq = Seq.distinctBy funcInt IntDistinct_bySeq - + let expectedIntSeq = seq [0;1;2] - + VerifySeqsEqual expectedIntSeq distinct_byIntSeq - + // string Seq let funcStrDistinct (s:string) = s.IndexOf("key") let strSeq = seq [ "key"; "blank key"; "key dup"; "blank key dup"] - + let DistinctStrSeq = Seq.distinctBy funcStrDistinct strSeq let expectedStrSeq = seq ["key"; "blank key"] VerifySeqsEqual expectedStrSeq DistinctStrSeq - + // Empty Seq let emptySeq : seq = Seq.empty let distinct_byEmptySeq : seq = Seq.distinctBy funcInt emptySeq let expectedEmptySeq : seq = seq [] - + VerifySeqsEqual expectedEmptySeq distinct_byEmptySeq // null Seq let nullSeq : seq<'a> = null - - CheckThrowsArgumentNullException(fun () -> Seq.distinctBy funcInt nullSeq |> ignore) - () + + CheckThrowsArgumentNullException(fun () -> Seq.distinctBy funcInt nullSeq |> ignore) + () [] member _.Except() = @@ -626,65 +626,65 @@ type SeqModule() = member _.Exists() = // Integer Seq - let funcInt x = (x % 2 = 0) - let IntexistsSeq = - seq { for i in 0..9 do + let funcInt x = (x % 2 = 0) + let IntexistsSeq = + seq { for i in 0..9 do yield i} - + let ifExistInt = Seq.exists funcInt IntexistsSeq - - Assert.True( ifExistInt) - + + Assert.True( ifExistInt) + // String Seq let funcStr (s:string) = s.Contains("key") let strSeq = seq ["key"; "blank key"] - + let ifExistStr = Seq.exists funcStr strSeq - + Assert.True( ifExistStr) - + // Empty Seq let emptySeq = Seq.empty let ifExistsEmpty = Seq.exists funcInt emptySeq - + Assert.False( ifExistsEmpty) - - + + // null Seq let nullSeq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.exists funcInt nullSeq |> ignore) - () - + + CheckThrowsArgumentNullException (fun () -> Seq.exists funcInt nullSeq |> ignore) + () + [] member _.Exists2() = // Integer Seq - let funcInt x y = (x+y)%3=0 + let funcInt x y = (x+y)%3=0 let Intexists2Seq1 = seq [1;3;7] let Intexists2Seq2 = seq [1;6;3] - + let ifExist2Int = Seq.exists2 funcInt Intexists2Seq1 Intexists2Seq2 Assert.True( ifExist2Int) - + // String Seq let funcStr s1 s2 = ((s1 + s2) = "CombinedString") let strSeq1 = seq [ "Combined"; "Not Combined"] let strSeq2 = seq ["String"; "Other String"] let ifexists2Str = Seq.exists2 funcStr strSeq1 strSeq2 Assert.True(ifexists2Str) - + // Empty Seq let emptySeq = Seq.empty let ifexists2Empty = Seq.exists2 funcInt emptySeq emptySeq Assert.False( ifexists2Empty) - + // null Seq let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.exists2 funcInt nullSeq nullSeq |> ignore) - () - - + CheckThrowsArgumentNullException (fun () -> Seq.exists2 funcInt nullSeq nullSeq |> ignore) + () + + [] member _.Filter() = // integer Seq @@ -692,67 +692,67 @@ type SeqModule() = let IntSeq = seq { for i in 1..20 do yield i } - + let filterIntSeq = Seq.filter funcInt IntSeq - + let expectedfilterInt = seq [ 5;10;15;20] - + VerifySeqsEqual expectedfilterInt filterIntSeq - + // string Seq let funcStr (s:string) = s.Contains("Expected Content") let strSeq = seq [ "Expected Content"; "Not Expected"; "Expected Content"; "Not Expected"] - + let filterStrSeq = Seq.filter funcStr strSeq - + let expectedfilterStr = seq ["Expected Content"; "Expected Content"] - - VerifySeqsEqual expectedfilterStr filterStrSeq + + VerifySeqsEqual expectedfilterStr filterStrSeq // Empty Seq let emptySeq = Seq.empty let filterEmptySeq = Seq.filter funcInt emptySeq - + let expectedEmptySeq =seq [] - + VerifySeqsEqual expectedEmptySeq filterEmptySeq - - + + // null Seq let nullSeq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.filter funcInt nullSeq |> ignore) - () - + + CheckThrowsArgumentNullException (fun () -> Seq.filter funcInt nullSeq |> ignore) + () + [] member _.Find() = - + // integer Seq let funcInt x = if (x % 5 = 0) then true else false let IntSeq = seq { for i in 1..20 do yield i } - + let findInt = Seq.find funcInt IntSeq - Assert.AreEqual(findInt, 5) - + Assert.AreEqual(findInt, 5) + // string Seq let funcStr (s:string) = s.Contains("Expected Content") let strSeq = seq [ "Expected Content";"Not Expected"] - + let findStr = Seq.find funcStr strSeq Assert.AreEqual(findStr, "Expected Content") - + // Empty Seq let emptySeq = Seq.empty - + CheckThrowsKeyNotFoundException(fun () -> Seq.find funcInt emptySeq |> ignore) - + // null Seq let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.find funcInt nullSeq |> ignore) + CheckThrowsArgumentNullException (fun () -> Seq.find funcInt nullSeq |> ignore) () - + [] member _.FindBack() = // integer Seq @@ -782,19 +782,19 @@ type SeqModule() = [] member _.FindIndex() = - + // integer Seq let digits = [1 .. 100] |> Seq.ofList let idx = digits |> Seq.findIndex (fun i -> i.ToString().Length > 1) Assert.AreEqual(idx, 9) - // empty Seq + // empty Seq CheckThrowsKeyNotFoundException(fun () -> Seq.findIndex (fun i -> true) Seq.empty |> ignore) - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.findIndex (fun i -> true) null |> ignore) () - + [] member _.Permute() = let mapIndex i = (i + 1) % 4 @@ -843,37 +843,37 @@ type SeqModule() = [] member _.Pick() = - + let digits = [| 1 .. 10 |] |> Seq.ofArray let result = Seq.pick (fun i -> if i > 5 then Some(i.ToString()) else None) digits Assert.AreEqual(result, "6") - + // Empty seq (Bugged, 4173) CheckThrowsKeyNotFoundException (fun () -> Seq.pick (fun i -> Some('a')) ([| |] : int[]) |> ignore) // Null CheckThrowsArgumentNullException (fun () -> Seq.pick (fun i -> Some(i + 0)) null |> ignore) () - + [] member _.Fold() = let funcInt x y = x+y - + let IntSeq = seq { for i in 1..10 do yield i} - + let foldInt = Seq.fold funcInt 1 IntSeq if foldInt <> 56 then Assert.Fail() - + // string Seq let funcStr (x:string) (y:string) = x+y let strSeq = seq ["B"; "C"; "D" ; "E"] let foldStr = Seq.fold funcStr "A" strSeq - + if foldStr <> "ABCDE" then Assert.Fail() - - + + // Empty Seq let emptySeq = Seq.empty let foldEmpty = Seq.fold funcInt 1 emptySeq @@ -881,9 +881,9 @@ type SeqModule() = // null Seq let nullSeq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.fold funcInt 1 nullSeq |> ignore) - () + + CheckThrowsArgumentNullException (fun () -> Seq.fold funcInt 1 nullSeq |> ignore) + () @@ -891,34 +891,34 @@ type SeqModule() = member _.Fold2() = Assert.AreEqual([(3,5); (2,3); (1,1)],Seq.fold2 (fun acc x y -> (x,y)::acc) [] (seq [ 1..3 ]) (seq [1..2..6])) - // integer List + // integer List let funcInt x y z = x + y + z let resultInt = Seq.fold2 funcInt 9 (seq [ 1..10 ]) (seq [1..2..20]) Assert.AreEqual(164, resultInt) - - // string List - let funcStr x y z = x + y + z - let resultStr = Seq.fold2 funcStr "*" ["a"; "b"; "c" ; "d" ] ["A"; "B"; "C" ; "D" ] + + // string List + let funcStr x y z = x + y + z + let resultStr = Seq.fold2 funcStr "*" ["a"; "b"; "c" ; "d" ] ["A"; "B"; "C" ; "D" ] Assert.AreEqual("*aAbBcCdD", resultStr) - + // empty List let emptyArr:int list = [ ] - let resultEpt = Seq.fold2 funcInt 5 emptyArr emptyArr + let resultEpt = Seq.fold2 funcInt 5 emptyArr emptyArr Assert.AreEqual(5, resultEpt) Assert.AreEqual(0,Seq.fold2 funcInt 0 Seq.empty (seq [1])) Assert.AreEqual(-1,Seq.fold2 funcInt -1 (seq [1]) Seq.empty) - + Assert.AreEqual(2,Seq.fold2 funcInt 0 (seq [1;2]) (seq [1])) Assert.AreEqual(4,Seq.fold2 funcInt 0 (seq [1]) (seq [3;6])) // null Seq - let nullSeq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.fold2 funcInt 0 nullSeq (seq [1]) |> ignore) - CheckThrowsArgumentNullException (fun () -> Seq.fold2 funcInt 0 (seq [1]) nullSeq |> ignore) + let nullSeq:seq<'a> = null + + CheckThrowsArgumentNullException (fun () -> Seq.fold2 funcInt 0 nullSeq (seq [1]) |> ignore) + CheckThrowsArgumentNullException (fun () -> Seq.fold2 funcInt 0 (seq [1]) nullSeq |> ignore) () - + [] member _.FoldBack() = // int Seq @@ -932,7 +932,7 @@ type SeqModule() = let strSeq = seq [ "A"; "B"; "C"; "D" ] let foldStr = Seq.foldBack funcStr strSeq "ABCDE" Assert.AreEqual("E", foldStr) - + // single element let funcStr2 elem acc = sprintf "%s%s" elem acc let strSeq2 = seq [ "A" ] @@ -1002,29 +1002,29 @@ type SeqModule() = seq { for i in 1..10 do yield i*2} let for_allInt = Seq.forall funcInt IntSeq - + if for_allInt <> true then Assert.Fail() - - + + // string Seq let funcStr (x:string) = x.Contains("a") let strSeq = seq ["a"; "ab"; "abc" ; "abcd"] let for_allStr = Seq.forall funcStr strSeq - + if for_allStr <> true then Assert.Fail() - - + + // Empty Seq let emptySeq = Seq.empty let for_allEmpty = Seq.forall funcInt emptySeq - + if for_allEmpty <> true then Assert.Fail() - + // null Seq let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.forall funcInt nullSeq |> ignore) - () - + CheckThrowsArgumentNullException (fun () -> Seq.forall funcInt nullSeq |> ignore) + () + [] member _.ForAll2() = @@ -1032,99 +1032,99 @@ type SeqModule() = let IntSeq = seq { for i in 1..10 do yield i} - + let for_all2Int = Seq.forall2 funcInt IntSeq IntSeq - + if for_all2Int <> true then Assert.Fail() - + // string Seq let funcStr (x:string) (y:string) = (x+y).Length = 5 let strSeq1 = seq ["a"; "ab"; "abc" ; "abcd"] let strSeq2 = seq ["abcd"; "abc"; "ab" ; "a"] let for_all2Str = Seq.forall2 funcStr strSeq1 strSeq2 - + if for_all2Str <> true then Assert.Fail() - + // Empty Seq let emptySeq = Seq.empty let for_all2Empty = Seq.forall2 funcInt emptySeq emptySeq - + if for_all2Empty <> true then Assert.Fail() // null Seq let nullSeq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.forall2 funcInt nullSeq nullSeq |> ignore) - + + CheckThrowsArgumentNullException (fun () -> Seq.forall2 funcInt nullSeq nullSeq |> ignore) + [] member _.GroupBy() = - + let funcInt x = x%5 - + let IntSeq = seq { for i in 0 .. 9 do yield i } - + let group_byInt = Seq.groupBy funcInt IntSeq |> Seq.map (fun (i, v) -> i, Seq.toList v) - - let expectedIntSeq = + + let expectedIntSeq = seq { for i in 0..4 do yield i, [i; i+5] } - + VerifySeqsEqual group_byInt expectedIntSeq - + // string Seq let funcStr (x:string) = x.Length let strSeq = seq ["length7"; "length 8"; "length7" ; "length 9"] - + let group_byStr = Seq.groupBy funcStr strSeq |> Seq.map (fun (i, v) -> i, Seq.toList v) - let expectedStrSeq = + let expectedStrSeq = seq { yield 7, ["length7"; "length7"] yield 8, ["length 8"] yield 9, ["length 9"] } - + VerifySeqsEqual expectedStrSeq group_byStr - + // Empty Seq let emptySeq = Seq.empty let group_byEmpty = Seq.groupBy funcInt emptySeq let expectedEmptySeq = seq [] VerifySeqsEqual expectedEmptySeq group_byEmpty - + // null Seq let nullSeq:seq<'a> = null let group_byNull = Seq.groupBy funcInt nullSeq - CheckThrowsArgumentNullException (fun () -> Seq.iter (fun _ -> ()) group_byNull) - () - + CheckThrowsArgumentNullException (fun () -> Seq.iter (fun _ -> ()) group_byNull) + () + [] member _.DisposalOfUnstartedEnumerator() = let mutable run = false - let f() = seq { + let f() = seq { try () - finally + finally run <- true } - - f().GetEnumerator().Dispose() + + f().GetEnumerator().Dispose() Assert.False(run) [] member _.WeirdLocalNames() = - - let f pc = seq { + + let f pc = seq { yield pc yield (pc+1) yield (pc+2) } - + let l = f 3 |> Seq.toList Assert.AreEqual([3;4;5], l) - let f i = seq { + let f i = seq { let pc = i*2 yield pc yield (pc+1) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs index 9ac290935fe..272e69c6047 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs @@ -36,42 +36,42 @@ type SeqModule2() = // null Seq let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () ->Seq.head nullSeq) - () + CheckThrowsArgumentNullException (fun () ->Seq.head nullSeq) + () [] member _.TryHead() = - // int Seq + // int Seq let IntSeq = seq { for i in 0 .. 9 -> i } - + let intResult = Seq.tryHead IntSeq // string Seq let strResult = Seq.tryHead (seq ["first"; "second"; "third"]) Assert.AreEqual("first", strResult.Value) - + // Empty Seq let emptyResult = Seq.tryHead Seq.empty Assert.AreEqual(None, emptyResult) - + // null Seq let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () ->Seq.head nullSeq) - () - + CheckThrowsArgumentNullException (fun () ->Seq.head nullSeq) + () + [] member _.Tl() = - // integer seq - let resultInt = Seq.tail <| seq { 1..10 } + // integer seq + let resultInt = Seq.tail <| seq { 1..10 } Assert.AreEqual(Array.ofSeq (seq { 2..10 }), Array.ofSeq resultInt) - + // string seq - let resultStr = Seq.tail <| seq { yield "a"; yield "b"; yield "c"; yield "d" } + let resultStr = Seq.tail <| seq { yield "a"; yield "b"; yield "c"; yield "d" } Assert.AreEqual(Array.ofSeq (seq { yield "b"; yield "c" ; yield "d" }), Array.ofSeq resultStr) - + // 1-element seq - let resultStr2 = Seq.tail <| seq { yield "a" } + let resultStr2 = Seq.tail <| seq { yield "a" } Assert.AreEqual(Array.ofSeq (Seq.empty : seq), Array.ofSeq resultStr2) CheckThrowsArgumentNullException(fun () -> Seq.tail null |> ignore) @@ -80,166 +80,166 @@ type SeqModule2() = [] member _.Last() = - + let IntSeq = seq { for i in 0 .. 9 do yield i } - + if Seq.last IntSeq <> 9 then Assert.Fail() - + // string Seq let strSeq = seq ["first"; "second"; "third"] if Seq.last strSeq <> "third" then Assert.Fail() - + // Empty Seq let emptySeq = Seq.empty CheckThrowsArgumentException ( fun() -> Seq.last emptySeq) - + // null Seq let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () ->Seq.last nullSeq) - - + CheckThrowsArgumentNullException (fun () ->Seq.last nullSeq) + + // ------ Test for Array ----- - let IntArr = Array.ofSeq IntSeq + let IntArr = Array.ofSeq IntSeq if Seq.last IntArr <> 9 then Assert.Fail() - + // string Array - let strArr = Array.ofSeq strSeq + let strArr = Array.ofSeq strSeq if Seq.last strArr <> "third" then Assert.Fail() - + // Empty Array let emptyArr = [| |] CheckThrowsArgumentException ( fun() -> Seq.last emptyArr) - + // null Array let nullArr: 'a array = null - CheckThrowsArgumentNullException (fun () ->Seq.last nullArr) - + CheckThrowsArgumentNullException (fun () ->Seq.last nullArr) + // ---- Test for IList ----- let IntRarr = ResizeArray(IntSeq) if Seq.last IntRarr <> 9 then Assert.Fail() - + // string IList - let strRarr = ResizeArray(strSeq) + let strRarr = ResizeArray(strSeq) if Seq.last strRarr <> "third" then Assert.Fail() - + // Empty IList let emptyRarr = ResizeArray() CheckThrowsArgumentException ( fun() -> Seq.last emptyRarr) - + // null IList let nullRarr: ResizeArray = null - CheckThrowsArgumentNullException (fun () ->Seq.last nullRarr) - + CheckThrowsArgumentNullException (fun () ->Seq.last nullRarr) + // ---- Test for list ----- let Intlist = List.ofSeq(IntSeq) if Seq.last Intlist <> 9 then Assert.Fail() - + // string list - let strlist = List.ofSeq(strSeq) + let strlist = List.ofSeq(strSeq) if Seq.last strlist <> "third" then Assert.Fail() - + // Empty list let emptylist: list = [] CheckThrowsArgumentException ( fun() -> Seq.last emptylist) - + // null list let nullList: list = Unchecked.defaultof> - CheckThrowsArgumentNullException (fun () ->Seq.last nullList) - () - + CheckThrowsArgumentNullException (fun () ->Seq.last nullList) + () + [] member _.TryLast() = - + let IntSeq = seq { for i in 0 .. 9 -> i } - + let intResult = Seq.tryLast IntSeq Assert.AreEqual(9, intResult.Value) - + // string Seq let strResult = Seq.tryLast (seq ["first"; "second"; "third"]) Assert.AreEqual("third", strResult.Value) - + // Empty Seq let emptyResult = Seq.tryLast Seq.empty Assert.True(emptyResult.IsNone) - + // null Seq let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullSeq |> ignore) // ------ Test for Array ----- - let IntArr = Array.ofSeq IntSeq + let IntArr = Array.ofSeq IntSeq let intResult = Seq.tryLast IntArr Assert.AreEqual(9, intResult.Value) - + // string Array let strResult = Seq.tryLast (Array.ofSeq (["first"; "second"; "third"])) Assert.AreEqual("third", strResult.Value) - + // Empty Array let emptyResult = Seq.tryLast Array.empty Assert.True(emptyResult.IsNone) - + // null Array let nullArr: unit array = null - CheckThrowsArgumentNullException (fun () -> Seq.tryLast nullArr |> ignore) + CheckThrowsArgumentNullException (fun () -> Seq.tryLast nullArr |> ignore) // ------ Test for IList ----- let IntRarr = ResizeArray( IntSeq ) let intResult = Seq.tryLast IntRarr Assert.AreEqual(9, intResult.Value) - + // string IList let strResult = Seq.tryLast (ResizeArray (["first"; "second"; "third"])) Assert.AreEqual("third", strResult.Value) - + // Empty IList let emptyResult = Seq.tryLast (ResizeArray()) Assert.True(emptyResult.IsNone) - + // null IList let nullRarr:ResizeArray = null - CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullRarr |> ignore) - + CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullRarr |> ignore) + // ------ Test for list ----- let Intlist= List.ofSeq( IntSeq ) let intResult = Seq.tryLast Intlist Assert.AreEqual(9, intResult.Value) - + // string list let strResult = Seq.tryLast ["first"; "second"; "third"] Assert.AreEqual("third", strResult.Value) - + // Empty list let emptylist: list = [] let emptyResult = Seq.tryLast emptylist Assert.True(emptyResult.IsNone) - + // null list let nullList: list = Unchecked.defaultof> - CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullList |> ignore) - () + CheckThrowsArgumentNullException (fun () ->Seq.tryLast nullList |> ignore) + () + - [] member _.ExactlyOne() = - + let IntSeq = seq { for i in 7 .. 7 do yield i } - + if Seq.exactlyOne IntSeq <> 7 then Assert.Fail() - + // string Seq let strSeq = seq ["second"] if Seq.exactlyOne strSeq <> "second" then Assert.Fail() - + // Empty Seq let emptySeq = Seq.empty CheckThrowsArgumentException ( fun() -> Seq.exactlyOne emptySeq) @@ -250,7 +250,7 @@ type SeqModule2() = // null Seq let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.exactlyOne nullSeq) + CheckThrowsArgumentNullException (fun () -> Seq.exactlyOne nullSeq) () [] @@ -284,145 +284,145 @@ type SeqModule2() = let funcInt x = x let init_finiteInt = Seq.init 9 funcInt let expectedIntSeq = seq [ 0..8] - + VerifySeqsEqual expectedIntSeq init_finiteInt - - + + // string Seq let funcStr x = x.ToString() let init_finiteStr = Seq.init 5 funcStr let expectedStrSeq = seq ["0";"1";"2";"3";"4"] VerifySeqsEqual expectedStrSeq init_finiteStr - + // null Seq let funcNull x = null let init_finiteNull = Seq.init 3 funcNull let expectedNullSeq = seq [ null;null;null] - + VerifySeqsEqual expectedNullSeq init_finiteNull - () - + () + [] member _.InitInfinite() = let funcInt x = x let init_infiniteInt = Seq.initInfinite funcInt let resultint = Seq.find (fun x -> x =100) init_infiniteInt - + Assert.AreEqual(100,resultint) - - + + // string Seq let funcStr x = x.ToString() let init_infiniteStr = Seq.initInfinite funcStr let resultstr = Seq.find (fun x -> x = "100") init_infiniteStr - + Assert.AreEqual("100",resultstr) - - + + [] member _.IsEmpty() = - + //seq int let seqint = seq [1;2;3] let is_emptyInt = Seq.isEmpty seqint - + Assert.False(is_emptyInt) - + //seq str let seqStr = seq ["first";"second"] let is_emptyStr = Seq.isEmpty seqStr Assert.False(is_emptyInt) - + //seq empty let seqEmpty = Seq.empty let is_emptyEmpty = Seq.isEmpty seqEmpty - Assert.True(is_emptyEmpty) - + Assert.True(is_emptyEmpty) + //seq null let seqnull:seq<'a> = null CheckThrowsArgumentNullException (fun () -> Seq.isEmpty seqnull |> ignore) () - + [] member _.Iter() = //seq int let seqint = seq [ 1..3] let mutable cacheint = 0 - + let funcint x = cacheint <- cacheint + x Seq.iter funcint seqint Assert.AreEqual(6, cacheint) - + //seq str let seqStr = seq ["first";"second"] let mutable cachestr = "" let funcstr x = cachestr <- cachestr+x Seq.iter funcstr seqStr - + Assert.AreEqual("firstsecond",cachestr) - - // empty array + + // empty array let emptyseq = Seq.empty - Seq.iter (fun x -> Assert.Fail()) emptyseq + Seq.iter (fun x -> Assert.Fail()) emptyseq // null seqay let nullseq:seq<'a> = null - - CheckThrowsArgumentNullException (fun () -> Seq.iter funcint nullseq |> ignore) + + CheckThrowsArgumentNullException (fun () -> Seq.iter funcint nullseq |> ignore) () - + [] member _.Iter2() = - + //seq int let seqint = seq [ 1..3] let mutable cacheint = 0 - + let funcint x y = cacheint <- cacheint + x+y Seq.iter2 funcint seqint seqint Assert.AreEqual(12, cacheint) - + //seq str let seqStr = seq ["first";"second"] let mutable cachestr = "" let funcstr x y = cachestr <- cachestr+x+y Seq.iter2 funcstr seqStr seqStr - + Assert.AreEqual("firstfirstsecondsecond",cachestr) - - // empty array + + // empty array let emptyseq = Seq.empty - Seq.iter2 (fun x y-> Assert.Fail()) emptyseq emptyseq + Seq.iter2 (fun x y-> Assert.Fail()) emptyseq emptyseq // null seqay let nullseq:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.iter2 funcint nullseq nullseq |> ignore) - + CheckThrowsArgumentNullException (fun () -> Seq.iter2 funcint nullseq nullseq |> ignore) + () - + [] member _.Iteri() = - + // seq int let seqint = seq [ 1..10] let mutable cacheint = 0 - + let funcint x y = cacheint <- cacheint + x+y Seq.iteri funcint seqint Assert.AreEqual(100, cacheint) - + // seq str let seqStr = seq ["first";"second"] let mutable cachestr = 0 let funcstr (x:int) (y:string) = cachestr <- cachestr+ x + y.Length Seq.iteri funcstr seqStr - + Assert.AreEqual(12, cachestr) - - // empty array + + // empty array let emptyseq = Seq.empty let mutable resultEpt = 0 Seq.iteri funcint emptyseq @@ -430,7 +430,7 @@ type SeqModule2() = // null seqay let nullseq:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.iteri funcint nullseq |> ignore) + CheckThrowsArgumentNullException (fun () -> Seq.iteri funcint nullseq |> ignore) () [] @@ -439,27 +439,27 @@ type SeqModule2() = //seq int let seqint = seq [ 1..3] let mutable cacheint = 0 - + let funcint x y z = cacheint <- cacheint + x + y + z Seq.iteri2 funcint seqint seqint Assert.AreEqual(15, cacheint) - + //seq str let seqStr = seq ["first";"second"] let mutable cachestr = 0 let funcstr (x:int) (y:string) (z:string) = cachestr <- cachestr + x + y.Length + z.Length Seq.iteri2 funcstr seqStr seqStr - + Assert.AreEqual(23, cachestr) - + // empty seq let emptyseq = Seq.empty - Seq.iteri2 (fun x y z -> Assert.Fail()) emptyseq emptyseq + Seq.iteri2 (fun x y z -> Assert.Fail()) emptyseq emptyseq // null seq let nullseq:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.iteri2 funcint nullseq nullseq |> ignore) - + CheckThrowsArgumentNullException (fun () -> Seq.iteri2 funcint nullseq nullseq |> ignore) + // len1 <> len2 let shorterSeq = seq { 1..3 } let longerSeq = seq { 2..2..100 } @@ -474,88 +474,88 @@ type SeqModule2() = Assert.AreEqual(21, testSeqLengths longerSeq shorterSeq) () - + [] member _.Length() = - // integer seq + // integer seq let resultInt = Seq.length (seq {1..8}) if resultInt <> 8 then Assert.Fail() - - // string Seq + + // string Seq let resultStr = Seq.length (seq ["Lists"; "are"; "commonly" ; "list" ]) if resultStr <> 4 then Assert.Fail() - - // empty Seq + + // empty Seq let resultEpt = Seq.length Seq.empty if resultEpt <> 0 then Assert.Fail() // null Seq - let nullSeq:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.length nullSeq |> ignore) - + let nullSeq:seq<'a> = null + CheckThrowsArgumentNullException (fun () -> Seq.length nullSeq |> ignore) + () - + [] member _.Map() = // integer Seq - let funcInt x = + let funcInt x = match x with - | _ when x % 2 = 0 -> 10*x + | _ when x % 2 = 0 -> 10*x | _ -> x - + let resultInt = Seq.map funcInt (seq { 1..10 }) let expectedint = seq [1;20;3;40;5;60;7;80;9;100] - + VerifySeqsEqual expectedint resultInt - + // string Seq let funcStr (x:string) = x.ToLower() let resultStr = Seq.map funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ]) let expectedSeq = seq ["lists"; "are"; "commonly" ; "list"] - + VerifySeqsEqual expectedSeq resultStr - + // empty Seq let resultEpt = Seq.map funcInt Seq.empty VerifySeqsEqual Seq.empty resultEpt // null Seq - let nullSeq:seq<'a> = null + let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () -> Seq.map funcStr nullSeq |> ignore) - + () - + [] member _.Map2() = // integer Seq let funcInt x y = x+y let resultInt = Seq.map2 funcInt (seq { 1..10 }) (seq {2..2..20}) let expectedint = seq [3;6;9;12;15;18;21;24;27;30] - + VerifySeqsEqual expectedint resultInt - + // string Seq let funcStr (x:int) (y:string) = x+y.Length let resultStr = Seq.map2 funcStr (seq [3;6;9;11]) (seq ["Lists"; "Are"; "Commonly" ; "List" ]) let expectedSeq = seq [8;9;17;15] - + VerifySeqsEqual expectedSeq resultStr - + // empty Seq let resultEpt = Seq.map2 funcInt Seq.empty Seq.empty VerifySeqsEqual Seq.empty resultEpt // null Seq - let nullSeq:seq<'a> = null + let nullSeq:seq<'a> = null let validSeq = seq [1] CheckThrowsArgumentNullException (fun () -> Seq.map2 funcInt nullSeq validSeq |> ignore) - + () [] - member _.Map3() = + member _.Map3() = // Integer seq let funcInt a b c = (a + b) * c let resultInt = Seq.map3 funcInt (seq { 1..8 }) (seq { 2..9 }) (seq { 3..10 }) @@ -640,7 +640,7 @@ type SeqModule2() = let mutable i = 0 let f x = i <- i + 1; x*x let e = ([1;2] |> map f).GetEnumerator() - + if expectExceptions then CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) Assert.AreEqual(0, i) @@ -650,7 +650,7 @@ type SeqModule2() = Assert.AreEqual(1, i) let _ = e.Current Assert.AreEqual(1, i) - + if not (e.MoveNext()) then Assert.Fail() Assert.AreEqual(2, i) let _ = e.Current @@ -664,15 +664,15 @@ type SeqModule2() = CheckThrowsInvalidOperationExn (fun _ -> e.Current |> ignore) Assert.AreEqual(2, i) - + i <- 0 let e = ([] |> map f).GetEnumerator() if e.MoveNext() then Assert.Fail() Assert.AreEqual(0, i) if e.MoveNext() then Assert.Fail() Assert.AreEqual(0, i) - - + + member private this.MapWithExceptionTester (map : (int -> int) -> seq -> seq) = let raiser x = if x > 0 then raise(NotSupportedException()) else x let e = (map raiser [0; 1]).GetEnumerator() @@ -684,16 +684,16 @@ type SeqModule2() = [] member this.MapWithSideEffects () = this.MapWithSideEffectsTester Seq.map true - + [] member this.MapWithException () = this.MapWithExceptionTester Seq.map - + [] member this.SingletonCollectWithSideEffects () = this.MapWithSideEffectsTester (fun f-> Seq.collect (f >> Seq.singleton)) true - + [] member this.SingletonCollectWithException () = this.MapWithExceptionTester (fun f-> Seq.collect (f >> Seq.singleton)) @@ -701,17 +701,17 @@ type SeqModule2() = [] member this.SystemLinqSelectWithSideEffects () = this.MapWithSideEffectsTester (fun f s -> System.Linq.Enumerable.Select(s, Func<_,_>(f))) false - + [] member this.SystemLinqSelectWithException () = this.MapWithExceptionTester (fun f s -> System.Linq.Enumerable.Select(s, Func<_,_>(f))) - + [] member _.MapiWithSideEffects () = let mutable i = 0 let f _ x = i <- i + 1; x*x let e = ([1;2] |> Seq.mapi f).GetEnumerator() - + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) Assert.AreEqual(0, i) if not (e.MoveNext()) then Assert.Fail() @@ -720,32 +720,32 @@ type SeqModule2() = Assert.AreEqual(1, i) let _ = e.Current Assert.AreEqual(1, i) - + if not (e.MoveNext()) then Assert.Fail() Assert.AreEqual(2, i) let _ = e.Current Assert.AreEqual(2, i) let _ = e.Current Assert.AreEqual(2, i) - + if e.MoveNext() then Assert.Fail() Assert.AreEqual(2, i) CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) Assert.AreEqual(2, i) - + i <- 0 let e = ([] |> Seq.mapi f).GetEnumerator() if e.MoveNext() then Assert.Fail() Assert.AreEqual(0,i) if e.MoveNext() then Assert.Fail() Assert.AreEqual(0,i) - + [] member _.Map2WithSideEffects () = let mutable i = 0 let f x y = i <- i + 1; x*x let e = (Seq.map2 f [1;2] [1;2]).GetEnumerator() - + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) Assert.AreEqual(0, i) if not (e.MoveNext()) then Assert.Fail() @@ -754,7 +754,7 @@ type SeqModule2() = Assert.AreEqual(1, i) let _ = e.Current Assert.AreEqual(1, i) - + if not (e.MoveNext()) then Assert.Fail() Assert.AreEqual(2, i) let _ = e.Current @@ -766,14 +766,14 @@ type SeqModule2() = Assert.AreEqual(2, i) CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) Assert.AreEqual(2, i) - + i <- 0 let e = (Seq.map2 f [] []).GetEnumerator() if e.MoveNext() then Assert.Fail() Assert.AreEqual(0, i) if e.MoveNext() then Assert.Fail() Assert.AreEqual(0, i) - + [] member _.Mapi2WithSideEffects () = let mutable i = 0 @@ -813,9 +813,9 @@ type SeqModule2() = // integer Seq let funcInt x = seq [x+1] let resultInt = Seq.collect funcInt (seq { 1..10 }) - + let expectedint = seq {2..11} - + VerifySeqsEqual expectedint resultInt // string Seq @@ -832,7 +832,7 @@ type SeqModule2() = VerifySeqsEqual Seq.empty resultEpt // null Seq - let nullSeq:seq<'a> = null + let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () -> Seq.collect funcInt nullSeq |> ignore) @@ -845,28 +845,28 @@ type SeqModule2() = let funcInt x y = x+y let resultInt = Seq.mapi funcInt (seq { 10..2..20 }) let expectedint = seq [10;13;16;19;22;25] - + VerifySeqsEqual expectedint resultInt - + // string Seq let funcStr (x:int) (y:string) =x+y.Length - + let resultStr = Seq.mapi funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ]) let expectedStr = seq [5;4;10;7] - + VerifySeqsEqual expectedStr resultStr - + // empty Seq let resultEpt = Seq.mapi funcInt Seq.empty VerifySeqsEqual Seq.empty resultEpt // null Seq - let nullSeq:seq<'a> = null - + let nullSeq:seq<'a> = null + CheckThrowsArgumentNullException (fun () -> Seq.mapi funcInt nullSeq |> ignore) - + () - + [] member _.Mapi2() = // integer Seq @@ -932,94 +932,94 @@ type SeqModule2() = member _.Max() = // integer Seq let resultInt = Seq.max (seq { 10..20 }) - + Assert.AreEqual(20,resultInt) - + // string Seq - + let resultStr = Seq.max (seq ["Lists"; "Are"; "MaxString" ; "List" ]) Assert.AreEqual("MaxString",resultStr) - + // empty Seq CheckThrowsArgumentException(fun () -> Seq.max ( Seq.empty : seq) |> ignore) - + // null Seq - let nullSeq:seq<'a> = null + let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () -> Seq.max nullSeq |> ignore) - + () - + [] member _.MaxBy() = - + // integer Seq let funcInt x = x % 8 let resultInt = Seq.maxBy funcInt (seq { 2..2..20 }) Assert.AreEqual(6,resultInt) - + // string Seq - let funcStr (x:string) =x.Length + let funcStr (x:string) =x.Length let resultStr = Seq.maxBy funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ]) Assert.AreEqual("Commonly",resultStr) - + // empty Seq CheckThrowsArgumentException (fun () -> Seq.maxBy funcInt (Seq.empty : seq) |> ignore) - + // null Seq - let nullSeq:seq<'a> = null + let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () ->Seq.maxBy funcInt nullSeq |> ignore) - + // returns first maximal element let max = Seq.maxBy fst (seq { 1, "a"; 2, "b"; 3, "c"; 2, "d"; 3, "e"; 1, "f" }) if snd max <> "c" then Assert.Fail() - + () - + [] member _.MinBy() = - + // integer Seq let funcInt x = x % 8 let resultInt = Seq.minBy funcInt (seq { 2..2..20 }) Assert.AreEqual(8,resultInt) - + // string Seq - let funcStr (x:string) =x.Length + let funcStr (x:string) =x.Length let resultStr = Seq.minBy funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ]) Assert.AreEqual("Are",resultStr) - + // empty Seq - CheckThrowsArgumentException (fun () -> Seq.minBy funcInt (Seq.empty : seq) |> ignore) - + CheckThrowsArgumentException (fun () -> Seq.minBy funcInt (Seq.empty : seq) |> ignore) + // null Seq - let nullSeq:seq<'a> = null + let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () ->Seq.minBy funcInt nullSeq |> ignore) - + // returns first minimal element let min = Seq.minBy fst (seq { 3, "a"; 2, "b"; 1, "c"; 2, "d"; 1, "e"; 3, "f" }) if snd min <> "c" then Assert.Fail() - + () - - + + [] member _.Min() = // integer Seq let resultInt = Seq.min (seq { 10..20 }) Assert.AreEqual(10,resultInt) - + // string Seq let resultStr = Seq.min (seq ["Lists"; "Are"; "minString" ; "List" ]) Assert.AreEqual("Are",resultStr) - + // empty Seq - CheckThrowsArgumentException (fun () -> Seq.min (Seq.empty : seq) |> ignore) - + CheckThrowsArgumentException (fun () -> Seq.min (Seq.empty : seq) |> ignore) + // null Seq - let nullSeq:seq<'a> = null + let nullSeq:seq<'a> = null CheckThrowsArgumentNullException (fun () -> Seq.min nullSeq |> ignore) - + () [] @@ -1066,77 +1066,77 @@ type SeqModule2() = // integer Seq let resultInt = Seq.ofArray [|1..10|] let expectedInt = seq {1..10} - + VerifySeqsEqual expectedInt resultInt - + // string Seq let resultStr = Seq.ofArray [|"Lists"; "Are"; "ofArrayString" ; "List" |] let expectedStr = seq ["Lists"; "Are"; "ofArrayString" ; "List" ] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.ofArray [| |] + + // empty Seq + let resultEpt = Seq.ofArray [| |] VerifySeqsEqual resultEpt Seq.empty - + () - + [] member _.Of_List() = // integer Seq let resultInt = Seq.ofList [1..10] let expectedInt = seq {1..10} - + VerifySeqsEqual expectedInt resultInt - + // string Seq - + let resultStr =Seq.ofList ["Lists"; "Are"; "ofListString" ; "List" ] let expectedStr = seq ["Lists"; "Are"; "ofListString" ; "List" ] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.ofList [] + + // empty Seq + let resultEpt = Seq.ofList [] VerifySeqsEqual resultEpt Seq.empty () - - + + [] member _.Pairwise() = // integer Seq let resultInt = Seq.pairwise (seq {1..3}) - + let expectedInt = seq [1,2;2,3] - + VerifySeqsEqual expectedInt resultInt - + // string Seq let resultStr =Seq.pairwise ["str1"; "str2";"str3" ] let expectedStr = seq ["str1","str2";"str2","str3"] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.pairwise [] + + // empty Seq + let resultEpt = Seq.pairwise [] VerifySeqsEqual resultEpt Seq.empty - + () - + [] member _.Reduce() = - + // integer Seq let resultInt = Seq.reduce (fun x y -> x/y) (seq [5*4*3*2; 4;3;2;1]) Assert.AreEqual(5,resultInt) - + // string Seq let resultStr = Seq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) (seq ["ABCDE";"A"; "B"; "C" ; "D" ]) - Assert.AreEqual("E",resultStr) - - // empty Seq + Assert.AreEqual("E",resultStr) + + // empty Seq CheckThrowsArgumentException (fun () -> Seq.reduce (fun x y -> x/y) Seq.empty |> ignore) - + // null Seq let nullSeq : seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullSeq |> ignore) + CheckThrowsArgumentNullException (fun () -> Seq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullSeq |> ignore) () [] @@ -1152,7 +1152,7 @@ type SeqModule2() = let strSeq = seq [ "A"; "B"; "C"; "D" ; "ABCDE" ] let reduceStr = Seq.reduceBack funcStr strSeq Assert.AreEqual("E", reduceStr) - + // string Seq let funcStr2 elem acc = sprintf "%s%s" elem acc let strSeq2 = seq [ "A" ] @@ -1193,24 +1193,24 @@ type SeqModule2() = let resultInt = Seq.scan funcInt 9 (seq {1..10}) let expectedInt = seq [9;10;12;15;19;24;30;37;45;54;64] VerifySeqsEqual expectedInt resultInt - + // string Seq let funcStr x y = x+y let resultStr =Seq.scan funcStr "x" ["str1"; "str2";"str3" ] - + let expectedStr = seq ["x";"xstr1"; "xstr1str2";"xstr1str2str3"] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.scan funcInt 5 Seq.empty - + + // empty Seq + let resultEpt = Seq.scan funcInt 5 Seq.empty + VerifySeqsEqual resultEpt (seq [ 5]) - + // null Seq let seqNull:seq<'a> = null CheckThrowsArgumentNullException(fun() -> Seq.scan funcInt 5 seqNull |> ignore) () - + [] member _.ScanBack() = // integer Seq @@ -1255,67 +1255,67 @@ type SeqModule2() = member _.Singleton() = // integer Seq let resultInt = Seq.singleton 1 - + let expectedInt = seq [1] VerifySeqsEqual expectedInt resultInt - + // string Seq let resultStr =Seq.singleton "str1" let expectedStr = seq ["str1"] VerifySeqsEqual expectedStr resultStr - + // null Seq let resultNull = Seq.singleton null let expectedNull = seq [null] VerifySeqsEqual expectedNull resultNull () - - + + [] member _.Skip() = - + // integer Seq let resultInt = Seq.skip 2 (seq [1;2;3;4]) let expectedInt = seq [3;4] VerifySeqsEqual expectedInt resultInt - + // string Seq let resultStr =Seq.skip 2 (seq ["str1";"str2";"str3";"str4"]) let expectedStr = seq ["str3";"str4"] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.skip 0 Seq.empty + + // empty Seq + let resultEpt = Seq.skip 0 Seq.empty VerifySeqsEqual resultEpt Seq.empty - - + + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.skip 1 null |> ignore) () - + [] member _.Skip_While() = - + // integer Seq let funcInt x = (x < 3) let resultInt = Seq.skipWhile funcInt (seq [1;2;3;4;5;6]) let expectedInt = seq [3;4;5;6] VerifySeqsEqual expectedInt resultInt - + // string Seq let funcStr (x:string) = x.Contains(".") let resultStr =Seq.skipWhile funcStr (seq [".";"asdfasdf.asdfasdf";"";"";"";"";"";"";"";"";""]) let expectedStr = seq ["";"";"";"";"";"";"";"";""] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.skipWhile funcInt Seq.empty + + // empty Seq + let resultEpt = Seq.skipWhile funcInt Seq.empty VerifySeqsEqual resultEpt Seq.empty - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.skipWhile funcInt null |> ignore) () - + [] member _.Sort() = @@ -1323,21 +1323,21 @@ type SeqModule2() = let resultInt = Seq.sort (seq [1;3;2;4;6;5;7]) let expectedInt = seq {1..7} VerifySeqsEqual expectedInt resultInt - + // string Seq - + let resultStr =Seq.sort (seq ["str1";"str3";"str2";"str4"]) let expectedStr = seq ["str1";"str2";"str3";"str4"] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.sort Seq.empty + + // empty Seq + let resultEpt = Seq.sort Seq.empty VerifySeqsEqual resultEpt Seq.empty - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.sort null |> ignore) () - + [] member _.SortBy() = @@ -1346,18 +1346,18 @@ type SeqModule2() = let resultInt = Seq.sortBy funcInt (seq [1;2;4;5;7]) let expectedInt = seq [5;4;7;2;1] VerifySeqsEqual expectedInt resultInt - + // string Seq let funcStr (x:string) = x.IndexOf("key") let resultStr =Seq.sortBy funcStr (seq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) - + let expectedStr = seq ["(key)str";"s(key)tr";"st(key)r";"str(key)"] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.sortBy funcInt Seq.empty + + // empty Seq + let resultEpt = Seq.sortBy funcInt Seq.empty VerifySeqsEqual resultEpt Seq.empty - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.sortBy funcInt null |> ignore) () @@ -1373,23 +1373,23 @@ type SeqModule2() = yield Int32.MinValue } VerifySeqsEqual expectedInt resultInt - + // string Seq - + let resultStr = Seq.sortDescending (seq ["str1";null;"str3";"";"Str1";"str2";"str4"]) let expectedStr = seq ["str4";"str3";"str2";"str1";"Str1";"";null] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.sortDescending Seq.empty + + // empty Seq + let resultEpt = Seq.sortDescending Seq.empty VerifySeqsEqual resultEpt Seq.empty // tuple Seq let tupSeq = (seq [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) let resultTup = Seq.sortDescending tupSeq - let expectedTup = (seq [(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")]) + let expectedTup = (seq [(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")]) VerifySeqsEqual expectedTup resultTup - + // float Seq let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon let floatSeq = seq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] @@ -1400,7 +1400,7 @@ type SeqModule2() = // null Seq CheckThrowsArgumentNullException(fun() -> Seq.sort null |> ignore) () - + [] member _.SortByDescending() = @@ -1409,24 +1409,24 @@ type SeqModule2() = let resultInt = Seq.sortByDescending funcInt (seq [1;2;4;5;7]) let expectedInt = seq [1;2;7;4;5] VerifySeqsEqual expectedInt resultInt - + // string Seq let funcStr (x:string) = x.IndexOf("key") let resultStr =Seq.sortByDescending funcStr (seq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) - + let expectedStr = seq ["str(key)";"st(key)r";"s(key)tr";"(key)str"] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.sortByDescending funcInt Seq.empty + + // empty Seq + let resultEpt = Seq.sortByDescending funcInt Seq.empty VerifySeqsEqual resultEpt Seq.empty // tuple Seq let tupSeq = (seq [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) - let resultTup = Seq.sortByDescending snd tupSeq + let resultTup = Seq.sortByDescending snd tupSeq let expectedTup = (seq [(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")]) VerifySeqsEqual expectedTup resultTup - + // float Seq let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon let floatSeq = seq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] @@ -1437,7 +1437,7 @@ type SeqModule2() = // null Seq CheckThrowsArgumentNullException(fun() -> Seq.sortByDescending funcInt null |> ignore) () - + member _.SortWith() = // integer Seq @@ -1462,179 +1462,179 @@ type SeqModule2() = [] member _.Sum() = - + // integer Seq let resultInt = Seq.sum (seq [1..10]) Assert.AreEqual(55,resultInt) - + // float32 Seq let floatSeq = (seq [ 1.2f;3.5f;6.7f ]) let resultFloat = Seq.sum floatSeq if resultFloat <> 11.4f then Assert.Fail() - + // double Seq let doubleSeq = (seq [ 1.0;8.0 ]) let resultDouble = Seq.sum doubleSeq if resultDouble <> 9.0 then Assert.Fail() - + // decimal Seq let decimalSeq = (seq [ 0M;19M;19.03M ]) let resultDecimal = Seq.sum decimalSeq - if resultDecimal <> 38.03M then Assert.Fail() - - + if resultDecimal <> 38.03M then Assert.Fail() + + // empty float32 Seq - let emptyFloatSeq = Seq.empty - let resultEptFloat = Seq.sum emptyFloatSeq + let emptyFloatSeq = Seq.empty + let resultEptFloat = Seq.sum emptyFloatSeq if resultEptFloat <> 0.0f then Assert.Fail() - + // empty double Seq - let emptyDoubleSeq = Seq.empty - let resultDouEmp = Seq.sum emptyDoubleSeq + let emptyDoubleSeq = Seq.empty + let resultDouEmp = Seq.sum emptyDoubleSeq if resultDouEmp <> 0.0 then Assert.Fail() - + // empty decimal Seq - let emptyDecimalSeq = Seq.empty - let resultDecEmp = Seq.sum emptyDecimalSeq + let emptyDecimalSeq = Seq.empty + let resultDecEmp = Seq.sum emptyDecimalSeq if resultDecEmp <> 0M then Assert.Fail() - + () - + [] member _.SumBy() = // integer Seq let resultInt = Seq.sumBy int (seq [1..10]) Assert.AreEqual(55,resultInt) - + // float32 Seq let floatSeq = (seq [ 1.2f;3.5f;6.7f ]) let resultFloat = Seq.sumBy float32 floatSeq if resultFloat <> 11.4f then Assert.Fail() - + // double Seq let doubleSeq = (seq [ 1.0;8.0 ]) let resultDouble = Seq.sumBy double doubleSeq if resultDouble <> 9.0 then Assert.Fail() - + // decimal Seq let decimalSeq = (seq [ 0M;19M;19.03M ]) let resultDecimal = Seq.sumBy decimal decimalSeq - if resultDecimal <> 38.03M then Assert.Fail() + if resultDecimal <> 38.03M then Assert.Fail() // empty float32 Seq - let emptyFloatSeq = Seq.empty - let resultEptFloat = Seq.sumBy float32 emptyFloatSeq + let emptyFloatSeq = Seq.empty + let resultEptFloat = Seq.sumBy float32 emptyFloatSeq if resultEptFloat <> 0.0f then Assert.Fail() - + // empty double Seq - let emptyDoubleSeq = Seq.empty - let resultDouEmp = Seq.sumBy double emptyDoubleSeq + let emptyDoubleSeq = Seq.empty + let resultDouEmp = Seq.sumBy double emptyDoubleSeq if resultDouEmp <> 0.0 then Assert.Fail() - + // empty decimal Seq - let emptyDecimalSeq = Seq.empty - let resultDecEmp = Seq.sumBy decimal emptyDecimalSeq + let emptyDecimalSeq = Seq.empty + let resultDecEmp = Seq.sumBy decimal emptyDecimalSeq if resultDecEmp <> 0M then Assert.Fail() - + () - + [] member _.Take() = // integer Seq - + let resultInt = Seq.take 3 (seq [1;2;4;5;7]) - + let expectedInt = seq [1;2;4] VerifySeqsEqual expectedInt resultInt - + // string Seq - + let resultStr =Seq.take 2(seq ["str1";"str2";"str3";"str4"]) - + let expectedStr = seq ["str1";"str2"] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.take 0 Seq.empty - + + // empty Seq + let resultEpt = Seq.take 0 Seq.empty + VerifySeqsEqual resultEpt Seq.empty - - + + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.take 1 null |> ignore) () - + [] member _.takeWhile() = // integer Seq let funcInt x = (x < 6) let resultInt = Seq.takeWhile funcInt (seq [1;2;4;5;6;7]) - + let expectedInt = seq [1;2;4;5] VerifySeqsEqual expectedInt resultInt - + // string Seq let funcStr (x:string) = (x.Length < 4) let resultStr =Seq.takeWhile funcStr (seq ["a"; "ab"; "abc"; "abcd"; "abcde"]) - + let expectedStr = seq ["a"; "ab"; "abc"] VerifySeqsEqual expectedStr resultStr - - // empty Seq - let resultEpt = Seq.takeWhile funcInt Seq.empty + + // empty Seq + let resultEpt = Seq.takeWhile funcInt Seq.empty VerifySeqsEqual resultEpt Seq.empty - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.takeWhile funcInt null |> ignore) () - + [] member _.ToArray() = // integer Seq let resultInt = Seq.toArray(seq [1;2;4;5;7]) - + let expectedInt = [|1;2;4;5;7|] Assert.AreEqual(expectedInt,resultInt) // string Seq let resultStr =Seq.toArray (seq ["str1";"str2";"str3"]) - + let expectedStr = [|"str1";"str2";"str3"|] Assert.AreEqual(expectedStr,resultStr) - - // empty Seq - let resultEpt = Seq.toArray Seq.empty + + // empty Seq + let resultEpt = Seq.toArray Seq.empty Assert.AreEqual([||],resultEpt) - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.toArray null |> ignore) () - - [] + + [] member _.ToArrayFromICollection() = let inputCollection = ResizeArray(seq [1;2;4;5;7]) let resultInt = Seq.toArray(inputCollection) let expectedInt = [|1;2;4;5;7|] - Assert.AreEqual(expectedInt,resultInt) - - [] + Assert.AreEqual(expectedInt,resultInt) + + [] member _.ToArrayEmptyInput() = let resultInt = Seq.toArray(Seq.empty) let expectedInt = Array.empty - Assert.AreEqual(expectedInt,resultInt) + Assert.AreEqual(expectedInt,resultInt) - [] + [] member _.ToArrayFromArray() = let resultInt = Seq.toArray([|1;2;4;5;7|]) let expectedInt = [|1;2;4;5;7|] - Assert.AreEqual(expectedInt,resultInt) - - [] + Assert.AreEqual(expectedInt,resultInt) + + [] member _.ToArrayFromList() = let resultInt = Seq.toArray([1;2;4;5;7]) let expectedInt = [|1;2;4;5;7|] - Assert.AreEqual(expectedInt,resultInt) + Assert.AreEqual(expectedInt,resultInt) [] member _.ToList() = @@ -1642,16 +1642,16 @@ type SeqModule2() = let resultInt = Seq.toList (seq [1;2;4;5;7]) let expectedInt = [1;2;4;5;7] Assert.AreEqual(expectedInt,resultInt) - + // string Seq let resultStr =Seq.toList (seq ["str1";"str2";"str3"]) let expectedStr = ["str1";"str2";"str3"] Assert.AreEqual(expectedStr,resultStr) - - // empty Seq - let resultEpt = Seq.toList Seq.empty + + // empty Seq + let resultEpt = Seq.toList Seq.empty Assert.AreEqual([],resultEpt) - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.toList null |> ignore) () @@ -1687,16 +1687,16 @@ type SeqModule2() = let resultInt = Seq.truncate 3 (seq [1;2;4;5;7]) let expectedInt = [1;2;4] VerifySeqsEqual expectedInt resultInt - + // string Seq let resultStr =Seq.truncate 2 (seq ["str1";"str2";"str3"]) let expectedStr = ["str1";"str2"] VerifySeqsEqual expectedStr resultStr - - // empty Seq + + // empty Seq let resultEpt = Seq.truncate 0 Seq.empty VerifySeqsEqual Seq.empty resultEpt - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.truncate 1 null |> ignore) @@ -1705,34 +1705,34 @@ type SeqModule2() = VerifySeqsEqual Seq.empty <| Seq.truncate System.Int32.MinValue (seq [1;2;4;5;7]) () - + [] member _.tryFind() = // integer Seq let resultInt = Seq.tryFind (fun x -> (x%2=0)) (seq [1;2;4;5;7]) Assert.AreEqual(Some(2), resultInt) - + // integer Seq - None let resultInt = Seq.tryFind (fun x -> (x%2=0)) (seq [1;3;5;7]) Assert.AreEqual(None, resultInt) - + // string Seq let resultStr = Seq.tryFind (fun (x:string) -> x.Contains("2")) (seq ["str1";"str2";"str3"]) Assert.AreEqual(Some("str2"),resultStr) - + // string Seq - None let resultStr = Seq.tryFind (fun (x:string) -> x.Contains("2")) (seq ["str1";"str4";"str3"]) Assert.AreEqual(None,resultStr) - - - // empty Seq + + + // empty Seq let resultEpt = Seq.tryFind (fun x -> (x%2=0)) Seq.empty Assert.AreEqual(None,resultEpt) // null Seq CheckThrowsArgumentNullException(fun() -> Seq.tryFind (fun x -> (x%2=0)) null |> ignore) () - + [] member _.TryFindBack() = // integer Seq @@ -1765,28 +1765,28 @@ type SeqModule2() = // integer Seq let resultInt = Seq.tryFindIndex (fun x -> (x % 5 = 0)) [8; 9; 10] Assert.AreEqual(Some(2), resultInt) - + // integer Seq - None let resultInt = Seq.tryFindIndex (fun x -> (x % 5 = 0)) [9;3;11] Assert.AreEqual(None, resultInt) - + // string Seq let resultStr = Seq.tryFindIndex (fun (x:string) -> x.Contains("2")) ["str1"; "str2"; "str3"] Assert.AreEqual(Some(1),resultStr) - + // string Seq - None let resultStr = Seq.tryFindIndex (fun (x:string) -> x.Contains("2")) ["str1"; "str4"; "str3"] Assert.AreEqual(None,resultStr) - - - // empty Seq + + + // empty Seq let resultEpt = Seq.tryFindIndex (fun x -> (x%2=0)) Seq.empty Assert.AreEqual(None, resultEpt) - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.tryFindIndex (fun x -> (x % 2 = 0)) null |> ignore) () - + [] member _.TryFindIndexBack() = @@ -1817,17 +1817,17 @@ type SeqModule2() = [] member _.Unfold() = // integer Seq - + let resultInt = Seq.unfold (fun x -> if x = 1 then Some(7,2) else None) 1 - + VerifySeqsEqual (seq [7]) resultInt - + // string Seq let resultStr =Seq.unfold (fun (x:string) -> if x.Contains("unfold") then Some("a","b") else None) "unfold" VerifySeqsEqual (seq ["a"]) resultStr () - - + + [] member _.Windowed() = @@ -1835,7 +1835,7 @@ type SeqModule2() = try config.InputSeq |> Seq.windowed config.WindowSize - |> VerifySeqsEqual config.ExpectedSeq + |> VerifySeqsEqual config.ExpectedSeq with | _ when Option.isNone config.Exception -> Assert.Fail() | e when e.GetType() = (Option.get config.Exception) -> () @@ -1891,78 +1891,78 @@ type SeqModule2() = } |> testWindowed () - + [] member _.Zip() = - + // integer Seq let resultInt = Seq.zip (seq [1..7]) (seq [11..17]) - let expectedInt = + let expectedInt = seq { for i in 1..7 do yield i, i+10 } VerifySeqsEqual expectedInt resultInt - + // string Seq let resultStr =Seq.zip (seq ["str3";"str4"]) (seq ["str1";"str2"]) let expectedStr = seq ["str3","str1";"str4","str2"] VerifySeqsEqual expectedStr resultStr - - // empty Seq + + // empty Seq let resultEpt = Seq.zip Seq.empty Seq.empty VerifySeqsEqual Seq.empty resultEpt - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.zip null null |> ignore) CheckThrowsArgumentNullException(fun() -> Seq.zip null (seq [1..7]) |> ignore) CheckThrowsArgumentNullException(fun() -> Seq.zip (seq [1..7]) null |> ignore) () - + [] member _.Zip3() = // integer Seq let resultInt = Seq.zip3 (seq [1..7]) (seq [11..17]) (seq [21..27]) - let expectedInt = + let expectedInt = seq { for i in 1..7 do yield i, (i + 10), (i + 20) } VerifySeqsEqual expectedInt resultInt - + // string Seq let resultStr =Seq.zip3 (seq ["str1";"str2"]) (seq ["str11";"str12"]) (seq ["str21";"str22"]) let expectedStr = seq ["str1","str11","str21";"str2","str12","str22" ] VerifySeqsEqual expectedStr resultStr - - // empty Seq + + // empty Seq let resultEpt = Seq.zip3 Seq.empty Seq.empty Seq.empty VerifySeqsEqual Seq.empty resultEpt - + // null Seq CheckThrowsArgumentNullException(fun() -> Seq.zip3 null null null |> ignore) CheckThrowsArgumentNullException(fun() -> Seq.zip3 null (seq [1..7]) (seq [1..7]) |> ignore) CheckThrowsArgumentNullException(fun() -> Seq.zip3 (seq [1..7]) null (seq [1..7]) |> ignore) CheckThrowsArgumentNullException(fun() -> Seq.zip3 (seq [1..7]) (seq [1..7]) null |> ignore) () - + [] member _.tryPick() = // integer Seq let resultInt = Seq.tryPick (fun x-> if x = 1 then Some("got") else None) (seq [1..5]) - + Assert.AreEqual(Some("got"),resultInt) - + // string Seq let resultStr = Seq.tryPick (fun x-> if x = "Are" then Some("got") else None) (seq ["Lists"; "Are"]) Assert.AreEqual(Some("got"),resultStr) - - // empty Seq + + // empty Seq let resultEpt = Seq.tryPick (fun x-> if x = 1 then Some("got") else None) Seq.empty Assert.Null(resultEpt) - + // null Seq - let nullSeq : seq<'a> = null + let nullSeq : seq<'a> = null let funcNull x = Some(1) - + CheckThrowsArgumentNullException(fun () -> Seq.tryPick funcNull nullSeq |> ignore) - + () [] @@ -1990,87 +1990,87 @@ type SeqModule2() = // Index greater than length let resultIndexGreater = Seq.tryItem 31 (seq { 10..20 }) Assert.AreEqual(None, resultIndexGreater) - + [] member _.RemoveAt() = // integer list Assert.AreEqual([2; 3; 4; 5], (Seq.removeAt 0 [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 4; 5], (Seq.removeAt 2 [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 3; 4], (Seq.removeAt 4 [1..5] |> Seq.toList)) - + //string list Assert.AreEqual(["2"; "3"; "4"; "5"], (Seq.removeAt 0 ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "4"; "5"], (Seq.removeAt 2 ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "3"; "4"], (Seq.removeAt 4 ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> Seq.removeAt 0 [] |> Seq.toList |> ignore) CheckThrowsArgumentException (fun () -> Seq.removeAt -1 [1] |> Seq.toList |> ignore) CheckThrowsArgumentException (fun () -> Seq.removeAt 2 [1] |> Seq.toList |> ignore) - + [] member _.RemoveManyAt() = // integer list Assert.AreEqual([3; 4; 5], (Seq.removeManyAt 0 2 [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 5], (Seq.removeManyAt 2 2 [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 3], (Seq.removeManyAt 3 2 [1..5] |> Seq.toList)) - + //string list Assert.AreEqual(["3"; "4"; "5"], (Seq.removeManyAt 0 2 ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "5"], (Seq.removeManyAt 2 2 ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "3"], (Seq.removeManyAt 3 2 ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> Seq.removeManyAt 0 2 [] |> Seq.toList |> ignore) CheckThrowsArgumentException (fun () -> Seq.removeManyAt -1 2 [1] |> Seq.toList |> ignore) CheckThrowsArgumentException (fun () -> Seq.removeManyAt 2 2 [1] |> Seq.toList |> ignore) - + [] member _.UpdateAt() = // integer list Assert.AreEqual([0; 2; 3; 4; 5], (Seq.updateAt 0 0 [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 0; 4; 5], (Seq.updateAt 2 0 [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 3; 4; 0], (Seq.updateAt 4 0 [1..5] |> Seq.toList)) - + //string list Assert.AreEqual(["0"; "2"; "3"; "4"; "5"], (Seq.updateAt 0 "0" ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "0"; "4"; "5"], (Seq.updateAt 2 "0" ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "3"; "4"; "0"], (Seq.updateAt 4 "0" ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) - + // empty list & out of bounds CheckThrowsArgumentException (fun () -> Seq.updateAt 0 0 [] |> Seq.toList |> ignore) CheckThrowsArgumentException (fun () -> Seq.updateAt -1 0 [1] |> Seq.toList |> ignore) CheckThrowsArgumentException (fun () -> Seq.updateAt 2 0 [1] |> Seq.toList |> ignore) - + [] member _.InsertAt() = // integer list Assert.AreEqual([0; 1; 2; 3; 4; 5], (Seq.insertAt 0 0 [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 0; 3; 4; 5], (Seq.insertAt 2 0 [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 3; 4; 0; 5], (Seq.insertAt 4 0 [1..5] |> Seq.toList)) - + //string list Assert.AreEqual(["0"; "1"; "2"; "3"; "4"; "5"], (List.insertAt 0 "0" ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "0"; "3"; "4"; "5"], (List.insertAt 2 "0" ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "3"; "4"; "0"; "5"], (List.insertAt 4 "0" ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) - + // empty list & out of bounds Assert.AreEqual([0], Seq.insertAt 0 0 [] |> Seq.toList) CheckThrowsArgumentException (fun () -> Seq.insertAt -1 0 [1] |> Seq.toList |> ignore) CheckThrowsArgumentException (fun () -> Seq.insertAt 2 0 [1] |> Seq.toList |> ignore) - + [] member _.InsertManyAt() = // integer list Assert.AreEqual([0; 0; 1; 2; 3; 4; 5], (Seq.insertManyAt 0 [0; 0] [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 0; 0; 3; 4; 5], (Seq.insertManyAt 2 [0; 0] [1..5] |> Seq.toList)) Assert.AreEqual([1; 2; 3; 4; 0; 0; 5], (Seq.insertManyAt 4 [0; 0] [1..5] |> Seq.toList)) - + //string list Assert.AreEqual(["0"; "0"; "1"; "2"; "3"; "4"; "5"], (Seq.insertManyAt 0 ["0"; "0"] ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "0"; "0"; "3"; "4"; "5"], (Seq.insertManyAt 2 ["0"; "0"] ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) Assert.AreEqual(["1"; "2"; "3"; "4"; "0"; "0"; "5"], (Seq.insertManyAt 4 ["0"; "0"] ["1"; "2"; "3"; "4"; "5"] |> Seq.toList)) - + // empty list & out of bounds Assert.AreEqual([0; 0], Seq.insertManyAt 0 [0; 0] [] |> Seq.toList) CheckThrowsArgumentException (fun () -> Seq.insertManyAt -1 [0; 0] [1] |> Seq.toList |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqProperties.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqProperties.fs index da19b1c37da..9e9802da498 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqProperties.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqProperties.fs @@ -24,17 +24,17 @@ type SeqProperties () = let indexed = xs |> Seq.indexed |> Seq.toList let sorted = indexed |> Seq.sortWith (fun x y -> compare (snd x) (snd y)) isStable sorted - + [] member this.``Seq.sortWithStable is stable`` () = Check.QuickThrowOnFailure this.sortWithStable Check.QuickThrowOnFailure this.sortWithStable - + member _.distinctByStable<'a when 'a : comparison> (xs : 'a []) = let indexed = xs |> Seq.indexed let sorted = indexed |> Seq.distinctBy snd isStable sorted - + [] member this.``Seq.distinctBy is stable`` () = Check.QuickThrowOnFailure this.distinctByStable diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs index 3c7e8d94949..2d6b9b5dbea 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs @@ -22,8 +22,8 @@ type SetModule() = [] member _.Empty() = let emptySet = Set.empty - if Set.count emptySet <> 0 then Assert.Fail() - + if Set.count emptySet <> 0 then Assert.Fail() + let c : Set = Set.empty let d : Set = Set.empty () @@ -33,10 +33,10 @@ type SetModule() = let intSingleton = Set.singleton 5 Assert.True(intSingleton.Count = 1) Assert.True(intSingleton.Contains(5)) - + let stringSingleton = Set.singleton (null) Assert.False(stringSingleton.Contains("")) - + [] member _.Add() = let empty = Set.empty @@ -44,11 +44,11 @@ type SetModule() = let xy = Set.add 'y' x let xyz = Set.add 'z' xy let wxyz = Set.add 'w' xyz - + Assert.True(Set.count xy = 2) Assert.True(Set.count xyz = 3) Assert.True(Set.count wxyz = 4) - + [] member _.Contains() = // Empty set searching for null = false @@ -61,48 +61,48 @@ type SetModule() = let odds = new Set([1 .. 2 .. 11]) if Set.contains 6 odds <> false then Assert.Fail() () - + [] - member _.Count() = + member _.Count() = let empty = Set.empty if Set.count empty <> 0 then Assert.Fail() - + let one = Set.add 1 empty if Set.count one <> 1 then Assert.Fail() - + let multi = new Set([| 'a' .. 'z' |]) if Set.count multi <> 26 then Assert.Fail() () - + [] - member _.Diff() = + member _.Diff() = // Given a large set and removing 0, 1, x elements... let alphabet = new Set([| 'a' .. 'z' |]) let emptyChar = Set.empty : Set - + let removeEmpty = alphabet - emptyChar if (alphabet = removeEmpty) <> true then Assert.Fail() - + let number = Set.singleton '1' let removeNumber = alphabet - number if (alphabet = removeNumber) <> true then Assert.Fail() - + let vowels = new Set([| 'a'; 'e'; 'i'; 'o'; 'u' |]) let noVowels = alphabet - vowels if noVowels.Count <> 21 then Assert.Fail() - + // Give a set of 0, 1, x elements remove some other set let odds = new Set([1 .. 2 .. 10]) let evens = new Set([2 .. 2 .. 10]) - + let emptyNum = Set.empty : Set - let removeOddsFromEmpty = emptyNum - odds + let removeOddsFromEmpty = emptyNum - odds if (emptyNum = removeOddsFromEmpty) <> true then Assert.Fail() - + let one = Set.singleton 1 let removeOddsFrom1 = one - odds if (removeOddsFrom1 = emptyNum) <> true then Assert.Fail() - + let evensSansOdds = evens - odds if (evensSansOdds = evens) <> true then Assert.Fail() () @@ -112,22 +112,22 @@ type SetModule() = let emptySet1 : Set = Set.empty let emptySet2 : Set = Set.empty if (emptySet1 = emptySet2) <> true then Assert.Fail() - + let a = new Set([1; 2; 3; 4; 5]) let b = new Set([1; 3; 5]) - + if (a = b) <> false then Assert.Fail() - + let a = a |> Set.remove 2 |> Set.remove 4 if (a = b) <> true then Assert.Fail() () - + [] member _.Compare() = // Comparing empty sets let emptyString1 = Set.empty : Set let emptyString2 = Set.empty : Set - + if compare emptyString1 emptyString1 <> 0 then Assert.Fail() if compare emptyString1 emptyString2 <> 0 then Assert.Fail() @@ -142,7 +142,7 @@ type SetModule() = // Comparing multi-element sets let alphabet = new Set(['a' .. 'z']) let vowels = new Set(['a'; 'e'; 'i'; 'o'; 'u']) - + let noVowelAlpha = alphabet - vowels if compare noVowelAlpha alphabet <> 1 then Assert.Fail() if compare alphabet alphabet <> 0 then Assert.Fail() @@ -152,81 +152,81 @@ type SetModule() = [] member _.Exists() = - + let emptyInt = Set.empty : Set if Set.exists (fun _ -> true) emptyInt <> false then Assert.Fail() - + let x = Set.singleton 'x' if Set.exists (fun c -> c = 'x') x <> true then Assert.Fail() if Set.exists (fun c -> c <> 'x') x <> false then Assert.Fail() - + let letNumPairs = new Set([("one", 1); ("two", 2); ("three", 3)]) if Set.exists (fun (text, num) -> text = "one" && num = 1) letNumPairs <> true then Assert.Fail() if Set.exists (fun (text, num) -> text = "four") letNumPairs <> false then Assert.Fail() () - + [] member _.Filter() = - + let emptyComplex = Set.empty : Set> * Set> - let filteredEmpty = Set.filter (fun _ -> false) emptyComplex + let filteredEmpty = Set.filter (fun _ -> false) emptyComplex if (filteredEmpty = emptyComplex) <> true then Assert.Fail() - + let nullSet = Set.singleton null if nullSet.Count <> 1 then Assert.Fail() let filteredNull = Set.filter (fun x -> x <> null) nullSet if filteredNull.Count <> 0 then Assert.Fail() - + let digits = new Set([1 .. 10]) let evens = new Set([2 .. 2 .. 10]) let filteredDigits = Set.filter(fun i -> i % 2 = 0) digits if (filteredDigits = evens) <> true then Assert.Fail() () - + [] member _.Map() = let emptySet : Set = Set.empty - + let result = Set.map (fun _ -> Assert.Fail(); "") emptySet if (emptySet = result) <> true then Assert.Fail() - + let alphabet = new Set<_>(['a' .. 'z']) let capped = Set.map (fun c -> Char.ToUpper(c)) alphabet - + if Set.exists (fun c -> c = Char.ToLower(c)) capped then Assert.Fail() () [] member _.Fold() = - + let emptySet : Set = Set.empty let result = Set.fold (fun _ _ -> Assert.Fail(); -1I) 0I emptySet if result <> 0I then Assert.Fail() - + let mutable callOrder = ([] : (int * int) list) let input = new Set<_>([1; 2; 3; 4; 5]) - - let result = Set.fold - (fun acc i -> callOrder <- (acc, i) :: callOrder; acc + i) - 0 + + let result = Set.fold + (fun acc i -> callOrder <- (acc, i) :: callOrder; acc + i) + 0 input if result <> 15 then Assert.Fail() if callOrder <> [(10, 5); (6, 4); (3, 3); (1, 2); (0, 1)] then Assert.Fail() () - + [] member _.FoldBack() = - + let emptySet : Set = Set.empty let result = Set.foldBack (fun _ _ -> Assert.Fail(); -1I) emptySet 0I if result <> 0I then Assert.Fail() - + let mutable callOrder = ([] : (int * int) list) let input = new Set<_>([1; 2; 3; 4; 5]) - + let result = Set.foldBack - (fun i acc -> callOrder <- (acc, i) :: callOrder; acc + i) + (fun i acc -> callOrder <- (acc, i) :: callOrder; acc + i) input 0 if result <> 15 then Assert.Fail() @@ -239,7 +239,7 @@ type SetModule() = let emptySet : Set = Set.empty let result = Set.forall (fun x -> Assert.Fail(); false) emptySet if result <> true then Assert.Fail() - + let seta = new Set<_>( [1 .. 99] |> List.map (fun i -> i.ToString()) ) let result = seta |> Set.forall (fun str -> str.Length < 3) Assert.True(result) @@ -251,31 +251,31 @@ type SetModule() = [] member _.Intersect() = - + let emptySet1 : Set = Set.empty let emptySet2 : Set = Set.empty let four = Set.singleton 4 - + let emptyInterEmpty = Set.intersect emptySet1 emptySet2 Assert.True( (emptyInterEmpty = emptySet1) ) - + let xInterEmpty = Set.intersect four emptySet1 Assert.False( (four = xInterEmpty) ) - + let emptyInterX = Set.intersect emptySet1 four Assert.False( (four = emptyInterX) ) () - + [] member _.Intersect2() = let a = new Set([3; 4; 5; 6]) let b = new Set([5; 6; 7; 8]) - + let intersection = Set.intersect a b let expectedResult = new Set([5; 6]) Assert.True( (intersection = expectedResult) ) - + [] member _.IntersectMany() = (* IntersectAll @@ -285,25 +285,25 @@ type SetModule() = 4567 567 67 *) - let setsToIntersect = + let setsToIntersect = [ for i = 1 to 6 do yield new Set([i .. 7]) ] - + let result = Set.intersectMany setsToIntersect Assert.True(result.Count = 2) - - let contains x s = s |> Set.exists (fun i -> i = x) + + let contains x s = s |> Set.exists (fun i -> i = x) Assert.True(contains 6 result) Assert.True(contains 7 result) - + [] member _.IntersectMany2() = let all = new Set<_>([1 .. 10]) let odds = new Set<_>([1 .. 2 .. 10]) let evens = new Set<_>([2 .. 2 .. 10]) - + let result = Set.intersectMany [odds; evens; all] Assert.True(Set.count result = 0) @@ -311,11 +311,11 @@ type SetModule() = member _.IntersectMany3() = let all = new Set<_>([1 .. 10]) let empty = Set.empty : Set - + let result = Set.intersectMany [all; empty; all] Assert.True(Set.count result = 0) - - + + [] member _.IntersectMany4() = CheckThrowsArgumentException (fun () -> Set.intersectMany (Seq.empty : seq>) |> ignore) @@ -326,36 +326,36 @@ type SetModule() = let emptySet1 : Set = Set.empty let emptySet2 : Set = Set.empty let four = Set.singleton 4 - + let emptyUnionEmpty = Set.union emptySet1 emptySet2 Assert.True( (emptyUnionEmpty = emptySet1) ) - + let xUnionEmpty = Set.union four emptySet1 Assert.True( (four = xUnionEmpty) ) - + let emptyUnionX = Set.union emptySet1 four Assert.True( (four = emptyUnionX) ) () - + [] member _.Union2() = let a = new Set([1; 2; 3; 4]) let b = new Set([5; 6; 7; 8]) - + let union = Set.union a b let expectedResult = new Set([1 .. 8]) Assert.True( (union = expectedResult) ) [] member _.Union3() = - let x = + let x = Set.singleton 1 |> Set.union (Set.singleton 1) |> Set.union (Set.singleton 1) |> Set.union (Set.singleton 1) - + Assert.True(x.Count = 1) - + [] member _.UnionMany() = let odds = new Set([1 .. 2 .. 10]) @@ -363,7 +363,7 @@ type SetModule() = let empty = Set.empty : Set let rest = new Set([11 .. 19]) let zero = Set.singleton 0 - + let result = Set.unionMany [odds; evens; empty; rest; zero] Assert.True(result.Count = 20) @@ -371,20 +371,20 @@ type SetModule() = member _.UnionMany2() = let result = Set.unionMany (Seq.empty : seq>) Assert.True(result.Count = 0) - + [] member _.IsEmpty() = let zero = Set.empty : Set let zero2 = new Set([]) let one = Set.singleton "foo" let n = new Set<_>( [1 .. 10] ) - + Assert.True(Set.isEmpty zero) Assert.True(Set.isEmpty zero2) - + Assert.False(Set.isEmpty one) Assert.False(Set.isEmpty n) - + [] member _.Iter() = @@ -393,26 +393,26 @@ type SetModule() = // Full set let elements = [| for i = 0 to 9 do yield false |] - + let set = new Set<_>(['0' .. '9']) Set.iter (fun c -> let i = int c - int '0' elements.[i] <- true) set - + Assert.True (Array.forall ( (=) true ) elements) [] member _.Partition() = - + // Empty let resulta, resultb = Set.partition (fun (x : int) -> Assert.Fail(); false) Set.empty Assert.True(resulta.Count = 0 && resultb.Count = 0) // One let single = Set.singleton "foo" - + let resulta, resultb = Set.partition (fun (str : string) -> str.Length <> 3) single Assert.True(resulta.Count = 0 && resultb.Count = 1) - + let resulta, resultb = Set.partition (fun (str : string) -> str.Length = 3) single Assert.True(resulta.Count = 1 && resultb.Count = 0) @@ -486,43 +486,43 @@ type SetModule() = [] member _.Remove() = - + let emptySet : Set = Set.empty let result = Set.remove 42 emptySet Assert.True(result.Count = 0) - + // One let single = Set.singleton 100I let resulta = Set.remove 100I single let resultb = Set.remove 1I single - + Assert.True (resulta.Count = 0) Assert.True (resultb.Count = 1) - + // Multi let a = new Set([1 .. 5]) Assert.True(a.Count = 5) - + let b = Set.remove 3 a Assert.True(b.Count = 4) // Call again, double delete let c = Set.remove 3 b Assert.True(c.Count = 4) - + Assert.False(Set.exists ( (=) 3 ) c) [] member _.Of_List() = - + // Empty let emptySet = Set.ofList ([] : (string * int * Set) list) Assert.True(Set.isEmpty emptySet) - + // Single let single = Set.ofList [1] Assert.True(single.Count = 1) Assert.True(Set.exists ( (=) 1 ) single) - + // Multi let multi = Set.ofList ["mon"; "tue"; "wed"; "thu"; "fri"] Assert.True(multi.Count = 5) @@ -535,27 +535,27 @@ type SetModule() = // Empty let emptySet : Set = Set.empty Assert.True(Set.toList emptySet = []) - + // Single let single = Set.singleton "stuff" Assert.True(Set.toList single = ["stuff"]) - + // Multi let multi = new Set<_>([5; 2; 3; 1; 4]) Assert.True(Set.toList multi = [1; 2; 3; 4; 5]) [] member _.Of_Array() = - + // Empty let emptySet = Set.ofArray ([| |] : (string * int * Set) []) Assert.True(Set.isEmpty emptySet) - + // Single let single = Set.ofArray [| 1 |] Assert.True(single.Count = 1) Assert.True(Set.exists ( (=) 1 ) single) - + // Multi let multi = Set.ofArray [| "mon"; "tue"; "wed"; "thu"; "fri" |] Assert.True(multi.Count = 5) @@ -568,11 +568,11 @@ type SetModule() = // Empty let emptySet : Set = Set.empty Assert.True(Set.toArray emptySet = [| |]) - + // Single let single = Set.singleton "stuff" Assert.True(Set.toArray single = [| "stuff" |]) - + // Multi let multi = new Set<_>([5; 2; 3; 1; 4]) Assert.True(Set.toArray multi = [| 1; 2; 3; 4; 5 |]) @@ -580,16 +580,16 @@ type SetModule() = [] member _.Of_Seq() = - + // Empty let emptySet = Set.ofSeq ([| |] : (string * int * Set) []) Assert.True(Set.isEmpty emptySet) - + // Single let single = Set.ofSeq [ 1 ] Assert.True(single.Count = 1) Assert.True(Set.exists ( (=) 1 ) single) - + // Multi let multi = Set.ofSeq [| "mon"; "tue"; "wed"; "thu"; "fri" |] Assert.True(multi.Count = 5) @@ -603,46 +603,46 @@ type SetModule() = let emptySet : Set = Set.empty let emptySeq = Set.toSeq emptySet Assert.True (Seq.length emptySeq = 0) - + // Single let single = Set.singleton "stuff" let singleSeq = Set.toSeq single Assert.True(Seq.toList singleSeq = [ "stuff" ]) - + // Multi let multi = new Set<_>([5; 2; 3; 1; 4]) let multiSeq = Set.toSeq multi Assert.True(Seq.toList multiSeq = [ 1; 2; 3; 4; 5 ]) - + [] member _.MinElement() = - + // Check for an argument exception "Set contains no members" CheckThrowsArgumentException(fun () -> Set.minElement Set.empty |> ignore) - + let set1 = Set.ofList [10; 8; 100; 1; 50] Assert.AreEqual(Set.minElement set1, 1) - + let set2 = Set.ofList ["abcd"; "a"; "abc"; "ab"] Assert.AreEqual(Set.minElement set2, "a") - + [] member _.MaxElement() = - + // Check for an argument exception "Set contains no members" CheckThrowsArgumentException(fun () -> Set.maxElement Set.empty |> ignore) - + let set1 = Set.ofList [10; 8; 100; 1; 50] Assert.AreEqual(Set.maxElement set1, 100) - + let set2 = Set.ofList ["abcd"; "a"; "abc"; "ab"] Assert.AreEqual(Set.maxElement set2, "abcd") [] member _.IsProperSubset() = - + let set1 = Set.ofList [10; 8; 100] let set2 = Set.ofList [100] Assert.True(Set.isProperSubset set2 set1) @@ -652,7 +652,7 @@ type SetModule() = [] member _.IsProperSuperset() = - + let set1 = Set.ofList [10; 8; 100] let set2 = Set.ofList [100; 8] Assert.True(Set.isProperSuperset set1 set2) @@ -660,33 +660,33 @@ type SetModule() = Assert.False(Set.isProperSuperset Set.empty Set.empty) Assert.False(Set.isProperSuperset set1 set1) Assert.False(Set.isProperSuperset set2 set1) - + // ----- Not associated with a module function ----- [] member _.GeneralTest1() = - + // Returns a random permutation of integers between the two bounds. - let randomPermutation lowerBound upperBound = + let randomPermutation lowerBound upperBound = let items = System.Collections.Generic.List<_>([lowerBound .. upperBound]) let rng = new Random() - + let randomPermutation = new System.Collections.Generic.List() while items.Count > 0 do let idx = rng.Next() % items.Count let i = items.[idx] items.RemoveAt(idx) randomPermutation.Add(i) - + randomPermutation.ToArray() - + for i in 0..50 do let permutation = randomPermutation 0 i - + let mutable set : Set = Set.empty // Add permutation items to set in order - permutation |> Array.iter (fun i -> - set <- Set.add i set) + permutation |> Array.iter (fun i -> + set <- Set.add i set) // Check that the set equals the full list Assert.True(Set.toList set = [0 .. i]) // Remove items in permutation order, ensuring set is dealt with correctly @@ -699,4 +699,3 @@ type SetModule() = permutation () - \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs index 6cb7c9bc0f6..7f6802b08b8 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs @@ -12,11 +12,11 @@ open FSharp.Core.UnitTests.LibraryTestFx open Xunit -/// This type is used to verify that Set.intersect preserves the object identity (reference) -/// of the first set (S1). By overriding equality to only check the 'Id' field, +/// This type is used to verify that Set.intersect preserves the object identity (reference) +/// of the first set (S1). By overriding equality to only check the 'Id' field, /// we can create two objects that are "equal" but live in different memory locations. [] -type IntersectItem = +type IntersectItem = { Id: int; Tag: string } override x.Equals(obj) = match obj with @@ -57,25 +57,25 @@ type SetType() = Assert.AreEqual(enum.Current, 'c') Assert.AreEqual(enum.MoveNext(), false) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - + testStepping() enum.Reset() testStepping() - + // Empty IE let ie = (new Set([])) :> IEnumerable // Note no type args let enum = ie.GetEnumerator() - + CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(enum.MoveNext(), false) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) [] - member this.IEnumerable_T() = + member this.IEnumerable_T() = // Legit IE let ie =(new Set(['a'; 'b'; 'c'])) :> IEnumerable let enum = ie.GetEnumerator() - + let testStepping() = CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(enum.MoveNext(), true) @@ -86,58 +86,58 @@ type SetType() = Assert.AreEqual(enum.Current, 'c') Assert.AreEqual(enum.MoveNext(), false) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - + testStepping() enum.Reset() testStepping() - + // Empty IE - let ie = (new Set([])) :> IEnumerable + let ie = (new Set([])) :> IEnumerable let enum = ie.GetEnumerator() - + CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) Assert.AreEqual(enum.MoveNext(), false) CheckThrowsInvalidOperationExn(fun () -> enum.Current |> ignore) - - + + [] - member this.ICollection() = - // Legit IC + member this.ICollection() = + // Legit IC let ic = (new Set([1;2;3;4])) :> ICollection - let st = new Set([1;2;3;4]) - - Assert.True(ic.Contains(3)) + let st = new Set([1;2;3;4]) + + Assert.True(ic.Contains(3)) let newArr = Array.create 5 0 - ic.CopyTo(newArr,0) - Assert.True(ic.IsReadOnly) - + ic.CopyTo(newArr,0) + Assert.True(ic.IsReadOnly) + // Empty IC let ic = (new Set([])) :> ICollection - Assert.False(ic.Contains("A") ) + Assert.False(ic.Contains("A") ) let newArr = Array.create 5 "a" - ic.CopyTo(newArr,0) + ic.CopyTo(newArr,0) [] - member this.IReadOnlyCollection() = + member this.IReadOnlyCollection() = // Legit IROC let iroc = (new Set([1;2;3;4])) :> IReadOnlyCollection - Assert.AreEqual(iroc.Count, 4) - + Assert.AreEqual(iroc.Count, 4) + // Empty IROC let iroc = (new Set([])) :> IReadOnlyCollection Assert.AreEqual(iroc.Count, 0) - + [] - member this.IComparable() = + member this.IComparable() = // Legit IC - let ic = (new Set([1;2;3;4])) :> IComparable - Assert.AreEqual(ic.CompareTo(new Set([1;2;3;4])),0) - + let ic = (new Set([1;2;3;4])) :> IComparable + Assert.AreEqual(ic.CompareTo(new Set([1;2;3;4])),0) + // Empty IC - let ic = (new Set([])) :> IComparable + let ic = (new Set([])) :> IComparable Assert.AreEqual(ic.CompareTo(Set.empty),0) - - + + // Base class methods [] member this.ObjectGetHashCode() = @@ -145,14 +145,14 @@ type SetType() = let x = Set.ofList [1; 2; 3] let y = Set.ofList [3; 2; 1] Assert.AreEqual(x.GetHashCode(), y.GetHashCode()) - + [] member this.ObjectToString() = Assert.AreEqual("set [1; 2; 3; ... ]", (new Set([1;2;3;4])).ToString()) Assert.AreEqual("set []", (Set.empty).ToString()) Assert.AreEqual("set [1; 3]", (new Set([1M;3M])).ToString()) - - + + [] member this.ObjectEquals() = // All three are different references, but equality has been @@ -172,127 +172,127 @@ type SetType() = let b = Set.empty Assert.False( b.Equals(a) ) Assert.False( a.Equals(b) ) - + // Co/contra variance not supported let a = Set.empty let b = Set.empty Assert.False(a.Equals(b)) Assert.False(b.Equals(a)) - + // Self equality let a = new Set([1]) Assert.True( (a = a) ) Assert.True(a.Equals(a)) - + // Null - Assert.False(a.Equals(null)) - - + Assert.False(a.Equals(null)) + + // Instance methods [] - member this.Add() = + member this.Add() = let l = new Set([1 .. 10]) let ad = l.Add 88 Assert.True(ad.Contains(88)) - + let e : Set = Set.empty let ade = e.Add "A" Assert.True(ade.Contains("A")) - + let s = Set.singleton 168 let ads = s.Add 100 Assert.True(ads.Contains(100)) - + [] - member this.Contains() = + member this.Contains() = let i = new Set([1 .. 10]) Assert.True(i.Contains(8)) - + let e : Set = Set.empty Assert.False(e.Contains("A")) - + let s = Set.singleton 168 Assert.True(s.Contains(168)) - + [] - member this.Count() = + member this.Count() = let l = new Set([1 .. 10]) Assert.AreEqual(l.Count, 10) - + let e : Set = Set.empty Assert.AreEqual(e.Count, 0) - + let s = Set.singleton 'a' - Assert.AreEqual(s.Count, 1) - + Assert.AreEqual(s.Count, 1) + [] member this.IsEmpty() = let i = new Set([1 .. 10]) Assert.False(i.IsEmpty) - + let e : Set = Set.empty Assert.True(e.IsEmpty) - + let s = Set.singleton 168 - Assert.False(s.IsEmpty) - + Assert.False(s.IsEmpty) + [] member this.IsSubsetOf() = let fir = new Set([1 .. 20]) let sec = new Set([1 .. 10]) Assert.True(sec.IsSubsetOf(fir)) Assert.True(Set.isSubset sec fir) - + let e : Set = Set.empty Assert.True(e.IsSubsetOf(fir)) Assert.True(Set.isSubset e fir) - + let s = Set.singleton 8 - Assert.True(s.IsSubsetOf(fir)) + Assert.True(s.IsSubsetOf(fir)) Assert.True(Set.isSubset s fir) - + let s100 = set [0..100] let s101 = set [0..101] - for i = 0 to 100 do + for i = 0 to 100 do Assert.False( (set [-1..i]).IsSubsetOf s100) Assert.True( (set [0..i]).IsSubsetOf s100) Assert.True( (set [0..i]).IsProperSubsetOf s101) - - + + [] member this.IsSupersetOf() = let fir = new Set([1 .. 10]) let sec = new Set([1 .. 20]) Assert.True(sec.IsSupersetOf(fir)) Assert.True(Set.isSuperset sec fir) - + let e : Set = Set.empty Assert.False(e.IsSupersetOf(fir)) Assert.False(Set.isSuperset e fir) - + let s = Set.singleton 168 - Assert.False(s.IsSupersetOf(fir)) + Assert.False(s.IsSupersetOf(fir)) Assert.False(Set.isSuperset s fir) let s100 = set [0..100] let s101 = set [0..101] - for i = 0 to 100 do + for i = 0 to 100 do Assert.False( s100.IsSupersetOf (set [-1..i])) Assert.True( s100.IsSupersetOf (set [0..i])) Assert.True( s101.IsSupersetOf (set [0..i])) - + [] - member this.Remove() = + member this.Remove() = let i = new Set([1;2;3;4]) Assert.AreEqual(i.Remove 3,(new Set([1;2;4]))) - + let e : Set = Set.empty Assert.AreEqual(e.Remove "A", e) - + let s = Set.singleton 168 - Assert.AreEqual(s.Remove 168, Set.empty) - - + Assert.AreEqual(s.Remove 168, Set.empty) + + // Static methods [] member this.Addition() = @@ -300,16 +300,16 @@ type SetType() = let sec = new Set([2;4;6]) Assert.AreEqual(fir + sec, new Set([1;2;3;4;5;6])) Assert.AreEqual(Set.op_Addition(fir,sec), new Set([1;2;3;4;5;6])) - + let e : Set = Set.empty Assert.AreEqual(e + e, e) Assert.AreEqual(Set.op_Addition(e,e),e) - + let s1 = Set.singleton 8 let s2 = Set.singleton 6 Assert.AreEqual(s1 + s2, new Set([8;6])) Assert.AreEqual(Set.op_Addition(s1,s2), new Set([8;6])) - + [] member this.Subtraction() = @@ -318,18 +318,18 @@ type SetType() = Assert.AreEqual(fir - sec, new Set([1;3;5])) Assert.AreEqual(Set.difference fir sec, new Set([1;3;5])) Assert.AreEqual(Set.op_Subtraction(fir,sec), new Set([1;3;5])) - + let e : Set = Set.empty Assert.AreEqual(e - e, e) Assert.AreEqual(Set.difference e e, e) Assert.AreEqual(Set.op_Subtraction(e,e),e) - + let s1 = Set.singleton 8 let s2 = Set.singleton 6 Assert.AreEqual(s1 - s2, new Set([8])) Assert.AreEqual(Set.difference s1 s2, new Set([8])) Assert.AreEqual(Set.op_Subtraction(s1,s2), new Set([8])) - + [] member this.MinimumElement() = @@ -339,7 +339,7 @@ type SetType() = Assert.AreEqual(sec.MinimumElement, 2) Assert.AreEqual(Set.minElement fir, 1) Assert.AreEqual(Set.minElement sec, 2) - + [] member this.MaximumElement() = @@ -362,13 +362,13 @@ type SetType() = // 2. [Test Strategy] Single-element set & [Identity Property] let item1_S1 = { Id = 1; Tag = "From_S1" } let item1_S2 = { Id = 1; Tag = "From_S2" } - + let s1_single = Set.singleton item1_S1 let s2_single = Set.singleton item1_S2 - + let resSingle = Set.intersect s1_single s2_single Assert.Equal(1, resSingle.Count) - + // Identity Check: Must be EXACTLY the same object in memory as S1 let singleResult = Set.minElement resSingle Assert.True(Object.ReferenceEquals(singleResult, item1_S1), "Single-element identity failed: Reference must come from S1") @@ -380,14 +380,14 @@ type SetType() = // S1 is large: hits intersectionAuxFromSmall (The optimized path) let list1 = [ for i in 1..50 -> if i = 5 then item5_S1 else { Id = i; Tag = sprintf "L%d" i } ] let list2 = [ for i in 1..5 -> if i = 5 then item5_S2 else { Id = i; Tag = sprintf "R%d" i } ] - + let s1_large = Set.ofList list1 let s2_small = Set.ofList list2 - + let resMany = Set.intersect s1_large s2_small - - // Identity Check in Loop: - // We iterate through the result and ensure every common element + + // Identity Check in Loop: + // We iterate through the result and ensure every common element // has the physical reference from the first set (list1) resMany |> Set.iter (fun item -> let originalInS1 = list1 |> List.find (fun x -> x.Id = item.Id) @@ -398,11 +398,11 @@ type SetType() = // 4. [Reversed Size Case] (Standard Path Check) // S1 is small, S2 is large: hits intersectionAux (The standard path) let resReversed = Set.intersect s2_small s1_large - + // Find the specific item with ID 5 in the result let item5InResult = resReversed |> Set.filter (fun x -> x.Id = 5) |> Set.minElement - - // Identity Check: Since s2_small was the FIRST argument, + + // Identity Check: Since s2_small was the FIRST argument, // the result MUST contain item5_S2 (from s2_small) Assert.True(Object.ReferenceEquals(item5InResult, item5_S2), "Reversed path identity failed: Reference must come from s2_small") diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs index e960a5c5cb7..3a8e02bd7e3 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs @@ -23,7 +23,7 @@ type StringModule() = [] member _.Concat() = /// This tests the three paths of String.concat w.r.t. array, list, seq - let execTest f expected arg = + let execTest f expected arg = let r1 = f (List.toSeq arg) Assert.AreEqual(expected, r1) @@ -72,10 +72,10 @@ type StringModule() = let e2 = String.map (fun c -> c + char 1) "abcde" Assert.AreEqual("bcdef", e2) - let e3 = String.map (fun c -> c) null + let e3 = String.map (fun c -> c) null Assert.AreEqual("", e3) - let e4 = String.map (fun c -> c) String.Empty + let e4 = String.map (fun c -> c) String.Empty Assert.AreEqual("", e4) let e5 = String.map (fun _ -> 'B') "A" @@ -110,16 +110,16 @@ type StringModule() = let e4 = String.mapi (fun i c -> char(int c + i)) "hello" Assert.AreEqual("hfnos", e4) - let e5 = String.mapi (fun _ c -> c) null + let e5 = String.mapi (fun _ c -> c) null Assert.AreEqual("", e5) - let e6 = String.mapi (fun _ c -> c) String.Empty + let e6 = String.mapi (fun _ c -> c) String.Empty Assert.AreEqual("", e6) - let e7 = String.mapi (fun _ _ -> failwith "should not fail") null + let e7 = String.mapi (fun _ _ -> failwith "should not fail") null Assert.AreEqual("", e7) - let e8 = String.mapi (fun i _ -> if i = 1 then failwith "should not fail" else char i) "X" + let e8 = String.mapi (fun i _ -> if i = 1 then failwith "should not fail" else char i) "X" Assert.AreEqual("\u0000", e8) // side-effect and "order of operation" test @@ -133,7 +133,7 @@ type StringModule() = let e1 = String.filter (fun c -> true) "Taradiddle" Assert.AreEqual("Taradiddle", e1) - let e2 = String.filter (fun c -> true) null + let e2 = String.filter (fun c -> true) null Assert.AreEqual("", e2) let e3 = String.filter Char.IsUpper "How Vexingly Quick Daft Zebras Jump!" @@ -157,7 +157,7 @@ type StringModule() = let e2 = String.collect (fun c -> null) "hello" Assert.AreEqual("", e2) - let e3 = String.collect (fun c -> "") null + let e3 = String.collect (fun c -> "") null Assert.AreEqual("", e3) [] @@ -174,7 +174,7 @@ type StringModule() = CheckThrowsArgumentException(fun () -> String.init -1 (fun c -> "") |> ignore) [] - member _.Replicate() = + member _.Replicate() = let e1 = String.replicate 0 "Snickersnee" Assert.AreEqual("", e1) @@ -214,7 +214,7 @@ type StringModule() = CheckThrowsArgumentException(fun () -> String.replicate -1 "foo" |> ignore) [] - member _.Forall() = + member _.Forall() = let e1 = String.forall (fun c -> true) "" Assert.AreEqual(true, e1) @@ -230,11 +230,11 @@ type StringModule() = let e5 = String.forall (fun c -> true) (String.replicate 1000000 "x") Assert.AreEqual(true, e5) - let e6 = String.forall (fun c -> false) null + let e6 = String.forall (fun c -> false) null Assert.AreEqual(true, e6) [] - member _.Exists() = + member _.Exists() = let e1 = String.exists (fun c -> true) "" Assert.AreEqual(false, e1) @@ -251,7 +251,7 @@ type StringModule() = Assert.AreEqual(false, e5) [] - member _.Length() = + member _.Length() = let e1 = String.length "" Assert.AreEqual(0, e1) @@ -262,7 +262,7 @@ type StringModule() = Assert.AreEqual(0, e3) [] - member _.``Slicing with both index reverse behaves as expected``() = + member _.``Slicing with both index reverse behaves as expected``() = let str = "abcde" Assert.AreEqual(str.[^3..^1], str.[1..3]) @@ -273,8 +273,8 @@ type StringModule() = Assert.AreEqual(str.[^1], 'd') - [] - member _.SlicingUnboundedEnd() = + [] + member _.SlicingUnboundedEnd() = let str = "123456" Assert.AreEqual(str.[-1..], str) @@ -285,9 +285,9 @@ type StringModule() = Assert.AreEqual(str.[6..], ("")) Assert.AreEqual(str.[7..], ("")) - - [] - member _.SlicingUnboundedStart() = + + [] + member _.SlicingUnboundedStart() = let str = "123456" Assert.AreEqual(str.[..(-1)], ("")) @@ -328,7 +328,7 @@ type StringModule() = [] - member _.SlicingEmptyString() = + member _.SlicingEmptyString() = let empty = "" Assert.AreEqual(empty.[*], ("")) @@ -340,9 +340,9 @@ type StringModule() = [] - member _.SlicingOutOfBounds() = + member _.SlicingOutOfBounds() = let str = "123456" - + Assert.AreEqual(str.[..6], "123456") Assert.AreEqual(str.[6..], ("")) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Utils.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Utils.fs index ce2a299a3f1..9796cb057bb 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Utils.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Utils.fs @@ -4,19 +4,19 @@ module FSharp.Core.UnitTests.Collections.Utils open Xunit -let run f = +let run f = try Ok(f()) with | exn -> Error(exn.Message) -let runAndCheckErrorType f = +let runAndCheckErrorType f = try Ok(f()) with | exn -> Error(exn.GetType().ToString()) -let runAndCheckIfAnyError f = +let runAndCheckIfAnyError f = try Ok(f()) with diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index d875c474f1b..fe9ea95ebfb 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -84,13 +84,13 @@ module ChoiceUtils = let result = let cancellationToken = match cancelAfter with - | Some ca -> + | Some ca -> let cts = new CancellationTokenSource() cts.CancelAfter(ca) Some cts.Token | None -> None - try Async.RunSynchronously(choiceWorkflow, ?cancellationToken = cancellationToken) |> Choice1Of2 + try Async.RunSynchronously(choiceWorkflow, ?cancellationToken = cancellationToken) |> Choice1Of2 with e -> Choice2Of2 e // Step 3. check that results are up to spec @@ -98,7 +98,7 @@ module ChoiceUtils = seq { yield Int32.MaxValue // "infinity": avoid exceptions if list is empty - for op in ops do + for op in ops do match op with | NoneResultAfter _ -> () | op -> yield op.Timeout @@ -109,7 +109,7 @@ module ChoiceUtils = let verifyIndex index = if index < 0 || index >= ops.Length then Assert.Fail "Returned choice index is out of bounds." - + // Step 3a. check that output is up to spec match result with | Choice1Of2 (Some index) -> @@ -146,37 +146,37 @@ module LeakUtils = // We also need something non trivial to dissuade the compiler from inlining in Release builds. type ToRun<'a>(f : unit -> 'a) = member _.Invoke() = f() - + let run (toRun : ToRun<'a>) = toRun.Invoke() // --------------------------------------------------- [] type AsyncModule() = - + /// Simple asynchronous task that delays 200ms and returns a list of the current tick count let getTicksTask = async { do! Async.SwitchToThreadPool() let mutable tickstamps = [] // like timestamps but for ticks :) - + for i = 1 to 10 do tickstamps <- DateTime.UtcNow.Ticks :: tickstamps do! Async.Sleep(20) - + return tickstamps } - let wait (wh : System.Threading.WaitHandle) (timeoutMilliseconds : int) = + let wait (wh : System.Threading.WaitHandle) (timeoutMilliseconds : int) = wh.WaitOne(timeoutMilliseconds, exitContext=false) let dispose(d : #IDisposable) = d.Dispose() - let testErrorAndCancelRace testCaseName computation = + let testErrorAndCancelRace testCaseName computation = for i in 1..20 do let cts = new System.Threading.CancellationTokenSource() use barrier = new System.Threading.ManualResetEvent(false) - async { cts.Cancel() } + async { cts.Cancel() } |> Async.Start let c = ref 0 @@ -208,8 +208,8 @@ type AsyncModule() = // When the operation has already completed let operationIAR = beginOp ((), new AsyncCallback(fun iar -> ()), null) sleep(250) - - let result = Async.AwaitIAsyncResult(operationIAR) |> Async.RunSynchronously + + let result = Async.AwaitIAsyncResult(operationIAR) |> Async.RunSynchronously match result with | true -> () | false -> Assert.Fail("Timed out. Expected to succeed.") @@ -222,11 +222,11 @@ type AsyncModule() = | false -> () [] - member _.``AwaitWaitHandle.Timeout``() = + member _.``AwaitWaitHandle.Timeout``() = use waitHandle = new System.Threading.ManualResetEvent(false) let startTime = DateTime.UtcNow - let r = + let r = Async.AwaitWaitHandle(waitHandle, 500) |> Async.RunSynchronously @@ -237,19 +237,19 @@ type AsyncModule() = Assert.True(delta.TotalMilliseconds < 1100.0, sprintf "Expected faster timeout than %.0f ms" delta.TotalMilliseconds) [] - member _.``AwaitWaitHandle.TimeoutWithCancellation``() = + member _.``AwaitWaitHandle.TimeoutWithCancellation``() = use barrier = new System.Threading.ManualResetEvent(false) use waitHandle = new System.Threading.ManualResetEvent(false) let cts = new System.Threading.CancellationTokenSource() Async.AwaitWaitHandle(waitHandle, 5000) |> Async.Ignore - |> fun c -> + |> fun c -> Async.StartWithContinuations( - c, - (failwithf "Unexpected success %A"), - (failwithf "Unexpected error %A"), - (fun _ -> barrier.Set() |> ignore), + c, + (failwithf "Unexpected success %A"), + (failwithf "Unexpected error %A"), + (fun _ -> barrier.Set() |> ignore), cts.Token ) @@ -264,9 +264,9 @@ type AsyncModule() = if not ok then Assert.Fail("Async computation was not completed in given time") [] - member _.``AwaitWaitHandle.DisposedWaitHandle1``() = + member _.``AwaitWaitHandle.DisposedWaitHandle1``() = let wh = new System.Threading.ManualResetEvent(false) - + dispose wh let test = async { try @@ -279,8 +279,8 @@ type AsyncModule() = Async.RunSynchronously test [] - member _.``OnCancel.RaceBetweenCancellationHandlerAndDisposingHandlerRegistration``() = - let test() = + member _.``OnCancel.RaceBetweenCancellationHandlerAndDisposingHandlerRegistration``() = + let test() = use flag = new ManualResetEvent(false) use cancelHandlerRegistered = new ManualResetEvent(false) let cts = new System.Threading.CancellationTokenSource() @@ -302,7 +302,7 @@ type AsyncModule() = for _i = 1 to 300 do test() [] - member _.``OnCancel.RaceBetweenCancellationAndDispose``() = + member _.``OnCancel.RaceBetweenCancellationAndDispose``() = let mutable flag = 0 let cts = new System.Threading.CancellationTokenSource() let go = async { @@ -320,8 +320,8 @@ type AsyncModule() = Assert.AreEqual(1, flag) [] - member _.``OnCancel.CancelThatWasSignalledBeforeRunningTheComputation``() = - let test() = + member _.``OnCancel.CancelThatWasSignalledBeforeRunningTheComputation``() = + let test() = let cts = new System.Threading.CancellationTokenSource() let go e (flag : bool ref) = async { let! _ = Async.AwaitWaitHandle e @@ -380,7 +380,7 @@ type AsyncModule() = #endif [] - member _.``AwaitWaitHandle.DisposedWaitHandle2``() = + member _.``AwaitWaitHandle.DisposedWaitHandle2``() = let wh = new ManualResetEvent(false) let started = new ManualResetEventSlim(false) let cts = new CancellationTokenSource() @@ -402,7 +402,7 @@ type AsyncModule() = Assert.ThrowsAsync(fun () -> test) [] - member _.``RunSynchronously.NoThreadJumpsAndTimeout``() = + member _.``RunSynchronously.NoThreadJumpsAndTimeout``() = let longRunningTask = async { sleep(5000) } try Async.RunSynchronously(longRunningTask, timeout = 500) @@ -411,7 +411,7 @@ type AsyncModule() = :? System.TimeoutException -> () [] - member _.``RunSynchronously.NoThreadJumpsAndTimeout.DifferentSyncContexts``() = + member _.``RunSynchronously.NoThreadJumpsAndTimeout.DifferentSyncContexts``() = let run syncContext = let old = SynchronizationContext.Current SynchronizationContext.SetSynchronizationContext(syncContext) @@ -429,7 +429,7 @@ type AsyncModule() = [] // See https://github.com/dotnet/fsharp/issues/12637#issuecomment-1020199383 - member _.``RunSynchronously.ThreadJump.IfSyncCtxtNonNull``() = + member _.``RunSynchronously.ThreadJump.IfSyncCtxtNonNull``() = async { do! Async.SwitchToThreadPool() let old = SynchronizationContext.Current @@ -495,7 +495,7 @@ type AsyncModule() = t.Start() t.Join() if exn <> null then raise exn - + [] // RunSynchronously offloads to the thread pool when SynchronizationContext.Current is non-null // (see RunSynchronously.ThreadJump.IfSyncCtxtNonNull). @@ -504,7 +504,7 @@ type AsyncModule() = member _.``RunSynchronouslyImmediate Starts on calling thread even when SynchronizationContext present``() = AsyncModule.OnFreshThread(fun () -> // Aside: bonus condition that would also make RunSynchronously offload - Assert.False(Thread.CurrentThread.IsThreadPoolThread) + Assert.False(Thread.CurrentThread.IsThreadPoolThread) let old = SynchronizationContext.Current try SynchronizationContext.SetSynchronizationContext(SynchronizationContext()) let mutable startThreadId = -1 @@ -556,7 +556,7 @@ type AsyncModule() = Assert.Equal(callerThreadId, exceptionOriginThreadId) [] - member _.``RaceBetweenCancellationAndError.AwaitWaitHandle``() = + member _.``RaceBetweenCancellationAndError.AwaitWaitHandle``() = let disposedEvent = new System.Threading.ManualResetEvent(false) dispose disposedEvent testErrorAndCancelRace "RaceBetweenCancellationAndError.AwaitWaitHandle" (Async.AwaitWaitHandle disposedEvent) @@ -589,7 +589,7 @@ type AsyncModule() = Interlocked.Increment &started |> ignore try do! failOnlyOne |> Async.AwaitWaitHandle |> Async.Ignore - failwith "boom" + failwith "boom" finally if ct.IsCancellationRequested then Interlocked.Increment &cancelled |> ignore @@ -607,7 +607,7 @@ type AsyncModule() = } [] - member _.``AwaitWaitHandle.ExceptionsAfterTimeout``() = + member _.``AwaitWaitHandle.ExceptionsAfterTimeout``() = let wh = new System.Threading.ManualResetEvent(false) let test = async { try @@ -619,40 +619,40 @@ type AsyncModule() = :? InvalidOperationException as e when e.Message = "EXPECTED" -> return () } Async.RunSynchronously(test) - + [] - member _.``FromContinuationsCanTailCallCurrentThread``() = + member _.``FromContinuationsCanTailCallCurrentThread``() = let mutable cnt = 0 - let origTid = System.Threading.Thread.CurrentThread.ManagedThreadId + let origTid = System.Threading.Thread.CurrentThread.ManagedThreadId let mutable finalTid = -1 let rec f n = if n = 0 then - async { + async { finalTid <- System.Threading.Thread.CurrentThread.ManagedThreadId return () } else async { cnt <- cnt + 1 do! Async.FromContinuations(fun (k,_,_) -> k()) - do! f (n-1) + do! f (n-1) } // 5000 is big enough that does-not-stackoverflow means we are tailcalling thru FromContinuations - f 5000 |> Async.StartImmediate + f 5000 |> Async.StartImmediate Assert.AreEqual(origTid, finalTid) Assert.AreEqual(5000, cnt) [] - member _.``AwaitWaitHandle With Cancellation``() = + member _.``AwaitWaitHandle With Cancellation``() = let run wh = async { let! r = Async.AwaitWaitHandle wh Assert.True(r, "Timeout not expected") - return() + return() } - let test () = + let test () = let wh = new System.Threading.ManualResetEvent(false) let cts = new System.Threading.CancellationTokenSource() let asyncs = - [ + [ yield! List.init 100 (fun _ -> run wh) yield async { cts.Cancel() } yield async { wh.Set() |> ignore } @@ -667,7 +667,7 @@ type AsyncModule() = for _ in 1..1000 do test() [] - member _.``StartWithContinuationsVersusDoBang``() = + member _.``StartWithContinuationsVersusDoBang``() = // worthwhile to note these three // case 1 let mutable r = "" @@ -676,8 +676,8 @@ type AsyncModule() = do! Async.FromContinuations(fun (s, _, _) -> s()) return failwith "boom" with - e-> r <- e.Message - } |> Async.RunSynchronously + e-> r <- e.Message + } |> Async.RunSynchronously Assert.AreEqual("boom", r) // case 2 r <- "" @@ -722,9 +722,9 @@ type AsyncModule() = #endif [] - member _.``Async caching should work``() = + member _.``Async caching should work``() = let mutable x = 0 - let someSlowFunc _mykey = async { + let someSlowFunc _mykey = async { Console.WriteLine "Simulated downloading..." do! Async.Sleep 400 Console.WriteLine "Simulated downloading Done." @@ -738,7 +738,7 @@ type AsyncModule() = do! memFunc "a" |> Async.Ignore do! memFunc "a" |> Async.Ignore do! memFunc "a" |> Async.Ignore - do! [|1 .. 30|] |> Seq.map(fun _ -> (memFunc "a")) + do! [|1 .. 30|] |> Seq.map(fun _ -> (memFunc "a")) |> Async.Parallel |> Async.Ignore Console.WriteLine "Still more ways...." @@ -753,7 +753,7 @@ type AsyncModule() = Async.Start( memFunc "a" |> Async.Ignore ) Console.WriteLine "Still more ways again again...." - do! [|1 .. 30|] |> Seq.map(fun _ -> (memFunc "a")) + do! [|1 .. 30|] |> Seq.map(fun _ -> (memFunc "a")) |> Async.Parallel |> Async.Ignore } |> Async.RunSynchronously Console.WriteLine "Checking result...." @@ -849,16 +849,16 @@ type AsyncModule() = // index 1 will enter the try/finally quickly, call failwith and cancel the other tasks // One of index 2 and index 3 will be stuck here before the try/finally. But having got // this far it should enter the try/finally before cancellation takes effect - do + do lock gate <| fun () -> printfn "[%i] Acquired semaphore" index Interlocked.Increment(&acquiredCount) |> ignore - if index <> 0 then + if index <> 0 then lock gate <| fun () -> printfn "[%i] Slowly entering try/finally" index System.Threading.Thread.Sleep(100) try lock gate <| fun () -> printfn "[%i] Within try-finally" index - if index = 0 then + if index = 0 then lock gate <| fun () -> printfn "[%i] Error" index // The failure will cause others to cancel failwith "Something bad happened!" diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModuleFunctions.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModuleFunctions.fs index 365e5c053f2..1fd24573ea6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModuleFunctions.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModuleFunctions.fs @@ -11,11 +11,11 @@ open System.Threading open System.Threading.Tasks open Xunit -#if NETFRAMEWORK // Polyfill for netstandard2.0 +#if NETFRAMEWORK // Polyfill for netstandard2.0 let cancelWithToken (tcs: TaskCompletionSource<'T>) = tcs.SetCanceled() // No CT overload available CancellationToken.None // so exception won't reference one -#else +#else let cancelWithToken (tcs: TaskCompletionSource<'T>) = let ct = CancellationToken true tcs.SetCanceled ct @@ -82,13 +82,13 @@ let ``Async.bind propagates incoming exception (sync)`` () = let a = async { return failwith "boom" } |> Async.bind Async.result let e = Assert.Throws(fun () -> a |> asyncWait |> ignore) Assert.Equal("boom", e.Message) - + [] let ``Async.bind propagates binder exception as Fault (async)`` () = let a = Async.result 5 |> Async.bind (fun x -> async { failwith $"boom {x}"}) let e = Assert.Throws(fun () -> asyncWait a) Assert.Equal("boom 5", e.Message) - + [] let ``Async.bind propagates Cancellation (sync)`` () = let ct = CancellationToken true @@ -121,7 +121,7 @@ let ``Async.ignore discards result (async)`` () = let t = async { return! tcs.Task |> Async.AwaitTask } |> Async.ignore |> Async.StartAsTask tcs.SetResult 42 Assert.Equal((), t.Result) - + [] let ``Async.ignore propagates incoming exception (sync)`` () = let a = async { return failwith "boom" : int } |> Async.ignore diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs index 9083a23418b..529c3e69b95 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs @@ -33,7 +33,7 @@ module AsyncType = async { Async.CancelDefaultToken() - return () + return () } |> expect Cancellation async { failwith "computation failed" } |> expect Exception @@ -68,7 +68,7 @@ type AsyncType() = [] let mutable spinloop = true - + [] member _.AsyncRunSynchronouslyReusesThreadPoolThread(immediate) = let run a = asyncWait immediate a @@ -450,7 +450,7 @@ type AsyncType() = return v // A canceled task yields TaskCanceledException via the exception continuation with - :? TaskCanceledException -> + :? TaskCanceledException -> ewh.Set() |> ignore // this is ok } let t1 = Async.StartAsTask a @@ -493,7 +493,7 @@ type AsyncType() = return v // A canceled task yields TaskCanceledException via the exception continuation with - :? TaskCanceledException -> + :? TaskCanceledException -> ewh.Set() |> ignore // this is ok } let t1 = Async.StartAsTask a @@ -526,10 +526,10 @@ type AsyncType() = Console.WriteLine (if x = 10000 then failwith "finish" else x) return! loop(x+1) } - + try asyncWait false (loop 0) hasThrown <- false - with Failure "finish" -> + with Failure "finish" -> hasThrown <- true Assert.True hasThrown @@ -558,7 +558,7 @@ type AsyncType() = res.Task.Wait() (* When an AggregateException has multiple inner exceptions, Await and AwaitTask behave identically *) - + [] member _.``Await and AwaitTask(Task<'T>) valid AggregateException is surfaced``(newAwait) = let tcs = TaskCompletionSource() @@ -582,9 +582,9 @@ type AsyncType() = with :? AggregateException as ae -> return ae.InnerExceptions.Count = 2 } Assert.True(asyncWaitImm a) - + (* Async.Await behavioral differences - + The following tests demonstrate where Async.Await deliberately differs from Async.AwaitTask *) // Async.AwaitTask(Task) surfaces the wrapping AggregateException ... @@ -636,7 +636,7 @@ type AsyncType() = Assert.True(asyncWaitImm a) (* Await(Task/Task<'T>) overloads happy path *) - + [] member _.``Await(Task<'T>) happy path``() = let a = async { @@ -820,7 +820,7 @@ module AsyncTaskLikeAwaitTests = return v } Assert.Equal(42, asyncWaitImm a) - + [] let ``Await(task-like) happy path unit``() = @@ -1016,7 +1016,7 @@ module AsyncAwaitStackTraceTests = let ``Await ValueTask-of-T: all three levels visible in stack trace`` () = // For a faulted ValueTask, IsCompletedSuccessfully is false; the overload falls // through to AwaitTask, which takes the same path as the specific Task<'T> overload. - let e = runAndCaptureException (async { do! Async.Await(ValueTask(level2Task())) }) + let e = runAndCaptureException (async { do! Async.Await(ValueTask(level2Task())) }) checkTrace 3 e [] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Cancellation.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Cancellation.fs index 3fc449546e1..cb5ac5a84d0 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Cancellation.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Cancellation.fs @@ -14,8 +14,8 @@ type CancellationType() = let ordered() = let mutable current = 1 - - fun n -> + + fun n -> async { SpinWait.SpinUntil(fun () -> current = n) Interlocked.Increment ¤t |> ignore @@ -35,7 +35,7 @@ type CancellationType() = Assert.False (token2.IsCancellationRequested) cts2.Cancel() Assert.True(token2.IsCancellationRequested) - + [] member this.CancellationRegistration() = let cts = new CancellationTokenSource() @@ -46,7 +46,7 @@ type CancellationType() = r.Dispose() cts.Cancel() Assert.False(called) - + [] member this.CancellationWithCallbacks() = let cts1 = new CancellationTokenSource() @@ -57,36 +57,36 @@ type CancellationType() = let assertAndOff (expected:bool) (r:bool ref) = Assert.AreEqual(expected,r.Value); r.Value <- false let r1 = cts1.Token.Register(Action(fun _ -> is1Called.Value <- true), null) let r2 = cts1.Token.Register(Action(fun _ -> is2Called.Value <- true), null) - let r3 = cts2.Token.Register(Action(fun _ -> is3Called.Value <- true), null) + let r3 = cts2.Token.Register(Action(fun _ -> is3Called.Value <- true), null) Assert.False(is1Called.Value) Assert.False(is2Called.Value) r2.Dispose() - + // Cancelling cts1: r2 is disposed and r3 is for cts2, only r1 should be called cts1.Cancel() assertAndOff true is1Called assertAndOff false is2Called assertAndOff false is3Called Assert.True(cts1.Token.IsCancellationRequested) - + let isAnotherOneCalled = ref false let _ = cts1.Token.Register(Action(fun _ -> isAnotherOneCalled.Value <- true), null) assertAndOff true isAnotherOneCalled - + // Cancelling cts2: only r3 should be called cts2.Cancel() assertAndOff false is1Called assertAndOff false is2Called assertAndOff true is3Called Assert.True(cts2.Token.IsCancellationRequested) - - + + // Cancelling cts1 again: no one should be called cts1.Cancel() assertAndOff false is1Called assertAndOff false is2Called assertAndOff false is3Called - + // Disposing let token = cts2.Token cts2.Dispose() @@ -98,7 +98,7 @@ type CancellationType() = with | :? ObjectDisposedException -> odeThrown <- true Assert.False(odeThrown) - + let () = let mutable odeThrown = false try @@ -107,9 +107,9 @@ type CancellationType() = | :? ObjectDisposedException -> odeThrown <- true Assert.True(odeThrown) () - - [] - member this.CallbackOrder() = + + [] + member this.CallbackOrder() = use cts = new CancellationTokenSource() let mutable current = 0 let action (o:obj) = Assert.AreEqual(current, (unbox o : int)); current <- current + 1 @@ -117,7 +117,7 @@ type CancellationType() = cts.Token.Register(Action(action), box 1) |> ignore cts.Token.Register(Action(action), box 0) |> ignore cts.Cancel() - + [] member this.CallbackExceptions() = use cts = new CancellationTokenSource() @@ -136,7 +136,7 @@ type CancellationType() = Assert.AreEqual(["2";"1";"0"], msgs) Assert.True exnThrown Assert.True cts.Token.IsCancellationRequested - + [] member this.LinkedSources() = let () = @@ -147,8 +147,8 @@ type CancellationType() = Assert.False(linkedToken.IsCancellationRequested) cts1.Cancel() Assert.True(linkedToken.IsCancellationRequested) - - let () = + + let () = use cts1 = new CancellationTokenSource() use cts2 = new CancellationTokenSource() use ctsLinked = CancellationTokenSource.CreateLinkedTokenSource(cts1.Token, cts2.Token) @@ -156,45 +156,45 @@ type CancellationType() = Assert.False(linkedToken.IsCancellationRequested) cts2.Cancel() Assert.True(linkedToken.IsCancellationRequested) - - let () = + + let () = use cts1 = new CancellationTokenSource() use cts2 = new CancellationTokenSource() cts1.Cancel() use ctsLinked = CancellationTokenSource.CreateLinkedTokenSource(cts1.Token, cts2.Token) - let linkedToken = ctsLinked.Token + let linkedToken = ctsLinked.Token Assert.True(linkedToken.IsCancellationRequested) let mutable doExec = false linkedToken.Register(Action(fun _ -> doExec <- true), null) |> ignore Assert.True(doExec) - + let () = use cts1 = new CancellationTokenSource() use cts2 = new CancellationTokenSource() use ctsLinked = CancellationTokenSource.CreateLinkedTokenSource(cts1.Token, cts2.Token) - let linkedToken = ctsLinked.Token + let linkedToken = ctsLinked.Token let mutable doExec = false linkedToken.Register(Action(fun _ -> doExec <- true), null) |> ignore Assert.False(doExec) cts1.Cancel() Assert.True(doExec) - + let () = use cts1 = new CancellationTokenSource() use cts2 = new CancellationTokenSource() let token1 = cts1.Token let token2 = cts2.Token - use ctsLinked = CancellationTokenSource.CreateLinkedTokenSource(token1, token2) - let linkedToken = ctsLinked.Token - Assert.False(linkedToken.IsCancellationRequested) + use ctsLinked = CancellationTokenSource.CreateLinkedTokenSource(token1, token2) + let linkedToken = ctsLinked.Token + Assert.False(linkedToken.IsCancellationRequested) ctsLinked.Cancel() Assert.True(linkedToken.IsCancellationRequested) - Assert.False(token1.IsCancellationRequested) - Assert.False(token2.IsCancellationRequested) - + Assert.False(token1.IsCancellationRequested) + Assert.False(token2.IsCancellationRequested) + () - - [] + + [] member this.TestCancellationRace() = use cts = new CancellationTokenSource() let token = cts.Token @@ -217,13 +217,13 @@ type CancellationType() = seq { for _ in 1..1000 do let cts = new CancellationTokenSource() let token = cts.Token - yield async { cts.Cancel() } + yield async { cts.Cancel() } let callback (_:obj) = Assert.True(token.IsCancellationRequested) - yield async { - do token.Register(Action(callback), null) |> ignore - } - } + yield async { + do token.Register(Action(callback), null) |> ignore + } + } (asyncs |> Async.Parallel |> Async.RunSynchronously |> ignore) [] @@ -235,9 +235,9 @@ type CancellationType() = let cts2 = new CancellationTokenSource() let token2 = cts2.Token let linkedCts = CancellationTokenSource.CreateLinkedTokenSource(token1, token2) - yield async { do cts1.Cancel() } - yield async { do linkedCts.Dispose() } - } + yield async { do cts1.Cancel() } + yield async { do linkedCts.Dispose() } + } asyncs |> Async.Parallel |> Async.RunSynchronously |> ignore // See https://github.com/dotnet/fsharp/issues/3254 @@ -322,12 +322,12 @@ type CancellationType() = let cts2 = new CancellationTokenSource() let t1a = cts1.Token let t1b = cts1.Token - let t2 = cts2.Token + let t2 = cts2.Token Assert.True((t1a = t1b)) Assert.False(t1a <> t1b) Assert.True(t1a <> t2) Assert.False((t1a = t2)) - + let r1a = t1a.Register(Action(fun _ -> ()), null) let r1b = t1b.Register(Action(fun _ -> ()), null) let r2 = t2.Register(Action(fun _ -> ()), null) @@ -335,7 +335,7 @@ type CancellationType() = Assert.True((r1a = r1a')) Assert.False((r1a = r1b)) Assert.False((r1a = r2)) - + Assert.False((r1a <> r1a')) Assert.True((r1a <> r1b)) Assert.True((r1a <> r2)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ContinuationsThreadingDetailsStandaloneExe.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ContinuationsThreadingDetailsStandaloneExe.fs index 2b5341ba06e..9fcde7a033a 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ContinuationsThreadingDetailsStandaloneExe.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ContinuationsThreadingDetailsStandaloneExe.fs @@ -4,7 +4,7 @@ open System.Threading type MyForm(Tests) as this = inherit System.Windows.Forms.Form() - do + do this.Load.Add(fun _ -> Tests() ThreadPool.QueueUserWorkItem(fun _ -> Thread.Sleep(1000); this.Invoke(new System.Action(fun _ -> this.Close())) |> ignore) |> ignore @@ -17,7 +17,7 @@ type MyForm(Tests) as this = let Main(args) = let orig = Thread.CurrentThread.ManagedThreadId let ev = new Event<_>() - let pub = ev.Publish + let pub = ev.Publish #if SYNC_CTXT System.Windows.Forms.Application.ThreadException.Add(fun e -> ev.Trigger("form exception:" + e.Exception.Message)) System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.CatchException, true) @@ -30,11 +30,11 @@ let Main(args) = use uhe = System.AppDomain.CurrentDomain.UnhandledException.Subscribe(fun e -> add "unhandled") use fe = pub.Subscribe(fun s -> add s) try - Async.StartWithContinuations( - a, - (fun _ -> add "ok"; failwith "boom"), - (fun _ -> add "error"), - (fun _ -> add "cancel" ) + Async.StartWithContinuations( + a, + (fun _ -> add "ok"; failwith "boom"), + (fun _ -> add "error"), + (fun _ -> add "cancel" ) ) with e -> add("caught:"+e.Message) @@ -94,19 +94,19 @@ let Main(args) = let FromContinuationsSchedulesFuture() = printf "FromContinuationsSchedulesFutureSuccess " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (cont, _, _) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (cont, _, _) -> ThreadPool.QueueUserWorkItem(fun _ -> Thread.Sleep(500); cont 10) |> ignore), 1000) Thread.Sleep(1500) printfn "%A" r printf "FromContinuationsSchedulesFutureError " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, econt, _) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, econt, _) -> ThreadPool.QueueUserWorkItem(fun _ -> Thread.Sleep(500); econt(new System.Exception("err"))) |> ignore), 1000) Thread.Sleep(1500) printfn "%A" r printf "FromContinuationsSchedulesFutureCancel " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, _, ccont) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, _, ccont) -> ThreadPool.QueueUserWorkItem(fun _ -> Thread.Sleep(500); ccont(new System.OperationCanceledException())) |> ignore), 1000) Thread.Sleep(1500) @@ -114,7 +114,7 @@ let Main(args) = let FromContinuationsSchedulesFutureAndThrowsSlowly() = printf "FromContinuationsSchedulesFutureSuccessAndThrowsSlowly " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (cont, _, _) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (cont, _, _) -> ThreadPool.QueueUserWorkItem(fun _ -> cont 10) |> ignore Thread.Sleep(500) failwith "pow"), @@ -122,7 +122,7 @@ let Main(args) = Thread.Sleep(1500) printfn "%A" r printf "FromContinuationsSchedulesFutureErrorAndThrowsSlowly " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, econt, _) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, econt, _) -> ThreadPool.QueueUserWorkItem(fun _ -> econt(new System.Exception("err"))) |> ignore Thread.Sleep(500) failwith "pow"), @@ -130,7 +130,7 @@ let Main(args) = Thread.Sleep(1500) printfn "%A" r printf "FromContinuationsSchedulesFutureCancelAndThrowsSlowly " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, _, ccont) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, _, ccont) -> ThreadPool.QueueUserWorkItem(fun _ -> ccont(new System.OperationCanceledException())) |> ignore Thread.Sleep(500) failwith "pow"), @@ -140,21 +140,21 @@ let Main(args) = let FromContinuationsSchedulesFutureAndThrowsQuickly() = printf "FromContinuationsSchedulesFutureSuccessAndThrowsQuickly " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (cont, _, _) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (cont, _, _) -> ThreadPool.QueueUserWorkItem(fun _ -> Thread.Sleep(500); cont 10) |> ignore failwith "pow"), 1000) Thread.Sleep(1500) printfn "%A" r printf "FromContinuationsSchedulesFutureErrorAndThrowsQuickly " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, econt, _) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, econt, _) -> ThreadPool.QueueUserWorkItem(fun _ -> Thread.Sleep(500); econt(new System.Exception("err"))) |> ignore failwith "pow"), 1000) Thread.Sleep(1500) printfn "%A" r printf "FromContinuationsSchedulesFutureCancelAndThrowsQuickly " - let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, _, ccont) -> + let r = SWCandContThrowsTimeout(Async.FromContinuations(fun (_, _, ccont) -> ThreadPool.QueueUserWorkItem(fun _ -> Thread.Sleep(500); ccont(new System.OperationCanceledException())) |> ignore failwith "pow"), 1000) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventModule.fs index 27bcf8759d6..c5a52ad872e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventModule.fs @@ -31,15 +31,15 @@ type MultiArgDelegate5 = delegate of obj * int * string * bool * int * string -> type MultiArgDelegate6 = delegate of obj * int * string * bool * int * string * bool -> unit type EventModule() = - + [] - member _.Choose() = - + member _.Choose() = + let coffeeCup = new EventfulCoffeeCup(10.0, 10.0) - + let needToCleanupEvent = - coffeeCup.Overflowing - |> Event.choose(fun amtOverflowingArgs -> + coffeeCup.Overflowing + |> Event.choose(fun amtOverflowingArgs -> let amtOverflowing = amtOverflowingArgs.AmountOverflowing if amtOverflowing < 5.0 then None elif amtOverflowing < 10.0 then Some("Medium") @@ -47,34 +47,34 @@ type EventModule() = let mutable lastCleanup = "" needToCleanupEvent.Add(fun amount -> lastCleanup <- amount) - + // Refil the cup, Overflow event will fire, will fire our 'needToCleanupEvent' coffeeCup.Refil(20.0) Assert.AreEqual("Large", lastCleanup) - + // Refil the cup, Overflow event will fire, will fire our 'needToCleanupEvent' coffeeCup.Refil(8.0) Assert.AreEqual("Medium", lastCleanup) - + // Refil the cup, Overflow event will fire, will NOT fire our 'needToCleanupEvent' lastCleanup <- "NA" coffeeCup.Refil(2.5) Assert.AreEqual("NA", lastCleanup) - + () [] - member _.Filter() = - + member _.Filter() = + let kexp = new RadioStation(90.3, "KEXP") - + let fotpSongs = kexp.BroadcastSignal |> Event.filter(fun broadEventArgs -> broadEventArgs.Message.Contains("Flight of the Penguins")) - + let mutable songsHeard = [] fotpSongs.Add(fun rbEventArgs -> songsHeard <- rbEventArgs.Message :: songsHeard) - + // Firing the main event, we should only listen in on those we want to hear kexp.BeginBroadcasting( [ @@ -84,19 +84,19 @@ type EventModule() = "Flight of the Penguins - song 2" ]) - Assert.AreEqual(songsHeard, ["Flight of the Penguins - song 2"; + Assert.AreEqual(songsHeard, ["Flight of the Penguins - song 2"; "Flight of the Penguins - song 1"]) () [] - member _.Listen() = - + member _.Listen() = + let kqfc = new RadioStation(90.3, "KEXP") - + let mutable timesListened = 0 kqfc.BroadcastSignal - |> Event.add(fun rbEventArgs -> + |> Event.add(fun rbEventArgs -> timesListened <- timesListened + 1) kqfc.BeginBroadcasting( @@ -105,157 +105,157 @@ type EventModule() = "The Beatles" "The Rolling Stones" ]) - + // The broadcast event should have fired 3 times Assert.AreEqual(timesListened, 3) - + () [] - member _.Map() = - + member _.Map() = + let numEvent = new Event() - - let getStr = + + let getStr = numEvent.Publish |> Event.map(fun i -> i.ToString()) - + let mutable results = "" - - getStr |> Event.add(fun msg -> + + getStr |> Event.add(fun msg -> results <- msg + results) - + numEvent.Trigger(1) numEvent.Trigger(22) numEvent.Trigger(333) - + Assert.AreEqual(results, "333221") () [] member _.Merge() = - + let evensEvent = new Event() let oddsEvent = new Event() - + let numberEvent = Event.merge evensEvent.Publish oddsEvent.Publish - + let mutable lastResult = 0 numberEvent.Add(fun i -> lastResult <- i) - + // Verify triggering either the evens or oddsEvent fires the 'numberEvent' evensEvent.Trigger(2) Assert.AreEqual(lastResult, 2) oddsEvent.Trigger(3) Assert.AreEqual(lastResult, 3) - + () [] - member _.Pairwise() = - + member _.Pairwise() = + let numEvent = new Event() - + let pairwiseEvent = Event.pairwise numEvent.Publish - + let mutable lastResult = (-1, -1) pairwiseEvent.Add(fun (x, y) -> lastResult <- (x, y)) - // Verify not fired until second call + // Verify not fired until second call numEvent.Trigger(1) Assert.AreEqual(lastResult, (-1, -1)) - + numEvent.Trigger(2) Assert.AreEqual(lastResult, (1, 2)) - + numEvent.Trigger(3) Assert.AreEqual(lastResult, (2, 3)) - + () - + [] - member _.Partition() = - + member _.Partition() = + let numEvent = new Event() - + let oddsEvent, evensEvent = Event.partition (fun i -> (i % 2 = 1)) numEvent.Publish - + let mutable lastOdd = 0 oddsEvent.Add(fun i -> lastOdd <- i) - + let mutable lastEven = 0 evensEvent.Add(fun i -> lastEven <- i) - + numEvent.Trigger(1) Assert.AreEqual(1, lastOdd) Assert.AreEqual(0, lastEven) - + numEvent.Trigger(2) Assert.AreEqual(1, lastOdd) // Not updated Assert.AreEqual(2, lastEven) () - + [] - member _.Scan() = - + member _.Scan() = + let numEvent = new Event() - - let sumEvent = - numEvent.Publish + + let sumEvent = + numEvent.Publish |> Event.scan(fun acc i -> acc + i) 0 - + let mutable lastSum = 0 sumEvent.Add(fun sum -> lastSum <- sum) - + numEvent.Trigger(1) Assert.AreEqual(lastSum, 1) - + numEvent.Trigger(10) Assert.AreEqual(lastSum, 11) - + numEvent.Trigger(100) Assert.AreEqual(lastSum, 111) - + () - + [] - member _.Split() = - + member _.Split() = + let numEvent = new Event() - + // Note the different types int -> { string * int, string * string } let positiveEvent, negativeEvent = numEvent.Publish |> Event.split(fun i -> if i > 0 then Choice1Of2(i.ToString(), i) else Choice2Of2(i.ToString(), i.ToString())) - + let mutable lastResult = "" positiveEvent.Add(fun (msg, i) -> lastResult <- sprintf "Positive [%s][%d]" msg i) negativeEvent.Add(fun (msg, msg2) -> lastResult <- sprintf "Negative [%s][%s]" msg msg2) - + numEvent.Trigger(10) Assert.AreEqual("Positive [10][10]", lastResult) - + numEvent.Trigger(-3) Assert.AreEqual("Negative [-3][-3]", lastResult) - + () [] - member _.InternalDelegate() = + member _.InternalDelegate() = let event = new Event() let p = event.Publish use s = p.Subscribe(fun _ -> ()) event.Trigger(null, ()) [] - member _.MultipleArguments() = + member _.MultipleArguments() = let mutable count = 0 - let test (evt : Event<_, _>) arg = + let test (evt : Event<_, _>) arg = let p = evt.Publish - use s = - p.Subscribe(fun _ -> + use s = + p.Subscribe(fun _ -> count <- count + 1) evt.Trigger(null, arg) @@ -267,4 +267,3 @@ type EventModule() = Assert.AreEqual(5, count) - \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventTypes.fs index 69cb4d65143..5ab09b64cde 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventTypes.fs @@ -14,20 +14,20 @@ module private EventTypes = let getListeners event = let eventType = event.GetType() - let multicastField = + let multicastField = eventType .GetField("multicast", BindingFlags.NonPublic ||| BindingFlags.Instance) - .GetValue event + .GetValue event :?> System.Delegate if not (isNull multicastField) then let multicastType = typeof - let listeners = + let listeners = multicastType .GetMethod("GetInvocationList") - .Invoke(multicastField, [||]) + .Invoke(multicastField, [||]) :?> System.Delegate [] - Some listeners + Some listeners else None @@ -47,8 +47,8 @@ type EventTypes() = } |> Async.Parallel |> Async.RunSynchronously |> ignore [] - member this.``Adding/removing handlers to published Event<'T> is thread-safe``() = - let event = new Event() + member this.``Adding/removing handlers to published Event<'T> is thread-safe``() = + let event = new Event() let listenersBefore = EventTypes.getListeners event runAddRemoveHandlers (event.Publish) (fun _ -> new Handler<_>(fun sender args -> ())) let listenersAfter = EventTypes.getListeners event @@ -57,8 +57,8 @@ type EventTypes() = Assert.True(listenersAfter.IsNone) [] - member this.``Adding/removing handlers to published DelegateEvent is thread-safe``() = - let event = new DelegateEvent<_>() + member this.``Adding/removing handlers to published DelegateEvent is thread-safe``() = + let event = new DelegateEvent<_>() let listenersBefore = EventTypes.getListeners event runAddRemoveHandlers (event.Publish) (fun _ -> EventTypes.MultiArgDelegate(fun sender args -> ())) let listenersAfter = EventTypes.getListeners event @@ -67,8 +67,8 @@ type EventTypes() = Assert.True(listenersAfter.IsNone) [] - member this.``Adding/removing handlers to published Event<'D,'A> is thread-safe``() = - let event = new Event<_, _>() + member this.``Adding/removing handlers to published Event<'D,'A> is thread-safe``() = + let event = new Event<_, _>() let listenersBefore = EventTypes.getListeners event runAddRemoveHandlers (event.Publish) (fun _ -> EventTypes.MultiArgDelegate(fun sender args -> ())) let listenersAfter = EventTypes.getListeners event diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/LazyType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/LazyType.fs index 9bc8ec3e7de..d260ec540d8 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/LazyType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/LazyType.fs @@ -12,115 +12,115 @@ open FSharp.Core.UnitTests.LibraryTestFx // Why warned - the tests here are actually trying to test that when this happens (unit passed), it indeed results in a null type LazyType() = - + [] member this.Create() = - - // int + + // int let intLazy = Lazy<_>.Create(fun () -> 2) Assert.AreEqual(intLazy.Value, 2) - + // string let stringLazy = Lazy<_>.Create(fun () -> "string") Assert.AreEqual(stringLazy.Value, "string") - + // null let nullLazy = Lazy<_>.Create(fun () -> ()) Assert.AreEqual(nullLazy.Value, null) - + [] member this.CreateFromValue() = - - // int + + // int let intLazy = Lazy<_>.CreateFromValue( 2) Assert.AreEqual(intLazy.Value,2) - + // string let stringLazy = Lazy<_>.CreateFromValue( "string") Assert.AreEqual(stringLazy.Value,"string") - + //null let nullLazy = Lazy<_>.CreateFromValue(null) Assert.AreEqual(nullLazy.Value,null) - - + + [] member this.Force() = - - // int + + // int let intLazy = Lazy<_>.CreateFromValue( 2) let intForce = intLazy.Force() Assert.AreEqual(intForce,2) - + // string let stringLazy = Lazy<_>.CreateFromValue( "string") let stringForce = stringLazy.Force() Assert.AreEqual(stringForce,"string") - + //null let nullLazy = Lazy<_>.CreateFromValue(null) let nullForce = nullLazy.Force() Assert.AreEqual(nullForce,null) - + [] member this.Value() = - - // int + + // int let intLazy = Lazy<_>.CreateFromValue( 2) Assert.AreEqual(intLazy.Value,2) - + // string let stringLazy = Lazy<_>.CreateFromValue( "string") Assert.AreEqual(stringLazy.Value,"string") - + //null let nullLazy = Lazy<_>.CreateFromValue(null) Assert.AreEqual(nullLazy.Value,null) - + [] member this.IsDelayed() = - - // int + + // int let intLazy = Lazy<_>.Create( fun () -> 1) Assert.AreEqual(not intLazy.IsValueCreated,true) let resultIsDelayed = intLazy.Force() Assert.AreEqual(not intLazy.IsValueCreated,false) - + // string let stringLazy = Lazy<_>.Create( fun () -> "string") Assert.AreEqual(not stringLazy.IsValueCreated,true) let resultIsDelayed = stringLazy.Force() Assert.AreEqual(not stringLazy.IsValueCreated,false) - - + + //null let nullLazy = Lazy<_>.Create(fun () -> null) Assert.AreEqual(not nullLazy.IsValueCreated,true) let resultIsDelayed = nullLazy.Force() Assert.AreEqual(not nullLazy.IsValueCreated,false) - + [] member this.IsForced() = - - // int + + // int let intLazy = Lazy<_>.Create( fun () -> 1) Assert.AreEqual( intLazy.IsValueCreated,false) let resultIsForced = intLazy.Force() Assert.AreEqual( intLazy.IsValueCreated,true) - + // string let stringLazy = Lazy<_>.Create( fun () -> "string") Assert.AreEqual( stringLazy.IsValueCreated,false) let resultIsForced = stringLazy.Force() Assert.AreEqual( stringLazy.IsValueCreated,true) - - + + //null let nullLazy = Lazy<_>.Create(fun () -> null) Assert.AreEqual( nullLazy.IsValueCreated,false) let resultIsForced = nullLazy.Force() Assert.AreEqual( nullLazy.IsValueCreated,true) - + [] member this.Printing() = let n = lazy 12 @@ -129,5 +129,5 @@ type LazyType() = Assert.AreEqual( n.IsValueCreated, false ) // printfn "%s" (n.ToString()) Assert.AreEqual( n.IsValueCreated, false ) - - + + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs index 24805e6869c..edcd1b154f6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs @@ -10,9 +10,9 @@ open System.Threading open System.Threading.Tasks open Xunit -type Message = - | Increment of int - | Fetch of AsyncReplyChannel +type Message = + | Increment of int + | Fetch of AsyncReplyChannel | Reset /// Bundles thread information into a type for testing StartImmediate @@ -31,9 +31,9 @@ type MailboxProcessorType() = let mailbox = new MailboxProcessor(fun inbox -> let rec loop n = - async { + async { let! msg = inbox.Receive() - + // Sleep 100ms - to validate timing out later do! Async.Sleep(100) @@ -41,7 +41,7 @@ type MailboxProcessorType() = | Increment m -> return! loop (n + m) | Reset -> return! loop 0 | Fetch chan -> do chan.Reply(n) - return! loop n + return! loop n () } loop 0 @@ -60,7 +60,7 @@ type MailboxProcessorType() = mailbox.Post(Reset) mailbox.Post(Increment(1)) let result = mailbox.TryPostAndReply(fun chan -> Fetch chan) - match result with + match result with | Some(1) -> () | None -> Assert.Fail("Timed out") | _ -> Assert.Fail("Did not reply with expected value.") @@ -71,7 +71,7 @@ type MailboxProcessorType() = mailbox.Post(Reset) mailbox.Post(Increment(1)) let result = mailbox.TryPostAndReply(fun chan -> Fetch chan) - match result with + match result with | None -> () | _ -> Assert.Fail("Replied with a value, expected to time out.") @@ -82,10 +82,10 @@ type MailboxProcessorType() = let mutable result = None use mre1 = new ManualResetEventSlim(false) use mre2 = new ManualResetEventSlim(false) - + // https://github.com/dotnet/fsharp/issues/3337 let cts = new CancellationTokenSource () - + let addMsg msg = match result with | Some text -> @@ -94,7 +94,7 @@ type MailboxProcessorType() = | None -> //printfn "got none, setting %s" msg result <- Some msg - + let mb = MailboxProcessor.Start ( fun inbox -> async { @@ -104,16 +104,16 @@ type MailboxProcessorType() = addMsg "Disposed" mre2.Set() } - + while true do let! (msg : int) = inbox.Receive() addMsg (sprintf "Received %i" msg) mre1.Set() }, cancellationToken = cts.Token) - + mb.Post(1) mre1.Wait() - + cts.Cancel() mre2.Wait() @@ -124,10 +124,10 @@ type MailboxProcessorType() = let mutable result = None use mre1 = new ManualResetEventSlim(false) use mre2 = new ManualResetEventSlim(false) - + // https://github.com/dotnet/fsharp/issues/3337 use cts = new CancellationTokenSource () - + let addMsg msg = match result with | Some text -> @@ -136,7 +136,7 @@ type MailboxProcessorType() = | None -> //printfn "got none, setting %s" msg result <- Some msg - + let mb = MailboxProcessor.Start ( fun inbox -> async { @@ -146,16 +146,16 @@ type MailboxProcessorType() = addMsg "Disposed" mre2.Set() } - + while true do let! (msg : int) = inbox.Receive(100000) addMsg (sprintf "Received %i" msg) mre1.Set() }, cancellationToken = cts.Token) - + mb.Post(1) mre1.Wait() - + cts.Cancel() mre2.Wait() @@ -412,7 +412,7 @@ type MailboxProcessorType() = member this.Dispose() = // No unit test actually hit the Dispose method for the Mailbox... - let test() = + let test() = use mailbox = getSimpleMailbox() mailbox.Start() @@ -442,7 +442,7 @@ type MailboxProcessorType() = let badAsync (mbox:MailboxProcessor>) = async { try printfn "bad async working..." - let! result = mbox.PostAndAsyncReply id // <- got stuck in here forever + let! result = mbox.PostAndAsyncReply id // <- got stuck in here forever printfn "%d" result finally printfn "bad async exited - that's what we want" // <- we never got here @@ -459,8 +459,8 @@ type MailboxProcessorType() = |> Async.Parallel |> Async.Ignore |> fun x -> Async.Start(x, cancel.Token) - System.Threading.Thread.Sleep(5000) // cancellation after 500 pause for 5 seconds - if not gotGood || not gotBad then + System.Threading.Thread.Sleep(5000) // cancellation after 500 pause for 5 seconds + if not gotGood || not gotBad then failwith <| sprintf "Expected both good and bad async's to be cancelled afterMailbox should not fail! gotGood: %A, gotBad: %A" gotGood gotBad [] @@ -468,7 +468,7 @@ type MailboxProcessorType() = /// Gets the current thread's ID and name let getThreadInfo () = let currentThread = Thread.CurrentThread - + { Id = currentThread.ManagedThreadId Name = currentThread.Name } @@ -484,7 +484,7 @@ type MailboxProcessorType() = let mailbox = MailboxProcessor.StartImmediate(fun inbox -> async{ // Get the MailboxProcessor's thread immediately after starting it let threadInfo = getThreadInfo () - + // Block until a single message is received let! message = inbox.Receive() @@ -513,7 +513,7 @@ module MailboxProcessorType = let tcs = TaskCompletionSource<_>() use mailbox = new MailboxProcessor(fun inbox -> async { - do! + do! inbox.TryScan( function | Reset -> async { tcs.SetResult "Reset processed" } |> Some | _ -> None) @@ -534,7 +534,7 @@ module MailboxProcessorType = use mailbox = new MailboxProcessor(fun inbox -> let rec loop i = async { - match! + match! inbox.TryScan( function | Reset -> async { tcs.SetResult i } |> Some | _ -> None) @@ -547,8 +547,8 @@ module MailboxProcessorType = mailbox.DefaultTimeout <- 10 mailbox.Start() - let iteration = - task { + let iteration = + task { for i in 1 .. 100 do mailbox.Post(Increment 1) do! Task.Delay 10 @@ -571,7 +571,7 @@ module MailboxProcessorType = let ``Disposed MailboxProcessor does not throw on Post`` () = task { let step = ordered() - + let cts = new CancellationTokenSource() let mb = MailboxProcessor.Start( (fun inbox -> diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs index e051ee0c40e..7453d8f7137 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs @@ -14,7 +14,7 @@ module NestedTasksFailingStateMachine = let FetchInternalTransfers (includeConfirmeds: int) = task { - let! mapPrioritiesTransfers = + let! mapPrioritiesTransfers = task { if includeConfirmeds > 1 then @@ -106,7 +106,7 @@ module NestedTasksFailingStateMachine = System.Threading.Tasks.Task.WaitAll test let result = test.Result |> printfn "%A" -type NestedStateMachineTests() = +type NestedStateMachineTests() = [] member _.NestedStateMachineFailure1() = let test = NestedTasksFailingStateMachine.Example1.FetchInternalTransfers 2 diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ObservableModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ObservableModule.fs index 41709136da8..0c74c14b89a 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ObservableModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ObservableModule.fs @@ -22,7 +22,7 @@ type ml type OverflowingEventArgs(amountOverflowing : float) = inherit EventArgs() - + member this.AmountOverflowing = amountOverflowing type EmptyCoffeeCupDelegate = delegate of obj * EventArgs -> unit @@ -32,7 +32,7 @@ type EventfulCoffeeCup(amount : float, cupSize : float) = let mutable m_amountLeft = amount let m_emptyCupEvent = new Event() let m_overflowingCupEvent = new Event() - + member this.Drink(amount) = // printfn "Drinking %.1f..." (float amount) m_amountLeft <- min (m_amountLeft - amount) 0.0 @@ -42,15 +42,15 @@ type EventfulCoffeeCup(amount : float, cupSize : float) = member this.Refil(amountAdded) = // printfn "Coffee Cup refilled with %.1f" (float amountAdded) m_amountLeft <- m_amountLeft + amountAdded - + if m_amountLeft > cupSize then let delta = m_amountLeft - cupSize m_amountLeft <- cupSize m_overflowingCupEvent.Trigger(this, new OverflowingEventArgs(delta)) - + [] member this.EmptyCup = m_overflowingCupEvent.Publish - + [] member this.Overflowing = m_overflowingCupEvent.Publish @@ -62,10 +62,10 @@ type RadioBroadcastEventArgs(msg) = type BroadcastEventDelegate = delegate of obj * RadioBroadcastEventArgs -> unit -type RadioStation(frequency, callsign) = - +type RadioStation(frequency, callsign) = + let m_broadcastEvent = new Event() - + member this.Frequency : float = frequency member this.Callsign : string = callsign @@ -78,15 +78,15 @@ type RadioStation(frequency, callsign) = // --------------------------------------------------- type ObservableModule() = - + [] - member this.Choose() = - + member this.Choose() = + let coffeeCup = new EventfulCoffeeCup(10.0, 10.0) let needToCleanupEvent = - coffeeCup.Overflowing - |> Observable.choose(fun amtOverflowingArgs -> + coffeeCup.Overflowing + |> Observable.choose(fun amtOverflowingArgs -> let amtOverflowing = amtOverflowingArgs.AmountOverflowing if amtOverflowing < 5.0 then None elif amtOverflowing < 10.0 then Some("Medium") @@ -94,35 +94,35 @@ type ObservableModule() = let mutable lastCleanup = "" needToCleanupEvent.Add(fun amount -> lastCleanup <- amount) - + // Refil the cup, Overflow event will fire, will fire our 'needToCleanupEvent' coffeeCup.Refil(20.0) Assert.AreEqual("Large", lastCleanup) - + // Refil the cup, Overflow event will fire, will fire our 'needToCleanupEvent' coffeeCup.Refil(8.0) Assert.AreEqual("Medium", lastCleanup) - + // Refil the cup, Overflow event will fire, will NOT fire our 'needToCleanupEvent' lastCleanup <- "NA" coffeeCup.Refil(2.5) Assert.AreEqual("NA", lastCleanup) - + () [] - member this.Filter() = - + member this.Filter() = + let kexp = new RadioStation(90.3, "KEXP") - + let fotpSongs = kexp.BroadcastSignal |> Observable.filter(fun broadEventArgs -> broadEventArgs.Message.Contains("Flight of the Penguins")) - + let mutable songsHeard = [] - fotpSongs.Add(fun rbEventArgs -> + fotpSongs.Add(fun rbEventArgs -> songsHeard <- rbEventArgs.Message :: songsHeard) - + // Firing the main event, we should only listen in on those we want to hear kexp.BeginBroadcasting( [ @@ -132,19 +132,19 @@ type ObservableModule() = "Flight of the Penguins - song 2" ]) - Assert.AreEqual(songsHeard, ["Flight of the Penguins - song 2"; + Assert.AreEqual(songsHeard, ["Flight of the Penguins - song 2"; "Flight of the Penguins - song 1"]) () [] - member this.Listen() = - + member this.Listen() = + let kqfc = new RadioStation(90.3, "KEXP") - + let mutable timesListened = 0 kqfc.BroadcastSignal - |> Observable.add(fun rbEventArgs -> + |> Observable.add(fun rbEventArgs -> timesListened <- timesListened + 1) kqfc.BeginBroadcasting( @@ -153,140 +153,140 @@ type ObservableModule() = "The Beatles" "The Rolling Stones" ]) - + // The broadcast event should have fired 3 times Assert.AreEqual(timesListened, 3) - + () [] - member this.Map() = - + member this.Map() = + let numEvent = new Event() - - let getStr = + + let getStr = numEvent.Publish |> Observable.map(fun i -> i.ToString()) - + let mutable results = "" - + getStr |> Observable.add(fun msg -> results <- msg + results) - + numEvent.Trigger(1) numEvent.Trigger(22) numEvent.Trigger(333) - + Assert.AreEqual(results, "333221") () [] member this.Merge() = - + let evensEvent = new Event() let oddsEvent = new Event() - + let numberEvent = Observable.merge evensEvent.Publish oddsEvent.Publish - + let mutable lastResult = 0 - numberEvent.Add(fun i -> + numberEvent.Add(fun i -> lastResult <- i) - + // Verify triggering either the evens or oddsEvent fires the 'numberEvent' evensEvent.Trigger(2) Assert.AreEqual(lastResult, 2) oddsEvent.Trigger(3) Assert.AreEqual(lastResult, 3) - + () [] - member this.Pairwise() = - + member this.Pairwise() = + let numEvent = new Event() - + let pairwiseEvent = Observable.pairwise numEvent.Publish - + let mutable lastResult = (-1, -1) - pairwiseEvent.Add(fun (x, y) -> + pairwiseEvent.Add(fun (x, y) -> lastResult <- (x, y)) - // Verify not fired until second call + // Verify not fired until second call numEvent.Trigger(1) Assert.AreEqual(lastResult, (-1, -1)) - + numEvent.Trigger(2) Assert.AreEqual(lastResult, (1, 2)) - + numEvent.Trigger(3) Assert.AreEqual(lastResult, (2, 3)) - + () - + [] - member this.Partition() = - + member this.Partition() = + let numEvent = new Event() - + let oddsEvent, evensEvent = Observable.partition (fun i -> (i % 2 = 1)) numEvent.Publish - + let mutable lastOdd = 0 oddsEvent.Add(fun i -> lastOdd <- i) - + let mutable lastEven = 0 evensEvent.Add(fun i -> lastEven <- i) - + numEvent.Trigger(1) Assert.AreEqual(1, lastOdd) Assert.AreEqual(0,lastEven) - + numEvent.Trigger(2) Assert.AreEqual(1, lastOdd) // Not updated Assert.AreEqual(2, lastEven) () - + [] - member this.Scan() = - + member this.Scan() = + let numEvent = new Event() - - let sumEvent = - numEvent.Publish + + let sumEvent = + numEvent.Publish |> Observable.scan(fun acc i -> acc + i) 0 - + let mutable lastSum = 0 sumEvent.Add(fun sum -> lastSum <- sum) - + numEvent.Trigger(1) Assert.AreEqual(lastSum, 1) - + numEvent.Trigger(10) Assert.AreEqual(lastSum, 11) - + numEvent.Trigger(100) Assert.AreEqual(lastSum, 111) - + () - + [] - member this.Split() = - + member this.Split() = + let numEvent = new Event() - + // Note the different types int -> { string * int, string * string } let positiveEvent, negativeEvent = numEvent.Publish |> Observable.split(fun i -> if i > 0 then Choice1Of2(i.ToString(), i) else Choice2Of2(i.ToString(), i.ToString())) - + let mutable lastResult = "" positiveEvent.Add(fun (msg, i) -> lastResult <- sprintf "Positive [%s][%d]" msg i) negativeEvent.Add(fun (msg, msg2) -> lastResult <- sprintf "Negative [%s][%s]" msg msg2) - + numEvent.Trigger(10) Assert.AreEqual("Positive [10][10]", lastResult) - + numEvent.Trigger(-3) Assert.AreEqual("Negative [-3][-3]", lastResult) - + () diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TaskModuleFunctions.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TaskModuleFunctions.fs index 6791e0ffc07..eeac096051f 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TaskModuleFunctions.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TaskModuleFunctions.fs @@ -10,12 +10,12 @@ open Xunit module TaskModuleFunctionsTests = -#if NETFRAMEWORK // Polyfill for netstandard2.0 +#if NETFRAMEWORK // Polyfill for netstandard2.0 type Task<'T> with member x.IsCompletedSuccessfully = x.Status = TaskStatus.RanToCompletion let cancelWithToken (tcs: TaskCompletionSource<'T>) = tcs.SetCanceled() // No CT overload available CancellationToken.None // so exception won't reference one -#else +#else let cancelWithToken (tcs: TaskCompletionSource<'T>) = let ct = CancellationToken true tcs.SetCanceled ct @@ -26,7 +26,7 @@ module TaskModuleFunctionsTests = let ``Task.result wraps value`` () = let t = Task.result 42 Assert.Equal(42, t.Result) - + [] let ``Task.map transforms value (sync)`` () = @@ -55,7 +55,7 @@ module TaskModuleFunctionsTests = tcs.SetException(Exception "boom") let! e = Assert.ThrowsAsync(fun () -> t).Result Assert.Equal("boom", e.Message) - + [] let ``Task.map propagates mapper exception as Fault (sync)`` () = let t = Task.result () |> Task.map (fun () -> failwith "boom") @@ -101,7 +101,7 @@ module TaskModuleFunctionsTests = Assert.False t.IsCompleted tcs.SetResult 21 Assert.Equal(42, t.Result) - + [] let ``Task.bind propagates incoming exception (sync)`` () = let t = Task.FromException(Exception "boom") |> Task.bind (fun x -> Task.result (x * 2)) @@ -115,13 +115,13 @@ module TaskModuleFunctionsTests = tcs.SetException(Exception "boom") let e = Assert.ThrowsAsync(fun () -> t).Result Assert.Equal("boom", e.Message) - + [] let ``Task.bind propagates binder exception as Fault (sync)`` () = let t = Task.result () |> Task.bind (fun () -> failwith "boom") let e = Assert.ThrowsAsync(fun () -> t).Result Assert.Equal("boom", e.Message) - + [] let ``Task.bind propagates binder exception as Fault (async)`` () = let tcs = TaskCompletionSource() @@ -147,7 +147,7 @@ module TaskModuleFunctionsTests = Assert.Equal(ct, e.CancellationToken) Assert.True t.IsCanceled - + [] let ``Task.ignore discards result (sync)`` () : unit = let t = Task.result 42 |> Task.ignore @@ -162,7 +162,7 @@ module TaskModuleFunctionsTests = tcs.SetResult 42 Assert.True t.IsCompletedSuccessfully t.Result : unit - + [] let ``Task.ignore propagates incoming exception (sync)`` () = let t = Task.FromException(Exception "boom") |> Task.ignore @@ -196,7 +196,7 @@ module TaskModuleFunctionsTests = Assert.Equal(ct, e.CancellationToken) Assert.True t.IsCanceled - + [] let ``Task.catchWith recovers from exception (sync)`` () = let source = Task.FromException(Exception "boom") @@ -247,7 +247,7 @@ module TaskModuleFunctionsTests = Assert.Equal(ct, e.CancellationToken) Assert.True t.IsCanceled - + [] let ``Task.catch returns Ok on success (sync)`` () : unit= let t = Task.result 42 |> Task.catch diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Tasks.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Tasks.fs index 3adfb14e417..e0d1a2daddb 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Tasks.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Tasks.fs @@ -49,7 +49,7 @@ type SmokeTestsForCompilation() = task { return 1 } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -59,7 +59,7 @@ type SmokeTestsForCompilation() = let! x = Task.FromResult(1) return 1 + x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 2 then failwith "failed" @@ -69,32 +69,32 @@ type SmokeTestsForCompilation() = let! x = task { return 1 } return x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" [] member _.tcatch0() = task { - try + try return 1 - with e -> + with e -> return 2 } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" [] member _.tcatch1() = task { - try + try let! x = Task.FromResult 1 return x - with e -> + with e -> return 2 } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -112,7 +112,7 @@ type SmokeTestsForCompilation() = System.Console.WriteLine("world") return 1 + x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 2 then failwith "failed" @@ -124,7 +124,7 @@ type SmokeTestsForCompilation() = System.Console.WriteLine("world") return 1 + x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 2 then failwith "failed" @@ -134,9 +134,9 @@ type SmokeTestsForCompilation() = System.Console.WriteLine("hello") do! Task.Delay(100) System.Console.WriteLine("world") - return 1 + return 1 } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -147,12 +147,12 @@ type SmokeTestsForCompilation() = try do! Task.Delay(0) with - | :? ArgumentException -> + | :? ArgumentException -> () - | _ -> + | _ -> () } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> () then failwith "failed" @@ -163,10 +163,10 @@ type SmokeTestsForCompilation() = try do! Task.Delay(0) with - | :? ArgumentException -> + | :? ArgumentException -> () } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> () then failwith "failed" @@ -179,7 +179,7 @@ type SmokeTestsForCompilation() = do! Task.Yield() return i } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 5 then failwith "failed" @@ -190,10 +190,10 @@ type SmokeTestsForCompilation() = and! y = Task.FromResult(2) return x + y } - |> fun t -> + |> fun t -> t.Wait() - if t.Result <> 3 then failwith "failed" - + if t.Result <> 3 then failwith "failed" + [] member _.merge3tasks() = task { @@ -202,7 +202,7 @@ type SmokeTestsForCompilation() = and! z = Task.FromResult(3) return x + y + z } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 6 then failwith "failed" @@ -213,7 +213,7 @@ type SmokeTestsForCompilation() = and! y = Task.FromResult(1) return y } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -224,7 +224,7 @@ type SmokeTestsForCompilation() = and! _ = Task.Yield() return x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -235,7 +235,7 @@ type SmokeTestsForCompilation() = and! y = ValueTask(Task.FromResult(2)) return x + y } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 3 then failwith "failed" @@ -247,7 +247,7 @@ type SmokeTestsForCompilation() = and! _ = Task.Yield() return x + y } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 3 then failwith "failed" @@ -259,7 +259,7 @@ type SmokeTestsForCompilation() = and! y = Task.FromResult(2) return x + y } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 3 then failwith "failed" @@ -271,7 +271,7 @@ type SmokeTestsForCompilation() = and! z = ValueTask(Task.FromResult(3)) return x + y + z } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 6 then failwith "failed" @@ -282,7 +282,7 @@ type SmokeTestsForCompilation() = and! y = async { return 2 } return x + y } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 3 then failwith "failed" @@ -294,7 +294,7 @@ type SmokeTestsForCompilation() = and! z = async { return 3 } return x + y + z } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 6 then failwith "failed" @@ -305,7 +305,7 @@ type SmokeTestsForCompilation() = and! y = async { return 1 } return y } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -316,7 +316,7 @@ type SmokeTestsForCompilation() = and! _ = Task.Yield() return x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -328,7 +328,7 @@ type SmokeTestsForCompilation() = and! y = async { return 2 } return x + y } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 3 then failwith "failed" @@ -340,7 +340,7 @@ type SmokeTestsForCompilation() = and! z = ValueTask(Task.FromResult(3)) return x + y + z } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 6 then failwith "failed" @@ -352,21 +352,21 @@ type SmokeTestsForCompilation() = and! z = ValueTask(Task.FromResult(3)) return x + y + z } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 6 then failwith "failed" exception TestException of string [] -module Helpers = +module Helpers = let BIG = 10 // let BIG = 10000 let require x msg = if not x then failwith msg let failtest str = raise (TestException str) [] -type Basics() = +type Basics() = [] member _.testShortCircuitResult() = printfn "Running testShortCircuitResult..." @@ -479,11 +479,11 @@ type Basics() = let t = task { try - let! _ = task { + let! _ = task { do! Task.Delay(100) x <- 1 } - and! _ = task { + and! _ = task { failtest "hello" } () @@ -552,7 +552,7 @@ type Basics() = [] member _.testWhileLoopAsyncZeroIteration() = printfn "Running testWhileLoopAsyncZeroIteration..." - for i in 1 .. 5 do + for i in 1 .. 5 do let t = task { let mutable i = 0 @@ -567,7 +567,7 @@ type Basics() = [] member _.testWhileLoopAsyncOneIteration() = printfn "Running testWhileLoopAsyncOneIteration..." - for i in 1 .. 5 do + for i in 1 .. 5 do let t = task { let mutable i = 0 @@ -582,7 +582,7 @@ type Basics() = [] member _.testWhileLoopAsync() = printfn "Running testWhileLoopAsync..." - for i in 1 .. 5 do + for i in 1 .. 5 do let t = task { let mutable i = 0 @@ -597,7 +597,7 @@ type Basics() = [] member _.testTryFinallyHappyPath() = printfn "Running testTryFinallyHappyPath..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let t = task { @@ -613,7 +613,7 @@ type Basics() = [] member _.testTryFinallySadPath() = printfn "Running testTryFinallySadPath..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let t = task { @@ -634,7 +634,7 @@ type Basics() = [] member _.testTryFinallyCaught() = printfn "Running testTryFinallyCaught..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let t = task { @@ -652,11 +652,11 @@ type Basics() = } require (t.Result = 2) "wrong return" require ran "never ran" - + [] member _.testUsing() = printfn "Running testUsing..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable disposed = false let t = task { @@ -900,14 +900,14 @@ type Basics() = let list = ["a"; "b"; "c"] |> Seq.ofList let t = task { - printfn "entering loop..." + printfn "entering loop..." let mutable x = Unchecked.defaultof<_> let e = list.GetEnumerator() - while e.MoveNext() do + while e.MoveNext() do x <- e.Current - printfn "x = %A" x + printfn "x = %A" x do! Task.Yield() - printfn "x = %A" x + printfn "x = %A" x } t.Wait() @@ -945,24 +945,24 @@ type Basics() = task { let mutable index = 0 do! Task.Yield() - printfn "entering loop..." + printfn "entering loop..." for x in wrapList do printfn "x = %A, index = %d" x index do! Task.Yield() - printfn "back from yield" + printfn "back from yield" do! Task.Yield() - printfn "back from yield" + printfn "back from yield" match index with | 0 -> require (x = "a") "wrong first value" | 1 -> require (x = "b") "wrong second value" | 2 -> require (x = "c") "wrong third value" | _ -> require false "iterated too far!" index <- index + 1 - printfn "yield again" + printfn "yield again" do! Task.Yield() - printfn "yield again again" + printfn "yield again again" do! Task.Yield() - printfn "looping again..." + printfn "looping again..." do! Task.Yield() return 1 } @@ -973,7 +973,7 @@ type Basics() = [] member _.testForLoopSadPath() = printfn "Running testForLoopSadPath..." - for i in 1 .. 5 do + for i in 1 .. 5 do let wrapList = ["a"; "b"; "c"] let t = task { @@ -989,7 +989,7 @@ type Basics() = [] member _.testForLoopSadPathComplex() = printfn "Running testForLoopSadPathComplex..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable disposed = false let wrapList = let raw = ["a"; "b"; "c"] |> Seq.ofList @@ -1040,10 +1040,10 @@ type Basics() = require (t.Result = 2) "wrong result" require caught "didn't catch exception" require disposed "never disposed A" - + [] member _.testExceptionAttachedToTaskWithoutAwait() = - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ranA = false let mutable ranB = false let t = @@ -1077,7 +1077,7 @@ type Basics() = [] member _.testExceptionAttachedToTaskWithAwait() = printfn "running testExceptionAttachedToTaskWithAwait" - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ranA = false let mutable ranB = false let t = @@ -1108,7 +1108,7 @@ type Basics() = require ranCatcher "didn't run" require catcher.Result "didn't catch" require caught "didn't catch" - + [] member _.testExceptionThrownInFinally() = printfn "running testExceptionThrownInFinally" @@ -1142,7 +1142,7 @@ type Basics() = [] member _.test2ndExceptionThrownInFinally() = printfn "running test2ndExceptionThrownInFinally" - for i in 1 .. 5 do + for i in 1 .. 5 do use ranInitial = new ManualResetEventSlim() use continueTask = new SemaphoreSlim(0) use ranNext = new ManualResetEventSlim() @@ -1168,11 +1168,11 @@ type Basics() = | _ -> () require ranNext.IsSet "didn't run next" require (ranFinally = 1) "didn't run finally exactly once" - + [] member _.testFixedStackWhileLoop() = printfn "running testFixedStackWhileLoop" - for i in 1 .. 100 do + for i in 1 .. 100 do let t = task { let mutable maxDepth = Nullable() @@ -1192,7 +1192,7 @@ type Basics() = [] member _.testFixedStackForLoop() = - for i in 1 .. 100 do + for i in 1 .. 100 do printfn "running testFixedStackForLoop" let mutable ran = false let t = @@ -1235,7 +1235,7 @@ type Basics() = return! Task.FromResult(()) } longLoop.Wait() - + [] member _.testNoStackOverflowWithYieldResult() = printfn "running testNoStackOverflowWithYieldResult" @@ -1270,7 +1270,7 @@ type Basics() = return! loop 0 } shortLoop.Wait() - + [] member _.testTryOverReturnFrom() = printfn "running testTryOverReturnFrom" @@ -1313,7 +1313,7 @@ type Basics() = with | :? AggregateException -> () require (m = 1) "didn't run finally" - + [] member _.testTryFinallyOverReturnFromWithoutException() = printfn "running testTryFinallyOverReturnFromWithoutException" @@ -1381,7 +1381,7 @@ type Basics() = let actual = $"{t.Result}, after task: {d}" require (actual = $"Before: {d}, in async: {d}, after async: {d}, after task: {d}") actual - + [] // no need to call this, we just want to check that it compiles w/o warnings @@ -1390,7 +1390,7 @@ type Basics() = task { let! r = t if r = None then - return! failwithf "Could not find x" + return! failwithf "Could not find x" else return r } @@ -1409,19 +1409,19 @@ type Basics() = [] member _.testTaskUsesSyncContext() = printfn "Running testBackgroundTask..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let mutable posted = false let oldSyncContext = SynchronizationContext.Current let syncContext = { new SynchronizationContext() with member _.Post(d,state) = posted <- true; d.Invoke(state) } - try + try SynchronizationContext.SetSynchronizationContext syncContext - let tid = System.Threading.Thread.CurrentThread.ManagedThreadId + let tid = System.Threading.Thread.CurrentThread.ManagedThreadId require (not (isNull SynchronizationContext.Current)) "need sync context non null on foreground thread A" require (SynchronizationContext.Current = syncContext) "need sync context known on foreground thread A" let t = task { - let tid2 = System.Threading.Thread.CurrentThread.ManagedThreadId + let tid2 = System.Threading.Thread.CurrentThread.ManagedThreadId require (not (isNull SynchronizationContext.Current)) "need sync context non null on foreground thread B" require (SynchronizationContext.Current = syncContext) "need sync context known on foreground thread B" require (tid = tid2) "expected synchronous start for task B2" @@ -1435,16 +1435,16 @@ type Basics() = require posted "never posted" finally SynchronizationContext.SetSynchronizationContext oldSyncContext - + [] member _.testBackgroundTaskEscapesSyncContext() = printfn "Running testBackgroundTask..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let mutable posted = false let oldSyncContext = SynchronizationContext.Current let syncContext = { new SynchronizationContext() with member _.Post(d,state) = posted <- true; d.Invoke(state) } - try + try SynchronizationContext.SetSynchronizationContext syncContext let t = backgroundTask { @@ -1456,22 +1456,22 @@ type Basics() = require (not posted) "did not expect post to sync context" finally SynchronizationContext.SetSynchronizationContext oldSyncContext - + [] member _.testBackgroundTaskStaysOnSameThreadIfAlreadyOnBackground() = printfn "Running testBackgroundTask..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let taskOuter = Task.Run(fun () -> - let tid = System.Threading.Thread.CurrentThread.ManagedThreadId + let tid = System.Threading.Thread.CurrentThread.ManagedThreadId // In case other thread pool activities have polluted this one, sigh SynchronizationContext.SetSynchronizationContext null require (System.Threading.Thread.CurrentThread.IsThreadPoolThread) "expected thread pool thread (1)" let t = backgroundTask { require (System.Threading.Thread.CurrentThread.IsThreadPoolThread) "expected thread pool thread (2)" - let tid2 = System.Threading.Thread.CurrentThread.ManagedThreadId + let tid2 = System.Threading.Thread.CurrentThread.ManagedThreadId require (tid = tid2) "expected synchronous starts when already on background thread" do! Task.Delay(200) ran <- true @@ -1479,16 +1479,16 @@ type Basics() = t.Wait() require ran "never ran") taskOuter.Wait() - + [] member _.testGenericBackgroundTasks() = printfn "Running testBackgroundTask..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let mutable posted = false let oldSyncContext = SynchronizationContext.Current let syncContext = { new SynchronizationContext() with member _.Post(d,state) = posted <- true; d.Invoke(state) } - try + try SynchronizationContext.SetSynchronizationContext syncContext let f (result: 'T ref) (x: 'T) = backgroundTask { @@ -1504,7 +1504,7 @@ type Basics() = require (not posted) "did not expect post to sync context" finally SynchronizationContext.SetSynchronizationContext oldSyncContext - + /// https://github.com/dotnet/fsharp/issues/12761 module Test12761A = @@ -1520,7 +1520,7 @@ module Test12761A = } type ProblematicType<'Key, 'Value, 'Dto, 'E>( fromDto : 'Dto -> Result,'E> ) = - let myTask = + let myTask = backgroundTask { let dto = """{"DtoValue":"1","Key":"key1"}""" |> box |> unbox<'Dto> return fromDto dto |> printfn "%A" @@ -1536,7 +1536,7 @@ module Test12761A = { Value = int dto.DtoValue Key = dto.Key - } + } |> Ok with | e -> Error e @@ -1573,7 +1573,7 @@ type Issue12184b() = member _.AsyncMethod(_value: int) : System.Runtime.CompilerServices.YieldAwaitable = Task.Yield() -// check this compiles +// check this compiles module Issue12184c = let TaskMethod(t) = task { @@ -1604,7 +1604,7 @@ module Issue12184e = } #endif -// check this compiles +// check this compiles module Issue12184f = let TaskMethod(t: Task) = task { diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs index ce333c7cf45..15509a897f5 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs @@ -28,9 +28,9 @@ open Xunit open System.Runtime.CompilerServices // Delegates to task, except 'Run' which is deliberately not inlined, hence no chance -// of static compilation of state machines. +// of static compilation of state machines. type TaskBuilderDynamic() = - + [] #nowarn 3511 member _.Run(code) = task.Run(code) // warning 3511 is generated here: state machine not compilable @@ -52,9 +52,9 @@ type TaskBuilderDynamic() = member inline _.ReturnFrom (t: Task<'T>) = task.ReturnFrom(t) // Delegates to task, except 'Run' which is deliberately not inlined, hence no chance -// of static compilation of state machines. +// of static compilation of state machines. type BackgroundTaskBuilderDynamic() = - + [] #nowarn 3511 member _.Run(code) = backgroundTask.Run(code) // warning 3511 is generated here: state machine not compilable @@ -76,7 +76,7 @@ type BackgroundTaskBuilderDynamic() = member inline _.ReturnFrom (t: Task<'T>) = backgroundTask.ReturnFrom(t) [] -module TaskBuilderDynamicLowPriority = +module TaskBuilderDynamicLowPriority = // Low priority extension method type TaskBuilderDynamic with @@ -89,10 +89,10 @@ module TaskBuilderDynamicLowPriority = backgroundTask.Using(resource, body) [] -module Value = +module Value = [] - module TaskLowPriorityExtensions = + module TaskLowPriorityExtensions = type TaskBuilderDynamic with member inline _.ReturnFrom<^TaskLike, ^Awaiter, ^T @@ -128,7 +128,7 @@ module Value = [] - module HighLowPriorityExtensions = + module HighLowPriorityExtensions = type TaskBuilderDynamic with member inline _.Bind (t: Task<'TResult1>, continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>)) : TaskCode<'TOverall, 'TResult2> = @@ -159,7 +159,7 @@ module Value = let taskDynamic = TaskBuilderDynamic() let backgroundTaskDynamic = BackgroundTaskBuilderDynamic() - type Do_no_use_task_in_this_file_use_taskDynamic_instead = | Nope + type Do_no_use_task_in_this_file_use_taskDynamic_instead = | Nope let task = Do_no_use_task_in_this_file_use_taskDynamic_instead.Nope type ITaskThing = @@ -172,7 +172,7 @@ type SmokeTestsForCompilation() = taskDynamic { return 1 } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -182,7 +182,7 @@ type SmokeTestsForCompilation() = let! x = Task.FromResult(1) return 1 + x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 2 then failwith "failed" @@ -192,32 +192,32 @@ type SmokeTestsForCompilation() = let! x = taskDynamic { return 1 } return x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" [] member _.tcatch0() = taskDynamic { - try + try return 1 - with e -> + with e -> return 2 } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" [] member _.tcatch1() = taskDynamic { - try + try let! x = Task.FromResult 1 return x - with e -> + with e -> return 2 } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -235,7 +235,7 @@ type SmokeTestsForCompilation() = System.Console.WriteLine("world") return 1 + x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 2 then failwith "failed" @@ -247,7 +247,7 @@ type SmokeTestsForCompilation() = System.Console.WriteLine("world") return 1 + x } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 2 then failwith "failed" @@ -257,9 +257,9 @@ type SmokeTestsForCompilation() = System.Console.WriteLine("hello") do! Task.Delay(100) System.Console.WriteLine("world") - return 1 + return 1 } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 1 then failwith "failed" @@ -270,12 +270,12 @@ type SmokeTestsForCompilation() = try do! Task.Delay(0) with - | :? ArgumentException -> + | :? ArgumentException -> () - | _ -> + | _ -> () } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> () then failwith "failed" @@ -286,10 +286,10 @@ type SmokeTestsForCompilation() = try do! Task.Delay(0) with - | :? ArgumentException -> + | :? ArgumentException -> () } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> () then failwith "failed" @@ -302,7 +302,7 @@ type SmokeTestsForCompilation() = do! Task.Yield() return i } - |> fun t -> + |> fun t -> t.Wait() if t.Result <> 5 then failwith "failed" @@ -310,14 +310,14 @@ type SmokeTestsForCompilation() = exception TestException of string [] -module Helpers = +module Helpers = let BIG = 10 // let BIG = 10000 let require x msg = if not x then failwith msg let failtest str = raise (TestException str) [] -type Basics() = +type Basics() = [] member _.testShortCircuitResult() = printfn "Running testShortCircuitResult..." @@ -476,7 +476,7 @@ type Basics() = [] member _.testWhileLoopAsyncZeroIteration() = printfn "Running testWhileLoopAsyncZeroIteration..." - for i in 1 .. 5 do + for i in 1 .. 5 do let t = taskDynamic { let mutable i = 0 @@ -491,7 +491,7 @@ type Basics() = [] member _.testWhileLoopAsyncOneIteration() = printfn "Running testWhileLoopAsyncOneIteration..." - for i in 1 .. 5 do + for i in 1 .. 5 do let t = taskDynamic { let mutable i = 0 @@ -506,7 +506,7 @@ type Basics() = [] member _.testWhileLoopAsync() = printfn "Running testWhileLoopAsync..." - for i in 1 .. 5 do + for i in 1 .. 5 do let t = taskDynamic { let mutable i = 0 @@ -521,7 +521,7 @@ type Basics() = [] member _.testTryFinallyHappyPath() = printfn "Running testTryFinallyHappyPath..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let t = taskDynamic { @@ -537,7 +537,7 @@ type Basics() = [] member _.testTryFinallySadPath() = printfn "Running testTryFinallySadPath..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let t = taskDynamic { @@ -558,7 +558,7 @@ type Basics() = [] member _.testTryFinallyCaught() = printfn "Running testTryFinallyCaught..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let t = taskDynamic { @@ -576,11 +576,11 @@ type Basics() = } require (t.Result = 2) "wrong return" require ran "never ran" - + [] member _.testUsing() = printfn "Running testUsing..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable disposed = false let t = taskDynamic { @@ -777,14 +777,14 @@ type Basics() = let list = ["a"; "b"; "c"] |> Seq.ofList let t = taskDynamic { - printfn "entering loop..." + printfn "entering loop..." let mutable x = Unchecked.defaultof<_> let e = list.GetEnumerator() - while e.MoveNext() do + while e.MoveNext() do x <- e.Current - printfn "x = %A" x + printfn "x = %A" x do! Task.Yield() - printfn "x = %A" x + printfn "x = %A" x } t.Wait() @@ -822,24 +822,24 @@ type Basics() = taskDynamic { let mutable index = 0 do! Task.Yield() - printfn "entering loop..." + printfn "entering loop..." for x in wrapList do printfn "x = %A, index = %d" x index do! Task.Yield() - printfn "back from yield" + printfn "back from yield" do! Task.Yield() - printfn "back from yield" + printfn "back from yield" match index with | 0 -> require (x = "a") "wrong first value" | 1 -> require (x = "b") "wrong second value" | 2 -> require (x = "c") "wrong third value" | _ -> require false "iterated too far!" index <- index + 1 - printfn "yield again" + printfn "yield again" do! Task.Yield() - printfn "yield again again" + printfn "yield again again" do! Task.Yield() - printfn "looping again..." + printfn "looping again..." do! Task.Yield() return 1 } @@ -850,7 +850,7 @@ type Basics() = [] member _.testForLoopSadPath() = printfn "Running testForLoopSadPath..." - for i in 1 .. 5 do + for i in 1 .. 5 do let wrapList = ["a"; "b"; "c"] let t = taskDynamic { @@ -866,7 +866,7 @@ type Basics() = [] member _.testForLoopSadPathComplex() = printfn "Running testForLoopSadPathComplex..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable disposed = false let wrapList = let raw = ["a"; "b"; "c"] |> Seq.ofList @@ -917,10 +917,10 @@ type Basics() = require (t.Result = 2) "wrong result" require caught "didn't catch exception" require disposed "never disposed A" - + [] member _.testExceptionAttachedToTaskWithoutAwait() = - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ranA = false let mutable ranB = false let t = @@ -954,7 +954,7 @@ type Basics() = [] member _.testExceptionAttachedToTaskWithAwait() = printfn "running testExceptionAttachedToTaskWithAwait" - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ranA = false let mutable ranB = false let t = @@ -985,7 +985,7 @@ type Basics() = require ranCatcher "didn't run" require catcher.Result "didn't catch" require caught "didn't catch" - + [] member _.testExceptionThrownInFinally() = printfn "running testExceptionThrownInFinally" @@ -1019,7 +1019,7 @@ type Basics() = [] member _.test2ndExceptionThrownInFinally() = printfn "running test2ndExceptionThrownInFinally" - for i in 1 .. 5 do + for i in 1 .. 5 do use ranInitial = new ManualResetEventSlim() use continueTask = new SemaphoreSlim(0) use ranNext = new ManualResetEventSlim() @@ -1045,11 +1045,11 @@ type Basics() = | _ -> () require ranNext.IsSet "didn't run next" require (ranFinally = 1) "didn't run finally exactly once" - + [] member _.testFixedStackWhileLoop() = printfn "running testFixedStackWhileLoop" - for i in 1 .. 100 do + for i in 1 .. 100 do let t = taskDynamic { let mutable maxDepth = Nullable() @@ -1069,7 +1069,7 @@ type Basics() = [] member _.testFixedStackForLoop() = - for i in 1 .. 100 do + for i in 1 .. 100 do printfn "running testFixedStackForLoop" let mutable ran = false let t = @@ -1112,7 +1112,7 @@ type Basics() = return! Task.FromResult(()) } longLoop.Wait() - + [] member _.testNoStackOverflowWithYieldResult() = printfn "running testNoStackOverflowWithYieldResult" @@ -1147,7 +1147,7 @@ type Basics() = return! loop 0 } shortLoop.Wait() - + [] member _.testTryOverReturnFrom() = printfn "running testTryOverReturnFrom" @@ -1190,7 +1190,7 @@ type Basics() = with | :? AggregateException -> () require (m = 1) "didn't run finally" - + [] member _.testTryFinallyOverReturnFromWithoutException() = printfn "running testTryFinallyOverReturnFromWithoutException" @@ -1251,7 +1251,7 @@ type Basics() = taskDynamic { let! r = t if r = None then - return! failwithf "Could not find x" + return! failwithf "Could not find x" else return r } @@ -1269,19 +1269,19 @@ type Basics() = [] member _.testTaskUsesSyncContext() = printfn "Running testBackgroundTask..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let mutable posted = false let oldSyncContext = SynchronizationContext.Current let syncContext = { new SynchronizationContext() with member _.Post(d,state) = posted <- true; d.Invoke(state) } - try + try SynchronizationContext.SetSynchronizationContext syncContext - let tid = System.Threading.Thread.CurrentThread.ManagedThreadId + let tid = System.Threading.Thread.CurrentThread.ManagedThreadId require (not (isNull SynchronizationContext.Current)) "need sync context non null on foreground thread A" require (SynchronizationContext.Current = syncContext) "need sync context known on foreground thread A" let t = taskDynamic { - let tid2 = System.Threading.Thread.CurrentThread.ManagedThreadId + let tid2 = System.Threading.Thread.CurrentThread.ManagedThreadId require (not (isNull SynchronizationContext.Current)) "need sync context non null on foreground thread B" require (SynchronizationContext.Current = syncContext) "need sync context known on foreground thread B" require (tid = tid2) "expected synchronous start for task B2" @@ -1295,16 +1295,16 @@ type Basics() = require posted "never posted" finally SynchronizationContext.SetSynchronizationContext oldSyncContext - + [] member _.testBackgroundTaskEscapesSyncContext() = printfn "Running testBackgroundTask..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let mutable posted = false let oldSyncContext = SynchronizationContext.Current let syncContext = { new SynchronizationContext() with member _.Post(d,state) = posted <- true; d.Invoke(state) } - try + try SynchronizationContext.SetSynchronizationContext syncContext let t = backgroundTaskDynamic { @@ -1320,18 +1320,18 @@ type Basics() = [] member _.testBackgroundTaskStaysOnSameThreadIfAlreadyOnBackground() = printfn "Running testBackgroundTask..." - for i in 1 .. 5 do + for i in 1 .. 5 do let mutable ran = false let taskOuter = Task.Run(fun () -> - let tid = System.Threading.Thread.CurrentThread.ManagedThreadId + let tid = System.Threading.Thread.CurrentThread.ManagedThreadId // In case other thread pool activities have polluted this one, sigh SynchronizationContext.SetSynchronizationContext null require (System.Threading.Thread.CurrentThread.IsThreadPoolThread) "expected thread pool thread (1)" let t = backgroundTaskDynamic { require (System.Threading.Thread.CurrentThread.IsThreadPoolThread) "expected thread pool thread (2)" - let tid2 = System.Threading.Thread.CurrentThread.ManagedThreadId + let tid2 = System.Threading.Thread.CurrentThread.ManagedThreadId require (tid = tid2) "expected synchronous starts when already on thread pool thread with null sync context" do! Task.Delay(200) ran <- true @@ -1339,4 +1339,4 @@ type Basics() = t.Wait() require ran "never ran") taskOuter.Wait() - + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs index caa7e84591c..2688cd8464a 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs @@ -5,7 +5,7 @@ namespace FSharp.Core.UnitTests.Math -#nowarn "52" // error FS0052: The value has been copied to ensure the original is not mutated by this operation +#nowarn "52" // error FS0052: The value has been copied to ensure the original is not mutated by this operation open System open FSharp.Core.UnitTests.LibraryTestFx @@ -29,31 +29,31 @@ type BigIntType() = let bigPositiveB = 98765432109876543210I let bigNegativeA = -bigPositiveA let bigNegativeB = -bigPositiveB - + // Interfaces [] - member this.IComparable() = - + member this.IComparable() = + // Legit IC - let ic = bigPositiveA :> IComparable - Assert.AreEqual(ic.CompareTo(bigPositiveA), 0) - + let ic = bigPositiveA :> IComparable + Assert.AreEqual(ic.CompareTo(bigPositiveA), 0) + // Base class methods [] member this.ObjectToString() = - Assert.AreEqual(bigPositiveA.ToString(), + Assert.AreEqual(bigPositiveA.ToString(), "12345678901234567890") Assert.AreEqual((new BigInteger(0)).ToString(), "0") Assert.AreEqual((new BigInteger(168)).ToString(), "168") Assert.AreEqual(-168I.ToString(), "-168") Assert.AreEqual(-0I.ToString(), "0") Assert.AreEqual((BigInteger()).ToString(), "0") - - + + [] member this.ObjectEquals() = // All three are different constructor, but have equivalent value - + let a = new BigInteger(168) let b = 168I let c = new BigInteger(168L) @@ -96,10 +96,10 @@ type BigIntType() = Assert.False(a.Equals(null)) Assert.True(0I.GetHashCode() = (BigInteger()).GetHashCode()) - + // static methods [] - member this.Abs() = + member this.Abs() = Assert.AreEqual(BigInteger.Abs(bigPositiveA), bigPositiveA) Assert.AreEqual(BigInteger.Abs(bigPositiveB), @@ -114,29 +114,29 @@ type BigIntType() = () [] - member this.DivRem() = - let mutable r = BigInteger(0) + member this.DivRem() = + let mutable r = BigInteger(0) let mutable q = BigInteger(0) let mutable qr = (BigInteger.Zero, BigInteger.Zero) - + q <- BigInteger.DivRem(100I, 123I, &r) Assert.AreEqual((q,r), (0I, 100I)) - + q <- BigInteger.DivRem(123I, 100I, &r) Assert.AreEqual((q,r), (1I, 23I)) - + q <- BigInteger.DivRem(123I, -100I, &r) Assert.AreEqual((q,r), (-1I, 23I)) - + q <- BigInteger.DivRem(0I, 1I, &r) - Assert.AreEqual((q,r), (0I, 0I)) - + Assert.AreEqual((q,r), (0I, 0I)) + q <- BigInteger.DivRem(-100I, -123I, &r) Assert.AreEqual((q,r), (0I, -100I)) - + q <- BigInteger.DivRem(-123I, -100I, &r) Assert.AreEqual((q,r), (1I, -23I)) - + q <- BigInteger.DivRem(0I, 100I, &r) Assert.AreEqual((q,r), (0I, 0I)) @@ -150,7 +150,7 @@ type BigIntType() = () [] - member this.GreatestCommonDivisor() = + member this.GreatestCommonDivisor() = Assert.AreEqual(BigInteger.GreatestCommonDivisor(bigPositiveA, bigPositiveB), 900000000090I) Assert.AreEqual(BigInteger.GreatestCommonDivisor(bigNegativeA, bigNegativeB), 900000000090I) Assert.AreEqual(BigInteger.GreatestCommonDivisor(0I, bigPositiveA), bigPositiveA) @@ -161,12 +161,12 @@ type BigIntType() = () [] - member this.One() = + member this.One() = Assert.AreEqual(BigInteger.One,1I) () [] - member this.Parse() = + member this.Parse() = Assert.AreEqual(BigInteger.Parse("12345678901234567890"), bigPositiveA) Assert.AreEqual(BigInteger.Parse("168"), 168I) @@ -176,7 +176,7 @@ type BigIntType() = Assert.AreEqual(BigInteger.Parse(" +4242 "), BigInteger(4242)) Assert.AreEqual(BigInteger.Parse("+0003"), BigInteger(3)) - + CheckThrowsFormatException(fun() -> BigInteger.Parse("abc168L") |> ignore) CheckThrowsFormatException(fun() -> BigInteger.Parse("") |> ignore) CheckThrowsFormatException(fun() -> BigInteger.Parse(" ") |> ignore) @@ -184,11 +184,11 @@ type BigIntType() = CheckThrowsFormatException(fun() -> BigInteger.Parse("+") |> ignore) CheckThrowsFormatException(fun() -> BigInteger.Parse("+-") |> ignore) CheckThrowsArgumentNullException(fun() -> BigInteger.Parse(null) |> ignore) - + () - + [] - member this.Pow() = + member this.Pow() = Assert.AreEqual(BigInteger.Pow(2I, 3), 8I) Assert.AreEqual(BigInteger.Pow(0I, 100), 0I) Assert.AreEqual(BigInteger.Pow(2I, 0), 1I) @@ -197,11 +197,11 @@ type BigIntType() = Assert.AreEqual(BigInteger.Pow(BigInteger(), 0), 1I) Assert.AreEqual(BigInteger.Pow(BigInteger(), 1), 0I) Assert.AreEqual(BigInteger.Pow(0I, 1), 0I) - CheckThrowsArgumentOutOfRangeException(fun() -> BigInteger.Pow(100I, -2) |> ignore) + CheckThrowsArgumentOutOfRangeException(fun() -> BigInteger.Pow(100I, -2) |> ignore) () [] - member this.Sign() = + member this.Sign() = Assert.AreEqual(0I.Sign, 0) Assert.AreEqual(BigInteger().Sign, 0) Assert.AreEqual(bigPositiveA.Sign, 1) @@ -209,7 +209,7 @@ type BigIntType() = () [] - member this.IsZero() = + member this.IsZero() = Assert.True(0I.IsZero) Assert.True(-0I.IsZero) Assert.True(BigInteger.Zero.IsZero) @@ -224,7 +224,7 @@ type BigIntType() = () [] - member this.IsOne() = + member this.IsOne() = Assert.False(0I.IsOne) Assert.False(-0I.IsOne) Assert.False(BigInteger.Zero.IsOne) @@ -238,62 +238,62 @@ type BigIntType() = Assert.True(BigInteger(1).IsOne) Assert.False(-1I.IsOne) () - + [] - member this.ToDouble() = + member this.ToDouble() = Assert.AreEqual(double 0I, 0.0) Assert.AreEqual(double (BigInteger()), 0.0) Assert.AreEqual(double 123I, 123.0) Assert.AreEqual(double -123I, -123.0) () - + [] - member this.ToInt32() = + member this.ToInt32() = Assert.AreEqual(int32 0I, 0) Assert.AreEqual(int32 (BigInteger()), 0) Assert.AreEqual(int32 123I, 123) Assert.AreEqual(int32 -123I, -123) () - + [] - member this.ToInt64() = + member this.ToInt64() = Assert.AreEqual(int64 0I, 0L) Assert.AreEqual(int64 (BigInteger()), 0L) Assert.AreEqual(int64 123I, 123L) Assert.AreEqual(int64 -123I, -123L) - + () - + [] - member this.Zero() = + member this.Zero() = Assert.AreEqual(BigInteger.Zero,0I) Assert.AreEqual(BigInteger.Zero, BigInteger()) () // operators [] - member this.Addition() = + member this.Addition() = Assert.AreEqual((123I + 456I),579I) Assert.AreEqual((-123I + (-456I)),-579I) Assert.AreEqual((0I + 123I),123I) Assert.AreEqual((BigInteger() + 123I),123I) Assert.AreEqual((123I + BigInteger()),123I) Assert.AreEqual((bigPositiveA + 0I),bigPositiveA) - Assert.AreEqual((bigPositiveA + bigNegativeA),0I) + Assert.AreEqual((bigPositiveA + bigNegativeA),0I) () [] - member this.Division() = + member this.Division() = Assert.AreEqual((123I / 124I),0I) Assert.AreEqual((123I / (-124I)),0I) - Assert.AreEqual((0I / 123I),0I) + Assert.AreEqual((0I / 123I),0I) Assert.AreEqual((BigInteger() / 123I),0I) () [] - member this.Equality() = + member this.Equality() = Assert.AreEqual((bigPositiveA = bigPositiveA),true) - Assert.AreEqual((bigPositiveA = bigNegativeA),false) + Assert.AreEqual((bigPositiveA = bigNegativeA),false) Assert.AreEqual((bigNegativeA = bigPositiveA),false) Assert.AreEqual((bigNegativeA = (-123I)),false) Assert.AreEqual((0I = new BigInteger(0)),true) @@ -301,7 +301,7 @@ type BigIntType() = () [] - member this.GreaterThan() = + member this.GreaterThan() = Assert.AreEqual((bigPositiveA > bigPositiveB),false) Assert.AreEqual((bigNegativeA > bigPositiveB),false) Assert.AreEqual((bigNegativeA > (-123I)),false) @@ -313,10 +313,10 @@ type BigIntType() = () [] - member this.GreaterThanOrEqual() = + member this.GreaterThanOrEqual() = Assert.AreEqual((bigPositiveA >= bigPositiveB),false) Assert.AreEqual((bigPositiveA >= bigNegativeB),true) - Assert.AreEqual((bigPositiveB >= bigPositiveA),true) + Assert.AreEqual((bigPositiveB >= bigPositiveA),true) Assert.AreEqual((bigNegativeA >= bigNegativeA),true) Assert.AreEqual((0I >= new BigInteger(0)),true) Assert.AreEqual((0I >= new BigInteger()),true) @@ -326,7 +326,7 @@ type BigIntType() = () [] - member this.LessThan() = + member this.LessThan() = Assert.AreEqual((bigPositiveA < bigPositiveB),true) Assert.AreEqual((bigNegativeA < bigPositiveB),true) Assert.AreEqual((bigPositiveA < bigNegativeB),false) @@ -339,11 +339,11 @@ type BigIntType() = () [] - member this.LessThanOrEqual() = + member this.LessThanOrEqual() = Assert.AreEqual((bigPositiveA <= bigPositiveB),true) Assert.AreEqual((bigPositiveA <= bigNegativeB),false) - Assert.AreEqual((bigNegativeB <= bigPositiveA),true) - Assert.AreEqual((bigNegativeA <= bigNegativeA),true) + Assert.AreEqual((bigNegativeB <= bigPositiveA),true) + Assert.AreEqual((bigNegativeA <= bigNegativeA),true) Assert.AreEqual((0I <= new BigInteger(-0)),true) Assert.AreEqual((0I <= new BigInteger()),true) Assert.AreEqual((BigInteger() <= BigInteger()),true) @@ -352,7 +352,7 @@ type BigIntType() = () [] - member this.Modulus() = + member this.Modulus() = Assert.AreEqual((bigPositiveA % bigPositiveB),bigPositiveA) Assert.AreEqual((bigNegativeA % bigNegativeB),bigNegativeA) Assert.AreEqual((0I % bigPositiveA),0I) @@ -362,7 +362,7 @@ type BigIntType() = () [] - member this.Multiply() = + member this.Multiply() = Assert.AreEqual((123I * 100I),12300I) Assert.AreEqual((123I * (-100I)),-12300I) Assert.AreEqual((-123I * (-100I)),12300I) @@ -372,9 +372,9 @@ type BigIntType() = () [] - member this.Range() = + member this.Range() = let resultPos = [123I..128I] - let seqPos = + let seqPos = [ 123I 124I @@ -386,7 +386,7 @@ type BigIntType() = VerifySeqsEqual resultPos seqPos let resultNeg = [(-128I) .. (-123I)] - let seqNeg = + let seqNeg = [ -128I -127I @@ -394,11 +394,11 @@ type BigIntType() = -125I -124I -123I - ] + ] VerifySeqsEqual resultNeg seqNeg - + let resultSmall1 = [0I..5I] - let seqSmall = [0I;1I;2I;3I;4I;5I] + let seqSmall = [0I;1I;2I;3I;4I;5I] VerifySeqsEqual resultSmall1 seqSmall let resultSmall2 = [BigInteger()..5I] @@ -406,30 +406,30 @@ type BigIntType() = () [] - member this.RangeStep() = + member this.RangeStep() = let resultPos = [100I .. 3I .. 109I] - let seqPos = + let seqPos = [ 100I 103I 106I 109I - ] + ] VerifySeqsEqual resultPos seqPos - - let resultNeg = [(-109I) .. 3I .. (-100I)] - let seqNeg = + + let resultNeg = [(-109I) .. 3I .. (-100I)] + let seqNeg = [ -109I -106I -103I -100I - ] + ] VerifySeqsEqual resultNeg seqNeg - + let resultSmall1 = [0I..3I..9I] let resultSmall1 = [BigInteger()..3I..9I] - let seqSmall = [0I;3I;6I;9I] + let seqSmall = [0I;3I;6I;9I] VerifySeqsEqual resultSmall1 seqSmall CheckThrowsArgumentException(fun () -> [0I .. BigInteger() .. 3I] |> ignore) @@ -438,7 +438,7 @@ type BigIntType() = () [] - member this.Subtraction() = + member this.Subtraction() = Assert.AreEqual((100I - 123I),-23I) Assert.AreEqual((0I - bigPositiveB),bigNegativeB) Assert.AreEqual((BigInteger() - bigPositiveB),bigNegativeB) @@ -446,20 +446,20 @@ type BigIntType() = Assert.AreEqual((bigPositiveB - 0I),bigPositiveB) Assert.AreEqual((-100I - (-123I)),23I) Assert.AreEqual((100I - (-123I)),223I) - Assert.AreEqual((-100I - 123I),-223I) - + Assert.AreEqual((-100I - 123I),-223I) + () - + [] - member this.UnaryNegation() = + member this.UnaryNegation() = Assert.AreEqual(-bigPositiveA,bigNegativeA) Assert.AreEqual(-bigNegativeA,bigPositiveA) - Assert.AreEqual(-0I,0I) - Assert.AreEqual(-BigInteger(),0I) + Assert.AreEqual(-0I,0I) + Assert.AreEqual(-BigInteger(),0I) () [] - member this.UnaryPlus() = + member this.UnaryPlus() = Assert.AreEqual(+bigPositiveA,bigPositiveA) Assert.AreEqual(+bigNegativeA,bigNegativeA) Assert.AreEqual(+0I,0I) @@ -468,17 +468,17 @@ type BigIntType() = // instance methods [] - member this.New_int32() = + member this.New_int32() = Assert.AreEqual(new BigInteger(0), 0I) Assert.AreEqual(new BigInteger(-10), -10I) - Assert.AreEqual(new BigInteger(System.Int32.MinValue),-2147483648I) - + Assert.AreEqual(new BigInteger(System.Int32.MinValue),-2147483648I) + () - + [] - member this.New_int64() = + member this.New_int64() = Assert.AreEqual(new BigInteger(0L), 0I) Assert.AreEqual(new BigInteger(-100L), -100I) Assert.AreEqual(new BigInteger(System.Int64.MinValue), -9223372036854775808I) - + () diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/IntConversionsGenerated.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/IntConversionsGenerated.fs index b45edd17b6f..72d3cdcf802 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/IntConversionsGenerated.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/IntConversionsGenerated.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -// This file is automatically generated by IntConversionsTestGenerator.fsx +// This file is automatically generated by IntConversionsTestGenerator.fsx namespace FSharp.Core.UnitTests open System open Xunit @@ -55,480 +55,480 @@ type IntConversionsGenerated() = member this.``int16.m1.To.uint8`` () = let i : int16 = -1s Assert.AreEqual (UInt8.MaxValue, uint8 i) - + [] member this.``int32.m1.To.uint8`` () = let i : int32 = -1l Assert.AreEqual (UInt8.MaxValue, uint8 i) - + [] member this.``int64.m1.To.uint8`` () = let i : int64 = -1L Assert.AreEqual (UInt8.MaxValue, uint8 i) - + [] member this.``sbyte.m1.To.uint16`` () = let i : sbyte = -1y Assert.AreEqual (UInt16.MaxValue, uint16 i) - + [] member this.``int8.m1.To.uint16`` () = let i : int8 = -1y Assert.AreEqual (UInt16.MaxValue, uint16 i) - + [] member this.``int16.m1.To.uint16`` () = let i : int16 = -1s Assert.AreEqual (UInt16.MaxValue, uint16 i) - + [] member this.``int32.m1.To.uint16`` () = let i : int32 = -1l Assert.AreEqual (UInt16.MaxValue, uint16 i) - + [] member this.``int64.m1.To.uint16`` () = let i : int64 = -1L Assert.AreEqual (UInt16.MaxValue, uint16 i) - + [] member this.``sbyte.m1.To.uint32`` () = let i : sbyte = -1y Assert.AreEqual (UInt32.MaxValue, uint32 i) - + [] member this.``int8.m1.To.uint32`` () = let i : int8 = -1y Assert.AreEqual (UInt32.MaxValue, uint32 i) - + [] member this.``int16.m1.To.uint32`` () = let i : int16 = -1s Assert.AreEqual (UInt32.MaxValue, uint32 i) - + [] member this.``int32.m1.To.uint32`` () = let i : int32 = -1l Assert.AreEqual (UInt32.MaxValue, uint32 i) - + [] member this.``int64.m1.To.uint32`` () = let i : int64 = -1L Assert.AreEqual (UInt32.MaxValue, uint32 i) - + [] member this.``sbyte.m1.To.uint64`` () = let i : sbyte = -1y Assert.AreEqual (UInt64.MaxValue, uint64 i) - + [] member this.``int8.m1.To.uint64`` () = let i : int8 = -1y Assert.AreEqual (UInt64.MaxValue, uint64 i) - + [] member this.``int16.m1.To.uint64`` () = let i : int16 = -1s Assert.AreEqual (UInt64.MaxValue, uint64 i) - + [] member this.``int32.m1.To.uint64`` () = let i : int32 = -1l Assert.AreEqual (UInt64.MaxValue, uint64 i) - + [] member this.``int64.m1.To.uint64`` () = let i : int64 = -1L Assert.AreEqual (UInt64.MaxValue, uint64 i) - + [] member this.``sbyte.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : sbyte = -1y Assert.AreEqual (minus1, sbyte i) - + [] member this.``int8.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : int8 = -1y Assert.AreEqual (minus1, sbyte i) - + [] member this.``int16.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : int16 = -1s Assert.AreEqual (minus1, sbyte i) - + [] member this.``int32.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : int32 = -1l Assert.AreEqual (minus1, sbyte i) - + [] member this.``int64.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : int64 = -1L Assert.AreEqual (minus1, sbyte i) - + [] member this.``sbyte.m1.To.int8`` () = let minus1 : int8 = -1y let i : sbyte = -1y Assert.AreEqual (minus1, int8 i) - + [] member this.``int8.m1.To.int8`` () = let minus1 : int8 = -1y let i : int8 = -1y Assert.AreEqual (minus1, int8 i) - + [] member this.``int16.m1.To.int8`` () = let minus1 : int8 = -1y let i : int16 = -1s Assert.AreEqual (minus1, int8 i) - + [] member this.``int32.m1.To.int8`` () = let minus1 : int8 = -1y let i : int32 = -1l Assert.AreEqual (minus1, int8 i) - + [] member this.``int64.m1.To.int8`` () = let minus1 : int8 = -1y let i : int64 = -1L Assert.AreEqual (minus1, int8 i) - + [] member this.``sbyte.m1.To.int16`` () = let minus1 : int16 = -1s let i : sbyte = -1y Assert.AreEqual (minus1, int16 i) - + [] member this.``int8.m1.To.int16`` () = let minus1 : int16 = -1s let i : int8 = -1y Assert.AreEqual (minus1, int16 i) - + [] member this.``int16.m1.To.int16`` () = let minus1 : int16 = -1s let i : int16 = -1s Assert.AreEqual (minus1, int16 i) - + [] member this.``int32.m1.To.int16`` () = let minus1 : int16 = -1s let i : int32 = -1l Assert.AreEqual (minus1, int16 i) - + [] member this.``int64.m1.To.int16`` () = let minus1 : int16 = -1s let i : int64 = -1L Assert.AreEqual (minus1, int16 i) - + [] member this.``sbyte.m1.To.int32`` () = let minus1 : int32 = -1l let i : sbyte = -1y Assert.AreEqual (minus1, int32 i) - + [] member this.``int8.m1.To.int32`` () = let minus1 : int32 = -1l let i : int8 = -1y Assert.AreEqual (minus1, int32 i) - + [] member this.``int16.m1.To.int32`` () = let minus1 : int32 = -1l let i : int16 = -1s Assert.AreEqual (minus1, int32 i) - + [] member this.``int32.m1.To.int32`` () = let minus1 : int32 = -1l let i : int32 = -1l Assert.AreEqual (minus1, int32 i) - + [] member this.``int64.m1.To.int32`` () = let minus1 : int32 = -1l let i : int64 = -1L Assert.AreEqual (minus1, int32 i) - + [] member this.``sbyte.m1.To.int64`` () = let minus1 : int64 = -1L let i : sbyte = -1y Assert.AreEqual (minus1, int64 i) - + [] member this.``int8.m1.To.int64`` () = let minus1 : int64 = -1L let i : int8 = -1y Assert.AreEqual (minus1, int64 i) - + [] member this.``int16.m1.To.int64`` () = let minus1 : int64 = -1L let i : int16 = -1s Assert.AreEqual (minus1, int64 i) - + [] member this.``int32.m1.To.int64`` () = let minus1 : int64 = -1L let i : int32 = -1l Assert.AreEqual (minus1, int64 i) - + [] member this.``int64.m1.To.int64`` () = let minus1 : int64 = -1L let i : int64 = -1L Assert.AreEqual (minus1, int64 i) - + [] member this.``byte.MaxValue.To.int16`` () = let sourceMaxValue : int16 = 0xFFs Assert.AreEqual (sourceMaxValue, int16 Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.int16`` () = let sourceMaxValue : int16 = 0xFFs Assert.AreEqual (sourceMaxValue, int16 UInt8.MaxValue) - + [] member this.``byte.MaxValue.To.uint16`` () = let sourceMaxValue : uint16 = 0xFFus Assert.AreEqual (sourceMaxValue, uint16 Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.uint16`` () = let sourceMaxValue : uint16 = 0xFFus Assert.AreEqual (sourceMaxValue, uint16 UInt8.MaxValue) - + [] member this.``byte.MaxValue.To.int32`` () = let sourceMaxValue : int32 = 0xFFl Assert.AreEqual (sourceMaxValue, int32 Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.int32`` () = let sourceMaxValue : int32 = 0xFFl Assert.AreEqual (sourceMaxValue, int32 UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.int32`` () = let sourceMaxValue : int32 = 0xFFFFl Assert.AreEqual (sourceMaxValue, int32 UInt16.MaxValue) - + [] member this.``byte.MaxValue.To.uint32`` () = let sourceMaxValue : uint32 = 0xFFul Assert.AreEqual (sourceMaxValue, uint32 Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.uint32`` () = let sourceMaxValue : uint32 = 0xFFul Assert.AreEqual (sourceMaxValue, uint32 UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.uint32`` () = let sourceMaxValue : uint32 = 0xFFFFul Assert.AreEqual (sourceMaxValue, uint32 UInt16.MaxValue) - + [] member this.``byte.MaxValue.To.int64`` () = let sourceMaxValue : int64 = 0xFFL Assert.AreEqual (sourceMaxValue, int64 Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.int64`` () = let sourceMaxValue : int64 = 0xFFL Assert.AreEqual (sourceMaxValue, int64 UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.int64`` () = let sourceMaxValue : int64 = 0xFFFFL Assert.AreEqual (sourceMaxValue, int64 UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.int64`` () = let sourceMaxValue : int64 = 0xFFFFFFFFL Assert.AreEqual (sourceMaxValue, int64 UInt32.MaxValue) - + [] member this.``byte.MaxValue.To.uint64`` () = let sourceMaxValue : uint64 = 0xFFuL Assert.AreEqual (sourceMaxValue, uint64 Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.uint64`` () = let sourceMaxValue : uint64 = 0xFFuL Assert.AreEqual (sourceMaxValue, uint64 UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.uint64`` () = let sourceMaxValue : uint64 = 0xFFFFuL Assert.AreEqual (sourceMaxValue, uint64 UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.uint64`` () = let sourceMaxValue : uint64 = 0xFFFFFFFFuL Assert.AreEqual (sourceMaxValue, uint64 UInt32.MaxValue) - + [] member this.``byte.MaxValue.To.sbyte`` () = Assert.AreEqual (-1y, sbyte Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.sbyte`` () = Assert.AreEqual (-1y, sbyte UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.sbyte`` () = Assert.AreEqual (-1y, sbyte UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.sbyte`` () = Assert.AreEqual (-1y, sbyte UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.sbyte`` () = Assert.AreEqual (-1y, sbyte UInt64.MaxValue) - + [] member this.``byte.MaxValue.To.int8`` () = Assert.AreEqual (-1y, int8 Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.int8`` () = Assert.AreEqual (-1y, int8 UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.int8`` () = Assert.AreEqual (-1y, int8 UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.int8`` () = Assert.AreEqual (-1y, int8 UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.int8`` () = Assert.AreEqual (-1y, int8 UInt64.MaxValue) - + [] member this.``uint16.MaxValue.To.int16`` () = Assert.AreEqual (-1s, int16 UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.int16`` () = Assert.AreEqual (-1s, int16 UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.int16`` () = Assert.AreEqual (-1s, int16 UInt64.MaxValue) - + [] member this.``uint32.MaxValue.To.int32`` () = Assert.AreEqual (-1l, int32 UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.int32`` () = Assert.AreEqual (-1l, int32 UInt64.MaxValue) - + [] member this.``uint64.MaxValue.To.int64`` () = Assert.AreEqual (-1L, int64 UInt64.MaxValue) - + [] member this.``byte.MaxValue.To.byte`` () = Assert.AreEqual (Byte.MaxValue, byte Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.byte`` () = Assert.AreEqual (Byte.MaxValue, byte UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.byte`` () = Assert.AreEqual (Byte.MaxValue, byte UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.byte`` () = Assert.AreEqual (Byte.MaxValue, byte UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.byte`` () = Assert.AreEqual (Byte.MaxValue, byte UInt64.MaxValue) - + [] member this.``byte.MaxValue.To.uint8`` () = Assert.AreEqual (UInt8.MaxValue, uint8 Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.uint8`` () = Assert.AreEqual (UInt8.MaxValue, uint8 UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.uint8`` () = Assert.AreEqual (UInt8.MaxValue, uint8 UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.uint8`` () = Assert.AreEqual (UInt8.MaxValue, uint8 UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.uint8`` () = Assert.AreEqual (UInt8.MaxValue, uint8 UInt64.MaxValue) - + [] member this.``uint16.MaxValue.To.uint16`` () = Assert.AreEqual (UInt16.MaxValue, uint16 UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.uint16`` () = Assert.AreEqual (UInt16.MaxValue, uint16 UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.uint16`` () = Assert.AreEqual (UInt16.MaxValue, uint16 UInt64.MaxValue) - + [] member this.``uint32.MaxValue.To.uint32`` () = Assert.AreEqual (UInt32.MaxValue, uint32 UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.uint32`` () = Assert.AreEqual (UInt32.MaxValue, uint32 UInt64.MaxValue) - + [] member this.``uint64.MaxValue.To.uint64`` () = Assert.AreEqual (UInt64.MaxValue, uint64 UInt64.MaxValue) - + [] member this.``sbyte.m1.To.nativeint`` () = Assert.AreEqual (-1n, nativeint -1y) - + [] member this.``int8.m1.To.nativeint`` () = Assert.AreEqual (-1n, nativeint -1y) - + [] member this.``int16.m1.To.nativeint`` () = Assert.AreEqual (-1n, nativeint -1s) - + [] member this.``int32.m1.To.nativeint`` () = Assert.AreEqual (-1n, nativeint -1l) - + [] member this.``int64.m1.To.nativeint`` () = Assert.AreEqual (-1n, nativeint -1L) - + [] member this.``byte.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -536,7 +536,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, nativeint Byte.MaxValue) else Assert.AreEqual (-1n, nativeint Byte.MaxValue) - + [] member this.``uint8.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -544,7 +544,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, nativeint UInt8.MaxValue) else Assert.AreEqual (-1n, nativeint UInt8.MaxValue) - + [] member this.``uint16.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -552,7 +552,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, nativeint UInt16.MaxValue) else Assert.AreEqual (-1n, nativeint UInt16.MaxValue) - + [] member this.``uint32.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -560,7 +560,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, nativeint UInt32.MaxValue) else Assert.AreEqual (-1n, nativeint UInt32.MaxValue) - + [] member this.``uint64.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -568,33 +568,33 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, nativeint UInt64.MaxValue) else Assert.AreEqual (-1n, nativeint UInt64.MaxValue) - + member private this.UnativeintMaxValue = let mutable unativeintMaxValue : unativeint = 0un for i = 1 to sizeof do unativeintMaxValue <- (unativeintMaxValue <<< 8) ||| 0xFFun unativeintMaxValue - + [] member this.``sbyte.m1.To.unativeint`` () = Assert.AreEqual (this.UnativeintMaxValue, unativeint -1y) - + [] member this.``int8.m1.To.unativeint`` () = Assert.AreEqual (this.UnativeintMaxValue, unativeint -1y) - + [] member this.``int16.m1.To.unativeint`` () = Assert.AreEqual (this.UnativeintMaxValue, unativeint -1s) - + [] member this.``int32.m1.To.unativeint`` () = Assert.AreEqual (this.UnativeintMaxValue, unativeint -1l) - + [] member this.``int64.m1.To.unativeint`` () = Assert.AreEqual (this.UnativeintMaxValue, unativeint -1L) - + [] member this.``byte.m1.To.unativeint`` () = if sizeof > sizeof then @@ -602,7 +602,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, unativeint Byte.MaxValue) else Assert.AreEqual (this.UnativeintMaxValue, unativeint Byte.MaxValue) - + [] member this.``uint8.m1.To.unativeint`` () = if sizeof > sizeof then @@ -610,7 +610,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, unativeint UInt8.MaxValue) else Assert.AreEqual (this.UnativeintMaxValue, unativeint UInt8.MaxValue) - + [] member this.``uint16.m1.To.unativeint`` () = if sizeof > sizeof then @@ -618,7 +618,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, unativeint UInt16.MaxValue) else Assert.AreEqual (this.UnativeintMaxValue, unativeint UInt16.MaxValue) - + [] member this.``uint32.m1.To.unativeint`` () = if sizeof > sizeof then @@ -626,7 +626,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, unativeint UInt32.MaxValue) else Assert.AreEqual (this.UnativeintMaxValue, unativeint UInt32.MaxValue) - + [] member this.``uint64.m1.To.unativeint`` () = if sizeof > sizeof then @@ -634,323 +634,323 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, unativeint UInt64.MaxValue) else Assert.AreEqual (this.UnativeintMaxValue, unativeint UInt64.MaxValue) - + [] member this.``Checked.sbyte.m1.To.byte`` () = let i : sbyte = -1y CheckThrowsExn(fun () -> Checked.byte i |> ignore) - + [] member this.``Checked.int16.m1.To.byte`` () = let i : int16 = -1s CheckThrowsExn(fun () -> Checked.byte i |> ignore) - + [] member this.``Checked.int32.m1.To.byte`` () = let i : int32 = -1l CheckThrowsExn(fun () -> Checked.byte i |> ignore) - + [] member this.``Checked.int64.m1.To.byte`` () = let i : int64 = -1L CheckThrowsExn(fun () -> Checked.byte i |> ignore) - + [] member this.``Checked.sbyte.m1.To.uint16`` () = let i : sbyte = -1y CheckThrowsExn(fun () -> Checked.uint16 i |> ignore) - + [] member this.``Checked.int16.m1.To.uint16`` () = let i : int16 = -1s CheckThrowsExn(fun () -> Checked.uint16 i |> ignore) - + [] member this.``Checked.int32.m1.To.uint16`` () = let i : int32 = -1l CheckThrowsExn(fun () -> Checked.uint16 i |> ignore) - + [] member this.``Checked.int64.m1.To.uint16`` () = let i : int64 = -1L CheckThrowsExn(fun () -> Checked.uint16 i |> ignore) - + [] member this.``Checked.sbyte.m1.To.uint32`` () = let i : sbyte = -1y CheckThrowsExn(fun () -> Checked.uint32 i |> ignore) - + [] member this.``Checked.int16.m1.To.uint32`` () = let i : int16 = -1s CheckThrowsExn(fun () -> Checked.uint32 i |> ignore) - + [] member this.``Checked.int32.m1.To.uint32`` () = let i : int32 = -1l CheckThrowsExn(fun () -> Checked.uint32 i |> ignore) - + [] member this.``Checked.int64.m1.To.uint32`` () = let i : int64 = -1L CheckThrowsExn(fun () -> Checked.uint32 i |> ignore) - + [] member this.``Checked.sbyte.m1.To.uint64`` () = let i : sbyte = -1y CheckThrowsExn(fun () -> Checked.uint64 i |> ignore) - + [] member this.``Checked.int16.m1.To.uint64`` () = let i : int16 = -1s CheckThrowsExn(fun () -> Checked.uint64 i |> ignore) - + [] member this.``Checked.int32.m1.To.uint64`` () = let i : int32 = -1l CheckThrowsExn(fun () -> Checked.uint64 i |> ignore) - + [] member this.``Checked.int64.m1.To.uint64`` () = let i : int64 = -1L CheckThrowsExn(fun () -> Checked.uint64 i |> ignore) - + [] member this.``Checked.sbyte.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : sbyte = -1y Assert.AreEqual (minus1, Checked.sbyte i) - + [] member this.``Checked.int16.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : int16 = -1s Assert.AreEqual (minus1, Checked.sbyte i) - + [] member this.``Checked.int32.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : int32 = -1l Assert.AreEqual (minus1, Checked.sbyte i) - + [] member this.``Checked.int64.m1.To.sbyte`` () = let minus1 : sbyte = -1y let i : int64 = -1L Assert.AreEqual (minus1, Checked.sbyte i) - + [] member this.``Checked.sbyte.m1.To.int16`` () = let minus1 : int16 = -1s let i : sbyte = -1y Assert.AreEqual (minus1, Checked.int16 i) - + [] member this.``Checked.int16.m1.To.int16`` () = let minus1 : int16 = -1s let i : int16 = -1s Assert.AreEqual (minus1, Checked.int16 i) - + [] member this.``Checked.int32.m1.To.int16`` () = let minus1 : int16 = -1s let i : int32 = -1l Assert.AreEqual (minus1, Checked.int16 i) - + [] member this.``Checked.int64.m1.To.int16`` () = let minus1 : int16 = -1s let i : int64 = -1L Assert.AreEqual (minus1, Checked.int16 i) - + [] member this.``Checked.sbyte.m1.To.int32`` () = let minus1 : int32 = -1l let i : sbyte = -1y Assert.AreEqual (minus1, Checked.int32 i) - + [] member this.``Checked.int16.m1.To.int32`` () = let minus1 : int32 = -1l let i : int16 = -1s Assert.AreEqual (minus1, Checked.int32 i) - + [] member this.``Checked.int32.m1.To.int32`` () = let minus1 : int32 = -1l let i : int32 = -1l Assert.AreEqual (minus1, Checked.int32 i) - + [] member this.``Checked.int64.m1.To.int32`` () = let minus1 : int32 = -1l let i : int64 = -1L Assert.AreEqual (minus1, Checked.int32 i) - + [] member this.``Checked.sbyte.m1.To.int64`` () = let minus1 : int64 = -1L let i : sbyte = -1y Assert.AreEqual (minus1, Checked.int64 i) - + [] member this.``Checked.int16.m1.To.int64`` () = let minus1 : int64 = -1L let i : int16 = -1s Assert.AreEqual (minus1, Checked.int64 i) - + [] member this.``Checked.int32.m1.To.int64`` () = let minus1 : int64 = -1L let i : int32 = -1l Assert.AreEqual (minus1, Checked.int64 i) - + [] member this.``Checked.int64.m1.To.int64`` () = let minus1 : int64 = -1L let i : int64 = -1L Assert.AreEqual (minus1, Checked.int64 i) - + [] member this.``Checked.byte.MaxValue.To.int16`` () = let sourceMaxValue : int16 = 0xFFs Assert.AreEqual (sourceMaxValue, Checked.int16 Byte.MaxValue) - + [] member this.``Checked.byte.MaxValue.To.uint16`` () = let sourceMaxValue : uint16 = 0xFFus Assert.AreEqual (sourceMaxValue, Checked.uint16 Byte.MaxValue) - + [] member this.``Checked.byte.MaxValue.To.int32`` () = let sourceMaxValue : int32 = 0xFFl Assert.AreEqual (sourceMaxValue, Checked.int32 Byte.MaxValue) - + [] member this.``Checked.uint16.MaxValue.To.int32`` () = let sourceMaxValue : int32 = 0xFFFFl Assert.AreEqual (sourceMaxValue, Checked.int32 UInt16.MaxValue) - + [] member this.``Checked.byte.MaxValue.To.uint32`` () = let sourceMaxValue : uint32 = 0xFFul Assert.AreEqual (sourceMaxValue, Checked.uint32 Byte.MaxValue) - + [] member this.``Checked.uint16.MaxValue.To.uint32`` () = let sourceMaxValue : uint32 = 0xFFFFul Assert.AreEqual (sourceMaxValue, Checked.uint32 UInt16.MaxValue) - + [] member this.``Checked.byte.MaxValue.To.int64`` () = let sourceMaxValue : int64 = 0xFFL Assert.AreEqual (sourceMaxValue, Checked.int64 Byte.MaxValue) - + [] member this.``Checked.uint16.MaxValue.To.int64`` () = let sourceMaxValue : int64 = 0xFFFFL Assert.AreEqual (sourceMaxValue, Checked.int64 UInt16.MaxValue) - + [] member this.``Checked.uint32.MaxValue.To.int64`` () = let sourceMaxValue : int64 = 0xFFFFFFFFL Assert.AreEqual (sourceMaxValue, Checked.int64 UInt32.MaxValue) - + [] member this.``Checked.byte.MaxValue.To.uint64`` () = let sourceMaxValue : uint64 = 0xFFuL Assert.AreEqual (sourceMaxValue, Checked.uint64 Byte.MaxValue) - + [] member this.``Checked.uint16.MaxValue.To.uint64`` () = let sourceMaxValue : uint64 = 0xFFFFuL Assert.AreEqual (sourceMaxValue, Checked.uint64 UInt16.MaxValue) - + [] member this.``Checked.uint32.MaxValue.To.uint64`` () = let sourceMaxValue : uint64 = 0xFFFFFFFFuL Assert.AreEqual (sourceMaxValue, Checked.uint64 UInt32.MaxValue) - + [] member this.``Checked.byte.MaxValue.To.sbyte`` () = CheckThrowsExn (fun () -> Checked.sbyte Byte.MaxValue |> ignore) - + [] member this.``Checked.uint16.MaxValue.To.sbyte`` () = CheckThrowsExn (fun () -> Checked.sbyte UInt16.MaxValue |> ignore) - + [] member this.``Checked.uint32.MaxValue.To.sbyte`` () = CheckThrowsExn (fun () -> Checked.sbyte UInt32.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.sbyte`` () = CheckThrowsExn (fun () -> Checked.sbyte UInt64.MaxValue |> ignore) - + [] member this.``Checked.uint16.MaxValue.To.int16`` () = CheckThrowsExn (fun () -> Checked.int16 UInt16.MaxValue |> ignore) - + [] member this.``Checked.uint32.MaxValue.To.int16`` () = CheckThrowsExn (fun () -> Checked.int16 UInt32.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.int16`` () = CheckThrowsExn (fun () -> Checked.int16 UInt64.MaxValue |> ignore) - + [] member this.``Checked.uint32.MaxValue.To.int32`` () = CheckThrowsExn (fun () -> Checked.int32 UInt32.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.int32`` () = CheckThrowsExn (fun () -> Checked.int32 UInt64.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.int64`` () = CheckThrowsExn (fun () -> Checked.int64 UInt64.MaxValue |> ignore) - + [] member this.``Checked.uint16.MaxValue.To.byte`` () = CheckThrowsExn (fun () -> Checked.byte UInt16.MaxValue |> ignore) - + [] member this.``Checked.uint32.MaxValue.To.byte`` () = CheckThrowsExn (fun () -> Checked.byte UInt32.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.byte`` () = CheckThrowsExn (fun () -> Checked.byte UInt64.MaxValue |> ignore) - + [] member this.``Checked.uint32.MaxValue.To.uint16`` () = CheckThrowsExn (fun () -> Checked.uint16 UInt32.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.uint16`` () = CheckThrowsExn (fun () -> Checked.uint16 UInt64.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.uint32`` () = CheckThrowsExn (fun () -> Checked.uint32 UInt64.MaxValue |> ignore) - + [] member this.``Checked.sbyte.m1.To.nativeint`` () = Assert.AreEqual (-1n, Checked.nativeint -1y) - + [] member this.``Checked.int16.m1.To.nativeint`` () = Assert.AreEqual (-1n, Checked.nativeint -1s) - + [] member this.``Checked.int32.m1.To.nativeint`` () = Assert.AreEqual (-1n, Checked.nativeint -1l) - + [] member this.``Checked.int64.m1.To.nativeint`` () = Assert.AreEqual (-1n, Checked.nativeint -1L) - + [] member this.``Checked.byte.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -958,7 +958,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, Checked.nativeint Byte.MaxValue) else CheckThrowsExn (fun () -> Checked.nativeint Byte.MaxValue |> ignore) - + [] member this.``Checked.uint16.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -966,7 +966,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, Checked.nativeint UInt16.MaxValue) else CheckThrowsExn (fun () -> Checked.nativeint UInt16.MaxValue |> ignore) - + [] member this.``Checked.uint32.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -974,7 +974,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, Checked.nativeint UInt32.MaxValue) else CheckThrowsExn (fun () -> Checked.nativeint UInt32.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.nativeint`` () = if sizeof > sizeof then @@ -982,23 +982,23 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, Checked.nativeint UInt64.MaxValue) else CheckThrowsExn (fun () -> Checked.nativeint UInt64.MaxValue |> ignore) - + [] member this.``Checked.sbyte.m1.To.unativeint`` () = CheckThrowsExn (fun () -> Checked.unativeint -1y |> ignore) - + [] member this.``Checked.int16.m1.To.unativeint`` () = CheckThrowsExn (fun () -> Checked.unativeint -1s |> ignore) - + [] member this.``Checked.int32.m1.To.unativeint`` () = CheckThrowsExn (fun () -> Checked.unativeint -1l |> ignore) - + [] member this.``Checked.int64.m1.To.unativeint`` () = CheckThrowsExn (fun () -> Checked.unativeint -1L |> ignore) - + [] member this.``Checked.byte.MaxValue.To.unativeint`` () = if sizeof >= sizeof then @@ -1006,7 +1006,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, Checked.unativeint Byte.MaxValue) else CheckThrowsExn (fun () -> Checked.unativeint Byte.MaxValue |> ignore) - + [] member this.``Checked.uint16.MaxValue.To.unativeint`` () = if sizeof >= sizeof then @@ -1014,7 +1014,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, Checked.unativeint UInt16.MaxValue) else CheckThrowsExn (fun () -> Checked.unativeint UInt16.MaxValue |> ignore) - + [] member this.``Checked.uint32.MaxValue.To.unativeint`` () = if sizeof >= sizeof then @@ -1022,7 +1022,7 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, Checked.unativeint UInt32.MaxValue) else CheckThrowsExn (fun () -> Checked.unativeint UInt32.MaxValue |> ignore) - + [] member this.``Checked.uint64.MaxValue.To.unativeint`` () = if sizeof >= sizeof then @@ -1030,4 +1030,4 @@ type IntConversionsGenerated() = Assert.AreEqual (sourceMaxValue, Checked.unativeint UInt64.MaxValue) else CheckThrowsExn (fun () -> Checked.unativeint UInt64.MaxValue |> ignore) - + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs index 106a1f5d7af..19b113bea16 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs @@ -24,7 +24,7 @@ type OptionModule() = Assert.AreEqual( Option.flatten None, None) Assert.AreEqual( Option.flatten (Some None), None) Assert.AreEqual( Option.flatten (Some <| Some 1), Some 1) - Assert.AreEqual( Option.flatten (Some <| Some ""), Some "") + Assert.AreEqual( Option.flatten (Some <| Some ""), Some "") [] member this.FilterSomeIntegerWhenPredicateReturnsTrue () = @@ -32,7 +32,7 @@ type OptionModule() = let actual = x |> Some |> Option.filter (fun _ -> true) let expected = x |> Some - Assert.AreEqual(expected, actual) + Assert.AreEqual(expected, actual) [0;1;-1;42] |> List.iter test [] @@ -131,9 +131,9 @@ type OptionModule() = member this.OfToObj() = Assert.True( Option.toObj (Some "3") = "3") Assert.True( Option.toObj (Some "") = "") - Assert.True( Option.toObj (Some null) = null) // TODO NULLNESS: this type annotation should not be needed - Assert.True( Option.toObj None = null) - + Assert.True( Option.toObj (Some null) = null) // TODO NULLNESS: this type annotation should not be needed + Assert.True( Option.toObj None = null) + Assert.True( Option.ofObj "3" = Some "3") Assert.True( Option.ofObj "" = Some "") Assert.True( Option.ofObj [| "" |] = Some [| "" |]) @@ -232,7 +232,7 @@ type ValueOptionTests() = member _.``ValueNone gives "ValueNone" when calling ToString`` () = Assert.AreEqual("ValueNone", ValueNone.ToString()) Assert.AreEqual("ValueNone", string ValueNone) - + [] member _.``ValueNone with sprintf`` () = Assert.AreEqual("ValueNone", sprintf "%O" (ValueNone.ToString())) @@ -264,13 +264,13 @@ type ValueOptionTests() = Assert.AreEqual((ValueSome (1,2)).Value, (1,2)) Assert.AreEqual(defaultValueArg ValueNone 1, 1) Assert.AreEqual(defaultValueArg (ValueSome 3) 1, 3) - + [] member this.Flatten () = Assert.AreEqual(ValueOption.flatten ValueNone, ValueNone) Assert.AreEqual(ValueOption.flatten (ValueSome ValueNone), ValueNone) Assert.AreEqual(ValueOption.flatten (ValueSome <| ValueSome 1), ValueSome 1) - Assert.AreEqual(ValueOption.flatten (ValueSome <| ValueSome ""), ValueSome "") + Assert.AreEqual(ValueOption.flatten (ValueSome <| ValueSome ""), ValueSome "") [] member this.FilterValueSomeIntegerWhenPredicateReturnsTrue () = @@ -377,8 +377,8 @@ type ValueOptionTests() = Assert.True(ValueOption.toObj (ValueSome "3") = "3") Assert.True(ValueOption.toObj (ValueSome "") = "") Assert.True(ValueOption.toObj (ValueSome null) = null) - Assert.True(ValueOption.toObj ValueNone = null) - + Assert.True(ValueOption.toObj ValueNone = null) + Assert.True(ValueOption.ofObj "3" = ValueSome "3") Assert.True(ValueOption.ofObj "" = ValueSome "") Assert.True(ValueOption.ofObj [| "" |] = ValueSome [| "" |]) @@ -393,7 +393,7 @@ type ValueOptionTests() = Assert.Equal(None, ValueOption.toOption (ValueNone: int voption)) Assert.Equal(ValueSome 3, ValueOption.ofOption (Some 3)) Assert.Equal(ValueNone, ValueOption.ofOption (None: int option)) - + [] member this.DefaultValue() = Assert.AreEqual(ValueOption.defaultValue 3 ValueNone, 3) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/PrintfTests.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/PrintfTests.fs index ab3c17d9d20..3cfaa7c25ed 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/PrintfTests.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/PrintfTests.fs @@ -44,7 +44,7 @@ type PrintfTests() = test "%-10d" 123 "123 " test "%10c" 'a' " a" test "%-10c" 'a' "a " - + [] member this.NumbersInDifferentBases() = test "%10u" 123 " 123" @@ -57,7 +57,7 @@ type PrintfTests() = test "%-10x" 123 "7b " test "%10X" 123 " 7B" test "%-10X" 123 "7B " - + [] member this.VariableWidth() = Assert.AreEqual(" a", sprintf "%*c" 8 'a' ) @@ -73,8 +73,8 @@ type PrintfTests() = Assert.AreEqual(" 7b", sprintf "%*x" 8 123 ) Assert.AreEqual("7b ", sprintf "%-*x" 8 123 ) Assert.AreEqual(" 7B", sprintf "%*X" 8 123 ) - Assert.AreEqual("7B ", sprintf "%-*X" 8 123 ) - + Assert.AreEqual("7B ", sprintf "%-*X" 8 123 ) + // test cases for https://github.com/dotnet/fsharp/issues/15557 [] member this.``sign flag - positive and negative one``() = @@ -82,17 +82,17 @@ type PrintfTests() = test "%f" -1.0 "-1.000000" test "%+f" +1.0 "+1.000000" test "%+f" -1.0 "-1.000000" - + test "%f" +1.0f "1.000000" test "%f" -1.0f "-1.000000" test "%+f" +1.0f "+1.000000" test "%+f" -1.0f "-1.000000" - + test "%f" +1.0M "1.000000" test "%f" -1.0M "-1.000000" test "%+f" +1.0M "+1.000000" test "%+f" -1.0M "-1.000000" - + [] member this.``sign flag - positive and negative zero``() = test "%f" +0.0 "0.000000" @@ -109,7 +109,7 @@ type PrintfTests() = #else "+0.000000" #endif - + test "%f" +0.0f "0.000000" test "%f" -0.0f #if NETCOREAPP @@ -124,12 +124,12 @@ type PrintfTests() = #else "+0.000000" #endif - + test "%f" +0.0M "0.000000" test "%f" -0.0M "0.000000" test "%+f" +0.0M "+0.000000" test "%+f" -0.0M "+0.000000" - + [] member this.``sign flag - positive and negative zero - corner cases`` () = test "%-10.3f" +0.0f "0.000 " @@ -153,7 +153,7 @@ type PrintfTests() = #else "+0000000.000000e+000" #endif - + test "%-10.3f" +0.0 "0.000 " test "%-10.3f" -0.0 #if NETCOREAPP @@ -175,8 +175,8 @@ type PrintfTests() = #else "+0000000.000000e+000" #endif - - + + [] member this.``sign flag - very small positive and negative numbers``() = test "%f" -0.0000001 @@ -191,8 +191,8 @@ type PrintfTests() = #else "+0.000000" #endif - - + + test "%f" -0.0000001f #if NETCOREAPP "-0.000000" @@ -205,18 +205,18 @@ type PrintfTests() = #else "+0.000000" #endif - + test "%f" -0.0000001M "0.000000" test "%+f" -0.0000001M "+0.000000" - + [] member this.``sign flag - infinity``() = test "%f" +infinity "Infinity" test "%f" -infinity "-Infinity" test "%+f" +infinity "Infinity" test "%+f" -infinity "-Infinity" - + test "%f" +infinityf "Infinity" test "%f" -infinityf "-Infinity" test "%+f" +infinityf "Infinity" @@ -228,24 +228,24 @@ type PrintfTests() = test "%f" -nan "NaN" test "%+f" +nan "NaN" test "%+f" -nan "NaN" - + test "%f" +nanf "NaN" test "%f" -nanf "NaN" test "%+f" +nanf "NaN" test "%+f" -nanf "NaN" - + // test cases for https://github.com/dotnet/fsharp/issues/15558 (same root cause as #15557; listing for completeness) [] member this.``zero padding - positive and negative one`` () = test "%010.3f" +1.0 "000001.000" test "%010.3f" -1.0 "-00001.000" - + test "%010.3f" +1.0f "000001.000" test "%010.3f" -1.0f "-00001.000" - + test "%010.3f" +1.0M "000001.000" test "%010.3f" -1.0M "-00001.000" - + [] member this.``zero padding - positive and negative zero`` () = test "%010.3f" +0.0 "000000.000" @@ -255,7 +255,7 @@ type PrintfTests() = #else "000000.000" #endif - + test "%010.3f" +0.0f "000000.000" test "%010.3f" -0.0f #if NETCOREAPP @@ -263,10 +263,10 @@ type PrintfTests() = #else "000000.000" #endif - + test "%010.3f" +0.0M "000000.000" test "%010.3f" -0.0M "000000.000" - + [] member _.``union case formatting`` () = Assert.AreEqual("CaseOne", sprintf "%A" CaseOne) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/ResultTests.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/ResultTests.fs index e2b08e867d7..2cc63ea4a8e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/ResultTests.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/ResultTests.fs @@ -18,7 +18,7 @@ open Result type ResultTests() = let assertWasNotCalledThunk () = raise (exn "Thunk should not have been called.") - + let fail_if_empty email= if String.IsNullOrEmpty(email) then Error Empty else Ok email @@ -49,25 +49,25 @@ type ResultTests() = [] member this.MapWillTransformOkValues() = - Ok "some@email.com" + Ok "some@email.com" |> map toUpper |> shouldBeOkWithValue "SOME@EMAIL.COM" [] member this.MapWillNotTransformErrorValues() = - Error "my error" + Error "my error" |> map toUpper |> shouldBeErrorWithValue "my error" [] member this.MapErrorWillTransformErrorValues() = - Error "my error" + Error "my error" |> mapError toUpper |> shouldBeErrorWithValue "MY ERROR" [] member this.MapErrorWillNotTransformOkValues() = - Ok "some@email.com" + Ok "some@email.com" |> mapError toUpper |> shouldBeOkWithValue "some@email.com" @@ -92,7 +92,7 @@ type ResultTests() = member this.IsError() = Assert.False(Result.isError (Ok 1)) Assert.True(Result.isError (Error 1)) - + [] member this.DefaultValue() = Assert.AreEqual(Result.defaultValue 3 (Error 42), 3) @@ -109,68 +109,68 @@ type ResultTests() = Assert.AreEqual(Result.defaultWith assertWasNotCalledThunk (Ok 42), 42) Assert.AreEqual(Result.defaultWith assertWasNotCalledThunk (Ok "1"), "1") - + [] member this.Count() = Assert.AreEqual(Result.count (Ok 1), 1) Assert.AreEqual(Result.count (Error 1), 0) - + [] member this.Fold() = Assert.AreEqual(Result.fold (fun accum x -> accum + x * 2) 0 (Error 2), 0) Assert.AreEqual(Result.fold (fun accum x -> accum + x * 2) 0 (Ok 1), 2) Assert.AreEqual(Result.fold (fun accum x -> accum + x * 2) 10 (Ok 1), 12) - + [] member this.FoldBack() = Assert.AreEqual(Result.foldBack (fun x accum -> accum + x * 2) (Error 2) 0, 0) Assert.AreEqual(Result.foldBack (fun x accum -> accum + x * 2) (Ok 1) 0, 2) Assert.AreEqual(Result.foldBack (fun x accum -> accum + x * 2) (Ok 1) 10, 12) - + [] member this.Exists() = Assert.AreEqual(Result.exists (fun x -> x >= 5) (Error 6), false) Assert.AreEqual(Result.exists (fun x -> x >= 5) (Ok 42), true) Assert.AreEqual(Result.exists (fun x -> x >= 5) (Ok 4), false) - + [] member this.ForAll() = Assert.AreEqual(Result.forall (fun x -> x >= 5) (Error 1), true) Assert.AreEqual(Result.forall (fun x -> x >= 5) (Ok 42), true) Assert.AreEqual(Result.forall (fun x -> x >= 5) (Ok 4), false) - + [] - member this.Contains() = + member this.Contains() = Assert.AreEqual(Result.contains 99 (Error 99), false) Assert.AreEqual(Result.contains 99 (Ok 99), true) Assert.AreEqual(Result.contains 99 (Ok 100), false) - + [] member this.Iterate() = let mutable i = 0 let increment _ = i <- i + 1 - + Result.iter increment (Error "Hello world") Assert.AreEqual(0, i) Result.iter increment (Ok "Hello world") Assert.AreEqual(1, i) - + [] member this.ToArray() = Assert.AreEqual(Result.toArray (Error 42), [| |]) Assert.AreEqual(Result.toArray (Ok 42), [| 42 |]) - + [] member this.ToList() = Assert.AreEqual(Result.toList (Error 42), [ ]) Assert.AreEqual(Result.toList (Ok 42), [ 42 ]) - + [] member this.ToOption() = Assert.AreEqual(Result.toOption (Error 42), None) Assert.AreEqual(Result.toOption (Ok 42), Some 42) - + [] member this.ToValueOption() = Assert.AreEqual(Result.toValueOption (Error 42), ValueNone) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Linq/NullableOperators.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Linq/NullableOperators.fs index dc957303eaf..254732b9802 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Linq/NullableOperators.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Linq/NullableOperators.fs @@ -7,7 +7,7 @@ open Xunit open Microsoft.FSharp.Linq type NullableOperators() = - [] + [] member _.CastingUint () = let expected = Nullable(12u) let actual = Nullable.uint (Nullable(12)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Linq/QueryTests.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Linq/QueryTests.fs index 3a1f33331d3..faebf58c869 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Linq/QueryTests.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Linq/QueryTests.fs @@ -14,28 +14,28 @@ open Microsoft.FSharp.Linq.RuntimeHelpers module TestData = type Person = { Id: int; Name: string; Age: int; DepartmentId: int } type Department = { Id: int; DeptName: string } - + let people = [ { Id = 1; Name = "Alice"; Age = 30; DepartmentId = 1 } { Id = 2; Name = "Bob"; Age = 25; DepartmentId = 1 } { Id = 3; Name = "Charlie"; Age = 35; DepartmentId = 2 } { Id = 4; Name = "Diana"; Age = 28; DepartmentId = 2 } ] - + let departments = [ { Id = 1; DeptName = "Engineering" } { Id = 2; DeptName = "Marketing" } ] - + type Table1 = { Id1: int; Id2: int; Value1: string } type Table2 = { Id1: int; Id2: int; Value2: string } - + let table1Data = [ { Table1.Id1 = 1; Id2 = 10; Value1 = "A" } { Table1.Id1 = 2; Id2 = 20; Value1 = "B" } { Table1.Id1 = 3; Id2 = 30; Value1 = "C" } ] - + let table2Data = [ { Table2.Id1 = 1; Id2 = 10; Value2 = "X" } { Table2.Id1 = 2; Id2 = 20; Value2 = "Y" } @@ -45,45 +45,45 @@ module TestData = open TestData type QueryTupleJoinTests() = - + [] member _.``Inline tuple join returns correct matches - issue 7885``() = let t1 = table1Data.AsQueryable() let t2 = table2Data.AsQueryable() - - let inlineResult = + + let inlineResult = query { for a in t1 do join b in t2 on ((a.Id1, a.Id2) = (b.Id1, b.Id2)) select (a.Value1, b.Value2) } |> Seq.toList - + Assert.Equal(2, inlineResult.Length) Assert.Contains(("A", "X"), inlineResult) Assert.Contains(("B", "Y"), inlineResult) - + [] member _.``Inline tuple join matches function-based tuple join - issue 7885``() = let t1 = table1Data.AsQueryable() let t2 = table2Data.AsQueryable() - + let makeKey1 (a: Table1) = (a.Id1, a.Id2) let makeKey2 (b: Table2) = (b.Id1, b.Id2) - - let inlineResult = + + let inlineResult = query { for a in t1 do join b in t2 on ((a.Id1, a.Id2) = (b.Id1, b.Id2)) select (a.Value1, b.Value2) } |> Seq.toList - - let funcResult = + + let funcResult = query { for a in t1 do join b in t2 on (makeKey1 a = makeKey2 b) select (a.Value1, b.Value2) } |> Seq.toList - + Assert.Equal(funcResult.Length, inlineResult.Length) for item in funcResult do Assert.Contains(item, inlineResult) @@ -92,69 +92,69 @@ type QueryTupleJoinTests() = type QueryGroupByTupleTests() = - + [] member _.``GroupBy with tuple key works - issue 47``() = - let data = + let data = [ (1, "A", 100); (1, "A", 200); (2, "B", 300) ].AsQueryable() - - let result = + + let result = query { for (x, y, z) in data do groupBy (x, y) into g select (g.Key, g.Count()) } |> Seq.toList - + Assert.Equal(2, result.Length) Assert.Contains(((1, "A"), 2), result) Assert.Contains(((2, "B"), 1), result) - + [] member _.``Accessing tuple elements after groupBy works - issue 47``() = let data = people.AsQueryable() - - let result = + + let result = query { for p in data do groupBy (p.DepartmentId, p.Age > 28) into g select (fst g.Key, snd g.Key, g.Count()) } |> Seq.toList - + Assert.True(result.Length > 0) for (deptId, isOver28, count) in result do Assert.True(deptId >= 1 && deptId <= 2) Assert.True(count >= 1) - + [] member _.``GroupBy with tuple key allows iteration over group elements``() = let data = table1Data.AsQueryable() - - let result = + + let result = query { for item in data do groupBy item.Id1 into g select (g.Key, g |> Seq.map (fun x -> x.Value1) |> Seq.toList) } |> Seq.toList - + Assert.Equal(3, result.Length) let group1 = result |> List.find (fun (k, _) -> k = 1) Assert.Contains("A", snd group1) type QueryGroupJoinTupleTests() = - + [] member _.``GroupJoin with inline tuple key works``() = let t1 = table1Data.AsQueryable() let t2 = table2Data.AsQueryable() - - let result = + + let result = query { for a in t1 do groupJoin b in t2 on ((a.Id1, a.Id2) = (b.Id1, b.Id2)) into bs select (a.Value1, bs |> Seq.length) } |> Seq.toList - + Assert.Equal(3, result.Length) Assert.Contains(("A", 1), result) Assert.Contains(("B", 1), result) @@ -162,164 +162,164 @@ type QueryGroupJoinTupleTests() = type AnonymousObjectEqualityTests() = - + [] member _.``AnonymousObject with same values are equal``() = let ao1 = Microsoft.FSharp.Linq.RuntimeHelpers.AnonymousObject(1, "test") let ao2 = Microsoft.FSharp.Linq.RuntimeHelpers.AnonymousObject(1, "test") - + Assert.True(ao1.Equals(ao2)) Assert.Equal(ao1.GetHashCode(), ao2.GetHashCode()) - + [] member _.``AnonymousObject with different values are not equal``() = let ao1 = Microsoft.FSharp.Linq.RuntimeHelpers.AnonymousObject(1, "test") let ao2 = Microsoft.FSharp.Linq.RuntimeHelpers.AnonymousObject(2, "test") - + Assert.False(ao1.Equals(ao2)) - + [] member _.``AnonymousObject hash codes are consistent with equality``() = let ao1 = Microsoft.FSharp.Linq.RuntimeHelpers.AnonymousObject(1, "test") let ao2 = Microsoft.FSharp.Linq.RuntimeHelpers.AnonymousObject(2, "other") - + // The important thing is that equal objects have equal hash codes Assert.False(ao1.Equals(ao2)) /// Tests for tuple select preserving IQueryable type - Issues #3782 and #15133 type QueryTupleSelectTests() = - + [] member _.``Tuple select preserves IQueryable type - issue 3782``() = let data = TestData.people.AsQueryable() - - let result = + + let result = query { for p in data do select (p.Id, p.Name) } - + // The result should be IQueryable - use box to avoid FS0067 warning Assert.NotNull(box result) - Assert.True(typeof>.IsAssignableFrom(result.GetType()), + Assert.True(typeof>.IsAssignableFrom(result.GetType()), sprintf "Expected IQueryable but got %s" (result.GetType().FullName)) - + let queryable = result let exprStr = queryable.Expression.ToString() - Assert.True(exprStr.Contains("Tuple") && exprStr.Contains("Select"), + Assert.True(exprStr.Contains("Tuple") && exprStr.Contains("Select"), sprintf "Expression should contain Select with Tuple, but got: %s" exprStr) - + // Verify the query can be composed - if incorrectly using Enumerable.Select, this would fail let composed = result.Where(fun (id, _name) -> id > 0) let items = composed |> Seq.toList Assert.True(items.Length > 0) - + [] member _.``System.Tuple select preserves IQueryable type``() = let data = TestData.people.AsQueryable() - - let result = + + let result = query { for p in data do select (System.Tuple.Create(p.Id, p.Name)) } - + // box to avoid FS0067 warning Assert.NotNull(box result) - Assert.True(typeof>>.IsAssignableFrom(result.GetType()), + Assert.True(typeof>>.IsAssignableFrom(result.GetType()), sprintf "Expected IQueryable> but got %s" (result.GetType().FullName)) - + let composed = result.Where(fun t -> t.Item1 > 0) let items = composed |> Seq.toList Assert.True(items.Length > 0) - + [] member _.``F# tuple and System.Tuple produce equivalent query behavior``() = let data = TestData.people.AsQueryable() - - let fsharpTupleResult = + + let fsharpTupleResult = query { for p in data do select (p.Id, p.Name) } |> Seq.toList - - let systemTupleResult = + + let systemTupleResult = query { for p in data do select (System.Tuple.Create(p.Id, p.Name)) } |> Seq.map (fun t -> (t.Item1, t.Item2)) |> Seq.toList - + Assert.Equal(fsharpTupleResult.Length, systemTupleResult.Length) for (expected, actual) in List.zip fsharpTupleResult systemTupleResult do Assert.Equal(expected, actual) - + [] member _.``Tuple select query can be composed with Where - issue 15133``() = let data = TestData.people.AsQueryable() - - let baseQuery = + + let baseQuery = query { for p in data do select (p.Id, p.Name, p.Age) } - + let filtered = baseQuery.Where(fun (id, name, age) -> age > 25) - + let result = filtered |> Seq.toList - + Assert.True(result.Length > 0) for (id, name, age) in result do Assert.True(age > 25, sprintf "Expected age > 25 but got %d" age) - + [] member _.``Tuple select query can be composed with OrderBy - issue 15133``() = let data = TestData.people.AsQueryable() - - let baseQuery = + + let baseQuery = query { for p in data do select (p.Id, p.Name, p.Age) } - + let sorted = baseQuery.OrderBy(fun (id, name, age) -> age) - + let result = sorted |> Seq.toList - + Assert.True(result.Length > 0) let ages = result |> List.map (fun (_, _, age) -> age) let sortedAges = ages |> List.sort Assert.Equal(sortedAges, ages) - + [] member _.``Record projection query is composable``() = let data = TestData.people.AsQueryable() - - let baseQuery = + + let baseQuery = query { for p in data do select { TestData.Person.Id = p.Id; Name = p.Name; Age = p.Age; DepartmentId = p.DepartmentId } } - + let filtered = baseQuery.Where(fun p -> p.Age > 28) let result = filtered |> Seq.toList Assert.True(result.Length > 0) for p in result do Assert.True(p.Age > 28) - + [] member _.``Multi-element tuple select preserves all elements for composition``() = let data = TestData.people.AsQueryable() - - let baseQuery = + + let baseQuery = query { for p in data do select (p.Id, p.Name, p.Age, p.DepartmentId) } - + let filtered = baseQuery.Where(fun (id, name, age, deptId) -> deptId = 1 && age > 20) let result = filtered |> Seq.toList - + Assert.True(result.Length > 0) for (_, _, _, deptId) in result do Assert.Equal(1, deptId) @@ -329,7 +329,7 @@ module MutationTestHelpers = type TypeWithMutableField() = [] val mutable Field: int - + type TypeWithSettableProperty() = let mutable value = 0 member this.Prop @@ -338,52 +338,52 @@ module MutationTestHelpers = /// Tests for EvaluateQuotation edge cases - Issue #19099 type EvaluateQuotationEdgeCaseTests() = - + [] member _.``EvaluateQuotation handles Sequential expressions - issue 19099``() = let result = LeafExpressionConverter.EvaluateQuotation <@ ignore 1; 42 @> Assert.Equal(42, result :?> int) - + [] member _.``EvaluateQuotation handles void method calls - issue 19099``() = // This should not throw - it should execute and return unit let result = LeafExpressionConverter.EvaluateQuotation <@ System.Console.Write("") @> Assert.Equal(box (), result) - + [] member _.``EvaluateQuotation handles unit return - issue 19099``() = // Test that unit-returning expressions work (previously failed with System.Void issue) let result = LeafExpressionConverter.EvaluateQuotation <@ ignore 1; () @> Assert.Equal(box (), result) - + [] member _.``EvaluateQuotation handles VarSet - issue 19099``() = let result = LeafExpressionConverter.EvaluateQuotation <@ let mutable x = 1 in x <- 2; x @> Assert.Equal(2, result :?> int) - + [] member _.``EvaluateQuotation handles FieldSet - issue 19099``() = let obj = MutationTestHelpers.TypeWithMutableField() let result = LeafExpressionConverter.EvaluateQuotation <@ obj.Field <- 42; obj.Field @> Assert.Equal(42, result :?> int) - + [] member _.``EvaluateQuotation handles PropertySet - issue 19099``() = let obj = MutationTestHelpers.TypeWithSettableProperty() let result = LeafExpressionConverter.EvaluateQuotation <@ obj.Prop <- 99; obj.Prop @> Assert.Equal(99, result :?> int) - + [] member _.``EvaluateQuotation handles indexed PropertySet - issue 19099``() = let arr = [| 1; 2; 3 |] let result = LeafExpressionConverter.EvaluateQuotation <@ arr.[0] <- 10; arr.[0] @> Assert.Equal(10, result :?> int) - + [] member _.``EvaluateQuotation handles deeply nested let bindings``() = let result = LeafExpressionConverter.EvaluateQuotation <@ let a = 42 in let b = a in let c = b in c @> Assert.Equal(42, result :?> int) - + [] member _.``EvaluateQuotation handles deeply nested let with computation``() = let result = LeafExpressionConverter.EvaluateQuotation <@ let a = 1 in let b = a + 1 in let c = b + 1 in let d = c + 1 in d @> @@ -392,7 +392,7 @@ type EvaluateQuotationEdgeCaseTests() = [] member _.``EvaluateQuotation handles 15 nested let bindings``() = // Verifies inlining is O(n) not O(2^n) - let result = LeafExpressionConverter.EvaluateQuotation <@ + let result = LeafExpressionConverter.EvaluateQuotation <@ let v1 = 1 in let v2 = v1 + 1 in let v3 = v2 + 1 in @@ -414,42 +414,42 @@ type EvaluateQuotationEdgeCaseTests() = /// Tests for conditional without else branch in queries - Issue #3445 type QueryConditionalTests() = - + [] member _.``Query with if-then no else compiles and runs - issue 3445``() = // This was throwing: Type mismatch when building 'cond' - let result = - query { + let result = + query { for i in [1; 2; 3].AsQueryable() do - if i > 1 then - select i + if i > 1 then + select i } |> Seq.toList - + Assert.Equal(2, result.Length) Assert.Contains(2, result) Assert.Contains(3, result) - + [] member _.``Query with if-then no else with false condition returns empty - issue 3445``() = - let result = - query { + let result = + query { for i in [1; 2; 3].AsQueryable() do - if false then - select i + if false then + select i } |> Seq.toList - + Assert.Empty(result) - + [] member _.``Query with complex if-then condition works - issue 3445``() = let data = TestData.people.AsQueryable() - let result = - query { + let result = + query { for p in data do - if p.Age > 25 && p.DepartmentId = 1 then + if p.Age > 25 && p.DepartmentId = 1 then select p.Name } |> Seq.toList - + // Alice (30, dept 1) matches; Bob (25, dept 1) doesn't (not >25) Assert.Single(result) |> ignore Assert.Contains("Alice", result) @@ -459,35 +459,35 @@ type QueryConditionalTests() = /// Note: This issue requires a compiler warning for proper fix. /// These tests document the current behavior. type QueryHeadOrDefaultTests() = - + [] member _.``headOrDefault with empty sequence returns default``() = let data = [1; 2; 3].AsQueryable() - let result = - query { + let result = + query { for x in data do where (x > 100) headOrDefault } // For int (value type), default is 0 Assert.Equal(0, result) - + [] member _.``headOrDefault with matching element returns first match``() = let data = [1; 2; 3].AsQueryable() - let result = - query { + let result = + query { for x in data do where (x > 1) headOrDefault } Assert.Equal(2, result) - + [] member _.``headOrDefault with tuple and no match returns null - issue 3845 known limitation``() = let data = [(1, "a"); (2, "b")].AsQueryable() - let result = - query { + let result = + query { for x in data do where (fst x > 100) headOrDefault diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Quotations/FSharpQuotations.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Quotations/FSharpQuotations.fs index bec73a21957..4b2c1caf3d3 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Quotations/FSharpQuotations.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Quotations/FSharpQuotations.fs @@ -33,10 +33,10 @@ module Check = type FSharpQuotationsTests() = - + [] member x.MethodInfoNRE() = - let f() = + let f() = E.Call(null, []) |> ignore CheckThrowsArgumentNullException f @@ -45,7 +45,7 @@ type FSharpQuotationsTests() = let f() = E.FieldGet(null) |> ignore CheckThrowsArgumentNullException f - + [] member x.ConstructorNRE() = let f() = @@ -57,15 +57,15 @@ type FSharpQuotationsTests() = let f() = E.PropertyGet(null,[]) |> ignore CheckThrowsArgumentNullException f - + [] member x.UnionCaseInfoNRE() = let f() = E.NewUnionCase(Unchecked.defaultof,[]) |> ignore CheckThrowsArgumentNullException f - + [] - member x.ReShapeTypechecking_Let() = + member x.ReShapeTypechecking_Let() = let q0 = <@ let a = 1 in a @> match q0 with | ExprShape.ShapeCombination(shape, [value;lambda]) -> @@ -80,7 +80,7 @@ type FSharpQuotationsTests() = | _ -> Assert.Fail() [] - member x.ReShapeStaticIndexedProperties() = + member x.ReShapeStaticIndexedProperties() = let q0 = <@ StaticIndexedPropertyTest.IdxProp 5 @> match q0 with | ExprShape.ShapeCombination(shape, args) -> @@ -283,20 +283,20 @@ module TestConditionalConstraints = let ``Anonymous record with non-alphabetical field order produces clean LINQ expression - issues 11131 and 15648`` () = // Non-alphabetical order - B before A let q = <@ fun (x: int) -> {| B = x; A = x + 1 |} @> - + let linqExpr = LeafExpressionConverter.QuotationToExpression q let exprStr = linqExpr.ToString() - + Assert.DoesNotContain(".Invoke(", exprStr) [] let ``Nested anonymous record produces clean LINQ expression`` () = // Nested anonymous record with non-alphabetical field order let q = <@ fun (x: int) -> {| Outer = {| B = x; A = x + 1 |} |} @> - + let linqExpr = LeafExpressionConverter.QuotationToExpression q let exprStr = linqExpr.ToString() - + Assert.DoesNotContain(".Invoke(", exprStr) [] @@ -305,13 +305,13 @@ module TestConditionalConstraints = let qAlpha = <@ fun (x: int) -> {| A = x + 1; B = x |} @> // Non-alphabetical order let qNonAlpha = <@ fun (x: int) -> {| B = x; A = x + 1 |} @> - + let linqAlpha = LeafExpressionConverter.QuotationToExpression qAlpha let linqNonAlpha = LeafExpressionConverter.QuotationToExpression qNonAlpha - + let exprAlpha = linqAlpha.ToString() let exprNonAlpha = linqNonAlpha.ToString() - + // Neither should contain Invoke Assert.DoesNotContain(".Invoke(", exprAlpha) Assert.DoesNotContain(".Invoke(", exprNonAlpha) @@ -326,10 +326,10 @@ module TestConditionalConstraints = let ``Array indexing produces ArrayIndex expression not GetArray - issue 16918`` () = // Array access like x.u.[0] should NOT produce GetArray call let q = <@ fun (x: ArrayTestDoc) -> x.u.[0] @> - + let linqExpr = LeafExpressionConverter.QuotationToExpression q let exprStr = linqExpr.ToString() - + // Should NOT contain GetArray Assert.DoesNotContain("GetArray", exprStr) // Should produce x.u[0] style array index expression @@ -339,10 +339,10 @@ module TestConditionalConstraints = let ``Nested array member access produces clean LINQ expression - issue 16918`` () = // x.u[0].c should generate proper expression tree without GetArray let q = <@ fun (x: ArrayTestDoc) -> x.u.[0].c @> - + let linqExpr = LeafExpressionConverter.QuotationToExpression q let exprStr = linqExpr.ToString() - + // Should NOT contain GetArray Assert.DoesNotContain("GetArray", exprStr) // Should contain array index @@ -354,9 +354,9 @@ module TestConditionalConstraints = let ``Array indexing with variable index produces clean expression`` () = // Array access with variable index let q = <@ fun (x: int[]) (i: int) -> x.[i] @> - + let linqExpr = LeafExpressionConverter.QuotationToExpression q let exprStr = linqExpr.ToString() - + // Should NOT contain GetArray Assert.DoesNotContain("GetArray", exprStr) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs index fabb8936201..d4a535e2acc 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs @@ -19,9 +19,9 @@ open Microsoft.FSharp.Reflection [Test Strategy] Make sure each method works on: * Generic types -* Null -* DiscriminatedUnion -* Delegate +* Null +* DiscriminatedUnion +* Delegate * Record * Exception * Tuple @@ -29,8 +29,8 @@ Make sure each method works on: * Struct versions of the above *) -module IsModule = - type IsModuleType () = +module IsModule = + type IsModuleType () = member _.M = 1 type FSharpDelegate = delegate of int -> string @@ -57,7 +57,7 @@ type DiscUnionType<'T> = [] type DiscStructUnionType<'T> = | A // No data associated with tag - | B of 'T + | B of 'T | Evil_C of f:float // This is sharing the field "f" in the struct | C of f:float * s:string @@ -65,49 +65,49 @@ exception ExceptionInt of int exception DatalessException -module FSharpModule = +module FSharpModule = type ModuleType() = class end type FSharpValueTests() = - + // global variables let rec record1 : RecordType = { field1 = "field1"; field2 = Some(record1); field3 = ( fun () -> (record1, "") )} let record2 : RecordType = { field1 = "field2"; field2 = Some(record1); field3 = ( fun () -> (record1, "") )} - + // global variables let rec structRecord1 : StructRecordType = { field1 = "field1"; field2 = None; field3 = ( fun () -> (structRecord1, "") )} let structRecord2 : StructRecordType = { field1 = "field2"; field2 = Some(structRecord1); field3 = ( fun () -> (structRecord1, "") )} - let rec genericRecordType1 : GenericRecordType = - { + let rec genericRecordType1 : GenericRecordType = + { field1 = "field1" field2 = 1 field3 = (fun () -> genericRecordType1) } - + let genericRecordType2 : GenericRecordType = { field1 = "field1"; field2 = 1; field3 = ( fun () -> genericRecordType1 )} - + let nullValue = null - + let singleCaseUnion1 = SingleCaseDiscUnion.SingleCaseTag(1.0, 2.0, 3.0) let singleCaseUnion2 = SingleCaseDiscUnion.SingleCaseTag(4.0, 5.0, 6.0) - + let singleCaseStructUnion1 = SingleCaseDiscStructUnion.SingleCaseTagStruct(1.0, 2.0, 3.0) let singleCaseStructUnion2 = SingleCaseDiscStructUnion.SingleCaseTagStruct(4.0, 5.0, 6.0) - + let discUnionCaseA = DiscUnionType.A let discUnionCaseB = DiscUnionType.B(1, Some(discUnionCaseA)) let discUnionCaseC = DiscUnionType.C(1.0, "stringparam") - + let discUnionRecCaseB = DiscUnionType.B(1, Some(discUnionCaseB)) - + let discStructUnionCaseA = DiscStructUnionType.A let discStructUnionCaseB = DiscStructUnionType.B(1) let discStructUnionCaseC = DiscStructUnionType.C(1.0, "stringparam") - + let optionSome = Some(3) let optionNone: int option = None @@ -116,29 +116,29 @@ type FSharpValueTests() = let list1 = [ 1; 2 ] let list2: int list = [] - + let fsharpDelegate1 = new FSharpDelegate(fun (x:int) -> "delegate1") let fsharpDelegate2 = new FSharpDelegate(fun (x:int) -> "delegate2") - + let tuple1 = ( 1, "tuple1") let tuple2 = ( 2, "tuple2", (fun x -> x + 1)) let tuple3 = ( 1, ( 2, "tuple")) let longTuple = (("yup", 1s), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, Some 12, 13, "nope", struct (15, 16), 17, 18, ValueSome 19) - + let structTuple1 = struct ( 1, "tuple1") let structTuple2 = struct ( 2, "tuple2", (fun x -> x + 1)) let structTuple3 = struct ( 1, struct ( 2, "tuple")) let longStructTuple = struct (("yup", 1s), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, Some 12, 13, "nope", struct (15, 16), 17, 18, ValueSome 19) - + let func1 param = param + 1 let func2 param = param + "" - + let exInt = ExceptionInt(1) let exDataless = DatalessException - + [] member _.Equals1() = - // Record value + // Record value Assert.True(FSharpValue.Equals(record1, record1)) Assert.False(FSharpValue.Equals(record1, record2)) @@ -155,49 +155,49 @@ type FSharpValueTests() = // Generic Record value Assert.True(FSharpValue.Equals(genericRecordType1, genericRecordType1)) Assert.False(FSharpValue.Equals(genericRecordType1, genericRecordType2)) - + [] member _.Equals4() = // null value Assert.True(FSharpValue.Equals(nullValue, nullValue)) Assert.False(FSharpValue.Equals(nullValue, 1)) - + [] member _.Equals5() = // Single Case Union Assert.True(FSharpValue.Equals(singleCaseUnion1, singleCaseUnion1)) Assert.False(FSharpValue.Equals(singleCaseUnion1, singleCaseUnion2)) - + [] member _.Equals6() = // Single Case Union Assert.True(FSharpValue.Equals(singleCaseStructUnion1, singleCaseStructUnion1)) Assert.False(FSharpValue.Equals(singleCaseStructUnion1, singleCaseStructUnion2)) - + [] member _.Equals7() = // Discriminated Union Assert.True(FSharpValue.Equals(discUnionCaseA, discUnionCaseA)) Assert.False(FSharpValue.Equals(discUnionCaseB, discUnionCaseC)) - + [] member _.Equals8() = // Discriminated Union Assert.True(FSharpValue.Equals(discStructUnionCaseA, discStructUnionCaseA)) Assert.False(FSharpValue.Equals(discStructUnionCaseB, discStructUnionCaseC)) - + [] member _.Equals9() = // FSharpDelegate Assert.True(FSharpValue.Equals(fsharpDelegate1, fsharpDelegate1)) Assert.False(FSharpValue.Equals(fsharpDelegate1, fsharpDelegate2)) - + [] member _.Equals10() = // Tuple Assert.True(FSharpValue.Equals(tuple1, tuple1)) Assert.False(FSharpValue.Equals( (1, 2, 3), (4, 5, 6) )) - + [] member _.Equals10b() = // Tuple @@ -208,562 +208,562 @@ type FSharpValueTests() = member _.Equals11() = // Tuples of differing types Assert.False(FSharpValue.Equals(tuple1, tuple2)) - + [] member _.Equals12() = // Exception Assert.True(FSharpValue.Equals(exInt, exInt)) - Assert.False(FSharpValue.Equals(exInt, exDataless)) + Assert.False(FSharpValue.Equals(exInt, exDataless)) [] member _.GetExceptionFields() = - - // int + + // int Assert.AreEqual(FSharpValue.GetExceptionFields(exInt), ([|1|] : obj [])) - + // dataless Assert.AreEqual(FSharpValue.GetExceptionFields(exDataless), [||]) - + // invalid type CheckThrowsArgumentException(fun () -> FSharpValue.GetExceptionFields(1) |> ignore) CheckThrowsArgumentNullException(fun () -> FSharpValue.GetExceptionFields( () ) |> ignore) - + // System Exception CheckThrowsArgumentException(fun () -> FSharpValue.GetExceptionFields(new System.Exception("ex message")) |> ignore) - + // null CheckThrowsArgumentNullException(fun () -> FSharpValue.GetExceptionFields(null) |> ignore) - + [] member _.GetRecordField() = - + // Record let propertyinfo1 = (typeof).GetProperty("field1") Assert.AreEqual((FSharpValue.GetRecordField(record1, propertyinfo1)), "field1") - + // Generic Record value let propertyinfo2 = (typeof>).GetProperty("field2") Assert.AreEqual((FSharpValue.GetRecordField(genericRecordType1, propertyinfo2)), 1) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.GetRecordField(null, propertyinfo1)|> ignore) CheckThrowsArgumentNullException(fun () ->FSharpValue.GetRecordField( () , propertyinfo1)|> ignore) - + // invalid value CheckThrowsArgumentException(fun () -> FSharpValue.GetRecordField("invalid", propertyinfo1) |> ignore) - + // invalid property info let propertyinfoint = (typeof).GetProperty("fieldstring") // null CheckThrowsArgumentNullException(fun () -> FSharpValue.GetRecordField("invalid", propertyinfoint) |> ignore) - + [] member _.GetStructRecordField() = - + // Record let propertyinfo1 = (typeof).GetProperty("field1") Assert.AreEqual((FSharpValue.GetRecordField(structRecord1, propertyinfo1)), "field1") - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.GetRecordField(null, propertyinfo1)|> ignore) CheckThrowsArgumentNullException(fun () ->FSharpValue.GetRecordField( () , propertyinfo1)|> ignore) - + // invalid value CheckThrowsArgumentException(fun () -> FSharpValue.GetRecordField("invalid", propertyinfo1) |> ignore) - + // invalid property info let propertyinfoint = (typeof).GetProperty("fieldstring") // null CheckThrowsArgumentNullException(fun () -> FSharpValue.GetRecordField("invalid", propertyinfoint) |> ignore) - + [] member _.GetRecordFields() = // Record let propertyinfo1 = (typeof).GetProperty("field1") Assert.AreEqual((FSharpValue.GetRecordFields(record1)).[0], "field1") - + // Generic Record value let propertyinfo2 = (typeof>).GetProperty("field1") Assert.AreEqual((FSharpValue.GetRecordFields(genericRecordType1)).[0], "field1") - + // null value CheckThrowsArgumentNullException(fun () -> FSharpValue.GetRecordFields(null)|> ignore) CheckThrowsArgumentNullException(fun () -> FSharpValue.GetRecordFields( () )|> ignore) - + // invalid value CheckThrowsArgumentException(fun () -> FSharpValue.GetRecordFields("invalid") |> ignore) - + [] member _.GetStructRecordFields() = let propertyinfo1 = (typeof).GetProperty("field1") Assert.AreEqual((FSharpValue.GetRecordFields(structRecord1)).[0], "field1") - + [] member _.GetTupleField() = // Tuple Assert.AreEqual((FSharpValue.GetTupleField(tuple1, 0)), 1) - + // Tuple with function element Assert.AreEqual( FSharpValue.GetTupleField(tuple2, 1), "tuple2") - + // null value CheckThrowsArgumentNullException(fun () -> FSharpValue.GetTupleField(null, 3)|> ignore) CheckThrowsArgumentNullException(fun () -> FSharpValue.GetTupleField( () , 3)|> ignore) - + // invalid value CheckThrowsArgumentException(fun () -> FSharpValue.GetTupleField("Invalid", 3)|> ignore) - + // index out of range CheckThrowsArgumentException(fun () -> FSharpValue.GetTupleField(tuple2, 8)|> ignore) - + [] member _.GetStructTupleField() = // Tuple Assert.AreEqual((FSharpValue.GetTupleField(structTuple1, 0)), 1) - + // Tuple with function element Assert.AreEqual( FSharpValue.GetTupleField(structTuple2, 1), "tuple2") - + // index out of range CheckThrowsArgumentException(fun () -> FSharpValue.GetTupleField(structTuple2, 8)|> ignore) - + [] member _.GetTupleFields() = // Tuple Assert.AreEqual(FSharpValue.GetTupleFields(tuple1).[0], 1) - + // Tuple with function element Assert.AreEqual( (FSharpValue.GetTupleFields(tuple2)).[1], "tuple2") - + // null value CheckThrowsArgumentNullException(fun () -> FSharpValue.GetTupleFields(null)|> ignore) CheckThrowsArgumentNullException(fun () -> FSharpValue.GetTupleFields( () )|> ignore) - + // invalid value CheckThrowsArgumentException(fun () -> FSharpValue.GetTupleFields("Invalid")|> ignore) - + [] member _.GetStructTupleFields() = // Tuple Assert.AreEqual(FSharpValue.GetTupleFields(structTuple1).[0], 1) - + // Tuple with function element Assert.AreEqual( (FSharpValue.GetTupleFields(structTuple2)).[1], "tuple2") - + [] member _.GetUnionFields() = - // single case union + // single case union let (singlecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) Assert.AreEqual(singlevaluearray, ([|1.0;2.0;3.0|] : obj [])) - + // DiscUnionType let (duCaseinfo, duValueArray) = FSharpValue.GetUnionFields(discUnionCaseB, typeof>) Assert.AreEqual(duValueArray.[0], 1) - + // null value CheckThrowsArgumentException(fun () -> FSharpValue.GetUnionFields(null, null)|> ignore) CheckThrowsArgumentException(fun () -> FSharpValue.GetUnionFields( () , null)|> ignore) - + [] member _.GetStructUnionFields() = - // single case union + // single case union let (_singlecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singleCaseStructUnion1, typeof) Assert.AreEqual(singlevaluearray, ([|1.0;2.0;3.0|] : obj [])) - + // DiscUnionType let (_duCaseinfo, duValueArray) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) Assert.AreEqual(duValueArray.[0], 1) - + [] member _.MakeFunction() = - + // Int function let implementationInt (x:obj) = box( unbox(x) + 1) let resultFuncIntObj = FSharpValue.MakeFunction(typeof int>, implementationInt ) let resultFuncInt = resultFuncIntObj :?> (int -> int) Assert.AreEqual(resultFuncInt(5), 6) - + // String function let implementationString (x:obj) = box( unbox(x) + " function") let resultFuncStringObj = FSharpValue.MakeFunction(typeof string>, implementationString ) let resultFuncString = resultFuncStringObj :?> (string -> string) Assert.AreEqual(resultFuncString("parameter"), "parameter function") - + [] member _.MakeRecord() = // Record let makeRecord = FSharpValue.MakeRecord(typeof, [| box"field1"; box(Some(record1)); box( fun () -> (record1, "")) |]) Assert.AreEqual(FSharpValue.GetRecordFields(makeRecord).[0], "field1") - + // Generic Record value let makeRecordGeneric = FSharpValue.MakeRecord(typeof>, [| box"field1"; box 1; box( fun () -> genericRecordType1) |]) Assert.AreEqual(FSharpValue.GetRecordFields(makeRecordGeneric).[0], "field1") - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.MakeRecord(null, null)|> ignore) - - // invalid value + + // invalid value CheckThrowsArgumentException(fun () -> FSharpValue.MakeRecord(typeof>, [| box 1; box("invalid param"); box("invalid param") |])|> ignore) - + [] member _.MakeStructRecord() = // Record let makeRecord = FSharpValue.MakeRecord(typeof, [| box"field1"; box(Some(structRecord1)); box( fun () -> (structRecord1, "")) |]) Assert.AreEqual(FSharpValue.GetRecordFields(makeRecord).[0], "field1") - + [] member _.MakeTuple() = // Tuple let makeTuple = FSharpValue.MakeTuple([| box 1; box("tuple") |], typeof>) Assert.AreEqual(FSharpValue.GetTupleFields(makeTuple).[0], 1) - + // Tuple with function let makeTuplewithFunc = FSharpValue.MakeTuple([| box 1; box "tuple with func"; box (fun x -> x + 1) |], typeof int)>>) Assert.AreEqual(FSharpValue.GetTupleFields(makeTuplewithFunc).[1], "tuple with func") - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.MakeTuple(null, null)|> ignore) - + // invalid value CheckThrowsArgumentException(fun () -> FSharpValue.MakeTuple([| box"invalid param"; box"invalid param"|], typeof>) |> ignore) - + [] member _.MakeStructTuple() = // Tuple let makeTuple = FSharpValue.MakeTuple([| box 1; box("tuple") |], typeof) Assert.AreEqual(FSharpValue.GetTupleFields(makeTuple).[0], 1) Assert.AreEqual(FSharpValue.GetTupleFields(makeTuple).[1], "tuple") - + // Tuple with function let makeTuplewithFunc = FSharpValue.MakeTuple([| box 1; box "tuple with func"; box (fun x -> x + 1) |], typeof int))>) Assert.AreEqual(FSharpValue.GetTupleFields(makeTuplewithFunc).[0], 1) Assert.AreEqual(FSharpValue.GetTupleFields(makeTuplewithFunc).[1], "tuple with func") - + // invalid value CheckThrowsArgumentException(fun () -> FSharpValue.MakeTuple([| box"invalid param"; box"invalid param"|], typeof) |> ignore) - + [] member _.MakeUnion() = - // single case union + // single case union let (singlecaseinfo, _singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) let resultSingleCaseUnion=FSharpValue.MakeUnion(singlecaseinfo, [| box 1.0; box 2.0; box 3.0|]) Assert.AreEqual(resultSingleCaseUnion, singleCaseUnion1) - + // DiscUnionType let (duCaseinfo, _duValueArray) = FSharpValue.GetUnionFields(discUnionCaseB, typeof>) let resultDiscUnion=FSharpValue.MakeUnion(duCaseinfo, [| box 1; box (Some discUnionCaseB) |]) Assert.AreEqual(resultDiscUnion, discUnionRecCaseB) - + [] member _.MakeStructUnion() = - // single case union + // single case union let (singlecaseinfo, _singlevaluearray) = FSharpValue.GetUnionFields(singleCaseStructUnion1, typeof) let resultSingleCaseUnion=FSharpValue.MakeUnion(singlecaseinfo, [| box 1.0; box 2.0; box 3.0|]) Assert.AreEqual(resultSingleCaseUnion, singleCaseStructUnion1) - + // DiscUnionType let (duCaseinfo, duValueArray) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) FSharpValue.MakeUnion(duCaseinfo, [| box 1|]) |> ignore - + [] member _.PreComputeRecordConstructor() = // Record let recCtor = FSharpValue.PreComputeRecordConstructor(typeof) let resultRecordType = recCtor([| box("field1"); box(Some(record1)); box(fun () -> (record1, "")) |]) Assert.AreEqual( (unbox(resultRecordType)).field1 , record1.field1) - + // Generic Record value let genericRecCtor = FSharpValue.PreComputeRecordConstructor(typeof>) let resultGenericRecordType = genericRecCtor([| box("field1"); box 2; box( fun () -> genericRecordType1) |]) Assert.AreEqual( (unbox>(resultGenericRecordType)).field1, genericRecordType1.field1) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.PreComputeRecordConstructor(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeRecordConstructor(typeof>) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeRecordConstructor(typeof>) |> ignore) + [] member _.PreComputeStructRecordConstructor() = // Record let recCtor = FSharpValue.PreComputeRecordConstructor(typeof) let resultRecordType = recCtor([| box("field1"); box(Some(structRecord1)); box(fun () -> (structRecord1, "")) |]) Assert.AreEqual( (unbox(resultRecordType)).field1 , structRecord1.field1) - - + + [] member _.PreComputeRecordConstructorInfo() = // Record let recordCtorInfo = FSharpValue.PreComputeRecordConstructorInfo(typeof) Assert.AreEqual(recordCtorInfo.ReflectedType, typeof ) - + // Generic Record value let genericrecordCtorInfo = FSharpValue.PreComputeRecordConstructorInfo(typeof>) Assert.AreEqual(genericrecordCtorInfo.ReflectedType, typeof>) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.PreComputeRecordConstructorInfo(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeRecordConstructorInfo(typeof>) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeRecordConstructorInfo(typeof>) |> ignore) + [] member _.PreComputeStructRecordConstructorInfo() = // Record let recordCtorInfo = FSharpValue.PreComputeRecordConstructorInfo(typeof) Assert.AreEqual(recordCtorInfo.ReflectedType, typeof ) - + [] member _.PreComputeRecordFieldReader() = // Record let recordFieldReader = FSharpValue.PreComputeRecordFieldReader((typeof).GetProperty("field1")) Assert.AreEqual(recordFieldReader(record1), box("field1")) - + // Generic Record value let recordFieldReader = FSharpValue.PreComputeRecordFieldReader((typeof>).GetProperty("field1")) Assert.AreEqual(recordFieldReader(genericRecordType1), box("field1")) - + // null value - CheckThrowsArgumentNullException(fun () -> FSharpValue.PreComputeRecordFieldReader(null)|> ignore) - + CheckThrowsArgumentNullException(fun () -> FSharpValue.PreComputeRecordFieldReader(null)|> ignore) + [] member _.PreComputeStructRecordFieldReader() = // Record let recordFieldReader = FSharpValue.PreComputeRecordFieldReader((typeof).GetProperty("field1")) Assert.AreEqual(recordFieldReader(structRecord1), box("field1")) - + [] member _.PreComputeRecordReader() = // Record let recordReader = FSharpValue.PreComputeRecordReader(typeof) Assert.AreEqual( (recordReader(record1)).[0], "field1") - + // Generic Record value let genericrecordReader = FSharpValue.PreComputeRecordReader(typeof>) Assert.AreEqual( (genericrecordReader(genericRecordType1)).[0], "field1") - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.PreComputeRecordReader(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeRecordReader(typeof>) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeRecordReader(typeof>) |> ignore) + [] member _.PreComputeStructRecordReader() = // Record let recordReader = FSharpValue.PreComputeRecordReader(typeof) Assert.AreEqual( (recordReader(structRecord1)).[0], "field1") - + [] member _.PreComputeTupleConstructor() = // Tuple - let tupleCtor = FSharpValue.PreComputeTupleConstructor(tuple1.GetType()) + let tupleCtor = FSharpValue.PreComputeTupleConstructor(tuple1.GetType()) Assert.AreEqual( tupleCtor([| box 1; box "tuple1" |]) , box(tuple1)) - let tupleCtor = FSharpValue.PreComputeTupleConstructor(longTuple.GetType()) + let tupleCtor = FSharpValue.PreComputeTupleConstructor(longTuple.GetType()) Assert.AreEqual( tupleCtor([| box ("yup", 1s); box 2; box 3; box 4; box 5; box 6; box 7; box 8; box 9; box 10; box 11; box (Some 12); box 13; box "nope"; box (struct (15, 16)); box 17; box 18; box (ValueSome 19) |]) , box(longTuple)) - + // Tuple with function member - let tuplewithFuncCtor = FSharpValue.PreComputeTupleConstructor(tuple2.GetType()) + let tuplewithFuncCtor = FSharpValue.PreComputeTupleConstructor(tuple2.GetType()) let resultTuplewithFunc = tuplewithFuncCtor([| box 2; box "tuple2"; box (fun x -> x + 1) |]) Assert.AreEqual( FSharpValue.GetTupleFields( box(resultTuplewithFunc)).[1] , "tuple2") - + // nested tuple let tupleNestedCtor = FSharpValue.PreComputeTupleConstructor(tuple3.GetType()) Assert.AreEqual( tupleNestedCtor([| box 1; box(2, "tuple") |] ), box(tuple3)) - + // null value CheckThrowsArgumentNullException(fun () -> FSharpValue.PreComputeTupleConstructor(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructor(typeof>) |> ignore) - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructor(typeof) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructor(typeof>) |> ignore) + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructor(typeof) |> ignore) + [] member _.PreComputeStructTupleConstructor() = // Tuple - let tupleCtor = FSharpValue.PreComputeTupleConstructor(structTuple1.GetType()) + let tupleCtor = FSharpValue.PreComputeTupleConstructor(structTuple1.GetType()) Assert.AreEqual( tupleCtor([| box 1; box "tuple1" |]) , box(structTuple1)) - - let tupleCtor = FSharpValue.PreComputeTupleConstructor(longStructTuple.GetType()) + + let tupleCtor = FSharpValue.PreComputeTupleConstructor(longStructTuple.GetType()) Assert.AreEqual( tupleCtor([| box ("yup", 1s); box 2; box 3; box 4; box 5; box 6; box 7; box 8; box 9; box 10; box 11; box (Some 12); box 13; box "nope"; box (struct (15, 16)); box 17; box 18; box (ValueSome 19) |]) , box(longStructTuple)) - + // Tuple with function member - let tuplewithFuncCtor = FSharpValue.PreComputeTupleConstructor(structTuple2.GetType()) + let tuplewithFuncCtor = FSharpValue.PreComputeTupleConstructor(structTuple2.GetType()) let resultTuplewithFunc = tuplewithFuncCtor([| box 2; box "tuple2"; box (fun x -> x + 1) |]) Assert.AreEqual( FSharpValue.GetTupleFields( box(resultTuplewithFunc)).[1] , "tuple2") - + // nested tuple let tupleNestedCtor = FSharpValue.PreComputeTupleConstructor(structTuple3.GetType()) Assert.AreEqual( tupleNestedCtor([| box 1; box (struct (2, "tuple")) |] ), box(structTuple3)) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructor(typeof>) |> ignore) + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructor(typeof>) |> ignore) [] member _.PreComputeTupleConstructorInfo() = // Tuple - let (tupleCtorInfo, _tupleType) = FSharpValue.PreComputeTupleConstructorInfo(typeof>) + let (tupleCtorInfo, _tupleType) = FSharpValue.PreComputeTupleConstructorInfo(typeof>) Assert.AreEqual(tupleCtorInfo.ReflectedType, typeof> ) - - // Nested - let (nestedTupleCtorInfo, _nestedTupleType) = FSharpValue.PreComputeTupleConstructorInfo(typeof>>) + + // Nested + let (nestedTupleCtorInfo, _nestedTupleType) = FSharpValue.PreComputeTupleConstructorInfo(typeof>>) Assert.AreEqual(nestedTupleCtorInfo.ReflectedType, typeof>>) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.PreComputeTupleConstructorInfo(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructorInfo(typeof) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructorInfo(typeof) |> ignore) + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructorInfo(typeof) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleConstructorInfo(typeof) |> ignore) + [] member _.PreComputeStructTupleConstructorInfo() = // Tuple - let (tupleCtorInfo, _tupleType) = FSharpValue.PreComputeTupleConstructorInfo(typeof) + let (tupleCtorInfo, _tupleType) = FSharpValue.PreComputeTupleConstructorInfo(typeof) Assert.AreEqual(tupleCtorInfo.ReflectedType, typeof ) - - // Nested - let (nestedTupleCtorInfo, _nestedTupleType) = FSharpValue.PreComputeTupleConstructorInfo(typeof) + + // Nested + let (nestedTupleCtorInfo, _nestedTupleType) = FSharpValue.PreComputeTupleConstructorInfo(typeof) Assert.AreEqual(nestedTupleCtorInfo.ReflectedType, typeof) - + [] member _.PreComputeTuplePropertyInfo() = - + // Tuple - let (tuplePropInfo, _typeindex) = FSharpValue.PreComputeTuplePropertyInfo(typeof>, 0) + let (tuplePropInfo, _typeindex) = FSharpValue.PreComputeTuplePropertyInfo(typeof>, 0) Assert.AreEqual(tuplePropInfo.PropertyType, typeof) - - // Nested - let (tupleNestedPropInfo, _typeindex) = FSharpValue.PreComputeTuplePropertyInfo(typeof>>, 1) + + // Nested + let (tupleNestedPropInfo, _typeindex) = FSharpValue.PreComputeTuplePropertyInfo(typeof>>, 1) Assert.AreEqual(tupleNestedPropInfo.PropertyType, typeof>) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.PreComputeTuplePropertyInfo(null, 0)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTuplePropertyInfo(typeof, 0) |> ignore) + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTuplePropertyInfo(typeof, 0) |> ignore) // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTuplePropertyInfo(typeof, 0) |> ignore) + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTuplePropertyInfo(typeof, 0) |> ignore) - // This fails as no PropertyInfo's actually exist for struct tuple types. + // This fails as no PropertyInfo's actually exist for struct tuple types. // //[] //member _.PreComputeStructTuplePropertyInfo() = // // // Tuple - // let (tuplePropInfo, _typeindex) = FSharpValue.PreComputeTuplePropertyInfo(typeof, 0) + // let (tuplePropInfo, _typeindex) = FSharpValue.PreComputeTuplePropertyInfo(typeof, 0) // Assert.AreEqual(tuplePropInfo.PropertyType, typeof) - // - // // Nested - // let (tupleNestedPropInfo, _typeindex) = FSharpValue.PreComputeTuplePropertyInfo(typeof, 1) + // + // // Nested + // let (tupleNestedPropInfo, _typeindex) = FSharpValue.PreComputeTuplePropertyInfo(typeof, 1) // Assert.AreEqual(tupleNestedPropInfo.PropertyType, typeof) - + [] member _.PreComputeTupleReader() = - + // Tuple - let tuplereader = FSharpValue.PreComputeTupleReader(typeof>) + let tuplereader = FSharpValue.PreComputeTupleReader(typeof>) Assert.AreEqual(tuplereader(tuple1).[0], 1) - - // Nested - let nestedtuplereader = FSharpValue.PreComputeTupleReader(typeof>>) + + // Nested + let nestedtuplereader = FSharpValue.PreComputeTupleReader(typeof>>) Assert.AreEqual(nestedtuplereader(tuple3).[1], box(2, "tuple")) let longTupleReader = FSharpValue.PreComputeTupleReader (longTuple.GetType ()) Assert.AreEqual (longTupleReader longTuple, [| box ("yup", 1s); box 2; box 3; box 4; box 5; box 6; box 7; box 8; box 9; box 10; box 11; box (Some 12); box 13; box "nope"; box (struct (15, 16)); box 17; box 18; box (ValueSome 19) |]) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.PreComputeTupleReader(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleReader(typeof) |> ignore) + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleReader(typeof) |> ignore) [] member _.PreComputeStructTupleReader() = - + // Tuple - let tuplereader = FSharpValue.PreComputeTupleReader(typeof) + let tuplereader = FSharpValue.PreComputeTupleReader(typeof) Assert.AreEqual(tuplereader(structTuple1).[0], 1) - - // Nested - let nestedtuplereader = FSharpValue.PreComputeTupleReader(typeof) + + // Nested + let nestedtuplereader = FSharpValue.PreComputeTupleReader(typeof) Assert.AreEqual(nestedtuplereader(structTuple3).[1], box (struct (2, "tuple"))) - + let longTupleReader = FSharpValue.PreComputeTupleReader (longStructTuple.GetType ()) Assert.AreEqual (longTupleReader longStructTuple, [| box ("yup", 1s); box 2; box 3; box 4; box 5; box 6; box 7; box 8; box 9; box 10; box 11; box (Some 12); box 13; box "nope"; box (struct (15, 16)); box 17; box 18; box (ValueSome 19) |]) // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleReader(typeof) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeTupleReader(typeof) |> ignore) + [] member _.PreComputeUnionConstructor() = - + // SingleCaseUnion let (singlecaseinfo, _singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) - let singleUnionCtor = FSharpValue.PreComputeUnionConstructor(singlecaseinfo) + let singleUnionCtor = FSharpValue.PreComputeUnionConstructor(singlecaseinfo) let resultSingleCaseUnion = singleUnionCtor([| box 1.0; box 2.0; box 3.0|]) Assert.AreEqual(resultSingleCaseUnion, singleCaseUnion1) - + // DiscUnion let (discunioninfo, _discunionvaluearray) = FSharpValue.GetUnionFields(discUnionCaseB, typeof>) - let discUnionCtor = FSharpValue.PreComputeUnionConstructor(discunioninfo) + let discUnionCtor = FSharpValue.PreComputeUnionConstructor(discunioninfo) let resultDiscUnionB = discUnionCtor([| box 1; box(Some(discUnionCaseB)) |]) Assert.AreEqual(resultDiscUnionB, discUnionRecCaseB) [] member _.PreComputeStructUnionConstructor() = - + // SingleCaseUnion let (singlecaseinfo, _singlevaluearray) = FSharpValue.GetUnionFields(singleCaseStructUnion1, typeof) - let singleUnionCtor = FSharpValue.PreComputeUnionConstructor(singlecaseinfo) + let singleUnionCtor = FSharpValue.PreComputeUnionConstructor(singlecaseinfo) let resultSingleCaseUnion = singleUnionCtor([| box 1.0; box 2.0; box 3.0|]) Assert.AreEqual(resultSingleCaseUnion, singleCaseStructUnion1) - + // DiscUnion let (discunioninfo, _discunionvaluearray) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) - let discUnionCtor = FSharpValue.PreComputeUnionConstructor(discunioninfo) + let discUnionCtor = FSharpValue.PreComputeUnionConstructor(discunioninfo) let resultDiscUnionB = discUnionCtor([| box 1|]) Assert.AreEqual(resultDiscUnionB, discStructUnionCaseB) - + [] member _.PreComputeUnionConstructorInfo() = - + // SingleCaseUnion let (singlecaseinfo, _singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) - let singlecaseMethodInfo = FSharpValue.PreComputeUnionConstructorInfo(singlecaseinfo) + let singlecaseMethodInfo = FSharpValue.PreComputeUnionConstructorInfo(singlecaseinfo) Assert.AreEqual(singlecaseMethodInfo.ReflectedType, typeof) - + // DiscUnion let (discUnionInfo, _discvaluearray) = FSharpValue.GetUnionFields(discUnionCaseB, typeof>) - let discUnionMethodInfo = FSharpValue.PreComputeUnionConstructorInfo(discUnionInfo) + let discUnionMethodInfo = FSharpValue.PreComputeUnionConstructorInfo(discUnionInfo) Assert.AreEqual(discUnionMethodInfo.ReflectedType, typeof>) - + [] member _.PreComputeStructUnionConstructorInfo() = - + // SingleCaseUnion let (singlecaseinfo, _singlevaluearray) = FSharpValue.GetUnionFields(singleCaseStructUnion1, typeof) - let singlecaseMethodInfo = FSharpValue.PreComputeUnionConstructorInfo(singlecaseinfo) + let singlecaseMethodInfo = FSharpValue.PreComputeUnionConstructorInfo(singlecaseinfo) Assert.AreEqual(singlecaseMethodInfo.ReflectedType, typeof) - + // DiscUnion let (discUnionInfo, _discvaluearray) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) - let discUnionMethodInfo = FSharpValue.PreComputeUnionConstructorInfo(discUnionInfo) + let discUnionMethodInfo = FSharpValue.PreComputeUnionConstructorInfo(discUnionInfo) Assert.AreEqual(discUnionMethodInfo.ReflectedType, typeof>) [] member _.PreComputeUnionReader() = - + // SingleCaseUnion let (singlecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) - let singlecaseUnionReader = FSharpValue.PreComputeUnionReader(singlecaseinfo) + let singlecaseUnionReader = FSharpValue.PreComputeUnionReader(singlecaseinfo) Assert.AreEqual(singlecaseUnionReader(box(singleCaseUnion1)), [| box 1.0; box 2.0; box 3.0|]) - + // DiscUnion let (discUnionInfo, discvaluearray) = FSharpValue.GetUnionFields(discUnionRecCaseB, typeof>) - let discUnionReader = FSharpValue.PreComputeUnionReader(discUnionInfo) + let discUnionReader = FSharpValue.PreComputeUnionReader(discUnionInfo) Assert.AreEqual(discUnionReader(box(discUnionRecCaseB)) , [| box 1; box(Some(discUnionCaseB)) |]) // Option @@ -783,18 +783,18 @@ type FSharpValueTests() = let (listCaseInfo, _) = FSharpValue.GetUnionFields(list2, typeof) let listReader = FSharpValue.PreComputeUnionReader(listCaseInfo) Assert.AreEqual(listReader(box(list2)), [| |]) - + [] member _.PreComputeStructUnionReader() = - + // SingleCaseUnion let (singlecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singleCaseStructUnion1, typeof) - let singlecaseUnionReader = FSharpValue.PreComputeUnionReader(singlecaseinfo) + let singlecaseUnionReader = FSharpValue.PreComputeUnionReader(singlecaseinfo) Assert.AreEqual(singlecaseUnionReader(box(singleCaseStructUnion1)), [| box 1.0; box 2.0; box 3.0|]) - + // DiscUnion let (discUnionInfo, discvaluearray) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) - let discUnionReader = FSharpValue.PreComputeUnionReader(discUnionInfo) + let discUnionReader = FSharpValue.PreComputeUnionReader(discUnionInfo) Assert.AreEqual(discUnionReader(box(discStructUnionCaseB)) , [| box 1|]) // Value Option @@ -805,44 +805,44 @@ type FSharpValueTests() = let (voptionCaseInfo, _) = FSharpValue.GetUnionFields(voptionNone, typeof) let voptionReader = FSharpValue.PreComputeUnionReader(voptionCaseInfo) Assert.AreEqual(voptionReader(box(voptionNone)), [| |]) - + [] member _.PreComputeUnionTagMemberInfo() = - + // SingleCaseUnion - let singlecaseUnionMemberInfo = FSharpValue.PreComputeUnionTagMemberInfo(typeof) + let singlecaseUnionMemberInfo = FSharpValue.PreComputeUnionTagMemberInfo(typeof) Assert.AreEqual(singlecaseUnionMemberInfo.ReflectedType, typeof) - + // DiscUnion - let discUnionMemberInfo = FSharpValue.PreComputeUnionTagMemberInfo(typeof>) + let discUnionMemberInfo = FSharpValue.PreComputeUnionTagMemberInfo(typeof>) Assert.AreEqual(discUnionMemberInfo.ReflectedType, typeof>) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.PreComputeUnionTagMemberInfo(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeUnionTagMemberInfo(typeof) |> ignore) + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeUnionTagMemberInfo(typeof) |> ignore) [] member _.PreComputeStructUnionTagMemberInfo() = - + // SingleCaseUnion - let singlecaseUnionMemberInfo = FSharpValue.PreComputeUnionTagMemberInfo(typeof) + let singlecaseUnionMemberInfo = FSharpValue.PreComputeUnionTagMemberInfo(typeof) Assert.AreEqual(singlecaseUnionMemberInfo.ReflectedType, typeof) - + // DiscUnion - let discUnionMemberInfo = FSharpValue.PreComputeUnionTagMemberInfo(typeof>) + let discUnionMemberInfo = FSharpValue.PreComputeUnionTagMemberInfo(typeof>) Assert.AreEqual(discUnionMemberInfo.ReflectedType, typeof>) - + [] member _.PreComputeUnionTagReader() = - + // SingleCaseUnion - let singlecaseUnionTagReader = FSharpValue.PreComputeUnionTagReader(typeof) + let singlecaseUnionTagReader = FSharpValue.PreComputeUnionTagReader(typeof) Assert.AreEqual(singlecaseUnionTagReader(box(singleCaseUnion1)), 0) - + // DiscUnion - let discUnionTagReader = FSharpValue.PreComputeUnionTagReader(typeof>) + let discUnionTagReader = FSharpValue.PreComputeUnionTagReader(typeof>) Assert.AreEqual(discUnionTagReader(box(discUnionCaseB)), 1) // Option @@ -854,176 +854,176 @@ type FSharpValueTests() = let voptionTagReader = FSharpValue.PreComputeUnionTagReader(typeof) Assert.AreEqual(voptionTagReader(box(voptionSome)), 1) Assert.AreEqual(voptionTagReader(box(voptionNone)), 0) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpValue.PreComputeUnionTagReader(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeUnionTagReader(typeof) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpValue.PreComputeUnionTagReader(typeof) |> ignore) + [] member _.PreComputeStructUnionTagReader() = - + // SingleCaseUnion - let singlecaseUnionTagReader = FSharpValue.PreComputeUnionTagReader(typeof) + let singlecaseUnionTagReader = FSharpValue.PreComputeUnionTagReader(typeof) Assert.AreEqual(singlecaseUnionTagReader(box(singleCaseStructUnion1)), 0) - + // DiscUnion - let discUnionTagReader = FSharpValue.PreComputeUnionTagReader(typeof>) + let discUnionTagReader = FSharpValue.PreComputeUnionTagReader(typeof>) Assert.AreEqual(discUnionTagReader(box(discStructUnionCaseB)), 1) -type FSharpTypeTests() = - +type FSharpTypeTests() = + // instance for member _.ObjectEquals let rec recordtype1 : RecordType = { field1 = "field1"; field2 = Some(recordtype1); field3 = ( fun () -> (recordtype1, "") )} let recordtype2 : RecordType = { field1 = "field2"; field2 = Some(recordtype1); field3 = ( fun () -> (recordtype1, "") )} let rec genericRecordType1 : GenericRecordType = { field1 = "field1"; field2 = 1; field3 = ( fun () -> genericRecordType1 )} let genericRecordType2 : GenericRecordType = { field1 = "field1"; field2 = 1; field3 = ( fun () -> genericRecordType1 )} - + let nullValue = null - + let singlecaseunion1 = SingleCaseDiscUnion.SingleCaseTag(1.0, 2.0, 3.0) let singlecaseunion2 = SingleCaseDiscUnion.SingleCaseTag(4.0, 5.0, 6.0) - + let discUniontypeA = DiscUnionType.A let discUniontypeB = DiscUnionType.B(1, Some(discUniontypeA)) let discUniontypeC = DiscUnionType.C(1.0, "stringparam") - + let fsharpdelegate1 = new FSharpDelegate(fun (x:int) -> "delegate1") let fsharpdelegate2 = new FSharpDelegate(fun (x:int) -> "delegate2") - - + + let tuple1 = ( 1, "tuple1") let tuple2 = ( 2, "tuple2") - + let func1 param = param + 1 let func2 param = param + "" - + let exInt = ExceptionInt(1) let exDataless = DatalessException - + // Base class methods [] - member _.ObjectEquals() = - - // Record value + member _.ObjectEquals() = + + // Record value Assert.True(FSharpValue.Equals(recordtype1, recordtype1)) Assert.False(FSharpValue.Equals(recordtype1, recordtype2)) // Generic Record value Assert.True(FSharpValue.Equals(genericRecordType1, genericRecordType1)) Assert.False(FSharpValue.Equals(genericRecordType1, genericRecordType2)) - + // null value Assert.True(FSharpValue.Equals(nullValue, nullValue)) Assert.False(FSharpValue.Equals(nullValue, 1)) - + // Single Case Union Assert.True(FSharpValue.Equals(singlecaseunion1, singlecaseunion1)) Assert.False(FSharpValue.Equals(singlecaseunion1, singlecaseunion2)) - + // Discriminated Union Assert.True(FSharpValue.Equals(discUniontypeA, discUniontypeA)) Assert.False(FSharpValue.Equals(discUniontypeB, discUniontypeC)) - + // FSharpDelegate Assert.True(FSharpValue.Equals(fsharpdelegate1, fsharpdelegate1)) Assert.False(FSharpValue.Equals(fsharpdelegate1, fsharpdelegate2)) - + // Tuple Assert.True(FSharpValue.Equals(tuple1, tuple1)) Assert.False(FSharpValue.Equals(tuple1, tuple2)) - + // Exception Assert.True(FSharpValue.Equals(exInt, exInt)) - Assert.False(FSharpValue.Equals(exInt, exDataless)) - - + Assert.False(FSharpValue.Equals(exInt, exDataless)) + + // Static methods [] - member _.GetExceptionFields() = - - // positive - let forallexistedInt = - FSharpType.GetExceptionFields(typeof) + member _.GetExceptionFields() = + + // positive + let forallexistedInt = + FSharpType.GetExceptionFields(typeof) |> Array.forall (fun property -> (Array.IndexOf(typeof.GetProperties(), property) > -1)) Assert.True(forallexistedInt) - - let forallexistedDataless = - FSharpType.GetExceptionFields(typeof) + + let forallexistedDataless = + FSharpType.GetExceptionFields(typeof) |> Array.forall (fun property -> (Array.IndexOf(typeof.GetProperties(), property) > -1)) Assert.True(forallexistedDataless) - + // Argument Exception CheckThrowsArgumentException(fun () ->FSharpType.GetExceptionFields(typeof) |> ignore ) - + // null CheckThrowsArgumentNullException(fun () ->FSharpType.GetExceptionFields(null) |> ignore ) - - + + [] - member _.GetFunctionElements() = - + member _.GetFunctionElements() = + // positive - Assert.AreEqual(FSharpType.GetFunctionElements(typeof string>), (typeof, typeof)) + Assert.AreEqual(FSharpType.GetFunctionElements(typeof string>), (typeof, typeof)) Assert.AreEqual(FSharpType.GetFunctionElements(typeof int -> string>), (typeof, typeof>)) - + // argument exception CheckThrowsArgumentException(fun () ->FSharpType.GetFunctionElements(typeof) |> ignore ) - + // null CheckThrowsArgumentNullException(fun () ->FSharpType.GetFunctionElements(null) |> ignore ) - + [] - member _.GetRecordFields() = - + member _.GetRecordFields() = + // positive - Assert.AreEqual(FSharpType.GetRecordFields(typeof), (typeof.GetProperties())) + Assert.AreEqual(FSharpType.GetRecordFields(typeof), (typeof.GetProperties())) Assert.AreEqual(FSharpType.GetRecordFields(typeof>), (typeof>.GetProperties())) - + // argument exception CheckThrowsArgumentException(fun () ->FSharpType.GetRecordFields(typeof) |> ignore ) - + // null CheckThrowsArgumentNullException(fun () ->FSharpType.GetRecordFields(null) |> ignore ) - - + + [] - member _.GetTupleElements() = - + member _.GetTupleElements() = + // positive Assert.AreEqual(FSharpType.GetTupleElements(typeof>), [|typeof; typeof|]) Assert.AreEqual(FSharpType.GetTupleElements(typeof>), [|typeof; typeof;typeof|]) - + // argument exception CheckThrowsArgumentException(fun () ->FSharpType.GetTupleElements(typeof) |> ignore ) - + // null CheckThrowsArgumentNullException(fun () ->FSharpType.GetTupleElements(null) |> ignore ) - + [] - member _.GetUnionCases() = + member _.GetUnionCases() = // SingleCaseUnion - let singlecaseUnionCaseInfoArray = FSharpType.GetUnionCases(typeof) + let singlecaseUnionCaseInfoArray = FSharpType.GetUnionCases(typeof) let (expectedSinglecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singlecaseunion1, typeof) Assert.AreEqual(singlecaseUnionCaseInfoArray.[0], expectedSinglecaseinfo) - + // DiscUnionType - let discunionCaseInfoArray = FSharpType.GetUnionCases(typeof>) + let discunionCaseInfoArray = FSharpType.GetUnionCases(typeof>) let (expectedDuCaseinfoArray, duValueArray) = FSharpValue.GetUnionFields(discUniontypeB, typeof>) Assert.AreEqual(discunionCaseInfoArray.[1], expectedDuCaseinfoArray) - + // null value CheckThrowsArgumentNullException(fun () ->FSharpType.GetUnionCases(null)|> ignore) - + // invalid value - CheckThrowsArgumentException(fun () -> FSharpType.GetUnionCases(typeof) |> ignore) - + CheckThrowsArgumentException(fun () -> FSharpType.GetUnionCases(typeof) |> ignore) + [] - member _.IsExceptionRepresentation() = - + member _.IsExceptionRepresentation() = + // positive Assert.True(FSharpType.IsExceptionRepresentation(typeof)) Assert.True(FSharpType.IsExceptionRepresentation(typeof)) @@ -1031,65 +1031,65 @@ type FSharpTypeTests() = // negative Assert.False(FSharpType.IsExceptionRepresentation(typeof)) Assert.False(FSharpType.IsExceptionRepresentation(typeof)) - + // null CheckThrowsArgumentNullException(fun () -> FSharpType.IsExceptionRepresentation(null) |> ignore ) - + [] - member _.IsFunction() = - - // positive + member _.IsFunction() = + + // positive Assert.True(FSharpType.IsFunction(typeof int>)) Assert.True(FSharpType.IsFunction(typeof int -> int>)) - + // negative Assert.False(FSharpType.IsFunction(typeof)) - + // null CheckThrowsArgumentNullException(fun () -> FSharpType.IsFunction(null) |> ignore ) [] - member _.IsModule() = - + member _.IsModule() = + let getasm (t : Type) = t.Assembly - + // Positive Test let assemblyTypesPositive = (getasm (typeof)).GetTypes() - + let moduleType = - assemblyTypesPositive + assemblyTypesPositive |> Array.filter (fun ty -> ty.Name = "IsModule") |> (fun arr -> arr.[0]) - + Assert.True(FSharpType.IsModule(moduleType)) //assemblyTypesPositive.[3] is Microsoft_FSharp_Reflection.FSharpModule which is module type - - // Negative Test + + // Negative Test // FSharp Assembly let asmCore = getasm (typeof>) Assert.False(FSharpType.IsModule(asmCore.GetTypes().[0])) - + // .Net Assembly let asmSystem = getasm (typeof) Assert.False(FSharpType.IsModule(asmSystem.GetTypes().[0])) - + // custom Assembly let asmCustom = getasm (typeof) Assert.False(FSharpType.IsModule(asmCustom.GetTypes().[0])) - + // null CheckThrowsArgumentNullException(fun () -> FSharpType.IsModule(null) |> ignore ) [] - member _.IsRecord() = - - // positive + member _.IsRecord() = + + // positive Assert.True(FSharpType.IsRecord(typeof)) Assert.True(FSharpType.IsRecord(typeof)) Assert.True(FSharpType.IsRecord(typeof>)) - + // negative Assert.False(FSharpType.IsRecord(typeof)) - + // null CheckThrowsArgumentNullException(fun () ->FSharpType.IsRecord(null) |> ignore ) @@ -1109,68 +1109,68 @@ type FSharpTypeTests() = Assert.True(FSharpType.IsTuple(typeof)) Assert.True(FSharpType.IsTuple(typeof)) - + // negative Assert.False(FSharpType.IsTuple(typeof)) Assert.False(FSharpType.IsTuple(typeof)) - + // null CheckThrowsArgumentNullException(fun () ->FSharpType.IsTuple(null) |> ignore ) - + [] - member _.IsUnion() = - - // positive + member _.IsUnion() = + + // positive Assert.True(FSharpType.IsUnion(typeof)) Assert.True(FSharpType.IsUnion(typeof)) Assert.True(FSharpType.IsUnion(typeof>)) Assert.True(FSharpType.IsUnion(typeof>)) - + // negative Assert.False(FSharpType.IsUnion(typeof)) Assert.False(FSharpType.IsUnion(typeof)) - + // null CheckThrowsArgumentNullException(fun () ->FSharpType.IsUnion(null) |> ignore ) - - [] - member _.MakeFunctionType() = - - // positive - Assert.AreEqual(FSharpType.MakeFunctionType(typeof, typeof), typeofstring>) - - // negative - Assert.AreNotEqual(FSharpType.MakeFunctionType(typeof, typeof), typeofstring->int>) - + + [] + member _.MakeFunctionType() = + + // positive + Assert.AreEqual(FSharpType.MakeFunctionType(typeof, typeof), typeofstring>) + + // negative + Assert.AreNotEqual(FSharpType.MakeFunctionType(typeof, typeof), typeofstring->int>) + // null CheckThrowsArgumentNullException(fun () ->FSharpType.MakeFunctionType(null, null) |> ignore ) - + [] - member _.MakeTupleType() = - + member _.MakeTupleType() = + // positive Assert.AreEqual(FSharpType.MakeTupleType([|typeof; typeof|]), typeof>) - + // negative Assert.AreNotEqual(FSharpType.MakeTupleType([|typeof; typeof|]), typeof>) - + // null CheckThrowsArgumentException(fun () ->FSharpType.MakeTupleType([|null;null|]) |> ignore ) [] - member _.MakeStructTupleType() = + member _.MakeStructTupleType() = let asm = typeof.Assembly // positive Assert.AreEqual(FSharpType.MakeStructTupleType(asm, [|typeof; typeof|]), typeof) - + // negative Assert.AreNotEqual(FSharpType.MakeStructTupleType(asm, [|typeof; typeof|]), typeof) - + // null CheckThrowsArgumentException(fun () ->FSharpType.MakeStructTupleType(asm, [|null;null|]) |> ignore ) [] - member _.MakeStructTupleTypeNoAsm() = + member _.MakeStructTupleTypeNoAsm() = // positive Assert.AreEqual(FSharpType.MakeStructTupleType( [|typeof; typeof|]), typeof) // positive for nested tuple @@ -1178,103 +1178,103 @@ type FSharpTypeTests() = // the representations above and below are equivalent, as tuple types are nested from 8th element on Assert.AreEqual(FSharpType.MakeStructTupleType( [|for i in 1..10 -> typeof|]), typeof>>) - + // negative Assert.AreNotEqual(FSharpType.MakeStructTupleType( [|typeof; typeof|]), typeof) - + // invalid cases CheckThrowsArgumentException(fun () ->FSharpType.MakeStructTupleType( [|null;null|]) |> ignore ) CheckThrowsArgumentNullException(fun () ->FSharpType.MakeStructTupleType( null) |> ignore ) CheckThrowsArgumentException(fun () ->FSharpType.MakeStructTupleType( [| |]) |> ignore ) -type UnionCaseInfoTests() = - +type UnionCaseInfoTests() = + let singlenullarycaseunion = SingleNullaryCaseDiscUnion.SingleNullaryCaseTag let singlecaseunion1 = SingleCaseDiscUnion.SingleCaseTag(1.0, 2.0, 3.0) let singlecaseunion2 = SingleCaseDiscUnion.SingleCaseTag(4.0, 5.0, 6.0) - + let discUniontypeA = DiscUnionType.A let discUniontypeB = DiscUnionType.B(1, Some(discUniontypeA)) let discUniontypeC = DiscUnionType.C(1.0, "stringparam") - + let recDiscUniontypeB = DiscUnionType.B(1, Some(discUniontypeB)) - + let ((singlenullarycaseinfo:UnionCaseInfo), singlenullaryvaluearray) = FSharpValue.GetUnionFields(singlenullarycaseunion, typeof) let ((singlecaseinfo:UnionCaseInfo), singlevaluearray) = FSharpValue.GetUnionFields(singlecaseunion1, typeof) - + let ((discUnionInfoA:UnionCaseInfo), discvaluearray) = FSharpValue.GetUnionFields(discUniontypeA, typeof>) let ((discUnionInfoB:UnionCaseInfo), discvaluearray) = FSharpValue.GetUnionFields(discUniontypeB, typeof>) let ((discUnionInfoC:UnionCaseInfo), discvaluearray) = FSharpValue.GetUnionFields(discUniontypeC, typeof>) - + let ((recDiscCaseinfo:UnionCaseInfo), recDiscCasevaluearray) = FSharpValue.GetUnionFields(recDiscUniontypeB, typeof>) let ((sharedstructUnionInfoA:UnionCaseInfo), _) = FSharpValue.GetUnionFields(DiscStructUnionType.A, typeof>) let ((sharedstructUnionInfoB:UnionCaseInfo), _) = FSharpValue.GetUnionFields(DiscStructUnionType.B(15), typeof>) let ((sharedstructUnionInfoC:UnionCaseInfo), _) = FSharpValue.GetUnionFields(DiscStructUnionType.C(15.,"x"), typeof>) let ((sharedstructUnionInfoEvilC:UnionCaseInfo), _) = FSharpValue.GetUnionFields(DiscStructUnionType.Evil_C(15.), typeof>) - + [] - member _.Equals() = + member _.Equals() = //positive // single case Assert.True(singlecaseinfo.Equals(singlecaseinfo)) - + // disc union Assert.True(discUnionInfoA.Equals(discUnionInfoA)) - + // rec disc union Assert.True(recDiscCaseinfo.Equals(recDiscCaseinfo)) - + // negative // single case Assert.False(singlecaseinfo.Equals(discUnionInfoA)) - + // disc union Assert.False(discUnionInfoA.Equals(discUnionInfoB)) - + // rec disc union Assert.False(recDiscCaseinfo.Equals(discUnionInfoA)) - + // null Assert.False(singlecaseinfo.Equals(null)) - + [] - member _.GetCustomAttributes() = - + member _.GetCustomAttributes() = + // single case let singlecaseAttribute = (singlecaseinfo.GetCustomAttributes()).[0] :?> Attribute Assert.AreEqual(singlecaseAttribute.ToString(), "Microsoft.FSharp.Core.CompilationMappingAttribute" ) - + // disc union let discunionAttribute = (discUnionInfoA.GetCustomAttributes()).[0] :?> Attribute Assert.AreEqual(discunionAttribute.ToString(), "Microsoft.FSharp.Core.CompilationMappingAttribute" ) - + // rec disc union let recdiscAttribute = (recDiscCaseinfo.GetCustomAttributes()).[0] :?> Attribute Assert.AreEqual(recdiscAttribute.ToString(), "Microsoft.FSharp.Core.CompilationMappingAttribute" ) - + // null - CheckThrowsArgumentNullException(fun () -> singlecaseinfo.GetCustomAttributes(null) |> ignore ) - + CheckThrowsArgumentNullException(fun () -> singlecaseinfo.GetCustomAttributes(null) |> ignore ) + [] - member _.GetFields() = - + member _.GetFields() = + // single case let singlecaseFieldInfo = (singlecaseinfo.GetFields()).[0] Assert.AreEqual(singlecaseFieldInfo.PropertyType , typeof<(float)>) - + // disc union null empty let discunionFieldInfoEpt = discUnionInfoA.GetFields() Assert.AreEqual(discunionFieldInfoEpt.Length , 0) - + // disc union int - let discunionFieldInfo = (discUnionInfoB.GetFields()).[0] + let discunionFieldInfo = (discUnionInfoB.GetFields()).[0] Assert.AreEqual(discunionFieldInfo.PropertyType , typeof) - + // rec disc union - let recdiscFieldInfo = (recDiscCaseinfo.GetFields()).[0] + let recdiscFieldInfo = (recDiscCaseinfo.GetFields()).[0] Assert.AreEqual(recdiscFieldInfo.PropertyType , typeof) @@ -1285,49 +1285,49 @@ type UnionCaseInfoTests() = Assert.AreEqual(sharedstructUnionInfoC.GetFields().[1].PropertyType ,typeof) Assert.AreEqual(sharedstructUnionInfoEvilC.GetFields().[0].PropertyType ,typeof) - + [] - member _.GetHashCode() = - + member _.GetHashCode() = + // positive // single case Assert.AreEqual(singlecaseinfo.GetHashCode(), singlecaseinfo.GetHashCode()) - + // disc union - + Assert.AreEqual(discUnionInfoA.GetHashCode(), discUnionInfoA.GetHashCode()) - + // rec disc union - + Assert.AreEqual(recDiscCaseinfo.GetHashCode(), recDiscCaseinfo.GetHashCode()) - + // negative // disc union Assert.AreNotEqual(discUnionInfoA.GetHashCode(), discUnionInfoB.GetHashCode()) - + [] - member _.GetType() = - + member _.GetType() = + // single case Assert.AreEqual(singlecaseinfo.GetType(), typeof ) - + // disc union Assert.AreEqual(discUnionInfoA.GetType(), typeof ) - + // rec disc union - Assert.AreEqual(recDiscCaseinfo.GetType(), typeof ) - + Assert.AreEqual(recDiscCaseinfo.GetType(), typeof ) + [] - member _.ToString() = - + member _.ToString() = + // single case Assert.AreEqual(singlenullarycaseinfo.ToString(), "SingleNullaryCaseDiscUnion.SingleNullaryCaseTag") // single case Assert.AreEqual(singlecaseinfo.ToString(), "SingleCaseDiscUnion.SingleCaseTag") - + // disc union Assert.True((discUnionInfoA.ToString()).Contains("DiscUnionType") ) - + // rec disc union Assert.True((recDiscCaseinfo.ToString()).Contains("DiscUnionType")) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs index ec620ebc220..0032fc36032 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs @@ -24,19 +24,19 @@ type OperatorsModule1() = let funcKeyValue x = match x with | Operators.KeyValue(a) -> a - + // string int let stringint = funcKeyValue ( new System.Collections.Generic.KeyValuePair("string",1)) Assert.AreEqual(("string",1), stringint) - + // float char let floatchar = funcKeyValue ( new System.Collections.Generic.KeyValuePair(1.0,'a')) Assert.AreEqual((1.0,'a'), floatchar) - + // null let nullresult = funcKeyValue ( new System.Collections.Generic.KeyValuePair(null,' ')) let (nullstring:string,blankchar:char) = nullresult - + CheckThrowsNullRefException(fun () -> nullstring.ToString() |> ignore) [] @@ -44,15 +44,15 @@ type OperatorsModule1() = let param1 = Some(1) let param2 = Some(2) - + // int let intslice = Operators.OperatorIntrinsics.GetArraySlice [|1;2;3;4;5;6|] param1 param2 Assert.AreEqual([|2;3|], intslice) - + // string let stringslice = Operators.OperatorIntrinsics.GetArraySlice [|"1";"2";"3"|] param1 param2 Assert.AreEqual([|"2";"3"|], stringslice) - + // null let stringslice = Operators.OperatorIntrinsics.GetArraySlice [|null;null;null|] param1 param2 Assert.AreEqual([|null;null|], stringslice) @@ -64,18 +64,18 @@ type OperatorsModule1() = let param1D2 = Some(1) let param2D1 = Some(0) let param2D2 = Some(1) - + // int let intArray2D = Array2D.init 2 3 (fun i j -> i*100+j) let intslice = Operators.OperatorIntrinsics.GetArraySlice2D intArray2D param1D1 param1D2 param2D1 param2D2 - + Assert.AreEqual(101, intslice.[1,1]) - + // string let stringArray2D = Array2D.init 2 3 (fun i j -> (i*100+j).ToString()) let stringslice = Operators.OperatorIntrinsics.GetArraySlice2D stringArray2D param1D1 param1D2 param2D1 param2D2 Assert.AreEqual((101).ToString(), stringslice.[1,1]) - + // null let nullArray2D = Array2D.init 2 3 (fun i j -> null) let nullslice = Operators.OperatorIntrinsics.GetArraySlice2D nullArray2D param1D1 param1D2 param2D1 param2D2 @@ -85,11 +85,11 @@ type OperatorsModule1() = member _.OptimizedRangesGetStringSlice() = let param1 = Some(4) let param2 = Some(6) - + // string let stringslice = Operators.OperatorIntrinsics.GetStringSlice "abcdefg" param1 param2 Assert.AreEqual("efg", stringslice) - + // null CheckThrowsNullRefException(fun () -> Operators.OperatorIntrinsics.GetStringSlice null param1 param2 |> ignore) @@ -97,19 +97,19 @@ type OperatorsModule1() = member _.OptimizedRangesSetArraySlice() = let param1 = Some(1) let param2 = Some(2) - + // int let intArray1 = [|1;2;3|] let intArray2 = [|4;5;6|] Operators.OperatorIntrinsics.SetArraySlice intArray1 param1 param2 intArray2 Assert.AreEqual([|1;4;5|], intArray1) - + // string let stringArray1 = [|"1";"2";"3"|] let stringArray2 = [|"4";"5";"6"|] Operators.OperatorIntrinsics.SetArraySlice stringArray1 param1 param2 stringArray2 Assert.AreEqual([|"1";"4";"5"|], stringArray1) - + // null let nullArray1 = [|null;null;null|] let nullArray2 = [|null;null;null|] @@ -122,19 +122,19 @@ type OperatorsModule1() = let param1D2 = Some(1) let param2D1 = Some(0) let param2D2 = Some(1) - + // int let intArray1 = Array2D.init 2 3 (fun i j -> i*10+j) let intArray2 = Array2D.init 2 3 (fun i j -> i*100+j) Operators.OperatorIntrinsics.SetArraySlice2D intArray1 param1D1 param1D2 param2D1 param2D2 intArray2 Assert.AreEqual(101, intArray1.[1,1]) - + // string let stringArray2D1 = Array2D.init 2 3 (fun i j -> (i*10+j).ToString()) let stringArray2D2 = Array2D.init 2 3 (fun i j -> (i*100+j).ToString()) Operators.OperatorIntrinsics.SetArraySlice2D stringArray2D1 param1D1 param1D2 param2D1 param2D2 stringArray2D2 Assert.AreEqual((101).ToString(), stringArray2D1.[1,1]) - + // null let nullArray2D1 = Array2D.init 2 3 (fun i j -> null) let nullArray2D2 = Array2D.init 2 3 (fun i j -> null) @@ -157,105 +157,105 @@ type OperatorsModule1() = [] member _.Uncheckeddefaultof () = - + // int let intdefault = Operators.Unchecked.defaultof Assert.AreEqual(0, intdefault) - + // string let stringdefault = Operators.Unchecked.defaultof CheckThrowsNullRefException(fun () -> stringdefault.ToString() |> ignore) - + // null let structdefault = Operators.Unchecked.defaultof Assert.AreEqual(1, structdefault.Day) [] member _.abs () = - + // int let intabs = Operators.abs (-7) Assert.AreEqual(7, intabs) - + // float let floatabs = Operators.abs (-100.0) Assert.AreEqual(100.0, floatabs) - + // decimal let decimalabs = Operators.abs (-1000M) Assert.AreEqual(1000M, decimalabs) [] member _.acos () = - + // min value let minacos = Operators.acos (0.0) Assert.AreNearEqual(1.5707963267948966, minacos) - + // normal value let normalacos = Operators.acos (0.3) Assert.AreNearEqual(1.2661036727794992, normalacos) - + // max value let maxacos = Operators.acos (1.0) Assert.AreEqual(0.0, maxacos) [] member _.asin () = - + // min value let minasin = Operators.asin (0.0) Assert.AreEqual(0.0, minasin) - + // normal value let normalasin = Operators.asin (0.5) Assert.AreNearEqual(0.52359877559829893, normalasin) - + // max value let maxasin = Operators.asin (1.0) Assert.AreNearEqual(1.5707963267948966, maxasin) [] member _.atan () = - + // min value let minatan = Operators.atan (0.0) Assert.AreNearEqual(0.0, minatan) - + // normal value let normalatan = Operators.atan (1.0) Assert.AreNearEqual(0.78539816339744828, normalatan) - + // biggish value let maxatan = Operators.atan (infinity) Assert.AreNearEqual(1.5707963267948966, maxatan) [] member _.atan2 () = - + // min value let minatan2 = Operators.atan2 (0.0) (1.0) Assert.AreNearEqual(0.0, minatan2) - + // normal value let normalatan2 = Operators.atan2 (1.0) (1.0) Assert.AreNearEqual(0.78539816339744828, normalatan2) - + // biggish value let maxatan2 = Operators.atan2 (1.0) (0.0) Assert.AreNearEqual(1.5707963267948966, maxatan2) [] member _.box () = - + // int value let intbox = Operators.box 1 Assert.AreEqual(1, intbox) - + // string value let stringbox = Operators.box "string" Assert.AreEqual("string", stringbox) - + // null value let nullbox = Operators.box null CheckThrowsNullRefException(fun () -> nullbox.ToString() |> ignore) @@ -265,23 +265,23 @@ type OperatorsModule1() = // 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) @@ -303,7 +303,7 @@ type OperatorsModule1() = Assert.AreEqual(0uy, result) else Assert.AreEqual(255uy, result) - + // Overflow let result = Operators.byte (Int64.MaxValue * 8L) Assert.AreEqual(248uy, result) // bit-complement @@ -314,29 +314,29 @@ type OperatorsModule1() = // OverflowException, from decimal is always checked CheckThrowsOverflowException(fun () -> Operators.byte Decimal.MinValue |> ignore) - + [] member _.ceil() = // min value let minceil = Operators.ceil 0.1 Assert.AreEqual(1.0, minceil) - + // normal value 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 @@ -366,36 +366,36 @@ type OperatorsModule1() = else Assert.AreEqual('\uffff', Operators.char Double.MaxValue) CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) - + // string type let stringchar = Operators.char " " Assert.AreEqual(' ', stringchar) - + [] member _.compare() = // int type let intcompare = Operators.compare 100 101 Assert.AreEqual(-1, intcompare) - + // char type let charcompare = Operators.compare '0' '1' Assert.AreEqual(-1, charcompare) - + // null value let boundcompare = Operators.compare null null Assert.AreEqual(0, boundcompare) [] member _.cos () = - + // min value let mincos = Operators.cos (0.0) Assert.AreEqual(1.0, mincos) - + // normal value let normalcos = Operators.cos (1.0) Assert.AreNearEqual(0.54030230586813977, normalcos) - + // biggish value let maxcos = Operators.cos (1.57) Assert.AreNearEqual(0.00079632671073326335, maxcos) @@ -406,34 +406,34 @@ type OperatorsModule1() = // min value let mincosh = Operators.cosh (0.0) Assert.AreEqual(1.0, mincosh) - + // normal value let normalcosh = Operators.cosh (1.0) Assert.AreNearEqual(1.5430806348152437, normalcosh) - + // biggish value let maxcosh = Operators.cosh (1.57) Assert.AreNearEqual(2.5073466880660993, maxcosh) [] member _.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) @@ -444,44 +444,44 @@ type OperatorsModule1() = let zeroref = ref 0 Operators.decr zeroref Assert.AreEqual((ref -1), zeroref) - + // big number let bigref = ref 32767 Operators.decr bigref Assert.AreEqual((ref 32766), bigref) - + // normal value let normalref = ref 100 Operators.decr (normalref) Assert.AreEqual((ref 99), normalref) - + [] member _.defaultArg() = // zero let zeroOption = Some(0) let intdefaultArg = Operators.defaultArg zeroOption 2 Assert.AreEqual(0, intdefaultArg) - + // big number let bigOption = Some(32767) let bigdefaultArg = Operators.defaultArg bigOption 32766 Assert.AreEqual(32767, bigdefaultArg) - + // normal value let normalOption = Some(100) let normalfaultArg = Operators.defaultArg normalOption 100 Assert.AreEqual(100, normalfaultArg) - + [] member _.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) @@ -492,17 +492,17 @@ type OperatorsModule1() = let intarg : int32 = 0 let intenum = Operators.enum intarg Assert.AreEqual(System.ConsoleColor.Black, intenum) - + // big number let bigarg : int32 = 15 let charenum = Operators.enum bigarg Assert.AreEqual(System.ConsoleColor.White, charenum) - + // normal value let normalarg : int32 = 9 let boundenum = Operators.enum normalarg Assert.AreEqual(System.ConsoleColor.Blue, boundenum) - + #if IGNORED [] member _.exit() = @@ -528,15 +528,15 @@ type OperatorsModule1() = // zero let zeroexp = Operators.exp 0.0 Assert.AreEqual(1.0, zeroexp) - + // big number let bigexp = Operators.exp 32767.0 Assert.AreEqual(infinity, bigexp) - + // normal value let normalexp = Operators.exp 100.0 Assert.AreEqual(2.6881171418161356E+43, normalexp) - + [] member _.failwith() = try @@ -552,7 +552,7 @@ type OperatorsModule1() = // int type let intfloat = Operators.float 100 Assert.AreEqual((float)100, intfloat) - + // char type let charfloat = Operators.float '0' Assert.AreEqual((float)48, charfloat) @@ -566,11 +566,11 @@ type OperatorsModule1() = // 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) @@ -580,53 +580,53 @@ type OperatorsModule1() = // float type let floatfloor = Operators.floor 100.9 Assert.AreEqual(100.0, floatfloor) - + // float32 type 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() = // int type let intfst = Operators.fst (100,101) Assert.AreEqual(100, intfst) - + // char type let charfst = Operators.fst ('0','1') Assert.AreEqual('0', charfst) - + // null value let boundfst = Operators.fst (null,null) Assert.AreEqual(null, boundfst) - + [] member _.hash() = // int type (stable between JIT versions) let inthash = Operators.hash 100 Assert.AreEqual(100, inthash) - + // char type (stable between JIT versions) let charhash = Operators.hash '0' Assert.AreEqual(3145776, charhash) - + // string value (test disabled, each JIT and each x86 vs x64 creates a different hash here) //let boundhash = Operators.hash "A" //Assert.AreEqual(-842352673, boundhash) - + [] member _.id() = // int type let intid = Operators.id 100 Assert.AreEqual(100, intid) - + // char type let charid = Operators.id '0' Assert.AreEqual('0', charid) - + // string value let boundid = Operators.id "A" Assert.AreEqual("A", boundid) @@ -636,7 +636,7 @@ type OperatorsModule1() = // value type let result = Operators.ignore 10 Assert.AreEqual(null, result) - + // reference type let result = Operators.ignore "A" Assert.AreEqual(null, result) @@ -647,7 +647,7 @@ type OperatorsModule1() = let result = ref 10 Operators.incr result Assert.AreEqual(11, !result) - + // Overflow. let result = ref (Operators.Checked.int System.Int32.MaxValue) Operators.incr result @@ -655,11 +655,11 @@ type OperatorsModule1() = [] member _.infinity() = - + let inf = Operators.infinity let result = inf > System.Double.MaxValue Assert.True(result) - + // arithmetic operation let result = infinity + 3.0 Assert.AreEqual(Double.PositiveInfinity, result) @@ -674,11 +674,11 @@ type OperatorsModule1() = [] member _.infinityf() = - + let inf = Operators.infinityf let result = inf > System.Single.MaxValue Assert.True(result) - + // arithmetic operation let result = infinityf + 3.0f Assert.AreEqual(Single.PositiveInfinity, result) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs index 358c155a3a8..85c2007504b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs @@ -28,7 +28,7 @@ type TestFs0670Error<'T> = | TestFs0670Error of 'T override this.ToString() = match this with - | TestFs0670Error x -> + | TestFs0670Error x -> // This used to raise FS0670 because the type is generic, and 'string' was inline // See: https://github.com/dotnet/fsharp/issues/7958 Operators.string x @@ -45,23 +45,23 @@ type OperatorsModule2() = // 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 if Info.isNetFramework then @@ -72,22 +72,22 @@ type OperatorsModule2() = // Overflow let result = Operators.int Single.MinValue Assert.AreEqual(Int32.MinValue, result) - + // Overflow let result = Operators.int Double.MaxValue if Info.isNetFramework then Assert.AreEqual(Int32.MinValue, result) else Assert.AreEqual(Int32.MaxValue, 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) @@ -98,29 +98,29 @@ type OperatorsModule2() = // OverflowException, from decimal is always checked CheckThrowsOverflowException(fun () -> Operators.int Decimal.MinValue |> ignore) - + [] member _.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 if Info.isNetFramework then @@ -131,7 +131,7 @@ type OperatorsModule2() = // Overflow let result = Operators.int16 Single.MinValue Assert.AreEqual(0s, result) - + // Overflow let result = Operators.int16 Double.MaxValue if Info.isNetFramework then @@ -162,23 +162,23 @@ type OperatorsModule2() = // 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 if Info.isNetFramework then @@ -189,7 +189,7 @@ type OperatorsModule2() = // Overflow let result = Operators.int32 Single.MinValue Assert.AreEqual(Int32.MinValue, result) - + // Overflow let result = Operators.int32 Double.MaxValue if Info.isNetFramework then @@ -200,11 +200,11 @@ type OperatorsModule2() = // 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) @@ -221,23 +221,23 @@ type OperatorsModule2() = // 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 if Info.isNetFramework then @@ -248,7 +248,7 @@ type OperatorsModule2() = // Overflow let result = Operators.int64 Single.MinValue Assert.AreEqual(Int64.MinValue, result) - + // Overflow. let result = Operators.int64 Double.MaxValue if Info.isNetFramework then @@ -275,7 +275,7 @@ type OperatorsModule2() = member _.invalidArg() = CheckThrowsArgumentException(fun () -> Operators.invalidArg "A" "B" |>ignore ) - + [] member _.lock() = // lock @@ -287,7 +287,7 @@ type OperatorsModule2() = k ) } let arr = Async.RunSynchronously (Async.Parallel(Seq.map comp [1..50])) Assert.AreEqual([|1..50|], Array.sort arr) - + // without lock let syncRoot = System.Object() let mutable k = 0 @@ -296,105 +296,105 @@ type OperatorsModule2() = return k } let arr = Async.RunSynchronously (Async.Parallel(Seq.map comp [1..100])) Assert.AreNotEqual ([|1..100|], Array.sort arr) - + [] member _.log() = // double let result = Operators.log 10.0 Assert.AreEqual(2.3025850929940459, result) - + // negative let result = Operators.log -10.0 Assert.AreEqual(Double.NaN, result) - + // zero let result = Operators.log 0.0 Assert.AreEqual(Double.NegativeInfinity , result) - + [] member _.log10() = // double let result = Operators.log10 10.0 Assert.AreEqual(1.0, result) - + // negative let result = Operators.log10 -10.0 Assert.AreEqual(System.Double.NaN, result) - + // zero let result = Operators.log10 0.0 Assert.AreEqual(Double.NegativeInfinity, result) - + [] member _.max() = // value type let result = Operators.max 10 8 Assert.AreEqual(10, result) - + // negative let result = Operators.max -10.0 -8.0 Assert.AreEqual(-8.0, result) - + // zero let result = Operators.max 0 0 Assert.AreEqual(0, result) - + // reference type let result = Operators.max "A" "ABC" Assert.AreEqual("ABC", result) - + [] member _.min() = // value type let result = Operators.min 10 8 Assert.AreEqual(8, result) - + // negative let result = Operators.min -10.0 -8.0 Assert.AreEqual(-10.0, result) - + // zero let result = Operators.min 0 0 Assert.AreEqual(0, result) - + // reference type let result = Operators.min "A" "ABC" Assert.AreEqual("A", result) - + [] member _.nan() = // value type let result = Operators.nan Assert.AreEqual(System.Double.NaN, nan) - + [] member _.nanf() = // value type let result = Operators.nanf Assert.AreEqual(System.Single.NaN, result) - + [] member _.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 Single.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.nativeint Single.MaxValue if Info.isX86Runtime then @@ -405,7 +405,7 @@ type OperatorsModule2() = Assert.AreEqual(-9223372036854775807n - 1n, result) else Assert.AreEqual(9223372036854775807n, result) - + // Overflow (depends on pointer size) let result = Operators.nativeint Single.MinValue if Info.isX86Runtime then @@ -432,7 +432,7 @@ type OperatorsModule2() = 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 @@ -481,50 +481,50 @@ type OperatorsModule2() = member _.not() = let result = Operators.not true Assert.False(result) - + let result = Operators.not false Assert.True(result) - + [] member _.nullArg() = CheckThrowsArgumentNullException(fun () -> Operators.nullArg "A" |> ignore) - + [] member _.pown() = // int let result = Operators.pown 10 2 Assert.AreEqual(100, result) - + // double let result = Operators.pown 10.0 2 Assert.AreEqual(100.0, result) - + // int64 let result = Operators.pown 10L 2 Assert.AreEqual(100L, result) - + // decimal let result = Operators.pown 10M 2 Assert.AreEqual(100M, result) - + // negative let result = Operators.pown -10 2 Assert.AreEqual(100, result) - + // zero let result = Operators.pown 0 2 Assert.AreEqual(0, result) - + // overflow 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) - + [] member _.raise() = CheckThrowsArgumentException(fun () -> Operators.raise <| new ArgumentException("Invalid Argument ") |> ignore) - + [] member _.ref() = // value type @@ -534,7 +534,7 @@ type OperatorsModule2() = () Array.iter funInt [|1..10|] Assert.AreEqual(!result,55) - + // reference type let result = Operators.ref "" let funStr (x : string) = @@ -542,7 +542,7 @@ type OperatorsModule2() = () Array.iter funStr [|"A";"B";"C";"D"|] Assert.AreEqual(!result,"ABCD") - + [] member _.reraise() = // nothing to reraise should not trigger exception @@ -550,75 +550,75 @@ type OperatorsModule2() = () with | _ -> Operators.reraise() - + [] member _.round() = // double let result = Operators.round 10.0 Assert.AreEqual(10.0, result) - + // double let result = Operators.round 0.6640367702678489 Assert.AreEqual(1.0, result) - + // double let result = Operators.round 0.6640367702678489e4 Assert.AreEqual(6640.0, result) - + // double, show half-to-even let result = Operators.round 0.6640500000e4 Assert.AreEqual(6640.0, result) - + // double, show half-to-even let result = Operators.round 0.6639500000e4 Assert.AreEqual(6640.0, result) - + // double, show half-to-even let result = Operators.round 0.6641500000e4 Assert.AreEqual(6642.0, result) - + // double, show rounding up if anything follows '5' let result = Operators.round 0.66405000001e4 Assert.AreEqual(6641.0, result) - + // decimal let result = Operators.round 10M Assert.AreEqual(10M, result) - + // decimal, show half-to-even let result = Operators.round 1233.5M Assert.AreEqual(1234M, result) - + // decimal, show half-to-even let result = Operators.round 1234.5M Assert.AreEqual(1234M, result) - + // decimal, show half-to-even let result = Operators.round 1235.5M Assert.AreEqual(1236M, result) - + // decimal, show rounding up if anything follows '5' let result = Operators.round 1234.500000000001M Assert.AreEqual(1235M, result) - + // decimal, round up let result = Operators.round 1234.6M Assert.AreEqual(1235M, result) - + [] member _.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) @@ -626,43 +626,43 @@ type OperatorsModule2() = // 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 Double.MinValue Assert.AreEqual(0y, result) - + // Overflow let result = Operators.sbyte Double.MaxValue if Info.isNetFramework then Assert.AreEqual(0y, result) else Assert.AreEqual(-1y, 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) - + [] member _.sign() = // int let result = Operators.sign 10 Assert.AreEqual(1, result) - + // negative int let result = Operators.sign -10 Assert.AreEqual(-1, result) - + // zero int let result = Operators.sign 0 Assert.AreEqual(0, result) @@ -670,27 +670,27 @@ type OperatorsModule2() = // double let result = Operators.sign 10.0 Assert.AreEqual(1, result) - + // double max let result = Operators.sign Double.MaxValue Assert.AreEqual(1, result) - + // double min let result = Operators.sign Double.MinValue Assert.AreEqual(-1, result) - + // double epsilon positive let result = Operators.sign Double.Epsilon Assert.AreEqual(1, result) - + // double epsilon negative let result = Operators.sign (-Double.Epsilon) Assert.AreEqual(-1, result) - + // double inf let result = Operators.sign Double.PositiveInfinity Assert.AreEqual(1, result) - + // double -inf let result = Operators.sign Double.NegativeInfinity Assert.AreEqual(-1, result) @@ -698,27 +698,27 @@ type OperatorsModule2() = // float32 let result = Operators.sign 10.0f Assert.AreEqual(1, result) - + // float32 max let result = Operators.sign Single.MaxValue Assert.AreEqual(1, result) - + // float32 min let result = Operators.sign Single.MinValue Assert.AreEqual(-1, result) - + // float32 epsilon positive let result = Operators.sign Single.Epsilon Assert.AreEqual(1, result) - + // float32 epsilon negative let result = Operators.sign (-Single.Epsilon) Assert.AreEqual(-1, result) - + // float32 inf let result = Operators.sign Single.PositiveInfinity Assert.AreEqual(1, result) - + // float32 -inf let result = Operators.sign Single.NegativeInfinity Assert.AreEqual(-1, result) @@ -728,42 +728,42 @@ type OperatorsModule2() = // float32 nan CheckThrowsArithmeticException(fun () -> Operators.sign Single.NaN |> ignore) - + [] member _.sin() = - + let result = Operators.sin 0.5 Assert.AreNearEqual(0.479425538604203, result) let result = Operators.sin Double.NaN Assert.AreEqual(Double.NaN, result) - + let result = Operators.sin Double.PositiveInfinity Assert.AreEqual(Double.NaN, result) - + let result = Operators.sin Double.NegativeInfinity Assert.AreEqual(Double.NaN, result) - + [] member _.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) - + [] member _.sinh() = - + let result = Operators.sinh 1.0 Assert.AreNearEqual(1.1752011936438014, result) - + let result = Operators.sinh 0.0 Assert.AreNearEqual(0.0, result) @@ -781,61 +781,61 @@ type OperatorsModule2() = // value type let result = Operators.sizeof Assert.AreEqual(4, result) - + // System.Int64 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) - + // null should have the same size as the IntPtr let result = Operators.sizeof Assert.AreEqual(IntPtr.Size, result) - + [] member _.snd() = // value type let result = Operators.snd ("ABC",100) Assert.AreEqual(100, result) - + // reference type let result = Operators.snd (100,"ABC") Assert.AreEqual("ABC", result) - + // null let result = Operators.snd (100,null) Assert.AreEqual(null, result) - + [] member _.sqrt() = // double let result = Operators.sqrt 100.0 Assert.AreEqual(10.0, result) - + let result = Operators.sqrt -2.0 Assert.AreEqual(Double.NaN, result) - + [] member _.stderr() = let result = Operators.stderr Assert.AreEqual(null, result.WriteLine("go")) - + [] member _.stdin() = let result = Operators.stdin Assert.AreEqual(null, result.Dispose()) - + [] member _.stdout() = let result = Operators.stdout Assert.AreEqual(null, result.WriteLine("go")) - + [] member _.string() = let result = Operators.string null @@ -860,7 +860,7 @@ type OperatorsModule2() = // value type let result = Operators.string 100 Assert.AreEqual("100", result) - + // reference type let result = Operators.string "ABC" Assert.AreEqual("ABC", result) @@ -883,7 +883,7 @@ type OperatorsModule2() = let result = Operators.string { new obj () with override _.ToString () = Operators.string null } Assert.AreEqual("", result) - + let result = Operators.string { new IFormattable with override _.ToString (_, _) = null } Assert.AreEqual("", result) @@ -926,13 +926,13 @@ type OperatorsModule2() = // See: https://github.com/dotnet/fsharp/issues/7958 let result = TestFs0670Error 32uy |> Operators.string Assert.AreEqual("32", result) - + [] member _.tan() = // double let result = Operators.tan 1.0 Assert.AreNearEqual(1.5574077246549023, result) - + [] member _.tanh() = // The x86 runtime uses 64 bit precision, whereas the x64 runtime uses SSE instructions with 80 bit precision @@ -951,128 +951,128 @@ type OperatorsModule2() = let result = tanh -infinity Assert.AreEqual(-1.0, result) - + [] member _.truncate() = // double let result = Operators.truncate 10.101 Assert.AreEqual(10.0, result) - + // decimal let result = Operators.truncate 10.101M Assert.AreEqual(10M, result) - + // zero let result = Operators.truncate 0.101 Assert.AreEqual(0.0, result) - + [] member _.typedefof() = // value type let result = Operators.typedefof Assert.AreEqual("System.Int32", result.FullName) - + // reference type let result = Operators.typedefof Assert.AreEqual("System.String", result.FullName) - + // unit let result = Operators.typedefof Assert.AreEqual("Microsoft.FSharp.Core.Unit", result.FullName) - + [] member _.typeof() = // value type let result = Operators.typeof Assert.AreEqual("System.Int32", result.FullName) - + // reference type let result = Operators.typeof Assert.AreEqual("System.String", result.FullName) - + // unit let result = Operators.typeof Assert.AreEqual("Microsoft.FSharp.Core.Unit", result.FullName) - + [] member _.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 if Info.isNetFramework then Assert.AreEqual(0us, result) else Assert.AreEqual(65535us, result) - + // Overflow let result = Operators.uint16 Single.MinValue Assert.AreEqual(0us, result) - + // Overflow let result = Operators.uint16 Double.MaxValue if Info.isNetFramework then Assert.AreEqual(0us, result) else Assert.AreEqual(65535us, 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) - + [] member _.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 if Info.isNetFramework then Assert.AreEqual(0u, result) else Assert.AreEqual(4294967295u, result) - + // Overflow let result = Operators.uint32 Single.MinValue Assert.AreEqual(0u, result) - + // Overflow let result = Operators.uint32 Double.MaxValue if Info.isNetFramework then Assert.AreEqual(0u, result) else Assert.AreEqual(4294967295u, 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) @@ -1094,11 +1094,11 @@ type OperatorsModule2() = // 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) @@ -1109,7 +1109,7 @@ type OperatorsModule2() = Assert.AreEqual(0UL, result) else Assert.AreEqual(18446744073709551615UL, result) - + // Overflow let result = Operators.uint64 Single.MinValue if Info.isNetFramework then @@ -1123,14 +1123,14 @@ type OperatorsModule2() = Assert.AreEqual(0UL, result) else Assert.AreEqual(18446744073709551615UL, result) - + // Overflow let result = Operators.uint64 Double.MinValue if Info.isNetFramework then Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 else Assert.AreEqual(0UL, result) - + // Overflow let result = Operators.uint64 Int64.MinValue Assert.AreEqual(9223372036854775808UL, result) @@ -1145,25 +1145,25 @@ type OperatorsModule2() = // OverflowException, from decimal is always checked CheckThrowsOverflowException(fun () -> Operators.uint64 Decimal.MinValue |> ignore) - + [] member _.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 if Info.isNetFramework then Assert.AreEqual(0un, result) else Assert.AreEqual(18446744073709551615un, result) - + // Overflow (depends on pointer size) let result = Operators.unativeint Single.MinValue if Info.isX86Runtime then @@ -1173,14 +1173,14 @@ type OperatorsModule2() = Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 else Assert.AreEqual(0un, result) - + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Double.MaxValue if Info.isNetFramework then Assert.AreEqual(0un, result) else Assert.AreEqual(18446744073709551615un, result) - + // Overflow (depends on pointer size) let result = Operators.unativeint Double.MinValue if Info.isX86Runtime then @@ -1190,7 +1190,7 @@ type OperatorsModule2() = Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 else Assert.AreEqual(0un, result) - + // Overflow (depends on pointer size) let result = Operators.unativeint Int64.MinValue if Info.isX86Runtime then @@ -1211,12 +1211,12 @@ type OperatorsModule2() = let oint = box 100 let result = Operators.unbox oint Assert.AreEqual(100, result) - + // reference type let ostr = box "ABC" let result = Operators.unbox ostr Assert.AreEqual("ABC", result) - + // null let onull = box null let result = Operators.unbox onull @@ -1227,11 +1227,10 @@ type OperatorsModule2() = let result = Operators.unbox onone Assert.AreEqual(None, result) Assert.AreEqual(null, result) - + [] member _.using() = let sr = new System.IO.StringReader("ABCD") Assert.AreEqual(sr.ReadToEnd(),"ABCD") let _ = Operators.using sr (fun x -> x.ToString()) CheckThrowsObjectDisposedException(fun () -> sr.ReadToEnd() |> ignore) - \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs index 54da228aca6..8cc41f84695 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs @@ -16,7 +16,7 @@ type OperatorsModuleChecked() = // int type let intByte = Operators.Checked.byte 100 Assert.AreEqual(100uy, intByte) - + // char type let charByte = Operators.Checked.byte '0' Assert.AreEqual(48uy, charByte) @@ -42,15 +42,15 @@ type OperatorsModuleChecked() = // 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) @@ -59,14 +59,14 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> '\uFFFF' + '\u0001' |> ignore) - + [] member _.CheckedInt() = // char let charInt = Operators.Checked.int '0' Assert.AreEqual(48, charInt) - + // float let floatInt = Operators.Checked.int 10.0 Assert.AreEqual(10, floatInt) @@ -74,7 +74,7 @@ type OperatorsModuleChecked() = // 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) @@ -92,15 +92,15 @@ type OperatorsModuleChecked() = // 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) @@ -118,15 +118,15 @@ type OperatorsModuleChecked() = // 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) @@ -144,21 +144,21 @@ type OperatorsModuleChecked() = // 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) @@ -176,15 +176,15 @@ type OperatorsModuleChecked() = // 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 @@ -194,22 +194,22 @@ type OperatorsModuleChecked() = CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Single.MaxValue |> ignore) CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Double.MaxValue |> ignore) - + [] member _.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) @@ -227,15 +227,15 @@ type OperatorsModuleChecked() = // 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) @@ -252,11 +252,11 @@ type OperatorsModuleChecked() = // 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) @@ -278,15 +278,15 @@ type OperatorsModuleChecked() = // 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) @@ -304,11 +304,11 @@ type OperatorsModuleChecked() = // 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 @@ -316,12 +316,12 @@ type OperatorsModuleChecked() = 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 () -> + CheckThrowsOverflowException(fun () -> if Info.isX86Runtime then Operators.Checked.unativeint (float UInt32.MaxValue + 1.0) |> ignore - else + else Operators.Checked.unativeint (float UInt64.MaxValue + 1.0) |> ignore ) CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Single.MaxValue |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs index 7d8b3678821..3aa64e3f81b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs @@ -13,14 +13,14 @@ 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 + sprintf "Expected %O exception, got no exception" typeof<'a> |> Assert.Fail with | :? 'a -> () | :? Reflection.TargetInvocationException as r when (r.InnerException :? 'a) -> () @@ -69,51 +69,51 @@ module OperatorsModuleDynamic = 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 if Info.isNetFramework then Assert.AreEqual(0uy, result) else Assert.AreEqual(255uy, result) - + // Overflow let result = Operators.byte Double.MinValue Assert.AreEqual(0uy, result) - + // Overflow let result = Operators.byte Double.MaxValue if Info.isNetFramework then Assert.AreEqual(0uy, result) else Assert.AreEqual(255uy, result) - + // Overflow let result = Operators.byte (Int64.MaxValue * 8L) Assert.AreEqual(248uy, result) // bit-complement @@ -124,7 +124,7 @@ module OperatorsModuleDynamic = // OverflowException, from decimal is always checked CheckThrowsOverflowException(fun () -> Operators.byte Decimal.MinValue |> ignore) - + [] let char() = // int type @@ -156,31 +156,31 @@ module OperatorsModuleDynamic = else Assert.AreEqual('\uffff', 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) @@ -190,11 +190,11 @@ module OperatorsModuleDynamic = // 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) @@ -204,7 +204,7 @@ module OperatorsModuleDynamic = // int type let intfloat = Operators.float 100 Assert.AreEqual((float)100, intfloat) - + // char type let charfloat = Operators.float '0' Assert.AreEqual((float)48, charfloat) @@ -218,11 +218,11 @@ module OperatorsModuleDynamic = // 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) @@ -232,49 +232,49 @@ module OperatorsModuleDynamic = // 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 if Info.isNetFramework then Assert.AreEqual(Int32.MinValue, result) else Assert.AreEqual(Int32.MaxValue, result) - + // Overflow let result = Operators.int Single.MinValue Assert.AreEqual(Int32.MinValue, result) - + // Overflow let result = Operators.int Double.MaxValue if Info.isNetFramework then Assert.AreEqual(Int32.MinValue, result) else Assert.AreEqual(Int32.MaxValue, 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) @@ -285,29 +285,29 @@ module OperatorsModuleDynamic = // 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 if Info.isNetFramework then @@ -318,7 +318,7 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int16 Single.MinValue Assert.AreEqual(0s, result) - + // Overflow let result = Operators.int16 Double.MaxValue if Info.isNetFramework then @@ -349,49 +349,49 @@ module OperatorsModuleDynamic = // 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 if Info.isNetFramework then Assert.AreEqual(Int32.MinValue, result) else Assert.AreEqual(Int32.MaxValue, result) - + // Overflow let result = Operators.int32 Single.MinValue Assert.AreEqual(Int32.MinValue, result) - + // Overflow let result = Operators.int32 Double.MaxValue if Info.isNetFramework then Assert.AreEqual(Int32.MinValue, result) else Assert.AreEqual(Int32.MaxValue, 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) @@ -408,23 +408,23 @@ module OperatorsModuleDynamic = // 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 if Info.isNetFramework then @@ -435,7 +435,7 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int64 Single.MinValue Assert.AreEqual(Int64.MinValue, result) - + // Overflow. let result = Operators.int64 Double.MaxValue if Info.isNetFramework then @@ -458,29 +458,29 @@ module OperatorsModuleDynamic = // 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 @@ -561,21 +561,21 @@ module OperatorsModuleDynamic = 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) @@ -583,123 +583,123 @@ module OperatorsModuleDynamic = // 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 if Info.isNetFramework then Assert.AreEqual(0y, result) else Assert.AreEqual(-1y, result) - + // Overflow let result = Operators.sbyte Double.MinValue Assert.AreEqual(0y, result) - + // Overflow let result = Operators.sbyte Double.MaxValue if Info.isNetFramework then Assert.AreEqual(0y, result) else Assert.AreEqual(-1y, 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 if Info.isNetFramework then Assert.AreEqual(0us, result) else Assert.AreEqual(65535us, result) - + // Overflow let result = Operators.uint16 Single.MinValue Assert.AreEqual(0us, result) - + // Overflow let result = Operators.uint16 Double.MaxValue if Info.isNetFramework then Assert.AreEqual(0us, result) else Assert.AreEqual(65535us, 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 if Info.isNetFramework then Assert.AreEqual(0u, result) else Assert.AreEqual(4294967295u, result) - + // Overflow let result = Operators.uint32 Single.MinValue Assert.AreEqual(0u, result) - + // Overflow let result = Operators.uint32 Double.MaxValue if Info.isNetFramework then @@ -709,11 +709,11 @@ module OperatorsModuleDynamic = // 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) @@ -735,11 +735,11 @@ module OperatorsModuleDynamic = // 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) @@ -785,25 +785,25 @@ module OperatorsModuleDynamic = // 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 if Info.isNetFramework then Assert.AreEqual(0un, result) else Assert.AreEqual(18446744073709551615un, result) - + // Overflow (depends on pointer size) let result = Operators.unativeint Single.MinValue if Info.isX86Runtime then @@ -813,14 +813,14 @@ module OperatorsModuleDynamic = Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 else Assert.AreEqual(0un, result) - + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Double.MaxValue if Info.isNetFramework then Assert.AreEqual(0un, result) else Assert.AreEqual(18446744073709551615un, result) - + // Overflow (depends on pointer size) let result = Operators.unativeint Double.MinValue if Info.isX86Runtime then @@ -845,13 +845,13 @@ module OperatorsModuleDynamic = 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) @@ -877,15 +877,15 @@ module OperatorsModuleDynamic = // 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) @@ -894,14 +894,14 @@ module OperatorsModuleDynamic = // 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) @@ -909,7 +909,7 @@ module OperatorsModuleDynamic = // 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) @@ -927,15 +927,15 @@ module OperatorsModuleDynamic = // 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) @@ -953,15 +953,15 @@ module OperatorsModuleDynamic = // 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) @@ -979,21 +979,21 @@ module OperatorsModuleDynamic = // 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) @@ -1011,15 +1011,15 @@ module OperatorsModuleDynamic = // 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 @@ -1029,22 +1029,22 @@ module OperatorsModuleDynamic = 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) @@ -1062,15 +1062,15 @@ module OperatorsModuleDynamic = // 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) @@ -1087,11 +1087,11 @@ module OperatorsModuleDynamic = // 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) @@ -1113,15 +1113,15 @@ module OperatorsModuleDynamic = // 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) @@ -1139,11 +1139,11 @@ module OperatorsModuleDynamic = // 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 @@ -1151,12 +1151,12 @@ module OperatorsModuleDynamic = 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 () -> + CheckThrowsOverflowException(fun () -> if Info.isX86Runtime then Operators.Checked.unativeint (float UInt32.MaxValue + 1.0) |> ignore - else + else Operators.Checked.unativeint (float UInt64.MaxValue + 1.0) |> ignore ) CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Single.MaxValue |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs index 68692f65c67..9fab5bb833b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs @@ -6,7 +6,7 @@ namespace FSharp.Core.UnitTests open System -open System.Numerics +open System.Numerics open FSharp.Core.UnitTests.LibraryTestFx open Xunit @@ -43,10 +43,10 @@ type LanguagePrimitivesModule() = let y = 2y Assert.AreEqual(y, y |> LanguagePrimitives.SByteWithMeasure |> sbyte) - + let n = 2n Assert.AreEqual(n, n |> LanguagePrimitives.IntPtrWithMeasure |> nativeint) - + let i = 2u Assert.AreEqual(i, i |> LanguagePrimitives.UInt32WithMeasure |> uint) @@ -55,7 +55,7 @@ type LanguagePrimitivesModule() = let s = 2us Assert.AreEqual(s, s |> LanguagePrimitives.UInt16WithMeasure |> uint16) - + let uy = 2uy Assert.AreEqual(uy, uy |> LanguagePrimitives.ByteWithMeasure |> byte) @@ -68,10 +68,10 @@ type LanguagePrimitivesModule() = let g (x: int) (y:int32) = x * y // should be: `int -> int32 -> int` let h (x: int) y = x * y let i (x: int32) y = x * y - + let tres = 3 let ocho : int32 = 8 - + Assert.Equal(ocho, f tres 5) Assert.Equal(64, g ocho ocho) Assert.Equal(h ocho tres, i tres ocho) @@ -85,7 +85,7 @@ type LanguagePrimitivesModule() = Assert.True(Single.IsNaN(max Single.NaN 1.0f)) Assert.True(Single.IsNaN(max 1.0f Single.NaN)) Assert.True(Single.IsNaN(max Single.NaN Single.NaN)) - + Assert.True(Double.IsNaN(min nan 1.0)) Assert.True(Double.IsNaN(min 1.0 nan)) Assert.True(Double.IsNaN(min nan nan)) @@ -96,32 +96,32 @@ type LanguagePrimitivesModule() = [] member this.DivideByInt() = - // float32 + // float32 let resultFloat32 = LanguagePrimitives.DivideByInt 3.0f 3 Assert.AreEqual(1.0f, resultFloat32) - - // double + + // double let resultDouble = LanguagePrimitives.DivideByInt 3.9 3 Assert.AreEqual(1.3, resultDouble) - - // decimal + + // decimal let resultDecimal = LanguagePrimitives.DivideByInt 3.9M 3 - Assert.AreEqual(1.3M, resultDecimal) + Assert.AreEqual(1.3M, resultDecimal) [] - member this.EnumOfValue() = + member this.EnumOfValue() = let monday = System.DayOfWeek.Monday let result = LanguagePrimitives.EnumOfValue(1) - + Assert.AreEqual(monday, result) - + [] member this.EnumToValue() = let monday = System.DayOfWeek.Monday let result = LanguagePrimitives.EnumToValue monday Assert.AreEqual(1, result) - + [] member this.GuidToString() = let s = "F99D95E0-2A5E-47c4-9B92-6661D65AE6B3" @@ -133,11 +133,11 @@ type LanguagePrimitivesModule() = // value type let resultValue = LanguagePrimitives.GenericComparison 1 1 Assert.AreEqual(0, resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericComparison "ABC" "ABCDE" Assert.AreEqual(-1, sign resultRef) - + // null reference let resultRef = LanguagePrimitives.GenericComparison "ABC" null Assert.AreEqual(1, resultRef) @@ -153,17 +153,17 @@ type LanguagePrimitivesModule() = let resultValue = LanguagePrimitives.GenericComparisonWithComparer System.Collections.Comparer.Default 1 200 Assert.AreEqual(-1, resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericComparisonWithComparer System.Collections.Comparer.Default "ABCDE" "ABC" Assert.AreEqual(1, sign resultRef) let resultRef = LanguagePrimitives.GenericComparisonWithComparer System.Collections.Comparer.Default "ABC" "ABC" Assert.AreEqual(0, sign resultRef) - + let resultRef = LanguagePrimitives.GenericComparisonWithComparer System.Collections.Comparer.Default "abc" "abcde" Assert.AreEqual(-1, sign resultRef) - + // null reference let resultRef = LanguagePrimitives.GenericComparisonWithComparer System.Collections.Comparer.Default "ABC" null Assert.AreEqual(1,sign resultRef) @@ -173,7 +173,7 @@ type LanguagePrimitivesModule() = let resultRef = LanguagePrimitives.GenericComparisonWithComparer System.Collections.Comparer.Default null "abc" Assert.AreEqual(-1, sign resultRef) - + [] member this.GenericEquality() = // value type @@ -182,14 +182,14 @@ type LanguagePrimitivesModule() = let resultValue = LanguagePrimitives.GenericEquality 1 2 Assert.False(resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericEquality "ABC" "ABC" Assert.True(resultRef) let resultRef = LanguagePrimitives.GenericEquality "ABC" "ABCDE" Assert.False(resultRef) - + // null reference let resultNul = LanguagePrimitives.GenericEquality null null Assert.True(resultNul) @@ -198,44 +198,44 @@ type LanguagePrimitivesModule() = Assert.False(resultNul) [] - member _.GenericEqualityForNans() = + member _.GenericEqualityForNans() = Assert.DoesNotContain(true, [| LanguagePrimitives.GenericEquality nan nan LanguagePrimitives.GenericEquality [nan] [nan] LanguagePrimitives.GenericEquality [|nan|] [|nan|] - LanguagePrimitives.GenericEquality (Set.ofList [nan]) (Set.ofList [nan]) + LanguagePrimitives.GenericEquality (Set.ofList [nan]) (Set.ofList [nan]) LanguagePrimitives.GenericEquality (Map.ofList [1,nan]) (Map.ofList [1,nan]) LanguagePrimitives.GenericEquality (Map.ofList [nan,1]) (Map.ofList [nan,1]) LanguagePrimitives.GenericEquality (Map.ofList [nan,nan]) (Map.ofList [nan,nan]) - + LanguagePrimitives.GenericEquality nanf nanf LanguagePrimitives.GenericEquality [nanf] [nanf] LanguagePrimitives.GenericEquality [|nanf|] [|nanf|] - LanguagePrimitives.GenericEquality (Set.ofList [nanf]) (Set.ofList [nanf]) + LanguagePrimitives.GenericEquality (Set.ofList [nanf]) (Set.ofList [nanf]) LanguagePrimitives.GenericEquality (Map.ofList [1,nanf]) (Map.ofList [1,nanf]) LanguagePrimitives.GenericEquality (Map.ofList [nanf,1]) (Map.ofList [nanf,1]) LanguagePrimitives.GenericEquality (Map.ofList [nanf,nanf]) (Map.ofList [nanf,nanf])|]) [] - member _.GenericEqualityER() = + member _.GenericEqualityER() = Assert.DoesNotContain(false, [| LanguagePrimitives.GenericEqualityER nan nan LanguagePrimitives.GenericEqualityER [nan] [nan] LanguagePrimitives.GenericEqualityER [|nan|] [|nan|] - LanguagePrimitives.GenericEqualityER (Set.ofList [nan]) (Set.ofList [nan]) + LanguagePrimitives.GenericEqualityER (Set.ofList [nan]) (Set.ofList [nan]) LanguagePrimitives.GenericEqualityER (Map.ofList [1,nan]) (Map.ofList [1,nan]) LanguagePrimitives.GenericEqualityER (Map.ofList [nan,1]) (Map.ofList [nan,1]) LanguagePrimitives.GenericEqualityER (Map.ofList [nan,nan]) (Map.ofList [nan,nan]) - + LanguagePrimitives.GenericEqualityER nanf nanf LanguagePrimitives.GenericEqualityER [nanf] [nanf] LanguagePrimitives.GenericEqualityER [|nanf|] [|nanf|] - LanguagePrimitives.GenericEqualityER (Set.ofList [nanf]) (Set.ofList [nanf]) + LanguagePrimitives.GenericEqualityER (Set.ofList [nanf]) (Set.ofList [nanf]) LanguagePrimitives.GenericEqualityER (Map.ofList [1,nanf]) (Map.ofList [1,nanf]) LanguagePrimitives.GenericEqualityER (Map.ofList [nanf,1]) (Map.ofList [nanf,1]) LanguagePrimitives.GenericEqualityER (Map.ofList [nanf,nanf]) (Map.ofList [nanf,nanf])|]) - - + + [] member this.GenericGreaterOrEqual() = // value type @@ -247,7 +247,7 @@ type LanguagePrimitivesModule() = let resultValue = LanguagePrimitives.GenericGreaterOrEqual 1 2 Assert.False(resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericGreaterOrEqual "abcde" "abc" Assert.True(resultRef) @@ -257,15 +257,15 @@ type LanguagePrimitivesModule() = let resultRef = LanguagePrimitives.GenericGreaterOrEqual "ABC" "ABCDE" Assert.False(resultRef) - + // null reference let resultNul = LanguagePrimitives.GenericGreaterOrEqual null null Assert.True(resultNul) let resultNul = LanguagePrimitives.GenericGreaterOrEqual null "ABCDE" Assert.False(resultNul) - - + + [] member this.GenericGreaterThan() = // value type @@ -274,7 +274,7 @@ type LanguagePrimitivesModule() = let resultValue = LanguagePrimitives.GenericGreaterThan 2 1 Assert.True(resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericGreaterThan "ABC" "ABCDE" Assert.False(resultRef) @@ -284,7 +284,7 @@ type LanguagePrimitivesModule() = let resultRef = LanguagePrimitives.GenericGreaterThan "abc" "a" Assert.True(resultRef) - + // null reference let resultNul = LanguagePrimitives.GenericGreaterThan null null Assert.False(resultNul) @@ -294,28 +294,28 @@ type LanguagePrimitivesModule() = let resultNul = LanguagePrimitives.GenericGreaterThan "ABC" null Assert.True(resultNul) - - + + [] member this.GenericHash() = // value type - let resultValue = LanguagePrimitives.GenericHash 1 + let resultValue = LanguagePrimitives.GenericHash 1 Assert.AreEqual(1, resultValue) // using standard .NET GetHashCode as oracle - let resultValue = LanguagePrimitives.GenericHash 1000 + let resultValue = LanguagePrimitives.GenericHash 1000 let x = 1000 Assert.AreEqual(x.GetHashCode(), resultValue) - + // reference type - let resultRef = LanguagePrimitives.GenericHash "ABC" + let resultRef = LanguagePrimitives.GenericHash "ABC" Assert.AreEqual("ABC".GetHashCode(), resultRef) - + // null reference - let resultNul = LanguagePrimitives.GenericHash null + let resultNul = LanguagePrimitives.GenericHash null Assert.AreEqual(0, resultNul) - - + + [] member this.GenericLessOrEqual() = // value type @@ -327,7 +327,7 @@ type LanguagePrimitivesModule() = let resultValue = LanguagePrimitives.GenericLessOrEqual -1 0 Assert.True(resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericLessOrEqual "ABC" "ABCDE" Assert.True(resultRef) @@ -337,7 +337,7 @@ type LanguagePrimitivesModule() = let resultRef = LanguagePrimitives.GenericLessOrEqual "abcde" "abc" Assert.False(resultRef) - + // null reference let resultNul = LanguagePrimitives.GenericLessOrEqual null null Assert.True(resultNul) @@ -347,8 +347,8 @@ type LanguagePrimitivesModule() = let resultNul = LanguagePrimitives.GenericLessOrEqual "abc" null Assert.False(resultNul) - - + + [] member this.GenericLessThan() = // value type @@ -360,7 +360,7 @@ type LanguagePrimitivesModule() = let resultValue = LanguagePrimitives.GenericLessThan 1 2 Assert.True(resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericLessThan "ABC" "ABCDE" Assert.True(resultRef) @@ -370,7 +370,7 @@ type LanguagePrimitivesModule() = let resultRef = LanguagePrimitives.GenericLessThan "abc" "a" Assert.False(resultRef) - + // null reference let resultNul = LanguagePrimitives.GenericLessThan null "abc" Assert.True(resultNul) @@ -389,15 +389,15 @@ type LanguagePrimitivesModule() = let resultValue = LanguagePrimitives.GenericMaximum -800 -900 Assert.AreEqual(-800, resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericMaximum "ABC" "ABCDE" - Assert.AreEqual("ABCDE", resultRef) - - let resultRef = LanguagePrimitives.GenericMaximum "ABCDE" "ABC" Assert.AreEqual("ABCDE", resultRef) - - + + let resultRef = LanguagePrimitives.GenericMaximum "ABCDE" "ABC" + Assert.AreEqual("ABCDE", resultRef) + + // null reference let resultNul = LanguagePrimitives.GenericMaximum null null Assert.Null(resultNul) @@ -407,7 +407,7 @@ type LanguagePrimitivesModule() = let resultNul = LanguagePrimitives.GenericMaximum "ABCDE" null Assert.AreEqual("ABCDE", resultNul) - + [] member this.GenericMinimum() = // value type @@ -416,14 +416,14 @@ type LanguagePrimitivesModule() = let resultValue = LanguagePrimitives.GenericMinimum -800 -900 Assert.AreEqual(-900, resultValue) - + // reference type let resultRef = LanguagePrimitives.GenericMinimum "ABC" "ABCDE" Assert.AreEqual("ABC", resultRef) let resultRef = LanguagePrimitives.GenericMinimum "abcde" "abc" Assert.AreEqual("abc", resultRef) - + // null reference let resultNul = LanguagePrimitives.GenericMinimum null null Assert.Null(resultNul) @@ -433,78 +433,78 @@ type LanguagePrimitivesModule() = let resultNul = LanguagePrimitives.GenericMinimum "ABC" null Assert.Null(resultNul) - + [] member this.GenericOne() = // int type - let resultValue = LanguagePrimitives.GenericOne + let resultValue = LanguagePrimitives.GenericOne Assert.AreEqual(1, resultValue) // float type - let resultValue = LanguagePrimitives.GenericOne + let resultValue = LanguagePrimitives.GenericOne Assert.AreEqual(1., resultValue) // bigint type - let resultValue = LanguagePrimitives.GenericOne + let resultValue = LanguagePrimitives.GenericOne Assert.AreEqual(1I, resultValue) - + [] member this.GenericZero() = // int type - let resultValue = LanguagePrimitives.GenericZero + let resultValue = LanguagePrimitives.GenericZero Assert.AreEqual(0, resultValue) // float type - let resultValue = LanguagePrimitives.GenericZero + let resultValue = LanguagePrimitives.GenericZero Assert.AreEqual(0., resultValue) // bigint type - let resultValue = LanguagePrimitives.GenericZero + let resultValue = LanguagePrimitives.GenericZero Assert.AreEqual(0I, resultValue) - + [] member this.ParseInt32() = - let resultValue = LanguagePrimitives.ParseInt32 "100" + let resultValue = LanguagePrimitives.ParseInt32 "100" Assert.AreEqual(typeof, resultValue.GetType()) - Assert.AreEqual(100, resultValue) + Assert.AreEqual(100, resultValue) - let resultValue = LanguagePrimitives.ParseInt32 "-123" - Assert.AreEqual(-123, resultValue) + let resultValue = LanguagePrimitives.ParseInt32 "-123" + Assert.AreEqual(-123, resultValue) + + let resultValue = LanguagePrimitives.ParseInt32 "0" + Assert.AreEqual(0, resultValue) - let resultValue = LanguagePrimitives.ParseInt32 "0" - Assert.AreEqual(0, resultValue) - CheckThrowsOverflowException(fun () -> LanguagePrimitives.ParseInt32 "-100000000000000000" |> ignore) - CheckThrowsFormatException(fun () -> LanguagePrimitives.ParseInt32 "" |> ignore) - + CheckThrowsFormatException(fun () -> LanguagePrimitives.ParseInt32 "" |> ignore) + CheckThrowsArgumentNullException(fun () -> LanguagePrimitives.ParseInt32 null |> ignore) - + [] member this.ParseInt64() = - let resultValue = LanguagePrimitives.ParseInt64 "100" - Assert.AreEqual(typeof, resultValue.GetType()) - Assert.AreEqual(100L, resultValue) + let resultValue = LanguagePrimitives.ParseInt64 "100" + Assert.AreEqual(typeof, resultValue.GetType()) + Assert.AreEqual(100L, resultValue) - let resultValue = LanguagePrimitives.ParseInt64 "-100000000000000000" - Assert.AreEqual(-100000000000000000L, resultValue) + let resultValue = LanguagePrimitives.ParseInt64 "-100000000000000000" + Assert.AreEqual(-100000000000000000L, resultValue) - let resultValue = LanguagePrimitives.ParseInt64 "0" + let resultValue = LanguagePrimitives.ParseInt64 "0" Assert.AreEqual(0L, resultValue) CheckThrowsOverflowException(fun () -> LanguagePrimitives.ParseInt64 "9223372036854775808" |> ignore) - CheckThrowsFormatException(fun () -> LanguagePrimitives.ParseInt64 "" |> ignore) - + CheckThrowsFormatException(fun () -> LanguagePrimitives.ParseInt64 "" |> ignore) + CheckThrowsArgumentNullException(fun () -> LanguagePrimitives.ParseInt64 null |> ignore) [] member this.ParseBinaryInt64() = - let resultValue = LanguagePrimitives.ParseInt64 "0b1100100" - Assert.AreEqual(typeof, resultValue.GetType()) - Assert.AreEqual(100L, resultValue) + let resultValue = LanguagePrimitives.ParseInt64 "0b1100100" + Assert.AreEqual(typeof, resultValue.GetType()) + Assert.AreEqual(100L, resultValue) let resultValue = LanguagePrimitives.ParseInt64 "-0b101100011010001010111100001011101100010100000000000000000" Assert.AreEqual(-100000000000000000L, resultValue) @@ -521,7 +521,7 @@ type LanguagePrimitivesModule() = member this.ParseOctalInt64() = let resultValue = LanguagePrimitives.ParseInt64 "0o144" Assert.AreEqual(typeof, resultValue.GetType()) - Assert.AreEqual(100L, resultValue) + Assert.AreEqual(100L, resultValue) let resultValue = LanguagePrimitives.ParseInt64 "-0o5432127413542400000" Assert.AreEqual(-100000000000000000L, resultValue) @@ -536,39 +536,39 @@ type LanguagePrimitivesModule() = [] member this.ParseUInt32() = - let resultValue = LanguagePrimitives.ParseUInt32 "100" - Assert.AreEqual(typeof, resultValue.GetType()) - Assert.AreEqual(100ul, resultValue) - + let resultValue = LanguagePrimitives.ParseUInt32 "100" + Assert.AreEqual(typeof, resultValue.GetType()) + Assert.AreEqual(100ul, resultValue) + CheckThrowsOverflowException(fun () -> LanguagePrimitives.ParseUInt32 "-1" |> ignore) - + CheckThrowsArgumentNullException(fun () -> LanguagePrimitives.ParseUInt32 null |> ignore) - + [] member this.ParseUInt64() = - let resultValue = LanguagePrimitives.ParseUInt64 "100" - Assert.AreEqual(typeof, resultValue.GetType()) - Assert.AreEqual(100UL, resultValue) + let resultValue = LanguagePrimitives.ParseUInt64 "100" + Assert.AreEqual(typeof, resultValue.GetType()) + Assert.AreEqual(100UL, resultValue) CheckThrowsOverflowException(fun () -> LanguagePrimitives.ParseUInt64 "-1" |> ignore) CheckThrowsOverflowException(fun () -> LanguagePrimitives.ParseUInt64 "18446744073709551616" |> ignore) - + CheckThrowsArgumentNullException(fun () -> LanguagePrimitives.ParseUInt64 null |> ignore) [] member this.ParseBinaryUInt64() = - let resultValue = LanguagePrimitives.ParseUInt64 "0b1100100" - Assert.AreEqual(typeof, resultValue.GetType()) - Assert.AreEqual(100UL, resultValue) + let resultValue = LanguagePrimitives.ParseUInt64 "0b1100100" + Assert.AreEqual(typeof, resultValue.GetType()) + Assert.AreEqual(100UL, resultValue) CheckThrowsFormatException(fun () -> LanguagePrimitives.ParseUInt64 "-0b1" |> ignore) CheckThrowsOverflowException(fun () -> LanguagePrimitives.ParseUInt64 "0b10000000000000000000000000000000000000000000000000000000000000000" |> ignore) [] member this.ParseOctalUInt64() = - let resultValue = LanguagePrimitives.ParseUInt64 "0o144" - Assert.AreEqual(typeof, resultValue.GetType()) - Assert.AreEqual(100UL, resultValue) + let resultValue = LanguagePrimitives.ParseUInt64 "0o144" + Assert.AreEqual(typeof, resultValue.GetType()) + Assert.AreEqual(100UL, resultValue) CheckThrowsFormatException(fun () -> LanguagePrimitives.ParseUInt64 "-0o1" |> ignore) CheckThrowsOverflowException(fun () -> LanguagePrimitives.ParseUInt64 "0o2000000000000000000000" |> ignore) @@ -599,31 +599,31 @@ type LanguagePrimitivesModule() = Assert.False(resultValue) Assert.True(LanguagePrimitives.PhysicalEquality ref1 ref1) Assert.True(LanguagePrimitives.PhysicalEquality ref2 ref2) - + // reference type let resultRef0 = LanguagePrimitives.PhysicalEquality "ABC" "ABC" Assert.True(resultRef0) - + let resultRef1 = LanguagePrimitives.PhysicalEquality "ABC" "DEF" Assert.False(resultRef1) - + // object type let resultRef2 = LanguagePrimitives.PhysicalEquality (obj()) (obj()) Assert.False(resultRef2) - + // object type let o = obj() - let resultRef3 = LanguagePrimitives.PhysicalEquality o o + let resultRef3 = LanguagePrimitives.PhysicalEquality o o Assert.True(resultRef3) - + // System.ValueType type let resultRef4 = LanguagePrimitives.PhysicalEquality (1 :> System.ValueType) (1 :> System.ValueType) Assert.False(resultRef4) - + // System.ValueType type let resultRef5 = LanguagePrimitives.PhysicalEquality (1 :> System.ValueType) (2 :> System.ValueType) Assert.False(resultRef5) - + // null reference let resultNul = LanguagePrimitives.PhysicalEquality null null Assert.True(resultNul) @@ -632,7 +632,7 @@ type LanguagePrimitivesModule() = type HashCompareModule() = // this module is internal/obsolete, but contains code reachable from many public APIs member inline this.ComparisonsFor< ^T when ^T : comparison>(x : ^T, y : ^T) = Assert.True( x < y ) - Assert.True( y > x ) + Assert.True( y > x ) Assert.True( (x = x) ) Assert.False( y < x ) Assert.False( x > y ) @@ -700,7 +700,7 @@ type HashCompareModule() = // this module is internal/obsolete, but contains cod y.[2,2,2] <- Z this.ComparisonsFor( x, y ) - + [] member this.MonsterTuple() = let mt = 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' @@ -712,22 +712,22 @@ type UnitType() = // interface [] - member this.IComparable() = + member this.IComparable() = let u:Unit = () // value type - let ic = u :> IComparable - CheckThrowsNullRefException(fun() ->ic.CompareTo(3) |>ignore) - + let ic = u :> IComparable + CheckThrowsNullRefException(fun() ->ic.CompareTo(3) |>ignore) + // Base class methods [] member this.ObjectGetHashCode() = let u:Unit = () - CheckThrowsNullRefException(fun() ->u.GetHashCode() |>ignore) - + CheckThrowsNullRefException(fun() ->u.GetHashCode() |>ignore) + [] member this.ObjectEquals() = let u:Unit = () - CheckThrowsNullRefException(fun() ->u.Equals(null) |>ignore) + CheckThrowsNullRefException(fun() ->u.Equals(null) |>ignore) type SourceConstructFlagsEnum() = @@ -796,25 +796,25 @@ type UnboxAndOptionStuff() = module internal RangeTestsHelpers = // strictly speaking, this is just undefined behaviour, but at some point the F# library decided that // it was an exception, so we are ensuring that such behaviour is retained - let inline regressionExceptionBeforeStartSingleStepRangeEnumerator zero one = + let inline regressionExceptionBeforeStartSingleStepRangeEnumerator zero one = let sequence = seq { zero .. one .. one } let enumerator = sequence.GetEnumerator() enumerator.Current |> ignore - let inline regressionExceptionBeforeStartVariableStepIntegralRange zero two = + let inline regressionExceptionBeforeStartVariableStepIntegralRange zero two = let sequence = seq { zero .. two .. two } let enumerator = sequence.GetEnumerator() enumerator.Current |> ignore // strictly speaking, this is just undefined behaviour, but at some point the F# library decided that // it was an exception, so we are ensuring that such behaviour is retained - let inline regressionExceptionAfterEndSingleStepRangeEnumerator zero one = + let inline regressionExceptionAfterEndSingleStepRangeEnumerator zero one = let sequence = seq { zero .. one .. one } let enumerator = sequence.GetEnumerator() while enumerator.MoveNext () do ignore () enumerator.Current |> ignore - let inline regressionExceptionAfterEndVariableStepIntegralRange zero two = + let inline regressionExceptionAfterEndVariableStepIntegralRange zero two = let sequence = seq { zero .. two .. two } let enumerator = sequence.GetEnumerator() while enumerator.MoveNext () do ignore () @@ -1123,7 +1123,7 @@ module RangeTests = if System.IntPtr.Size = 8 then RangeTestsHelpers.signed 0x0n 0x1n 0x8000000000000000n 0x7fffffffffffffffn - + [] let ``Range.UIntPtr`` () = if System.UIntPtr.Size >= 4 then diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs index a4fd85d07b7..513f3b8ac71 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs @@ -26,14 +26,14 @@ type StructRecord = type MutableStructRecord = { mutable M1: int mutable M2: int - } - + } + let private hasAttribute<'T,'Attr>() = typeof<'T>.GetTypeInfo().GetCustomAttributes() |> Seq.exists (fun x -> x.GetType() = typeof<'Attr>) [] type StructRecordDefaultValue = - { [] + { [] R1: Record R2: StructRecord } @@ -51,7 +51,7 @@ let [] ``struct records have correct behaviour with a [] on [] type StructRecordDefaultValue2 = { R1: Record - [] + [] R2: StructRecord } @@ -157,23 +157,23 @@ type DefaultLayoutMutableRecord = mutable Fourth : int } -let inline CX_get_A(x: ^T) = +let inline CX_get_A(x: ^T) = ( (^T : (member A : int) (x)) ) -let inline CX_get_C(x: ^T) = +let inline CX_get_C(x: ^T) = ( (^T : (member C : int) (x)) ) -let inline CX_set_First(x: ^T, v) = +let inline CX_set_First(x: ^T, v) = ( (^T : (member First : int with set) (x,v)) ) -type Members() = - static member CreateMutableStructRecord() = { M1 = 1; M2 = 2 } +type Members() = + static member CreateMutableStructRecord() = { M1 = 1; M2 = 2 } type RecordTypesTestClass () = inherit TestClassWithSimpleNameAppDomainResolver () [] - member _.``can compare records`` () = + member _.``can compare records`` () = Check.QuickThrowOnFailure <| fun (i1:int) (i2:int) -> i1 <> i2 ==> @@ -205,9 +205,9 @@ type RecordTypesTestClass () = let sr1 = { C = i1; D = i2 } (match sr1 with | { C = c; D = d } when c = i1 && d = i2 -> true - | _ -> false) + | _ -> false) |@ "with pattern match on struct record" .&. - (sr1 |> function + (sr1 |> function | { C = c; D = d } when c = i1 && d = i2 -> true | _ -> false) |@ "function pattern match on struct record" @@ -228,9 +228,9 @@ type RecordTypesTestClass () = let sr1 = { C = i1; D = i2 } let test sr1 ({ C = c1; D = d2 } as sr2) = sr1 = sr2 && c1 = i1 && d2 = i2 - test sr1 sr1 - - + test sr1 sr1 + + [] member _.``struct records fields can be mutated`` () = Check.QuickThrowOnFailure <| @@ -247,12 +247,12 @@ type RecordTypesTestClass () = fun (i1:int) (i2:int) -> let sr1 = { C1 = i1; C2 = i2 } let sr2 = { C1 = i1; C2 = i2 } - (sr1.Equals sr2) + (sr1.Equals sr2) [] member _.``struct records support []`` () = Check.QuickThrowOnFailure <| - fun (i1:int) (i2:int) (k1:int) (k2:int) -> + fun (i1:int) (i2:int) (k1:int) (k2:int) -> let sr1 = { C1 = i1; C2 = i2 } let sr2 = { C1 = k1; C2 = k2 } if sr1 > sr2 then compare sr1 sr2 = 1 @@ -272,7 +272,7 @@ type RecordTypesTestClass () = [] member _.``struct records offset fields correctly with [] and []`` () = - let checkOffset fieldName offset = + let checkOffset fieldName offset = offset = int (Marshal.OffsetOf (typeof, fieldName)) Assert.True (checkOffset "X@" 0) Assert.True (checkOffset "Y@" 4) @@ -280,7 +280,7 @@ type RecordTypesTestClass () = [] member _.``struct records offset mutable fields correctly with [] and []`` () = - let checkOffset fieldName offset = + let checkOffset fieldName offset = offset = int (Marshal.OffsetOf (typeof, fieldName)) Assert.True (checkOffset "X@" 0) Assert.True (checkOffset "Y@" 4) @@ -288,7 +288,7 @@ type RecordTypesTestClass () = [] member _.``struct records order fields correctly with []`` () = - let compareOffsets field1 fn field2 = + let compareOffsets field1 fn field2 = fn (Marshal.OffsetOf (typeof, field1)) (Marshal.OffsetOf (typeof, field2)) Assert.True (compareOffsets "First@" (<) "Second@") @@ -297,7 +297,7 @@ type RecordTypesTestClass () = [] member _.``struct records default field order matches []`` () = - let compareOffsets field1 fn field2 = + let compareOffsets field1 fn field2 = fn (Marshal.OffsetOf (typeof, field1)) (Marshal.OffsetOf (typeof, field2)) Assert.True (compareOffsets "First@" (=) "First@") @@ -307,7 +307,7 @@ type RecordTypesTestClass () = [] member _.``struct records order mutable field correctly with []`` () = - let compareOffsets field1 fn field2 = + let compareOffsets field1 fn field2 = fn (Marshal.OffsetOf (typeof, field1)) (Marshal.OffsetOf (typeof, field2)) Assert.True (compareOffsets "First@" (<) "Second@") @@ -335,7 +335,7 @@ type RecordTypesTestClass () = let v2 = CX_get_C ({ C = 1; D = 2 }) Assert.AreEqual (1, v2) - + let mutable m : DefaultLayoutMutableRecord = { First = 0xbaad1 Second = 0.987654 @@ -350,6 +350,6 @@ type RecordTypesTestClass () = let v = Members.CreateMutableStructRecord() Assert.AreEqual (1, v.M1) - + //let v2 = Members.CreateMutableStructRecord(M1 = 100) //Assert.AreEqual (100, v2.M1) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/XmlDocumentationValidation.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/XmlDocumentationValidation.fs index f2321963935..b337306f9d4 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/XmlDocumentationValidation.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/XmlDocumentationValidation.fs @@ -41,7 +41,7 @@ let extractXmlDocBlocks (content: string) = // Keep the current XML documentation block open across conditional directives and blank lines // Handles docs that have internal #if/#else/#endif guards within xmldoc blocks to cover TFM variations. () - else + else match tryFlushCurrentBlock () with | Some block -> yield block | None -> () @@ -61,7 +61,7 @@ let validateXmlBlock (xmlLines: (string * int) list) = else let xmlContent = xmlLines |> List.map fst |> String.concat "\n" let firstLineNumber = xmlLines |> List.head |> snd - + // Skip empty or whitespace-only blocks if String.IsNullOrWhiteSpace(xmlContent) then Ok () @@ -91,18 +91,18 @@ let getFSharpCoreFsiFiles () = [] let ``XML documentation in FSharp.Core fsi files should be well-formed`` () = let fsiFiles = getFSharpCoreFsiFiles() - + Assert.False(List.isEmpty fsiFiles, "No .fsi files found in FSharp.Core directory") - + let mutable errors = [] let mutable totalBlocks = 0 - + for fsiFile in fsiFiles do let relativePath = Path.GetFileName(fsiFile) try let content = File.ReadAllText(fsiFile) let xmlBlocks = extractXmlDocBlocks content - + for xmlBlock in xmlBlocks do totalBlocks <- totalBlocks + 1 match validateXmlBlock xmlBlock with @@ -114,12 +114,12 @@ let ``XML documentation in FSharp.Core fsi files should be well-formed`` () = | ex -> let error = sprintf "%s: Failed to read file - %s" relativePath ex.Message errors <- error :: errors - + // Report statistics let validBlocks = totalBlocks - List.length errors - let message = sprintf "Validated %d XML documentation blocks in %d .fsi files. %d valid, %d invalid." + let message = sprintf "Validated %d XML documentation blocks in %d .fsi files. %d valid, %d invalid." totalBlocks (List.length fsiFiles) validBlocks (List.length errors) - + if not (List.isEmpty errors) then let errorDetails = errors |> List.rev |> String.concat "\n" Assert.Fail(sprintf "%s\n\nErrors:\n%s" message errorDetails) diff --git a/tests/FSharp.Core.UnitTests/LibraryTestFx.fs b/tests/FSharp.Core.UnitTests/LibraryTestFx.fs index 6137eb79d75..4338a8f8658 100644 --- a/tests/FSharp.Core.UnitTests/LibraryTestFx.fs +++ b/tests/FSharp.Core.UnitTests/LibraryTestFx.fs @@ -16,7 +16,7 @@ open Xunit let CheckThrowsExn<'a when 'a :> exn> (f : unit -> unit) = try let _ = f () - sprintf "Expected %O exception, got no exception" typeof<'a> |> Assert.Fail + sprintf "Expected %O exception, got no exception" typeof<'a> |> Assert.Fail with | :? 'a -> () | e -> sprintf "Expected %O exception, got: %O" typeof<'a> e |> Assert.Fail diff --git a/tests/FSharp.Core.UnitTests/TestFrameworkHelpers.fs b/tests/FSharp.Core.UnitTests/TestFrameworkHelpers.fs index 31a699ae586..041cc590bfb 100644 --- a/tests/FSharp.Core.UnitTests/TestFrameworkHelpers.fs +++ b/tests/FSharp.Core.UnitTests/TestFrameworkHelpers.fs @@ -63,22 +63,22 @@ module private Impl = let expected = toArray expected let actual = toArray actual - match expected, actual with + match expected, actual with | (:? Array as a1), (:? Array as a2) -> - if a1.Rank > 1 then failwith "Rank > 1 not supported" + if a1.Rank > 1 then failwith "Rank > 1 not supported" if a2.Rank > 1 then false else let lb = a1.GetLowerBound(0) let ub = a1.GetUpperBound(0) if lb <> a2.GetLowerBound(0) || ub <> a2.GetUpperBound(0) then false else - seq {lb..ub} |> Seq.forall(fun i -> equals (a1.GetValue(i)) (a2.GetValue(i))) + seq {lb..ub} |> Seq.forall(fun i -> equals (a1.GetValue(i)) (a2.GetValue(i))) | _ -> Object.Equals(expected, actual) - /// Special treatment of float and float32 to get a somewhat meaningful error message + /// Special treatment of float and float32 to get a somewhat meaningful error message /// (otherwise, the missing precision leads to different values that are close together looking the same) - let floatStr (flt1: obj) (flt2: obj) = + let floatStr (flt1: obj) (flt2: obj) = match flt1, flt2 with | :? float as flt1, (:? float as flt2) -> flt1.ToString("R"), flt2.ToString("R") @@ -93,7 +93,7 @@ type Assert = static member AreEqual(expected : obj, actual : obj, message : string) = if not (Impl.equals expected actual) then - let message = + let message = let (exp, act) = Impl.floatStr expected actual sprintf "%s: Expected %s but got %s" message exp act @@ -110,7 +110,7 @@ type Assert = /// between 80-bit (dotnet, RyuJIT) and 64-bit (x86, Legacy JIT) floating point calculations static member AreNearEqual(expected: float, actual: float) = let delta = 1.0e-15 - let message = + let message = let ((e, a)) = Impl.floatStr expected actual sprintf "Are near equal: expected %s, but got %s (with delta: %f)" e a delta @@ -120,12 +120,12 @@ type Assert = static member Fail(message : string) = Exception(message) |> raise - static member Fail() = Assert.Fail("") + static member Fail() = Assert.Fail("") static member Fail(message : string, args : obj[]) = Assert.Fail(String.Format(message,args)) type CollectionAssert = - static member AreEqual(expected, actual) = + static member AreEqual(expected, actual) = Assert.AreEqual(expected, actual) /// Disposable type to implement a simple resolve handler that searches the currently loaded assemblies to see if the requested assembly is already loaded. diff --git a/tests/FSharp.Test.Utilities/Assert.fs b/tests/FSharp.Test.Utilities/Assert.fs index 6b999340a98..e46e3db54ec 100644 --- a/tests/FSharp.Test.Utilities/Assert.fs +++ b/tests/FSharp.Test.Utilities/Assert.fs @@ -45,20 +45,20 @@ module Assert = let shouldBeSameMultilineStringSets expectedText actualText = let getLines text = use reader = new StringReader(text) - Seq.initInfinite (fun _ -> reader.ReadLine()) + Seq.initInfinite (fun _ -> reader.ReadLine()) |> Seq.takeWhile (not << isNull) |> set - let actual = getLines actualText + let actual = getLines actualText let expected = getLines expectedText - - let unexpectedlyMissing = Set.difference expected actual + + let unexpectedlyMissing = Set.difference expected actual let unexpectedlyPresent = Set.difference actual expected // If both sets are empty, the surface areas match so allow the test to pass. if Set.isEmpty unexpectedlyMissing && Set.isEmpty unexpectedlyPresent then None - else + else let msg = let inline newLine (sb : System.Text.StringBuilder) = sb.AppendLine () |> ignore let sb = System.Text.StringBuilder () diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index e3ed7d1a64d..2d7b7e077cb 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -649,7 +649,7 @@ $ code --diff {outFile} {expectedFile} let withLangVersion10 (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--langversion:10.0" ] "withLangVersion10 is only supported on F#" cUnit - + let withLangVersion11 (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--langversion:11.0" ] "withLangVersion11 is only supported on F#" cUnit @@ -1205,7 +1205,7 @@ $ code --diff {outFile} {expectedFile} evalFSharp fs script | _ -> failwith "Script evaluation is only supported for F#." - let internal sessionCache = + let internal sessionCache = Collections.Concurrent.ConcurrentDictionary * LangVersion, FSharpScript>() let internal createSessionWithShadowedExit args version = @@ -1215,12 +1215,12 @@ $ code --diff {outFile} {expectedFile} let getIsolatedSessionForEval args version = createSessionWithShadowedExit args version - + let getSessionForEval args version = let key = Set args, version match sessionCache.TryGetValue(key) with | true, script -> script - | _ -> + | _ -> let script = createSessionWithShadowedExit args version sessionCache.TryAdd(key, script) |> ignore script @@ -2036,7 +2036,7 @@ $ code --diff {outFile} {expectedFile} | Some (ExecutionOutput {Outcome = Failure ex }) -> failwithf $"Eval or Execution has failed (expected to succeed): %A{ex}\n{diagnostics}" | _ -> - + failwithf $"Operation failed (expected to succeed).\n{diagnostics} \n OUTPUTs: %A{r.Output}" let shouldFail (result: CompilationResult) : CompilationResult = @@ -2261,10 +2261,10 @@ $ code --diff {outFile} {expectedFile} let m = Regex(pattern, RegexOptions.Multiline).Match(input) if m.Success then m.Index - else + else -1 | MatchStyle.Standard -> - input.IndexOf(pattern) + input.IndexOf(pattern) let private checkOutputInOrderCore matchStyle (category: string) (substrings: string list) (selector: ExecutionOutput -> string) (result: CompilationResult) : CompilationResult = match result.RunOutput with diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index d8a05cbbd55..b226fb2e75f 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -78,7 +78,7 @@ module AssemblyResolver = ) #endif -type ExecutionOutcome = +type ExecutionOutcome = | NoExitCode | ExitCode of int | Failure of exn @@ -366,8 +366,8 @@ module CompilerAssertHelpers = use capture = new TestConsole.ExecutionCapture() let outcome = - try - match entryPoint.Invoke(Unchecked.defaultof, args) with + try + match entryPoint.Invoke(Unchecked.defaultof, args) with | :? int as rc -> ExitCode rc | _ -> NoExitCode with @@ -421,7 +421,7 @@ module CompilerAssertHelpers = eprintf $"{errors}" testCaseDomain.remove_AssemblyResolve handler - + outcome, output, errors #endif @@ -509,7 +509,7 @@ module CompilerAssertHelpers = | FSharpDiagnosticSeverity.Hidden-> $"Hidden {errN}" | FSharpDiagnosticSeverity.Info -> $"Information {errN}" $"""({errorType}, Line {range.StartLine}, Col {range.StartColumn}, Line {range.EndLine}, Col {range.EndColumn}, "{message}")""".Replace("\r\n", "\n") - + let errors = errors |> Array.filter (fun error -> if ignoreWarnings then error.Severity <> FSharpDiagnosticSeverity.Warning && error.Severity <> FSharpDiagnosticSeverity.Info else true) @@ -519,7 +519,7 @@ module CompilerAssertHelpers = errors |> Array.map (fun info -> (info.Severity, info.ErrorNumber, (info.StartLine - libAdjust, info.StartColumn + 1, info.EndLine - libAdjust, info.EndColumn + 1), info.Message)) - + let checkEqual k a b = if a <> b then failwithf $"Mismatch in %s{k}, expected '%A{a}', got '%A{b}'.\nAll errors:\n%s{errorsAsStr}" @@ -691,12 +691,12 @@ type CompilerAssert private () = if errors.Length > 0 then Assert.Fail (sprintf "Compile had errors: %A" errors) let debugInfoFile = outputFilePath + ".debuginfo" - if not (File.Exists expectedFile) then + if not (File.Exists expectedFile) then File.Copy(debugInfoFile, expectedFile) failwith $"debug info expected file {expectedFile} didn't exist, now copied over" let debugInfo = File.ReadAllLines(debugInfoFile) let expected = File.ReadAllLines(expectedFile) - if debugInfo <> expected then + if debugInfo <> expected then File.Copy(debugInfoFile, expectedFile, overwrite=true) failwith $"""debug info mismatch Expected is in {expectedFile} @@ -736,7 +736,7 @@ Updated automatically, please check diffs in your pull request, changes must be returnCompilation cmpl (defaultArg ignoreWarnings false) static member ExecuteAndReturnResult (outputFilePath: string, isFsx: bool, deps: string list, newProcess: bool) = - let outcome, output, errors = + let outcome, output, errors = if not newProcess then executeBuiltApp outputFilePath deps isFsx else @@ -758,7 +758,7 @@ Updated automatically, please check diffs in your pull request, changes must be compileCompilation ignoreWarnings cmpl (fun ((errors, _, outputFilePath), deps) -> assertErrors 0 ignoreWarnings errors [||] beforeExecute outputFilePath deps - if newProcess then + if newProcess then executeBuiltAppNewProcess outputFilePath else executeBuiltApp outputFilePath deps false @@ -774,7 +774,7 @@ Updated automatically, please check diffs in your pull request, changes must be static member ExecutionHasOutput(cmpl: Compilation, expectedOutput: string) = let _, output, _ = CompilerAssert.ExecuteAux(cmpl, newProcess = true) - Assert.Equal(expectedOutput, output) + Assert.Equal(expectedOutput, output) static member Pass (source: string) = let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions TargetFramework.Current) |> Async.RunSynchronouslyImmediate @@ -847,7 +847,7 @@ Updated automatically, please check diffs in your pull request, changes must be if options |> Array.contains "--test:ContinueAfterParseFailure" then [| yield! parseResults.Diagnostics match fileAnswer with - | FSharpCheckFileAnswer.Succeeded(tcResults) -> yield! tcResults.Diagnostics + | FSharpCheckFileAnswer.Succeeded(tcResults) -> yield! tcResults.Diagnostics | _ -> () |] else parseResults.Diagnostics else @@ -990,10 +990,10 @@ Updated automatically, please check diffs in your pull request, changes must be compileExeAndRunWithOptions [||] (SourceCodeFileKind.Create("test.fs", source)) static member CompileLibraryAndVerifyILWithOptions(options, (source: SourceCodeFileKind), (f: ILVerifier -> unit)) = - compileLibraryAndVerifyILWithOptions options source f + compileLibraryAndVerifyILWithOptions options source f static member CompileLibraryAndVerifyILWithOptions(options, (source: string), (f: ILVerifier -> unit)) = - compileLibraryAndVerifyILWithOptions options (SourceCodeFileKind.Create("test.fs", source)) f + compileLibraryAndVerifyILWithOptions options (SourceCodeFileKind.Create("test.fs", source)) f static member CompileLibraryAndVerifyDebugInfoWithOptions(options, (expectedFile: string), (source: SourceCodeFileKind)) = compileLibraryAndVerifyDebugInfoWithOptions options expectedFile source @@ -1015,7 +1015,7 @@ Updated automatically, please check diffs in your pull request, changes must be // FSI may change these via --preferreduilang option, and the change persists // in the static GraphNode.culture which affects async computations in other tests let originalUICulture = CultureInfo.CurrentUICulture - let originalGraphNodeCulture = GraphNode.culture + let originalGraphNodeCulture = GraphNode.culture try use outStream = new StringWriter() use errStream = new StringWriter() diff --git a/tests/FSharp.Test.Utilities/DirectoryAttribute.fs b/tests/FSharp.Test.Utilities/DirectoryAttribute.fs index ef84c877b45..edf7219facf 100644 --- a/tests/FSharp.Test.Utilities/DirectoryAttribute.fs +++ b/tests/FSharp.Test.Utilities/DirectoryAttribute.fs @@ -24,16 +24,16 @@ open TestFramework [] type DirectoryAttribute(dir: string) = inherit DataAttributeBase() - + do if String.IsNullOrWhiteSpace(dir) then invalidArg "dir" "Directory cannot be null, empty or whitespace only." let directoryPath = normalizePathSeparator (Path.GetFullPath(dir)) let mutable baselineSuffix = "" let mutable includes = Array.empty - + new([] dirs: string[]) = DirectoryAttribute(Path.Combine(dirs) : string) - + member _.BaselineSuffix with get() = baselineSuffix and set v = baselineSuffix <- v member _.Includes with get() = includes and set v = includes <- v diff --git a/tests/FSharp.Test.Utilities/FileInlineDataAttribute.fs b/tests/FSharp.Test.Utilities/FileInlineDataAttribute.fs index 8e8ad19f084..f93f849c4f7 100644 --- a/tests/FSharp.Test.Utilities/FileInlineDataAttribute.fs +++ b/tests/FSharp.Test.Utilities/FileInlineDataAttribute.fs @@ -33,7 +33,7 @@ type BooleanOptions = | Both = 3 | None = 0 -// realsig and optimized are boxed so null = not set, true or false = set +// realsig and optimized are boxed so null = not set, true or false = set // Keeping CompilationHelper as it may be used elsewhere [] type CompilationHelper internal (filename: obj, directory: obj, realsig: obj, optimize: obj) = @@ -153,7 +153,7 @@ type CompilationHelper internal (filename: obj, directory: obj, realsig: obj, op [] type FileInlineData(filenameArg: string, realsig: BooleanOptions option, optimize: BooleanOptions option, []directory: string) = inherit DataAttributeBase() - + let mutable directory: string = directory let mutable filename: string = filenameArg let mutable optimize: BooleanOptions option = optimize diff --git a/tests/FSharp.Test.Utilities/ILChecker.fs b/tests/FSharp.Test.Utilities/ILChecker.fs index ad7e01a5baf..b5f1edc0166 100644 --- a/tests/FSharp.Test.Utilities/ILChecker.fs +++ b/tests/FSharp.Test.Utilities/ILChecker.fs @@ -81,7 +81,7 @@ module ILChecker = let stripManagedResources (text: string) = let result = Regex.Replace(text, "\.mresource public .*\r?\n{\s*}\r?\n", "", RegexOptions.Multiline) result - + // This lets the same test be used when targeting both netfx and netcore. let unifyNetStandardVersions (text: string) = text.Replace(".ver 2:0:0:0", ".ver 2:1:0:0") diff --git a/tests/FSharp.Test.Utilities/ILVerifierModule.fs b/tests/FSharp.Test.Utilities/ILVerifierModule.fs index c570b4cc150..7509ecad2ef 100644 --- a/tests/FSharp.Test.Utilities/ILVerifierModule.fs +++ b/tests/FSharp.Test.Utilities/ILVerifierModule.fs @@ -39,8 +39,8 @@ module ILVerifierModule = exec config.DotNetExe peverifyFullArgs workingDirectory match exitCode with - | 0 -> {Outcome = NoExitCode; StdOut = outputText; StdErr = errorText } - | _ -> {Outcome = ExitCode exitCode; StdOut = outputText; StdErr = errorText } + | 0 -> {Outcome = NoExitCode; StdOut = outputText; StdErr = errorText } + | _ -> {Outcome = ExitCode exitCode; StdOut = outputText; StdErr = errorText } let private verifyPEFileAux (compilationResult: CompilationResult) args = let result = diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 2d220685b69..bd1dd5439d3 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -365,7 +365,7 @@ type SyntheticProject = UnresolvedReferences = None OriginalLoadReferences = [] Stamp = None } - + OptionsCache.GetOrAdd(key, factory).Value diff --git a/tests/FSharp.Test.Utilities/TestConsole.fs b/tests/FSharp.Test.Utilities/TestConsole.fs index add9e7e99c6..758a4654c62 100644 --- a/tests/FSharp.Test.Utilities/TestConsole.fs +++ b/tests/FSharp.Test.Utilities/TestConsole.fs @@ -34,7 +34,7 @@ module TestConsole = let private localIn = new RedirectingTextReader() let private localOut = new RedirectingTextWriter() let private localError = new RedirectingTextWriter() - + let private isInstalled = ref 0 /// Installs console redirection. Idempotent and thread-safe. @@ -43,14 +43,14 @@ module TestConsole = Console.SetIn localIn Console.SetOut localOut Console.SetError localError - + // Taps into the redirected console stream. type private CapturingWriter(redirecting: RedirectingTextWriter) as this = inherit StringWriter() let wrapped = redirecting.Writer do redirecting.Writer <- this override _.Encoding = Encoding.UTF8 - override _.Write(value: char) = + override _.Write(value: char) = wrapped.Write(value) base.Write(value) override _.Dispose (disposing: bool) = diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index 0b48050f5bc..6c27d91349f 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -320,7 +320,7 @@ let config configurationName envVars = let artifactsBinPath = artifactsPath ++ "bin" let csc_flags = "/nologo" let vbc_flags = "/nologo" - let fsc_flags = "-r:System.Core.dll --nowarn:20 --define:COMPILED --preferreduilang:en-US" + let fsc_flags = "-r:System.Core.dll --nowarn:20 --define:COMPILED --preferreduilang:en-US" let fsi_flags = "-r:System.Core.dll --nowarn:20 --define:INTERACTIVE --maxerrors:1 --abortonerror --preferreduilang:en-US" let operatingSystem = getOperatingSystem () let Is64BitOperatingSystem = DotnetPlatform.Is64BitOperatingSystem envVars @@ -534,13 +534,13 @@ module Command = let inputWriter sources (writer: StreamWriter) = let pipeFile name = async { let path = Commands.getfullpath dir name - + // Read file content as text using UTF-8 (the standard encoding for F# source files) let! content = async { use reader = new StreamReader(path, Text.Encoding.UTF8, detectEncodingFromByteOrderMarks = true) return! reader.ReadToEndAsync() |> Async.AwaitTask } - + // Write using the StreamWriter which now uses UTF-8 encoding (set in ensureConsole). try do! writer.WriteAsync(content) |> Async.AwaitTask diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index 81d623241b0..1db689ca706 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -29,7 +29,7 @@ type TheoryForNETCOREAPPAttribute() = type FactForNETCOREAPPAttribute() = inherit FactAttribute() - #if !NETCOREAPP + #if !NETCOREAPP do base.Skip <- "Only NETCOREAPP is supported runtime for this kind of test." #endif @@ -48,7 +48,7 @@ type FactForWINDOWSAttribute() = module SignedBuildSkip = let isSignedBuild = System.Environment.GetEnvironmentVariable("SIGNTYPE") = "Real" let skipMessage = "Test skipped on signed builds due to NuGet package restore restrictions" - + let skipIfSigned (attr: #FactAttribute) = if isSignedBuild then attr.Skip <- skipMessage @@ -64,7 +64,7 @@ type TheorySkipOnSignedBuildAttribute() as this = type FactForNETCOREAPPSkipOnSignedBuildAttribute() as this = inherit FactAttribute() do SignedBuildSkip.skipIfSigned this - #if !NETCOREAPP + #if !NETCOREAPP do base.Skip <- "Only NETCOREAPP is supported runtime for this kind of test." #endif @@ -104,7 +104,7 @@ module Utilities = let inline getTestsDirectory src dir = src ++ dir module private TestReferences = - let testDirectory = lazy ( + let testDirectory = lazy ( let path = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()) Directory.CreateDirectory(path) |> ignore path) @@ -216,7 +216,7 @@ let main argv = 0""" File.WriteAllText(directoryBuildTargetsFileName, directoryBuildTargets) let exitCode, dotnetoutput, dotneterrors = Commands.executeProcess config.DotNetExe "build" projectDirectory - + if exitCode <> 0 || errors.Length > 0 then errors <- dotneterrors output <- dotnetoutput @@ -256,10 +256,10 @@ An error occurred getting netcoreapp references (compare the output of `dotnet - let private netStandard20References = lazy ImmutableArray.Create( - NetStandard20.References.netStandardRef.Value, - NetStandard20.References.mscorlibRef.Value, - NetStandard20.References.systemRuntimeRef.Value, - NetStandard20.References.systemCoreRef.Value, + NetStandard20.References.netStandardRef.Value, + NetStandard20.References.mscorlibRef.Value, + NetStandard20.References.systemRuntimeRef.Value, + NetStandard20.References.systemCoreRef.Value, NetStandard20.References.systemDynamicRuntimeRef.Value, NetStandard20.References.systemCollectionsImmutableRef.Value) diff --git a/tests/FSharp.Test.Utilities/VSInstallDiscovery.fs b/tests/FSharp.Test.Utilities/VSInstallDiscovery.fs index e59eec8eed2..f8e6369e366 100644 --- a/tests/FSharp.Test.Utilities/VSInstallDiscovery.fs +++ b/tests/FSharp.Test.Utilities/VSInstallDiscovery.fs @@ -3,7 +3,7 @@ namespace FSharp.Test /// Test-only Visual Studio installation discovery infrastructure. -/// Provides a centralized, robust, and graceful discovery mechanism for Visual Studio installations +/// Provides a centralized, robust, and graceful discovery mechanism for Visual Studio installations /// used by integration/editor/unit tests under vsintegration/tests. module VSInstallDiscovery = @@ -12,13 +12,13 @@ module VSInstallDiscovery = open System.Diagnostics /// Result of VS installation discovery - type VSInstallResult = + type VSInstallResult = | Found of installPath: string * source: string | NotFound of reason: string /// Attempts to find a Visual Studio installation using multiple fallback strategies let tryFindVSInstallation () : VSInstallResult = - + /// Check if a path exists and looks like a valid VS installation let validateVSPath path = if String.IsNullOrEmpty(path) then false @@ -50,12 +50,12 @@ module VSInstallDiscovery = let vsVersions = [ ("VS180COMNTOOLS", 18) // Visual Studio 2026 ("VS170COMNTOOLS", 17) // Visual Studio 2022 - ("VS160COMNTOOLS", 16) // Visual Studio 2019 + ("VS160COMNTOOLS", 16) // Visual Studio 2019 ("VS150COMNTOOLS", 15) // Visual Studio 2017 ("VS140COMNTOOLS", 14) // Visual Studio 2015 ("VS120COMNTOOLS", 12) // Visual Studio 2013 ] - + vsVersions |> List.tryPick (fun (envName, version) -> let envVar = Environment.GetEnvironmentVariable(envName) @@ -74,7 +74,7 @@ module VSInstallDiscovery = try let programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) let vswherePath = Path.Combine(programFiles, "Microsoft Visual Studio", "Installer", "vswhere.exe") - + if File.Exists(vswherePath) then let startInfo = ProcessStartInfo( FileName = vswherePath, @@ -84,10 +84,10 @@ module VSInstallDiscovery = RedirectStandardError = true, CreateNoWindow = true ) - + use proc = Process.Start(startInfo) proc.WaitForExit(5000) |> ignore // 5 second timeout - + if proc.ExitCode = 0 then let output = proc.StandardOutput.ReadToEnd().Trim() if validateVSPath output then @@ -120,10 +120,10 @@ module VSInstallDiscovery = /// Useful for debugging installation discovery issues in tests. let getVSInstallDirWithLogging (logAction: string -> unit) : string option = match tryFindVSInstallation () with - | Found (path, source) -> + | Found (path, source) -> logAction $"Visual Studio installation found at: {path} (via {source})" Some path - | NotFound reason -> + | NotFound reason -> logAction $"Visual Studio installation not found: {reason}" None @@ -132,7 +132,7 @@ module VSInstallDiscovery = let getVSInstallDirOrFail () : string = match tryFindVSInstallation () with | Found (path, _) -> path - | NotFound reason -> + | NotFound reason -> failwith $"Visual Studio installation not found: {reason}. Ensure VS is installed or environment variables (VSAPPIDDIR, VS*COMNTOOLS) are set." /// Assembly resolver for Visual Studio test infrastructure. @@ -147,7 +147,7 @@ module VSAssemblyResolver = /// This should be called early in test initialization to ensure VS assemblies can be loaded. let addResolver () = let vsInstallDir = VSInstallDiscovery.getVSInstallDirOrFail () - + let probingPaths = [| Path.Combine(vsInstallDir, @"IDE\CommonExtensions\Microsoft\Editor") diff --git a/tests/FSharp.Test.Utilities/XunitSetup.fs b/tests/FSharp.Test.Utilities/XunitSetup.fs index 7e5a3b1443b..f5c6e6e73d0 100644 --- a/tests/FSharp.Test.Utilities/XunitSetup.fs +++ b/tests/FSharp.Test.Utilities/XunitSetup.fs @@ -21,7 +21,7 @@ module XUnitSetup = [); CaptureConsole; CaptureTrace>] do () - + /// Modules/Types included in this Collection (via `[`)): /// 1. do not run concurrently with other tests or modules in the collection (typical behavior) /// 2. run entirely isolated from all other tests in a given test run (including ones not included in a Collection) due to `DisableParallelization = true` @@ -31,7 +31,7 @@ type NotThreadSafeResourceCollection() = class end namespace Xunit -#nowarn "1182" // the DisableParallelization properties are unused as these are shims waiting for us to move to xunit3 >= 4 +#nowarn "1182" // the DisableParallelization properties are unused as these are shims waiting for us to move to xunit3 >= 4 // Shim to be deleted when xunit dependency updates to >= 4 [] diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Async.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Async.fs index aee633f8fab..5c50b95a8ee 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Async.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Async.fs @@ -1,4 +1,4 @@ -module Async +module Async open BenchmarkDotNet.Attributes diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Collections.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Collections.fs index 50f1719c5b5..038e0790b7a 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Collections.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Collections.fs @@ -10,56 +10,56 @@ type CollectionsBenchmark() = let mutable length = 0 let mutable list = [] let mutable array = [||] - + [] member this.Length with get () = length - and set (value) = + and set (value) = length <- value list <- List.init length (fun _ -> 0) - array <- Array.init length (fun _ -> 0) - + array <- Array.init length (fun _ -> 0) + /// List [] member x.ListRemoveAtBeginning() = list - |> List.removeAt 0 + |> List.removeAt 0 |> ignore [] member x.ListRemoveAtEnd() = list - |> List.removeAt (x.Length - 1) + |> List.removeAt (x.Length - 1) |> ignore - + [] member x.ListRemoveManyAtBeginning() = list - |> List.removeManyAt 0 10 + |> List.removeManyAt 0 10 |> ignore [] member x.ListRemoveManyAtEnd() = list - |> List.removeManyAt (x.Length - 11) 10 + |> List.removeManyAt (x.Length - 11) 10 |> ignore - + [] member x.ListInsertAtBeginning() = list - |> List.insertAt 0 1 + |> List.insertAt 0 1 |> ignore [] member x.ListInsertAtEnd() = list - |> List.insertAt (x.Length - 1) 1 + |> List.insertAt (x.Length - 1) 1 |> ignore - + [] member x.ListInsertManyAtBeginning() = list - |> List.insertManyAt 0 [1..10] + |> List.insertManyAt 0 [1..10] |> ignore [] @@ -67,11 +67,11 @@ type CollectionsBenchmark() = list |> List.insertManyAt (x.Length - 11) [1..10] |> ignore - + [] member x.ListUpdateAtBeginning() = list - |> List.updateAt 0 1 + |> List.updateAt 0 1 |> ignore [] @@ -79,48 +79,48 @@ type CollectionsBenchmark() = list |> List.updateAt (x.Length - 1) 1 |> ignore - + /// Array [] member x.ArrayRemoveAtBeginning() = array - |> Array.removeAt 0 + |> Array.removeAt 0 |> ignore [] member x.ArrayRemoveAtEnd() = array - |> Array.removeAt (x.Length - 1) + |> Array.removeAt (x.Length - 1) |> ignore - + [] member x.ArrayRemoveManyAtBeginning() = array - |> Array.removeManyAt 0 10 + |> Array.removeManyAt 0 10 |> ignore [] member x.ArrayRemoveManyAtEnd() = array - |> Array.removeManyAt (x.Length - 11) 10 + |> Array.removeManyAt (x.Length - 11) 10 |> ignore - + [] member x.ArrayInsertAtBeginning() = array - |> Array.insertAt 0 1 + |> Array.insertAt 0 1 |> ignore [] member x.ArrayInsertAtEnd() = array - |> Array.insertAt (x.Length - 1) 1 + |> Array.insertAt (x.Length - 1) 1 |> ignore - + [] member x.ArrayInsertManyAtBeginning() = array - |> Array.insertManyAt 0 [1..10] + |> Array.insertManyAt 0 [1..10] |> ignore [] @@ -128,11 +128,11 @@ type CollectionsBenchmark() = array |> Array.insertManyAt (x.Length - 11) [1..10] |> ignore - + [] member x.ArrayUpdateAtBeginning() = array - |> Array.updateAt 0 1 + |> Array.updateAt 0 1 |> ignore [] @@ -140,41 +140,41 @@ type CollectionsBenchmark() = array |> Array.updateAt (x.Length - 1) 1 |> ignore - + /// Seq [] member x.SeqBaseline() = - array + array |> Seq.toList |> ignore - + [] member x.SeqRemoveAtBeginning() = list - |> Seq.removeAt 0 + |> Seq.removeAt 0 |> Seq.toList |> ignore [] member x.SeqRemoveAtEnd() = list - |> Seq.removeAt (x.Length - 1) + |> Seq.removeAt (x.Length - 1) |> Seq.toList |> ignore - + [] member x.SeqRemoveManyAtBeginning() = list - |> Seq.removeManyAt 0 10 + |> Seq.removeManyAt 0 10 |> Seq.toList |> ignore [] member x.SeqRemoveManyAtEnd() = list - |> Seq.removeManyAt (x.Length - 11) 10 + |> Seq.removeManyAt (x.Length - 11) 10 |> Seq.iter ignore - + [] member x.SeqInsertAtBeginning() = list @@ -184,13 +184,13 @@ type CollectionsBenchmark() = [] member x.SeqInsertAtEnd() = list - |> Seq.insertAt (x.Length - 1) 1 + |> Seq.insertAt (x.Length - 1) 1 |> Seq.iter ignore - + [] member x.SeqInsertManyAtBeginning() = list - |> Seq.insertManyAt 0 [1..10] + |> Seq.insertManyAt 0 [1..10] |> Seq.iter ignore [] @@ -198,11 +198,11 @@ type CollectionsBenchmark() = list |> Seq.insertManyAt (x.Length - 11) [1..10] |> Seq.iter ignore - + [] member x.SeqUpdateAtBeginning() = list - |> Seq.updateAt 0 1 + |> Seq.updateAt 0 1 |> Seq.iter ignore [] diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Conditions.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Conditions.fs index e2a6a634b5e..64477f2211a 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Conditions.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Conditions.fs @@ -1,4 +1,4 @@ -module Conditions +module Conditions open BenchmarkDotNet.Attributes open BenchmarkDotNet.Diagnosers diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/BasicTypes.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/BasicTypes.fs index 219284fe732..a4f44ca56d4 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/BasicTypes.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/BasicTypes.fs @@ -34,7 +34,7 @@ type BasicTypes() = [] member _.UInt16() = uint16s |> Array.distinct - + [] member _.Int32() = int32s |> Array.distinct diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/ExactEquals.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/ExactEquals.fs index b175fe6b8ba..cdef9863177 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/ExactEquals.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/ExactEquals.fs @@ -36,7 +36,7 @@ type TinyRecord = { V: int } [] type ExactEquals_EqualityTests() = - + [] member _.Struct() = Struct(1, 2) = Struct(2, 3) @@ -48,7 +48,7 @@ type ExactEquals_EqualityTests() = [] member _.StructRecord() = { V = 1; U = 2 } = { V = 2; U = 3 } - + [] member _.GenericStruct() = Struct(1, 2) = Struct(2, 3) @@ -59,7 +59,7 @@ type ExactEquals_EqualityTests() = [] member _.GenericStructRecord() = - { V = 1; U = 2 } = { V = 2; U = 3 } + { V = 1; U = 2 } = { V = 2; U = 3 } [] member _.TinyStruct() = diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/Misc.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/Misc.fs index fa7c445c620..b88d217c2d1 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/Misc.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/Misc.fs @@ -5,7 +5,7 @@ open BenchmarkDotNet.Attributes open System [] -type BigStruct = +type BigStruct = val A : int64 val B : int64 new (a, b) = { A = a; B = b } @@ -15,17 +15,17 @@ type Container<'a> = val Item : 'a new i = { Item = i } -type RandomRecord = { +type RandomRecord = { Field1 : int Field2 : string - Field3 : byte + Field3 : byte } [] -type RandomRecordStruct = { +type RandomRecordStruct = { Field1S : int Field2S : string - Field3S : byte + Field3S : byte } type RandomGeneric<'a> = RandomGeneric of 'a * 'a @@ -33,7 +33,7 @@ type RandomGeneric<'a> = RandomGeneric of 'a * 'a [] type Misc() = - let createBigStruct() = + let createBigStruct() = let n = Random().NextInt64() Container (BigStruct (n, n)) @@ -46,19 +46,19 @@ type Misc() = [] member _.Record() = let array = Array.init 1000 id - array |> Array.countBy (fun n -> { + array |> Array.countBy (fun n -> { Field1 = n Field2 = string n - Field3 = byte n + Field3 = byte n }) - + [] member _.RecordStruct() = let array = Array.init 1000 id - array |> Array.countBy (fun n -> { + array |> Array.countBy (fun n -> { Field1S = n Field2S = string n - Field3S = byte n + Field3S = byte n }) // BDN can't work with F# anon records yet @@ -66,10 +66,10 @@ type Misc() = // [] member _.AnonymousRecord() = let array = Array.init 1000 id - array |> Array.countBy (fun n -> {| + array |> Array.countBy (fun n -> {| Field1A = n Field2A = string n - Field3A = byte n + Field3A = byte n |}) [] diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/OptionsAndCo.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/OptionsAndCo.fs index a31f53e3367..41b8539fe5a 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/OptionsAndCo.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/OptionsAndCo.fs @@ -8,38 +8,38 @@ type OptionsAndCo() = let numbers = Array.init 1000 id - let createOption x = + let createOption x = match x with | x when x % 2 = 0 -> Some x | _ -> None - let createValueOption x = + let createValueOption x = match x with | x when x % 2 = 0 -> ValueSome x | _ -> ValueNone - let createResult x = + let createResult x = match x with | x when x % 2 = 0 -> Ok x | x -> Error x - let createNullable x = + let createNullable x = match x with | x when x % 2 = 0 -> Nullable x | _ -> Nullable 42 [] - member _.Option() = + member _.Option() = numbers |> Array.countBy createOption [] - member _.ValueOption() = + member _.ValueOption() = numbers |> Array.countBy createValueOption [] - member _.Result() = + member _.Result() = numbers |> Array.countBy createResult [] - member _.Nullable() = + member _.Nullable() = numbers |> Array.countBy createNullable diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/ValueTypes.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/ValueTypes.fs index 5e48a1c6a91..0c712f43b0b 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/ValueTypes.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality/ValueTypes.fs @@ -3,7 +3,7 @@ namespace Equality open System open BenchmarkDotNet.Attributes -type SomeEnum = +type SomeEnum = | Case0 = 0 | Case1 = 1 | Case2 = 2 @@ -14,13 +14,13 @@ type ValueTypes() = let numbers = Array.init 1000 id let now = DateTimeOffset.Now - let createFSharpStruct (x: int) = + let createFSharpStruct (x: int) = struct (x % 7, x % 7) let createFSharpEnum (x: int) = enum(x % 3) - let createCSharpStruct (x: int) = + let createCSharpStruct (x: int) = now.AddMinutes x let createCSharpEnum (x: int) = diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/Helpers.fs b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/Helpers.fs index 29e17839003..fd123d30298 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/Helpers.fs +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/Helpers.fs @@ -22,7 +22,7 @@ let getFileSourceText (filePath : string) = #endif let failOnErrors (results : FSharpCheckFileResults) = -#if SERVICE_13_0_0 || SERVICE_30_0_0 +#if SERVICE_13_0_0 || SERVICE_30_0_0 if results.Errors.Length > 0 then failwithf "had errors: %A" results.Errors #else if results.Diagnostics.Length > 0 then failwithf $"had errors: %A{results.Diagnostics}" @@ -41,7 +41,7 @@ let makeCmdlineArgsWithSystemReferences (filePath : string) = ) |> Array.ofSeq |> Array.append [|typeof.Assembly.Location|] - + let refs = assemblies |> Array.map (fun x -> diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/Runner.fs b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/Runner.fs index c471060bdba..d6d0bbb0d7f 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/Runner.fs +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/Runner.fs @@ -47,7 +47,7 @@ module Utils = module Build = type MSBuildProps = (string * string) list - + module MSBuildProps = let private makeVersionDefines (v : NuGetVersion) = if v.Major < 30 then "SERVICE_13_0_0" @@ -70,7 +70,7 @@ module Build = "FcsReferenceType", "dll" "FcsDllPath", fcsDllPath "FSharpCoreDllPath", fsharpCoreDllPath - "DefineConstants", "" // This means the 'revision' method doesn't support codebases prior to v40 + "DefineConstants", "" // This means the 'revision' method doesn't support codebases prior to v40 ] let buildFCS (dir : string) = @@ -86,7 +86,7 @@ module Build = module Local = let build () = Build.buildFCS @"..\..\..\..\" - + let benchmark (outputDir : string) = let msBuildArgs = Build.MSBuildProps.makeProject @"..\..\..\..\src\Compiler\FSharp.Compiler.Service.fsproj" Build.runBenchmark outputDir msBuildArgs @@ -96,7 +96,7 @@ module Local = module NuGet = let private source = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" let private packageId = "FSharp.Compiler.Service" - + let private getAllVersionsMetadata () = let cache = new SourceCacheContext() let repo = Repository.Factory.GetCoreV3(source); @@ -105,14 +105,14 @@ module NuGet = |> Async.AwaitTask |> Async.RunSynchronously |> Seq.toList - + let allVersionsMetadata = lazy getAllVersionsMetadata - + /// Fetch a given version of FCS into the global packages folder let private downloadPackage (version : NuGetVersion) = let logger = NullLogger.Instance let cancellationToken = CancellationToken.None - + let settings = Settings.LoadDefaultSettings(null) let globalPackagesFolder = SettingsUtility.GetGlobalPackagesFolder(settings); @@ -141,7 +141,7 @@ module NuGet = ) |> Async.AwaitTask |> Async.RunSynchronously |> ignore - + let resolvePackageRevision (v : NuGetVersion) = printfn $"Downloading FCS package version {v} to find out its revision" downloadPackage v @@ -153,7 +153,7 @@ module NuGet = match Regex.Match(pv, "\+([a-zA-Z0-9]+)$") with | r when r.Success -> r.Groups[1].Value | _ -> failwith $"Couldn't match product version {pv}" - + let findVersionMetadata (version : string) = allVersionsMetadata.Value() |> List.find (fun v -> v.Identity.Version.OriginalVersion = version) @@ -162,15 +162,15 @@ module NuGet = version.OriginalVersion |> findVersionMetadata |> fun metadata -> metadata.Published.Value.UtcDateTime - + let getMetadataVersion (metadata : IPackageSearchMetadata) = metadata.Identity.Version - + let findVersion (versionString : string) = versionString |> findVersionMetadata |> getMetadataVersion - + let benchmark (outputDir : string) (version : NuGetVersion) = Build.runBenchmark outputDir (Build.MSBuildProps.makeNuGet version) @@ -205,7 +205,7 @@ module RunConfig = [] module Git = open LibGit2Sharp - + let clone (path : string) : Repository = printfn $"Fetching 'dotnet/fsharp.git' in '{path}'..." Repository.Init(path) |> ignore @@ -213,14 +213,14 @@ module Git = let remote = repo.Network.Remotes.Add("origin", "https://github.com/dotnet/fsharp.git") repo.Network.Fetch(remote.Name, []) repo - + let checkout (commit : string) (repo : Repository) : unit = printfn $"Checkout {commit} in {repo.Info.Path}" Commands.Checkout(repo, commit) |> ignore - + let revisionDir (baseDir : string) (revision : string) = Path.Combine(baseDir, revision) - + let prepareRevisionCheckout (baseDir : string) (revision : string) = let dir = revisionDir baseDir revision if Repository.IsValid dir |> not then @@ -230,16 +230,16 @@ module Git = checkout revision repo else printfn $"{revision} already checked out in {dir}" - + let private fcsDllPath (checkoutDir : string) = Path.Combine(checkoutDir, "artifacts/bin/FSharp.Compiler.Service/Release/netstandard2.0/FSharp.Compiler.Service.dll") - + let private fsharpCoreDllPath (rootDir : string) = (fcsDllPath rootDir).Replace("FSharp.Compiler.Service.dll", "FSharp.Core.dll") - + let checkoutContainsBuiltFcs (checkoutDir : string) = File.Exists(fcsDllPath checkoutDir) - + let private prepareRevisionBuild (checkoutsBaseDir : string) (revision : string) = let dir = revisionDir checkoutsBaseDir revision if checkoutContainsBuiltFcs dir |> not then @@ -247,16 +247,16 @@ module Git = Build.buildFCS dir else printfn $"{revision} already built in {dir}" - + let checkoutAndBuild (checkoutsBaseDir : string) (revision : string) = prepareRevisionCheckout checkoutsBaseDir revision prepareRevisionBuild checkoutsBaseDir revision - + let private prepareMainRepo (config : RunConfig) = let dir = revisionDir config.CheckoutBaseDir "main" if Directory.Exists dir then new Repository(dir) else clone dir - + let findCommitsBetweenInclusive (config : RunConfig) (older : Commit) (newer : Commit) = let repo = prepareMainRepo config let filter : CommitFilter = CommitFilter(IncludeReachableFrom=newer, ExcludeReachableFrom=older) @@ -264,21 +264,21 @@ module Git = |> Seq.toList |> fun l -> if l |> List.contains older then l - else l @ [older] - + else l @ [older] + /// Some revisions don't build - exclude them let excludeBadCommits (badCommits : string list) (commits : Commit list) = let knownBadCommits = badCommits let goodCommits = commits |> List.filter (fun c -> knownBadCommits |> List.contains c.Sha |> not) printfn $"Resolved {goodCommits.Length} valid commits out of {goodCommits.Length}" goodCommits - + let benchmark (checkoutsBaseDir : string) (bdnOutputDir : string) (commitHash: string) = checkoutAndBuild checkoutsBaseDir commitHash let root = revisionDir checkoutsBaseDir commitHash let fcsDll = fcsDllPath root let fsharpCoreDll = fsharpCoreDllPath root - + printfn $"Benchmarking revision {commitHash}, fcsDllPath={fcsDll} fsharpCoreDll={fsharpCoreDll}" if File.Exists(fcsDll) |> not then failwith $"{fcsDll} doesn't exist" @@ -286,11 +286,11 @@ module Git = failwith $"{fsharpCoreDll} doesn't exist" let msBuildArgs = Build.MSBuildProps.makeDll fcsDll fsharpCoreDll Build.runBenchmark bdnOutputDir msBuildArgs - + let findCommit (config : RunConfig) (revision : string) = let repo = prepareMainRepo config - repo.Lookup(revision) - + repo.Lookup(revision) + let findCommitDate (config : RunConfig) (revision : string) = let commit = findCommit config revision commit.Committer.When @@ -319,7 +319,7 @@ type RunResults = MeanS : double AllocatedMB : double } - + type Run = { Version : FCSVersion @@ -344,13 +344,13 @@ module Runner = let time = r.VersionTime.ToString("yyyy-MM-dd") $"{r.Version.ShortName()} - {time}" ) - + let getMeanMS {Results = {MeanS = mean}} = Math.Round(mean / 1000000.0, 2) let getAllocatedMB { Results = {AllocatedMB = allocated}} = Math.Round(allocated / 1024.0 / 1024.0, 2) - + let meanMS = (x, (results |> List.map getMeanMS)) ||> List.zip let allocatedMB = (x, (results |> List.map getAllocatedMB)) ||> List.zip - + let meanLine = Chart.Line(meanMS, Name="Mean (ms)") let allocatedLine = Chart.Line(allocatedMB, Name="Allocated (MB)") @@ -359,7 +359,7 @@ module Runner = let exportEntriesAsJson (path : string) (entries : Run list) = printfn $"Saving {entries.Length} aggregate results as JSON in {path}" File.WriteAllText(path, JsonConvert.SerializeObject(entries, Formatting.Indented)) - + let exportEntriesAsCsv (path : string) (entries : Run list) = printfn $"Saving {entries.Length} aggregate results as CSV in {path}" let header = "Version,MeanS,AllocatedMB" @@ -369,10 +369,10 @@ module Runner = |> fun rows -> header :: rows |> fun lines -> String.Join(Environment.NewLine, lines) File.WriteAllText(path, csv) - + let bdnBaseDir (config : RunConfig) = Path.Combine(config.BDNOutputBaseDir, config.Time.ToString("yyyy-MM-dd_HH-mm")) - + let exportEntries (config : RunConfig) (entries : Run list) : GenericChart = let dir = Path.Combine(bdnBaseDir config, config.ResultsSuffix) Directory.CreateDirectory dir |> ignore @@ -384,36 +384,36 @@ module Runner = printfn $"Saving chart for {entries.Length} results as HTML in {htmlPath}" Chart.saveHtml (htmlPath, false) chart chart - + let getBdnArtifactDir (bdnsBaseDir : string) (version : FCSVersion) = Path.Combine(bdnsBaseDir, $"{version}") let resultsJsonPath (bdnArtifactDir : string) = Path.Combine(bdnArtifactDir, @"results/HistoricalBenchmark.DecentlySizedStandAloneFileBenchmark-report.json") - + let readBDNJsonResults (bdnArtifactDir : string) = let json = File.ReadAllText(resultsJsonPath bdnArtifactDir) JsonConvert.DeserializeObject(json) - + let extractResultsFromJson (summary : JObject) : RunResults = let benchmark = summary["Benchmarks"][0] let stats = benchmark["Statistics"] let mean = stats["Mean"].ToString() |> Double.Parse - + let metrics = benchmark["Metrics"] :?> JArray let am = let found = metrics |> Seq.find (fun m -> (m["Descriptor"]["Id"]).ToString() = "Allocated Memory") found["Value"].ToString() |> Double.Parse - + { MeanS = mean; AllocatedMB = am } - + let bdnResultExists (config : RunConfig) (v : FCSVersion) = let dir = getBdnArtifactDir (bdnBaseDir config) v let jsonReportPath = resultsJsonPath dir File.Exists jsonReportPath - + let benchmark (config : RunConfig) (version : FCSVersion) = let outputDir = getBdnArtifactDir (bdnBaseDir config) version if bdnResultExists config version then @@ -434,7 +434,7 @@ module Runner = with e -> printfn $"Failed to benchmark {version}: {e.Message}" e.Message|> Error - + let loadResultsFromDisk (config : RunConfig) (v : FCSVersion) = try let bdnDir = getBdnArtifactDir (bdnBaseDir config) v @@ -446,7 +446,7 @@ module Runner = |> Ok with e -> Error e.Message - + /// Prepare version but don't run any benchmarks let prepareVersion (config : RunConfig) (version : FCSVersion) = printfn $"*** Preparing version {version}" @@ -461,7 +461,7 @@ module Runner = |> Some | FCSVersion.Local | FCSVersion.NuGet _ -> None - + let prepareVersions (config : RunConfig) (parallelism : int) (versions : FCSVersion list) = printfn $"Preparing {versions.Length} versions" versions @@ -470,7 +470,7 @@ module Runner = |> fun jobs -> Async.Parallel(jobs, parallelism) |> Async.RunSynchronously |> ignore - + let runAll (config : RunConfig) (versions : FCSVersion list) = printfn $"*** Preparing and running benchmarks for the following {versions.Length} versions:" versions |> List.iter (fun v -> printfn $"- {v}") diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/SingleFileCompiler.fs b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/SingleFileCompiler.fs index 6e1efa64f80..66a5d21dd19 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/SingleFileCompiler.fs +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/SingleFileCompiler.fs @@ -58,7 +58,7 @@ type SingleFileCompiler(filePath: string, optionsCreationMethod : OptionsCreatio match configOpt with | None -> failwith "Setup not run" | Some {Checker = checker; Options = options} -> - let _, result = + let _, result = checker.ParseAndCheckFileInProject(filePath, 0, Helpers.getFileSourceText filePath, options) |> Async.RunSynchronously match result with diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/CompilerServiceBenchmarks.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/CompilerServiceBenchmarks.fs index 912ed142b5a..de389321808 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/CompilerServiceBenchmarks.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/CompilerServiceBenchmarks.fs @@ -25,7 +25,7 @@ type private Config = [] module private Helpers = - + let createProject name referencedProjects = let tmpPath = Path.GetTempPath() let file = Path.Combine(tmpPath, Path.ChangeExtension(name, ".fs")) @@ -33,7 +33,7 @@ module private Helpers = ProjectFileName = Path.Combine(tmpPath, Path.ChangeExtension(name, ".dll")) ProjectId = None SourceFiles = [|file|] - OtherOptions = + OtherOptions = Array.append [|"--optimize+"; "--target:library" |] (referencedProjects |> Array.ofList |> Array.map (fun x -> "-r:" + x.ProjectFileName)) ReferencedProjects = referencedProjects @@ -71,11 +71,11 @@ let function%s{moduleName} (x: %s{moduleName}) = type CompilerServiceBenchmarks() = let mutable configOpt : Config option = None let sourcePath = Path.Combine(__SOURCE_DIRECTORY__, "../decentlySizedStandAloneFile.fs") - + let getConfig () = configOpt |> Option.defaultWith (fun () -> failwith "Setup not run") - + let parsingOptions = { SourceFiles = [|"CheckExpressions.fs"|] @@ -105,14 +105,14 @@ type CompilerServiceBenchmarks() = let checker = FSharpChecker.Create(projectCacheSize = 200) let path = __SOURCE_DIRECTORY__ ++ ".." ++ ".." ++ ".." ++ ".." ++ "src" ++ "Compiler" ++ "Checking" ++ "Expressions" ++ "CheckExpressions.fs" let source = FSharpSourceText.From(File.OpenRead(path), Encoding.Default, FSharpSourceHashAlgorithm.Sha1, true) - let assemblies = + let assemblies = AppDomain.CurrentDomain.GetAssemblies() |> Array.map (fun x -> x.Location) let decentlySizedStandAloneFile = File.ReadAllText(Path.Combine(__SOURCE_DIRECTORY__, sourcePath)) let options, _ = checker.GetProjectOptionsFromScript(sourcePath, SourceText.ofString decentlySizedStandAloneFile) |> Async.RunSynchronously - let _, checkResult = + let _, checkResult = checker.ParseAndCheckFileInProject(sourcePath, 0, SourceText.ofString decentlySizedStandAloneFile, options) |> Async.RunSynchronously { @@ -123,7 +123,7 @@ type CompilerServiceBenchmarks() = DecentlySizedFileSource = decentlySizedStandAloneFile } |> Some - + [] member _.ParsingCheckExpressionsFs() = let config = getConfig() @@ -186,7 +186,7 @@ type CompilerServiceBenchmarks() = let options = this.TypeCheckFileWith100ReferencedProjectsOptions let file = options.SourceFiles.[0] let checker = getConfig().Checker - let parseResult, checkResult = + let parseResult, checkResult = checker.ParseAndCheckFileInProject(file, 0, SourceText.ofString (File.ReadAllText(file)), options) |> Async.RunSynchronously @@ -248,7 +248,7 @@ type CompilerServiceBenchmarks() = | FSharpCheckFileAnswer.Succeeded results -> let sourceLines = source.Split ([|"\r\n"; "\n"; "\r"|], StringSplitOptions.None) let ranges = SimplifyNames.getSimplifiableNames(results, fun lineNum -> sourceLines.[Line.toZ lineNum]) |> Async.RunSynchronously - ignore ranges + ignore ranges [] member _.UnusedOpens() = @@ -259,7 +259,7 @@ type CompilerServiceBenchmarks() = | FSharpCheckFileAnswer.Succeeded results -> let sourceLines = source.Split ([|"\r\n"; "\n"; "\r"|], StringSplitOptions.None) let decls = UnusedOpens.getUnusedOpens(results, fun lineNum -> sourceLines.[Line.toZ lineNum]) |> Async.RunSynchronously - ignore decls + ignore decls [] member _.UnusedDeclarations() = @@ -268,4 +268,4 @@ type CompilerServiceBenchmarks() = | FSharpCheckFileAnswer.Aborted -> failwith "checker aborted" | FSharpCheckFileAnswer.Succeeded results -> let decls = UnusedDeclarations.getUnusedDeclarations(results, true) |> Async.RunSynchronously - ignore decls // should be 16 + ignore decls // should be 16 diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FileCascadeBenchmarks.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FileCascadeBenchmarks.fs index 6eddb5eb5b3..eb432d22469 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FileCascadeBenchmarks.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FileCascadeBenchmarks.fs @@ -12,13 +12,13 @@ open FSharp.Benchmarks.Common.Categories [] module private CascadeProjectHelpers = - - let createProject files projectFilename = + + let createProject files projectFilename = { ProjectFileName = projectFilename ProjectId = None SourceFiles = files - OtherOptions = [|"--optimize+" |] + OtherOptions = [|"--optimize+" |] ReferencedProjects = [||] IsIncompleteTypeCheckEnvironment = false UseScriptResolutionRules = false @@ -36,7 +36,7 @@ let myFunc0 () = returnValue type MyType0 = MyType0 of string type MyOtherType0 = MyOtherType0 of int""" - let baselineFsi = + let baselineFsi = """ module Benchmark0 @@ -64,7 +64,7 @@ let processFunc{number} (x) (func:MyFunctionType{number}) = //$COMMENTAREA$""" /// Code created using FSharpCheckFileResults.GenerateSignature() - let generateFsi number = + let generateFsi number = $""" module Benchmark{number} @@ -83,8 +83,8 @@ val processFunc{number}: x: MyType{number} -> func: MyFunctionType{number} -> As [] [] [] -type FileCascadeBenchmarks() = - let mutable project : FSharpProjectOptions option = None +type FileCascadeBenchmarks() = + let mutable project : FSharpProjectOptions option = None let filesToCreate = 128 member val FinalFileContents = SourceText.ofString "" with get,set @@ -95,46 +95,46 @@ type FileCascadeBenchmarks() = member val Checker = Unchecked.defaultof with get, set member this.GetProject() = project.Value - + [] member this.Setup() = printfn $"Running Setup(). Partial = {this.PartialCheck}, FSIGen = {this.GenerateFSI}" this.Checker <- FSharpChecker.Create( - projectCacheSize = 5, + projectCacheSize = 5, enablePartialTypeChecking = this.PartialCheck) - let projectFolder = Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(),"CascadeBenchmarkProject")) + let projectFolder = Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(),"CascadeBenchmarkProject")) if(projectFolder.Exists) then do projectFolder.Delete(recursive=true) do Directory.CreateDirectory(projectFolder.FullName) |> ignore let inProjectFolder fileName = Path.Combine(projectFolder.FullName,fileName) - + if this.GenerateFSI then File.WriteAllText(inProjectFolder "Benchmark0.fsi",baselineFsi) File.WriteAllText(inProjectFolder "Benchmark0.fs",baselineModule) - for i = 1 to filesToCreate do + for i = 1 to filesToCreate do if this.GenerateFSI then File.WriteAllText(inProjectFolder $"Benchmark%i{i}.fsi", generateFsi i) File.WriteAllText(inProjectFolder $"Benchmark%i{i}.fs", generateSourceCode i) let dllFileName = inProjectFolder "CascadingBenchMark.dll" - let allSourceCodeFiles = - [| for i in 0 .. filesToCreate do + let allSourceCodeFiles = + [| for i in 0 .. filesToCreate do if this.GenerateFSI then yield (inProjectFolder $"Benchmark%i{i}.fsi") yield (inProjectFolder $"Benchmark%i{i}.fs") |] let x = createProject allSourceCodeFiles dllFileName project <- Some x - this.FinalFileContents <- generateSourceCode filesToCreate |> SourceText.ofString + this.FinalFileContents <- generateSourceCode filesToCreate |> SourceText.ofString () - member x.ChangeFile(fileIndex:int, action) = + member x.ChangeFile(fileIndex:int, action) = let project = x.GetProject() let fileIndexAdapted = if x.GenerateFSI then fileIndex * 2 else fileIndex let fileName = project.SourceFiles.[fileIndexAdapted] @@ -152,7 +152,7 @@ type FileCascadeBenchmarks() = printfn $"ParseError = {pr.ParseHadErrors}; Check = {match cr with | FSharpCheckFileAnswer.Succeeded _ -> '+' | _ -> '-' }" for e in pr.Diagnostics do printfn "Error:= %s" (e.ToString()) - + [] member x.ParseAndCheckLastFileProjectAsIs() = x.ParseAndCheckLastFileInTheProject() @@ -161,17 +161,17 @@ type FileCascadeBenchmarks() = member x.ParseProjectWithFullCacheClear() = x.Checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() x.Checker.ClearCache([x.GetProject()]) - x.Checker.InvalidateConfiguration(x.GetProject()) + x.Checker.InvalidateConfiguration(x.GetProject()) x.ParseAndCheckLastFileInTheProject() [] member x.ParseProjectWithChangingFirstFile() = - x.ChangeFile(fileIndex=0, action= fun () -> x.ParseAndCheckLastFileInTheProject()) + x.ChangeFile(fileIndex=0, action= fun () -> x.ParseAndCheckLastFileInTheProject()) [] member x.ParseProjectWithChangingMiddleFile() = - x.ChangeFile(fileIndex=filesToCreate/2, action= fun () -> x.ParseAndCheckLastFileInTheProject()) + x.ChangeFile(fileIndex=filesToCreate/2, action= fun () -> x.ParseAndCheckLastFileInTheProject()) [] member x.ParseProjectWithChangingPenultimateFile() = - x.ChangeFile(fileIndex=(filesToCreate-2), action= fun () -> x.ParseAndCheckLastFileInTheProject()) \ No newline at end of file + x.ChangeFile(fileIndex=(filesToCreate-2), action= fun () -> x.ParseAndCheckLastFileInTheProject()) \ No newline at end of file diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SourceText.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SourceText.fs index 89d911d9b71..c0fecf52923 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SourceText.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SourceText.fs @@ -14,7 +14,7 @@ module internal SourceText = let sourceText = { new ISourceText with - + member __.Item with get index = sourceText.[index] member __.GetLineString(lineIndex) = @@ -49,7 +49,7 @@ module internal SourceText = while not finished && i < target.Length do if target.[i] <> sourceText.[startIndex + i] then didEqual <- false - finished <- true // bail out early + finished <- true // bail out early else i <- i + 1 @@ -101,7 +101,7 @@ module internal SourceText = } sourceText - + let toFSharpSourceText (sourceText : SourceText) = weakTable.GetValue(sourceText, ConditionalWeakTable<_,_>.CreateValueCallback(create)) diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/ce/CE1xnest15.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/ce/CE1xnest15.fs index 13e44372f92..128cc0df2d9 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/ce/CE1xnest15.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/ce/CE1xnest15.fs @@ -1,11 +1,11 @@ module Test = - + type MyBuilder() = member x.Zero() : float = 0.0 member x.Yield(a : float) = a member x.Delay(l : unit -> float) = l() - member x.Combine(l : float, r : float) = l+r + member x.Combine(l : float, r : float) = l+r let my = MyBuilder() @@ -15,7 +15,7 @@ module Test = my { 1 my { - + my { 3.0 my { @@ -37,19 +37,19 @@ module Test = my { my { 1.0 - } + } } - } + } } - } + } } - } + } } - } + } } - } + } } - } + } } - } + } } \ No newline at end of file diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/ce/CEwCO500xnest1.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/ce/CEwCO500xnest1.fs index c67f8e73528..4a3e857df5c 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/ce/CEwCO500xnest1.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/ce/CEwCO500xnest1.fs @@ -21,7 +21,7 @@ member _.Mul(state: CalcState, x) = { state with r = state.r * x } - + [] member _.Div(state: CalcState, x) = if x = 0 then diff --git a/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/Program.fs b/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/Program.fs index 6bbd617708c..0729caaf37f 100644 --- a/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/Program.fs +++ b/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/Program.fs @@ -275,7 +275,7 @@ module Project = __SOURCE_DIRECTORY__ + @"\..\..\..\..\artifacts\bin\FSharp.Core\Debug\netstandard2.1\FSharp.Core.dll", projectOptions ) - + let FSharpDependencyManagerNuget = let projectOptions = { ProjectFileName = __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\FSharp.DependencyManager.Nuget\FSharp.DependencyManager.Nuget.fsproj" @@ -464,7 +464,7 @@ module Project = __SOURCE_DIRECTORY__ + @"\..\..\..\..\artifacts\bin\FSharp.DependencyManager.Nuget\Debug\netstandard2.0\FSharp.DependencyManager.Nuget.dll", projectOptions ) - + let FSharpCompilerService = { ProjectFileName = __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\FSharp.Compiler.Service.fsproj" ProjectId = None @@ -892,8 +892,8 @@ type CompilerService() = | _ -> () match sourceOpt with - | None -> - sourceOpt <- + | None -> + sourceOpt <- projectOptions.SourceFiles |> Array.filter (fun filePath -> filePath.EndsWith("CheckDeclarations.fs")) |> Array.map (fun filePath -> filePath, SourceText.ofString (File.ReadAllText(filePath))) diff --git a/tests/benchmarks/FCSBenchmarks/decentlySizedStandAloneFile.fs b/tests/benchmarks/FCSBenchmarks/decentlySizedStandAloneFile.fs index 53412c942d1..8a5ac235c96 100644 --- a/tests/benchmarks/FCSBenchmarks/decentlySizedStandAloneFile.fs +++ b/tests/benchmarks/FCSBenchmarks/decentlySizedStandAloneFile.fs @@ -1,7 +1,7 @@ -module Parser = - +module Parser = + (* - F# implementation of a generic Top-Down-Operator-Precedence Parser + F# implementation of a generic Top-Down-Operator-Precedence Parser as described in this paper http://portal.acm.org/citation.cfm?id=512931. The parser has been extended to allow for statements in comparison to Pratt's @@ -43,32 +43,32 @@ Stmt : Map<'c, 'a -> T<'a, 'b, 'c> -> 'b> Left : Map<'c, 'a -> 'b -> T<'a, 'b, 'c> -> 'b> } - - type Pattern<'a, 'b, 'c> when 'c : comparison + + type Pattern<'a, 'b, 'c> when 'c : comparison = Sym of 'c | Get of (T<'a, 'b, 'c> -> 'b) //Errors - type Exn (msg, pos) = + type Exn (msg, pos) = inherit System.Exception(msg) member x.Position = pos (* - Creates a string error snippet + Creates a string error snippet that points out the exact source position where the error occurred, for example: - + 4: if(x == y) { 5: print'x equals y'); ----------^ *) let errorSource pos source = - - let splitLines (text:string) = + + let splitLines (text:string) = let text = text.Replace("\r\n", "\n").Replace("\r", "\n") System.Text.RegularExpressions.Regex.Split(text, "\n") - let lineNum (input:int) n = + let lineNum (input:int) n = (input.ToString()).PadLeft(n, '0') let stringRepeat n input = @@ -79,8 +79,8 @@ match source with | None -> "" - | Some(source:string) -> - let source = source |> splitLines + | Some(source:string) -> + let source = source |> splitLines let result = ref "" let line, column = pos @@ -90,7 +90,7 @@ //previous line let pline = line - 1 - if pline >= 1 then + if pline >= 1 then let num = lineNum pline nrl result.Value <- num+": "+source.[pline-1]+"\n" @@ -103,7 +103,7 @@ result.Value let exn msg = Exn(msg, (0, 0)) |> raise - let exnLine pos msg = + let exnLine pos msg = let line = sprintf "Error on line: %i col: %i\n" (fst pos) (snd pos) Exn(line + msg, pos) |> raise @@ -115,25 +115,25 @@ | Some f -> token |> f let pos = token |> parser.Position - let source = parser.Lines |> errorSource pos + let source = parser.Lines |> errorSource pos let expected = sprintf "Unexpected: %s" type' (source + expected) |> exnLine pos - let inline private getBindingPower tok parser = + let inline private getBindingPower tok parser = let pwr = parser.BindingPower.TryFind (parser.Type tok) match pwr with Some pwr -> pwr | _ -> 0 - let current parser = + let current parser = match parser.Input.Value with | token::_ -> token | _ -> unexpectedEnd () - let currentTry parser = + let currentTry parser = match parser.Input.Value with | token::_ -> Some token | _ -> None - let currentType parser = + let currentType parser = parser |> current |> parser.Type let currentTypeTry parser = @@ -148,10 +148,10 @@ let skipIf type' parser = match parser.Input.Value with - | token::xs when parser.Type token = type' -> + | token::xs when parser.Type token = type' -> parser.Input.Value <- xs - | token::_ -> + | token::_ -> unexpectedToken token parser | _ -> unexpectedEnd () @@ -160,15 +160,15 @@ let current = parser |> current parser |> skip current - + let exprPwr rbpw parser = let rec expr left = match parser |> currentTry with - | Some token when rbpw < (parser |> getBindingPower token) -> + | Some token when rbpw < (parser |> getBindingPower token) -> parser |> skip let type' = parser.Type token - let led = + let led = match parser.Left.TryFind type' with | None -> unexpectedToken token parser | Some led -> led @@ -184,9 +184,9 @@ | None -> unexpectedToken tok parser | Some nud -> nud - nud tok parser |> expr + nud tok parser |> expr - let expr parser = + let expr parser = parser |> exprPwr 0 let exprSkip type' parser = @@ -215,60 +215,60 @@ match pattern with | [] -> acc |> List.rev - | Sym(symbol)::pattern -> + | Sym(symbol)::pattern -> parser |> skipIf symbol parser |> match' acc pattern | Get(f)::pattern -> let acc = (f parser) :: acc - parser |> match' acc pattern + parser |> match' acc pattern parser |> match' [] pattern (* - Convenience functions exposed for + Convenience functions exposed for easing parser definition and usage *) let create<'a, 'b, 'c when 'c : comparison> type' position prettyPrint = { Input = ref [] Lines = None - + Type = type' Position = position PrettyPrint = prettyPrint - + BindingPower = Map.empty<'c, int> Null = Map.empty<'c, 'a -> T<'a, 'b, 'c> -> 'b> Stmt = Map.empty<'c, 'a -> T<'a, 'b, 'c> -> 'b> Left = Map.empty<'c, 'a -> 'b -> T<'a, 'b, 'c> -> 'b> } - + let matchError () = exn "Match pattern failed" let smd token funct parser = {parser with T.Stmt = parser.Stmt.Add(token, funct)} let nud token funct parser = {parser with T.Null = parser.Null.Add(token, funct)} let led token funct parser = {parser with T.Left = parser.Left.Add(token, funct)} let bpw token power parser = {parser with T.BindingPower = parser.BindingPower.Add(token, power)} - + (*Defines a left-associative infix operator*) let infix f typ pwr p = - let infix tok left p = + let infix tok left p = f tok left (p |> exprPwr pwr) p |> bpw typ pwr |> led typ infix - + (*Defines a right-associative infix operator*) let infixr f typ pwr p = let lpwr = pwr - 1 - let infix tok left p = + let infix tok left p = f tok left (p |> exprPwr lpwr) p |> bpw typ pwr |> led typ infix (*Defines a prefix/unary operator*) let prefix f typ pwr p = - let prefix tok parser = + let prefix tok parser = f tok (parser |> exprPwr pwr) p |> nud typ prefix @@ -276,23 +276,23 @@ (*Defines a constant*) let constant symbol value p = p |> nud symbol (fun _ _ -> value) - - (* - Runs the parser and treats all - top level construct as expressions + + (* + Runs the parser and treats all + top level construct as expressions *) let runExpr input source parser = - {parser with + {parser with T.Input = ref input T.Lines = source } |> exprList - - (* - Runs the parser and treats all - top level construct as statements + + (* + Runs the parser and treats all + top level construct as statements *) let runStmt input source term parser = - {parser with + {parser with T.Input = ref input T.Lines = source } |> stmtList term @@ -305,7 +305,7 @@ type UnaryOp = Plus | Minus - + type BinaryOp = Multiply | Add @@ -380,10 +380,10 @@ let toUnaryOp tok = | _ -> P.exn (sprintf "Couldn't convert %s-token to UnaryOp" (type' tok)) //Utility function for defining infix operators -let infix = - P.infix (fun token left right -> +let infix = + P.infix (fun token left right -> Binary(token |> toBinaryOp, left, right)) - + //Utility function for defining prefix operators let prefix = P.prefix (fun token ast -> @@ -393,7 +393,7 @@ let prefix = let constant typ value p = p |> P.nud typ (fun _ _ -> value) -//Utility function for parsing a block +//Utility function for parsing a block let block p = let rec stmts p = match p |> P.currentTypeTry with @@ -417,14 +417,14 @@ let example_parser = (P.create type' pos (Some prettyPrint)) //Literals and identifiers - |> P.nud "#number" (fun t _ -> t |> value |> int |> Number) + |> P.nud "#number" (fun t _ -> t |> value |> int |> Number) |> P.nud "#identifier" (fun t _ -> t |> value |> Identifier) |> P.nud "#string" (fun t _ -> t |> value |> String) //Constants |> constant "true" Ast.True |> constant "false" Ast.False - + //Infix Operators |> infix "==" 40 |> infix "+" 50 @@ -436,7 +436,7 @@ let example_parser = //Prefix Operators |> prefix "+" 70 |> prefix "-" 70 - + //Grouping expressions () |> P.nud "(" (fun t p -> p |> P.exprSkip ")") @@ -455,7 +455,7 @@ let example_parser = let else' = [P.Sym "else"; P.Get block] match p |> P.match' if' with - | test::ifTrue::_ -> + | test::ifTrue::_ -> match p |> P.match' else' with | ifFalse::_ -> If(test, ifTrue, Some(ifFalse)) | _ -> If(test, ifTrue, None) @@ -473,12 +473,12 @@ let example_parser = Call(func, args p) ) - + //Code to parse (* 1: x = 5; 2: y = 5; -3: +3: 4: if(x == y) { 5: print("x equals y"); 6: } else { @@ -498,7 +498,7 @@ if(x == y) { //The code in tokens, manually entered //since we don't have a lexer to produce //the tokens for us -let tokens = +let tokens = [ //x = 5; identifier "x" (1, 1) diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs index 97cc692d7eb..9782b6479da 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs @@ -57,7 +57,7 @@ let compute (x: int) = // We had a regression in debug code regression where we were falsely marking pipelines // as non-side-effecting, causing them to be eliminated in loops. // -// After the fix +// After the fix // 1. pipelines are correctly marked as having effect // 2. we don't eliminate loops anyway module DontEliminateForLoopsInDebugCode = diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs index fe50b0bfc5e..c2f8a3d7b58 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs @@ -50,9 +50,9 @@ let test() = let commonOptionsBasicMvid = lazy(getMvid basicCodeSnippet commonOptions) - let calculateRefAssMvids referenceCodeSnippet codeAfterChangeIsDone = + let calculateRefAssMvids referenceCodeSnippet codeAfterChangeIsDone = - let mvid1 = + let mvid1 = if referenceCodeSnippet = basicCodeSnippet then commonOptionsBasicMvid.Value else @@ -63,7 +63,7 @@ let test() = [] - let ``Simple assembly should be deterministic``() = + let ``Simple assembly should be deterministic``() = File.WriteAllText(inputPath, basicCodeSnippet) let getMvid() = @@ -75,7 +75,7 @@ let test() = Assert.Equal(getMvid(), getMvid()) [] - let ``Simple assembly with different platform should not be deterministic``() = + let ``Simple assembly with different platform should not be deterministic``() = let mvid1 = getMvid basicCodeSnippet ["--deterministic"] let mvid2 = getMvid basicCodeSnippet ["--deterministic";"--platform:Itanium"] // No two platforms should produce the same MVID @@ -100,27 +100,27 @@ let test() = let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet src2 Assert.NotEqual(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function name is different with the same function name length`` () = let privCode1 = basicCodeSnippet.Replace("privTest()","privTest1()") let privCode2 = basicCodeSnippet.Replace("privTest()","privTest2()") let mvid1, mvid2 = calculateRefAssMvids privCode1 privCode2 Assert.Equal(mvid1, mvid2) - - - [] + + + [] let ``Reference assemblies should be deterministic when only private function name is different with the different function name length`` () = let src2 = basicCodeSnippet.Replace("privTest()","privTest11()") let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet src2 Assert.Equal(mvid1, mvid2) - - [] + + [] let ``Reference assemblies should be deterministic when only private function body is different`` () = let src2 = basicCodeSnippet.Replace("""Console.WriteLine("Private Hello World!")""","""Console.Write("Private Hello World!")""") let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet src2 Assert.Equal(mvid1, mvid2) - - [] + + [] let ``Reference assemblies should be deterministic when only private function return type is different`` () = let src2 = @@ -137,8 +137,8 @@ let test() = """ let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet src2 Assert.Equal(mvid1, mvid2) - - [] + + [] let ``Reference assemblies should be deterministic when only private function parameter count is different`` () = let src = """ @@ -152,7 +152,7 @@ let test() = privTest1 () |> ignore Console.WriteLine() """ - + let src2 = """ module ReferenceAssembly @@ -169,7 +169,7 @@ let test() = let mvid1, mvid2 = calculateRefAssMvids src src2 Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function parameter count is different and private function is unused`` () = let src = """ @@ -196,8 +196,8 @@ let test() = let mvid1, mvid2 = calculateRefAssMvids src src2 Assert.Equal(mvid1, mvid2) - - [] + + [] let ``Reference assemblies should be deterministic when only private function parameter types are different`` () = let src = """ @@ -224,11 +224,11 @@ let test() = privTest1 "" |> ignore Console.WriteLine() """ - + let mvid1, mvid2 = calculateRefAssMvids src src2 Assert.Equal(mvid1, mvid2) - - [] + + [] let ``Reference assemblies should be deterministic when private function is missing in one of them`` () = let src = """ @@ -256,7 +256,7 @@ let test() = let mvid1, mvid2 = calculateRefAssMvids src src2 Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when inner function is removed`` () = let src = """ @@ -271,7 +271,7 @@ let test() = let stringVal = innerFunc 15 Console.WriteLine(stringVal) """ - + let src2 = """ module ReferenceAssembly @@ -281,11 +281,11 @@ open System let test() = Console.WriteLine() """ - + let mvid1, mvid2 = calculateRefAssMvids src src2 Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be same when contents of quoted expression change`` () = let src = """ @@ -315,7 +315,7 @@ let inline myFunc x y = x + y""" [] let ``Reference assemblies must not change when a must-inline function does not change`` () = let codeBefore = """module ReferenceAssembly -let inline myFunc x y = x - y""" +let inline myFunc x y = x - y""" let mvid1, mvid2 = calculateRefAssMvids codeBefore codeBefore Assert.Equal(mvid1,mvid2) @@ -323,7 +323,7 @@ let inline myFunc x y = x - y""" [] // If IVT provided -> MVID must reflect internal binding [] // No IVT => internal binding can be ignored for mvid purposes let ``Reference assemblies MVID when having internal binding``(additionalSnippet:string, shouldBeStable:bool) = - let codeAfter = + let codeAfter = basicCodeSnippet .Replace("private","internal") .Replace("//PLACEHOLDER", additionalSnippet) diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs index e3803ce8437..d01ee7888f4 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs @@ -629,7 +629,7 @@ extends [runtime]System.Object }"""] [] - let ``Cli events are emitted even for CliEvent members which are not last in a file`` () = + let ``Cli events are emitted even for CliEvent members which are not last in a file`` () = FSharp """ module LibraryWithTwoClassesAndTwoEvents open System @@ -727,7 +727,7 @@ type MyClass2() = """ ] [] - let ``Properties are emitted for CliMutable records`` () = + let ``Properties are emitted for CliMutable records`` () = FSharp """ namespace ReferenceAssembly type [] MyRecord = { MyId: int }""" @@ -738,8 +738,8 @@ type [] MyRecord = { MyId: int }""" referenceAssemblyAttributeExpectedIL " .property instance int32 MyId()"] - [] - let ``Properties are emitted even for CliMutable records which are not last in a file`` () = + [] + let ``Properties are emitted even for CliMutable records which are not last in a file`` () = FSharp """ namespace ReferenceAssembly type [] MyRecord = { MyId: int } @@ -755,7 +755,7 @@ type [] MySecondRecord = { MySecondId: strin [] // 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`` () = + let ``Properties are emitted for equal records in the same file`` () = FSharp """ namespace Net7FSharpSnafu.Library @@ -1012,7 +1012,7 @@ type MySecondaryAttribute() = } } """ ] - + [] let ``Internal and private fields are emitted for structs`` () = FSharp """ diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs index a76c80a6dd9..2f39f559e26 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs @@ -30,7 +30,7 @@ printfn "%A" y """ Compilation.Create(source, Exe, cmplRefs=[CompilationReference.CreateFSharp(module1, staticLink=true)]) - CompilerAssert.Execute(module2, + CompilerAssert.Execute(module2, beforeExecute=(fun _ deps -> deps |> List.iter (fun dep -> try File.Delete dep with | _ -> ()))) @@ -55,7 +55,7 @@ printfn "%A" y Compilation.Create(source, Exe, cmplRefs=[CompilationReference.CreateFSharp module1]) Assert.Throws(fun _ -> - CompilerAssert.Execute(module2, + CompilerAssert.Execute(module2, beforeExecute=(fun _ deps -> deps |> List.iter (fun dep -> try File.Delete dep with | _ -> ())))) |> ignore diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs index 174b1b29dbc..c821a9e3996 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs @@ -9,7 +9,7 @@ open Xunit // These tests are sensitive to the fact that FSharp.Core is compiled release, not debug // The code generated changes slightly in debug mode -#if !DEBUG +#if !DEBUG // Check the exact code produced for tasks module TaskGeneratedCode = @@ -1171,7 +1171,7 @@ printfn "test passed" """) -#if !DEBUG +#if !DEBUG [] let ``check generic task exact code``() = @@ -1329,20 +1329,20 @@ let main _ = // Test that the SRTP Bind on a ValueTask is still generic in the bind type -module ``Check return attributes`` = +module ``Check return attributes`` = let incr (x:int) : [] (int -> int) = (fun a -> a + x) // Putting a return attribute of any kind on f function should be respected - // If the function is curried its inferred arity should be no more than - // the declared arguments (the F# rule that infers additional arguments + // If the function is curried its inferred arity should be no more than + // the declared arguments (the F# rule that infers additional arguments // should not kick in). [] let ``check return attribute of curried function``() = match <@ incr 3 4 @> with | Quotations.Patterns.Application (Quotations.Patterns.Call(None, mi, [Quotations.DerivedPatterns.Int32 3]), Quotations.DerivedPatterns.Int32 4) -> - if mi.GetParameters().Length <> 1 then + if mi.GetParameters().Length <> 1 then failwith "wrong number of parameters" - if mi.ReturnTypeCustomAttributes.GetCustomAttributes(false).Length <> 1 then + if mi.ReturnTypeCustomAttributes.GetCustomAttributes(false).Length <> 1 then failwith "wrong number of attributes" () | _ -> failwith "curried function expected" @@ -1359,7 +1359,7 @@ module ``SRTP Bind on a ValueTask is still generic in the bind type (nested)`` = } let t1 : Task = TryFindAsync() // test TryFindAsync is generic let t2 : Task = TryFindAsync() // test TryFindAsync is generic - + // Compilation test // Test that the SRTP Bind on a ValueTask is still generic in the bind type module ``SRTP Bind on a ValueTask is still generic in the bind type`` = @@ -1368,13 +1368,13 @@ module ``SRTP Bind on a ValueTask is still generic in the bind type`` = let! r = FindAsync() return r } - + // Compilation test module ``SRTP ReturnFrom on a ValueTask is still generic in the bind type`` = let FindAsync() = ValueTask<'T>(Unchecked.defaultof<'T>) let TryFindAsync() : Task<'T> = task { return! FindAsync() } - + let t1 : Task = TryFindAsync() // test TryFindAsync is generic let t2 : Task = TryFindAsync() // test TryFindAsync is generic diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs index 4169349ba7a..6da5b88ea20 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs @@ -11,7 +11,7 @@ module ``Basic Grammar Element Constants`` = let ``Basic constants compile `` () = let tripleQuotedByteString = " \"\"\" \" \"\"\"B " - CompilerAssert.Pass + CompilerAssert.Pass $""" let sbyteConst = 1y let int16Const = 1us @@ -56,7 +56,7 @@ let unitConst = () """ [] - let ``Long with underscores``() = + let ``Long with underscores``() = CompilerAssert.CompileExeAndRun """ let creditCardNumber = 1234_5678_9012_3456L @@ -69,7 +69,7 @@ printfn "%A" creditCardNumber """ [] - let ``float 32 with underscores``() = + let ``float 32 with underscores``() = CompilerAssert.CompileExeAndRun """ let pi = 3.14_15F @@ -78,7 +78,7 @@ printfn "%A" pi """ [] - let ``int with underscores hexBytes``() = + let ``int with underscores hexBytes``() = CompilerAssert.CompileExeAndRun """ let hexBytes = 0xFF_EC_DE_5E @@ -88,7 +88,7 @@ printfn "%A" hexBytes [] - let ``int with underscore hexWords``() = + let ``int with underscore hexWords``() = CompilerAssert.CompileExeAndRun """ let hexWords = 0xCAFE_BABE @@ -97,7 +97,7 @@ printfn "%A" hexWords """ [] - let ``Long with underscores maxLong``() = + let ``Long with underscores maxLong``() = CompilerAssert.CompileExeAndRun """ let maxLong = 0x7fff_ffff_ffff_ffffL @@ -106,7 +106,7 @@ printfn "%A" maxLong """ [] - let ``int with underscore nybbles``() = + let ``int with underscore nybbles``() = CompilerAssert.CompileExeAndRun """ let nybbles = 0b0010_0101 @@ -115,7 +115,7 @@ printfn "%A" nybbles """ [] - let ``int with underscores bytes``() = + let ``int with underscores bytes``() = CompilerAssert.CompileExeAndRun """ let bytes = 0b11010010_01101001_10010100_10010010 @@ -124,7 +124,7 @@ printfn "%A" bytes """ [] - let ``int with single underscore literal``() = + let ``int with single underscore literal``() = CompilerAssert.CompileExeAndRun """ let x2 = 5_2 @@ -133,7 +133,7 @@ printfn "%A" x2 """ [] - let ``int with multiple underscores literal``() = + let ``int with multiple underscores literal``() = CompilerAssert.CompileExeAndRun """ let x4 = 5_______2 @@ -142,7 +142,7 @@ printfn "%A" x4 """ [] - let ``int with single underscore Hex literal``() = + let ``int with single underscore Hex literal``() = CompilerAssert.CompileExeAndRun """ let x7 = 0x5_2 @@ -152,7 +152,7 @@ printfn "%A" x7 """ [] - let ``int with single underscore after leading zero literal``() = + let ``int with single underscore after leading zero literal``() = CompilerAssert.CompileExeAndRun """ let x9 = 0_52 @@ -161,7 +161,7 @@ printfn "%A" x9 """ [] - let ``int with single underscore after literal with leading zero ``() = + let ``int with single underscore after literal with leading zero ``() = CompilerAssert.CompileExeAndRun """ let x10 = 05_2 @@ -170,7 +170,7 @@ printfn "%A" x10 """ [] - let ``int with single underscore after octo literal ``() = + let ``int with single underscore after octo literal ``() = CompilerAssert.CompileExeAndRun """ let x14 = 0o5_2 @@ -178,7 +178,7 @@ if x14 <> 0o52 then failwith "Wrong parsing" printfn "%A" x14 """ [] - let ``dotless float``() = + let ``dotless float``() = CompilerAssert.CompileExeWithOptions([|"--langversion:8.0"|], """ let x = 42f @@ -186,14 +186,14 @@ printfn "%A" x """) [] - let ``dotted float``() = + let ``dotted float``() = CompilerAssert.CompileExe(""" let x = 42.f printfn "%A" x """) [] - let ``dotted floats should be equal to dotless floats``() = + let ``dotted floats should be equal to dotless floats``() = CompilerAssert.CompileExeAndRunWithOptions([|"--langversion:8.0"|], """ if 1.0f <> 1f then failwith "1.0f <> 1f" @@ -207,14 +207,14 @@ if 1.0e1f <> 10.f then failwith "1.0e1f <> 10.f" """ [] - let ``exponent dotless floats should be equal to dotted floats``() = + let ``exponent dotless floats should be equal to dotted floats``() = CompilerAssert.CompileExeAndRun """ if 1e1f <> 10.f then failwith "1e1f <> 10.f" """ [] - let ``exponent dotted floats should be equal to dotless floats``() = + let ``exponent dotted floats should be equal to dotless floats``() = CompilerAssert.CompileExeAndRunWithOptions( [|"--langversion:8.0"|], """ @@ -222,7 +222,7 @@ if 1.0e1f <> 10f then failwith "1.0e1f <> 10f" """) [] - let ``exponent dotless floats should be equal to dotless floats``() = + let ``exponent dotless floats should be equal to dotless floats``() = CompilerAssert.CompileExeAndRunWithOptions( [|"--langversion:8.0"|], """ diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs index 0333711b8ac..3a2d22cc243 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs @@ -17,24 +17,24 @@ module ``Decimal Constants`` = [] let ``Sum of decimal constants``() = - let x = - 1.0E0M + let x = + 1.0E0M + 2.0E1M + 3.0E2M + 4.0E3M + 5.0E4M + 6.0E5M - + 7.0E6M + + 7.0E6M + 8.0E7M - + 9.0E8M + + 9.0E8M + 1.0E-1M + 2.0E-2M - + 3.0E-3M + + 3.0E-3M + 4.0E-4M - + 5.0E-5M - + 6.0E-6M - + 7.0E-7M - + 8.0E-8M + + 5.0E-5M + + 6.0E-6M + + 7.0E-7M + + 8.0E-8M + 9.0E-9M Assert.areEqual 987654321.123456789M x diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs index 46fb01dca01..6f60178418c 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs @@ -24,22 +24,22 @@ module ``Integer Constants`` = let ``Operations with negative integers``() = // Verify the ability to specify negative numbers // (And not get confused wrt subtraction.) - + let fiveMinusSix = 5 - 6 let fiveMinusSeven = 5-7 let negativeSeven = -7 - - Assert.areEqual -1 fiveMinusSix - Assert.areEqual -2 fiveMinusSeven - Assert.areEqual (-1 * 7) negativeSeven + + Assert.areEqual -1 fiveMinusSix + Assert.areEqual -2 fiveMinusSeven + Assert.areEqual (-1 * 7) negativeSeven [] let ``Functions with negative integers``() = // Verify the ability to specify negative numbers // (And not get confused wrt subtraction.) - + let ident x = x let add x y = x + y - + Assert.areEqual -10 (ident -10) Assert.areEqual -10 (add -5 -5) \ No newline at end of file diff --git a/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs b/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs index f90de327250..3ec7bd96529 100644 --- a/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs +++ b/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs @@ -11,7 +11,7 @@ module ``ComputationExpressions`` = let tmp = 1 type Flags = { includeMergeSourcesOverloads: bool; includeBindReturnExtras: bool } - let applicativeLib (opts: Flags) = + let applicativeLib (opts: Flags) = """ /// Used for tracking what operations a Trace builder was asked to perform [] @@ -699,7 +699,7 @@ let ceResult = check "grwerjkrwejgk42" ceResult.Value 2 """ - let overloadLib includeInternalExtensions includeExternalExtensions = + let overloadLib includeInternalExtensions includeExternalExtensions = """ open System diff --git a/tests/fsharp/Compiler/Language/AnonRecordTests.fs b/tests/fsharp/Compiler/Language/AnonRecordTests.fs index 57f50937fc1..3ed7ed56da3 100644 --- a/tests/fsharp/Compiler/Language/AnonRecordTests.fs +++ b/tests/fsharp/Compiler/Language/AnonRecordTests.fs @@ -31,7 +31,7 @@ let sAnon = StructClass() """ type RefClass<'a when 'a : not struct>() = class end let rAnon = RefClass() - """ + """ FSharpDiagnosticSeverity.Error 1 (3, 13, 3, 42) diff --git a/tests/fsharp/Compiler/Language/ComparisonOptimizationTest.fs b/tests/fsharp/Compiler/Language/ComparisonOptimizationTest.fs index 5099728921e..79aee69d405 100644 --- a/tests/fsharp/Compiler/Language/ComparisonOptimizationTest.fs +++ b/tests/fsharp/Compiler/Language/ComparisonOptimizationTest.fs @@ -8,7 +8,7 @@ module ComparisonOptimizationTests = [] let Script_Compare_int() = - let script = + let script = """ module Test open System @@ -16,7 +16,7 @@ open System let f (x: int) (y: int) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -37,7 +37,7 @@ let f (x: int) (y: int) = compare x y [] let Script_Compare_uint() = - let script = + let script = """ module Test open System @@ -45,7 +45,7 @@ open System let f (x: uint) (y: uint) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -66,7 +66,7 @@ let f (x: uint) (y: uint) = compare x y [] let Script_Compare_int64() = - let script = + let script = """ module Test open System @@ -74,7 +74,7 @@ open System let f (x: int64) (y: int64) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -95,7 +95,7 @@ let f (x: int64) (y: int64) = compare x y [] let Script_Compare_uint64() = - let script = + let script = """ module Test open System @@ -103,7 +103,7 @@ open System let f (x: uint64) (y: uint64) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -125,7 +125,7 @@ let f (x: uint64) (y: uint64) = compare x y [] let Script_Compare_int16() = - let script = + let script = """ module Test open System @@ -133,7 +133,7 @@ open System let f (x: int16) (y: int16) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -154,7 +154,7 @@ let f (x: int16) (y: int16) = compare x y [] let Script_Compare_uint16() = - let script = + let script = """ module Test open System @@ -162,7 +162,7 @@ open System let f (x: uint16) (y: uint16) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -183,7 +183,7 @@ let f (x: uint16) (y: uint16) = compare x y [] let Script_Compare_byte() = - let script = + let script = """ module Test open System @@ -191,7 +191,7 @@ open System let f (x: byte) (y: byte) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -213,7 +213,7 @@ let f (x: byte) (y: byte) = compare x y [] let Script_Compare_sbyte() = - let script = + let script = """ module Test open System @@ -221,7 +221,7 @@ open System let f (x: sbyte) (y: sbyte) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -243,7 +243,7 @@ let f (x: sbyte) (y: sbyte) = compare x y [] let Script_Compare_char() = - let script = + let script = """ module Test open System @@ -251,7 +251,7 @@ open System let f (x: char) (y: char) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -272,7 +272,7 @@ let f (x: char) (y: char) = compare x y [] let Script_Compare_bool() = - let script = + let script = """ module Test open System @@ -280,7 +280,7 @@ open System let f (x: bool) (y: bool) = compare x y """ - + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize+"|], script, (fun verifier -> verifier.VerifyIL @@ -296,7 +296,7 @@ let f (x: bool) (y: bool) = compare x y ) - + module Assert = /// Checks that x and y have same sign. diff --git a/tests/fsharp/Compiler/Language/CustomCollectionTests.fs b/tests/fsharp/Compiler/Language/CustomCollectionTests.fs index 2c935b77e53..b4d7e718249 100644 --- a/tests/fsharp/Compiler/Language/CustomCollectionTests.fs +++ b/tests/fsharp/Compiler/Language/CustomCollectionTests.fs @@ -40,7 +40,7 @@ a[^"2"..^"1"] <- "-1" if a["2".."1"] <> "2 1 -1" then failwithf "expected 2 1 -1 but got %A" a["2".."1"] """) - + [] let ``Custom collection with Item and GetReverseIndex should support reverse index indexing``() = CompilerAssert.CompileExeAndRunWithOptions([| "--langversion:preview" |], @@ -128,7 +128,7 @@ let a = foo() if a[^2..1] <> 13 then failwith "expected 13" """) - + [] let ``Custom collection without GetReverseIndex should not support reverse index slicing``() = CompilerAssert.TypeCheckSingleErrorWithOptions [| "--langversion:preview" |] diff --git a/tests/fsharp/Compiler/Language/FixedIndexSliceTests.fs b/tests/fsharp/Compiler/Language/FixedIndexSliceTests.fs index e4d3b4cc680..a0266566529 100644 --- a/tests/fsharp/Compiler/Language/FixedIndexSliceTests.fs +++ b/tests/fsharp/Compiler/Language/FixedIndexSliceTests.fs @@ -8,7 +8,7 @@ open FSharp.Compiler.Diagnostics module FixedIndexSliceTests = // These tests verify that 3D/4D fixed-index slicing works correctly (feature added in F# 5.0) - + [] let ``Fixed index 3d slicing works in langversion 8``() = CompilerAssert.PassWithOptions [| "--langversion:8.0"|] @@ -45,7 +45,7 @@ let _ = arr4.[1, 1, *, 1] let _ = arr4.[1, 1, 1, *] let _ = arr4.[*, 1, 1, 1] """ - + [] let ``Fixed index 3d set slicing works in langversion 8``() = CompilerAssert.PassWithOptions [| "--langversion:8.0"|] diff --git a/tests/fsharp/Compiler/Language/HatDesugaringTests.fs b/tests/fsharp/Compiler/Language/HatDesugaringTests.fs index 2d8b44a0ae7..b133792a79d 100644 --- a/tests/fsharp/Compiler/Language/HatDesugaringTests.fs +++ b/tests/fsharp/Compiler/Language/HatDesugaringTests.fs @@ -19,7 +19,7 @@ let (^) (x: int) (y: int) = x + y if 1 ^ 2 <> 3 then failwithf "expected result to be 3 but got %i" (1 ^ 2) Console.WriteLine() """) - + [] let ``Reverse slicing should work with overloaded infix hat``() = CompilerAssert.CompileExeAndRunWithOptions( @@ -47,7 +47,7 @@ let x = @1 |] [] - let ``Hat operator should not be overloadable as prefix operator``() = + let ``Hat operator should not be overloadable as prefix operator``() = CompilerAssert.ParseWithErrors """ module X diff --git a/tests/fsharp/Compiler/Language/OpenTypeDeclarationTests.fs b/tests/fsharp/Compiler/Language/OpenTypeDeclarationTests.fs index ecdcc8f3f88..24c2a09c8f5 100644 --- a/tests/fsharp/Compiler/Language/OpenTypeDeclarationTests.fs +++ b/tests/fsharp/Compiler/Language/OpenTypeDeclarationTests.fs @@ -850,7 +850,7 @@ module Test = [] let ``Open C# enum should have access to its cases`` () = - let csharp = + let csharp = CSharp """ namespace CSharpTest { diff --git a/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs b/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs index ca911a9bcf1..33a04f47cea 100644 --- a/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs +++ b/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs @@ -241,7 +241,7 @@ let test3 () = IL_00f6: call string [mscorlib]System.String::Concat(string[]) IL_00fb: ret }""" - + let test4Source = """ let test4 () = ss 5 + ss 6 + ss 7 + String.Concat(ss 8, ss 9) + ss 10 + "_50_" + "_60_" + String.Concat(ss 100, String.Concat(ss 101, ss 102), ss 103) + String.Concat([|"_104_";"_105_"|]) + ss 106 @@ -448,7 +448,7 @@ let test4 () = IL_025b: call string [runtime]System.String::Concat(string[]) IL_0260: ret }""" - + let test5Source = """ let test5 () = ss 5 + ss 6 + ss 7 + String.Concat(ss 8, ss 9) + ss 10 + "_50_" + "_60_" + String.Concat(ss 100, (let x = String.Concat(ss 101, ss 102) in Console.WriteLine(x);x), ss 103) + String.Concat([|"_104_";"_105_"|]) + ss 106 @@ -836,7 +836,7 @@ let test9 () = IL_0071: ret }""" - let sources = + let sources = [ baseSource test1Source diff --git a/tests/fsharp/Compiler/Language/StringInterpolation.fs b/tests/fsharp/Compiler/Language/StringInterpolation.fs index 05f0956081a..52f739ff87d 100644 --- a/tests/fsharp/Compiler/Language/StringInterpolation.fs +++ b/tests/fsharp/Compiler/Language/StringInterpolation.fs @@ -776,7 +776,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 "Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression."); (FSharpDiagnosticSeverity.Error, 3374, (9, 62, 9, 66), "Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression.")|] - + [] let ``String interpolation negative incomplete string`` () = let code = """let x1 = $"one %d{System.String.Empty}""" @@ -786,7 +786,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 "Incomplete structured construct at or before this point in binding. Expected interpolated string (final part), interpolated string (part) or other token."); (FSharpDiagnosticSeverity.Error, 3379, (1, 38, 1, 39), "Incomplete interpolated string begun at or before here")|] - + [] let ``String interpolation negative incomplete string fill`` () = let code = """let x1 = $"one %d{System.String.Empty""" @@ -796,7 +796,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 "Incomplete structured construct at or before this point in binding. Expected interpolated string (final part), interpolated string (part) or other token."); (FSharpDiagnosticSeverity.Error, 3378, (1, 18, 1, 19), "Incomplete interpolated string expression fill begun at or before here")|] - + [] let ``String interpolation negative incomplete verbatim string`` () = let code = """let x1 = @$"one %d{System.String.Empty} """ @@ -806,7 +806,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 "Incomplete structured construct at or before this point in binding. Expected interpolated string (final part), interpolated string (part) or other token."); (FSharpDiagnosticSeverity.Error, 3380, (1, 39, 1, 40), "Incomplete interpolated verbatim string begun at or before here")|] - + [] let ``String interpolation negative incomplete triple quote string`` () = let code = "let x1 = $\"\"\"one" diff --git a/tests/fsharp/Compiler/Language/StructActivePatternTests.fs b/tests/fsharp/Compiler/Language/StructActivePatternTests.fs index b5161e471c8..37a84a50bfd 100644 --- a/tests/fsharp/Compiler/Language/StructActivePatternTests.fs +++ b/tests/fsharp/Compiler/Language/StructActivePatternTests.fs @@ -88,7 +88,7 @@ match t4 with """ [] - let ``[] attribute is rotated to the return value``() = + let ``[] attribute is rotated to the return value``() = run """ open System @@ -122,7 +122,7 @@ match ret_attrs, binding_attrs with | _ -> fail $"ret_attrs = {ret_attrs}, binding_attrs = {binding_attrs} method = {method}" """ [] - let ``Implicitly-targeted attribute on let binding do not target return``() = + let ``Implicitly-targeted attribute on let binding do not target return``() = run """ open System @@ -173,7 +173,7 @@ let (|Foo|_|) x = ValueNone [] let ``StructAttribute not allowed on other bindings than partial active pattern definitions`` () = - fail + fail """ [] let x = 1 diff --git a/tests/fsharp/Compiler/Language/TypeAttributeTests.fs b/tests/fsharp/Compiler/Language/TypeAttributeTests.fs index 4e82cce7df3..6fe907508f8 100644 --- a/tests/fsharp/Compiler/Language/TypeAttributeTests.fs +++ b/tests/fsharp/Compiler/Language/TypeAttributeTests.fs @@ -5,17 +5,17 @@ open FSharp.Test open FSharp.Compiler.Diagnostics -module TypeAttributeTests = +module TypeAttributeTests = [] - let ``Attribute can be applied to type definition``() = + let ``Attribute can be applied to type definition``() = CompilerAssert.Pass """ [] type Point = {x:int; y:int} """ [] - let ``Attribute cannot be applied to optional type extension``() = + let ``Attribute cannot be applied to optional type extension``() = CompilerAssert.TypeCheckSingleError """ open System @@ -30,7 +30,7 @@ type String with "Attributes cannot be applied to type extensions." [] - let ``Attribute cannot be applied to intrinsic type extension``() = + let ``Attribute cannot be applied to intrinsic type extension``() = CompilerAssert.TypeCheckSingleError """ type Point = {x:int; y:int} diff --git a/tests/fsharp/Compiler/Language/TypeDirectedConversionTests.fs b/tests/fsharp/Compiler/Language/TypeDirectedConversionTests.fs index 1200b79fcd2..8ee6ea0ac8d 100644 --- a/tests/fsharp/Compiler/Language/TypeDirectedConversionTests.fs +++ b/tests/fsharp/Compiler/Language/TypeDirectedConversionTests.fs @@ -89,7 +89,7 @@ let test() = Thing(Do = 100) """ ])) - + [] let ``int32 converts to System.Nullable in method call property setter``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], @@ -196,7 +196,7 @@ let test() = Thing.Do(true) 'bool' is not compatible with type 'System.Nullable' -""" +""" [] let ``Assigning a 'T value to a System.Nullable<'T> binding succeeds``() = @@ -210,7 +210,7 @@ let test(): System.Nullable = 1 3391 (4, 36, 4, 37) """This expression uses the implicit conversion 'System.Nullable.op_Implicit(value: int) : System.Nullable' to convert type 'int' to type 'System.Nullable'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391".""" - + [] let ``Assigning an int32 to a System.Nullable binding fails``() = CompilerAssert.TypeCheckSingleError @@ -240,8 +240,8 @@ type M() = let test() = M.A(System.Nullable 3) M.A(Result.Ok 3) -""" - +""" + [] let ``Overloading on System.Nullable and Result produces a builtin conversion warning when Nullable is picked``() = @@ -256,12 +256,12 @@ type M() = let test() = M.A(3) -""" +""" FSharpDiagnosticSeverity.Warning 3389 (9, 9, 9, 10) """This expression uses a built-in implicit conversion to convert type 'int' to type 'System.Nullable'. See https://aka.ms/fsharp-implicit-convs.""" - + [] let ``Overloading on System.Nullable, System.Nullable<'T> and int all work without error``() = CompilerAssert.RunScript @@ -349,9 +349,9 @@ Known type of argument: 'T Candidates: - static member M2.A: n: System.Nullable -> unit - static member M2.A: n: System.Nullable -> unit - - static member M2.A: n: int -> unit""") + - static member M2.A: n: int -> unit""") |] - + [] let ``Ambiguous overload for typar does not pick System.Nullable<'T>``() = CompilerAssert.TypeCheckSingleError @@ -377,7 +377,7 @@ Candidates: - static member M.A: n: System.Nullable<'T> -> unit when 'T: (new: unit -> 'T) and 'T: struct and 'T :> System.ValueType - static member M.A: n: float -> unit - static member M.A: n: int -> unit""" - + [] let ``Passing an argument in nested method call property setter works``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], @@ -469,7 +469,7 @@ if test() <> 2 then failwith "Incorrect overload picked" [] let ``Prefer nullable conversion over op_Implicit conversion``() = - + CompilerAssert.RunScript """ type M() = diff --git a/tests/fsharp/Compiler/Language/WitnessTests.fs b/tests/fsharp/Compiler/Language/WitnessTests.fs index 08f20ac8073..08b9a1b3a2a 100644 --- a/tests/fsharp/Compiler/Language/WitnessTests.fs +++ b/tests/fsharp/Compiler/Language/WitnessTests.fs @@ -26,5 +26,5 @@ module WitnessTests = |> shouldSucceed |> ignore #endif - + diff --git a/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs b/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs index 46e10f6605e..d20f9b7ecb0 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs @@ -13,23 +13,23 @@ module ``IEnumerable Tests`` = let mutable dispose_called_in_E = 0 // we expect this to be incremented 3 times let mutable dispose_called_in_C = 0 // we expect this to be incremented once (=this is what the bug was about, i.e. .Dispose() was never invoked) - + type E(_c:int) = class interface System.IDisposable with member _.Dispose () = dispose_called_in_E <- dispose_called_in_E + 1 end - + type C() = class let mutable i = 0 interface System.Collections.IEnumerator with member _.Current with get () = new E(i) :> obj - member _.MoveNext () = - i <- i+1 + member _.MoveNext () = + i <- i+1 i<4 member _.Reset () = i <- 0 interface System.Collections.IEnumerable with member x.GetEnumerator () = x :> System.Collections.IEnumerator - + interface System.IDisposable with member _.Dispose () = dispose_called_in_C <- dispose_called_in_C + 1 end @@ -37,7 +37,7 @@ module ``IEnumerable Tests`` = [] let ``Dispose``() = - let _ = Seq.cast (new C()) |> Seq.map (fun x -> use o = x; + let _ = Seq.cast (new C()) |> Seq.map (fun x -> use o = x; o) |> Seq.length Assert.areEqual 3 dispose_called_in_E diff --git a/tests/fsharp/Compiler/Libraries/Core/Collections/ListTests.fs b/tests/fsharp/Compiler/Libraries/Core/Collections/ListTests.fs index c4eb8cba354..7b49c52de53 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Collections/ListTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Collections/ListTests.fs @@ -23,13 +23,13 @@ List.hd [1] |> ignore (2, 6, 2, 8) "The value, constructor, namespace or type 'hd' is not defined." - - + + [] let ``List tl should not exist``() = // Regression test for FSharp1.0:5641 // Title: List.hd/tl --> List.head/tail - + CompilerAssert.TypeCheckSingleError """ List.tl [1] |> ignore diff --git a/tests/fsharp/Compiler/Libraries/Core/Collections/MapTests.fs b/tests/fsharp/Compiler/Libraries/Core/Collections/MapTests.fs index c9450738b2c..d8d96d1c919 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Collections/MapTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Collections/MapTests.fs @@ -10,6 +10,6 @@ module ``Map Tests`` = [] let ``Equality should be implemented on map``() = // Dev11:19569 - this used to throw an ArgumentException saying Object didn't implement IComparable - + let m = Map.ofArray [| 1, obj() |] (m = m) |> ignore \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/CastToUnitsTests.fs b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/CastToUnitsTests.fs index dde7f59f5d8..19e7e8de21d 100644 --- a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/CastToUnitsTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/CastToUnitsTests.fs @@ -7,7 +7,7 @@ open FSharp.Test module ``Cast to Units Tests`` = - + [] let ``Casting to Measures should compile``() = CompilerAssert.PassWithOptions [| |] diff --git a/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs b/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs index b01da9cd01e..044bb466965 100644 --- a/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs @@ -22,7 +22,7 @@ module ``Stackalloc Tests`` = NativeInterop.NativePtr.set data i now for i = 0 to 99 do Assert.areEqual (NativeInterop.NativePtr.get data i) now - + let later = now.AddDays 1. for i = 0 to 99 do let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) @@ -34,10 +34,10 @@ module ``Stackalloc Tests`` = [] let ``Stackalloc of enum``() = let data = NativeInterop.NativePtr.stackalloc 10 - + for i = 0 to 9 do NativeInterop.NativePtr.set data i (if (i % 2)=0 then E.A else E.B) - + for i = 0 to 9 do let expected = if (i % 2) = 0 then E.A else E.B Assert.areEqual (NativeInterop.NativePtr.get data i) expected @@ -45,7 +45,7 @@ module ``Stackalloc Tests`` = for i = 0 to 9 do let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) datai <- (if (i % 2)=1 then E.A else E.B) - + for i = 0 to 9 do let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) let expected = if (i % 2)=1 then E.A else E.B @@ -101,17 +101,17 @@ let _ = NativeInterop.NativePtr.stackalloc 1 [] let ``Stackalloc of int``() = let data = NativeInterop.NativePtr.stackalloc 100 - + for i = 0 to 99 do NativeInterop.NativePtr.set data i (i*i) - + for i = 0 to 99 do Assert.areEqual (NativeInterop.NativePtr.get data i) (i*i) - + for i = 0 to 99 do let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) datai <- 1-i - + for i = 0 to 99 do let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) Assert.areEqual datai (1-i) @@ -128,7 +128,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 for i = 0 to 99 do let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) datai <- int64 (1-i) - + for i = 0 to 99 do let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) Assert.areEqual datai (int64 (1-i)) @@ -166,17 +166,17 @@ let _ = NativeInterop.NativePtr.stackalloc 1 1 (6, 9, 6, 43) "A generic construct requires that the type 'R' is an unmanaged type" - + [] let ``Stackalloc zero-size``() = // Regression test for FSHARP1.0: // stackalloc 0 - + // check stackalloc 0 -- ok let data = NativeInterop.NativePtr.stackalloc 0 - + // The returned pointer is undefined // No allocation should happen let _ = NativeInterop.NativePtr.toNativeInt data - + () \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/AbsTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/AbsTests.fs index 6e0f1216564..5dc24b8ef8c 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/AbsTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/AbsTests.fs @@ -30,7 +30,7 @@ abs -1uy |> ignore 1 (2, 6, 2, 9) "The type 'byte' does not support the operator 'abs'" - + [] let ``Abs of uint16``() = CompilerAssert.TypeCheckSingleError @@ -61,7 +61,7 @@ abs -1u |> ignore 1 (2, 6, 2, 8) "The type 'uint32' does not support the operator 'abs'" - + [] let ``Abs of unativeint``() = CompilerAssert.TypeCheckSingleError @@ -72,7 +72,7 @@ abs -1un |> ignore 1 (2, 6, 2, 9) "The type 'unativeint' does not support the operator 'abs'" - + [] let ``Abs of uint64``() = CompilerAssert.TypeCheckSingleError @@ -83,7 +83,7 @@ abs -1uL |> ignore 1 (2, 6, 2, 9) "The type 'uint64' does not support the operator 'abs'" - + CompilerAssert.TypeCheckSingleError """ abs -1UL |> ignore diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/HashTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/HashTests.fs index d4d0929242f..3769069dd40 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/HashTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/HashTests.fs @@ -15,7 +15,7 @@ module ``Hash Tests`` = // You should not be able to hash F# function values // Note: most positive cases already covered under fsharp\typecheck\sigs // I'm adding this simple one since I did not see it there. - + CompilerAssert.TypeCheckSingleError """ hash id |> ignore diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/PowTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/PowTests.fs index 2e88c04a1ef..192161153da 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/PowTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/PowTests.fs @@ -6,10 +6,10 @@ open Xunit module ``Pow Tests`` = - + type T() = static let mutable m = false - static member Pow (g: T, _: float) = + static member Pow (g: T, _: float) = m <- true g static member Check() = m diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs index 3153a82d9e9..329e63ce8a0 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs @@ -30,7 +30,7 @@ module ``Round Tests`` = Assert.areEqual (round 1.2m) 1.0m Assert.areEqual (round 1.3m) 1.0m Assert.areEqual (round 1.4m) 1.0m - + // Round down Assert.areEqual (round 1.6) 2.0 Assert.areEqual (round 1.7) 2.0 @@ -44,16 +44,16 @@ module ``Round Tests`` = Assert.areEqual (round 1.7m) 2.0m Assert.areEqual (round 1.8m) 2.0m Assert.areEqual (round 1.9m) 2.0m - + // Midpoint rounding. If between two numbers, round to the 'even' one. - Assert.areEqual (round 1.5 ) 2.0 + Assert.areEqual (round 1.5 ) 2.0 Assert.areEqual (round 1.5f) 2.0f Assert.areEqual (round 1.5m) 2.0m - Assert.areEqual (round 2.5 ) 2.0 + Assert.areEqual (round 2.5 ) 2.0 Assert.areEqual (round 2.5f) 2.0f Assert.areEqual (round 2.5m) 2.0m - + // If not midpoint, round to nearest as usual - Assert.areEqual (round 2.500001 ) 3.0 + Assert.areEqual (round 2.500001 ) 3.0 Assert.areEqual (round 2.500001f) 3.0f Assert.areEqual (round 2.500001m) 3.0m \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/SignTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/SignTests.fs index 14c4ef591e1..5a315184d93 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/SignTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/SignTests.fs @@ -33,7 +33,7 @@ module ``Sign Tests`` = Assert.areEqual (sign -1.0) -1 // double Assert.areEqual (sign -1.0m) -1 // decimal - // #Regression #Libraries #Operators + // #Regression #Libraries #Operators // Test sign function on unsigned primitives, should get error. [] diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs index 3317542d33f..7cbb67d22d3 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs @@ -9,14 +9,14 @@ open FSharp.Test module ``String Tests`` = - type CalcSum(x : int, y: int) = + type CalcSum(x : int, y: int) = let mutable x = x let mutable y = y - + member _.Sum () = x + y - + interface IFormattable with - member x.ToString (format: string, _ : IFormatProvider) = + member x.ToString (format: string, _ : IFormatProvider) = match format with | null | "" | "g" | "G" -> String.Format("X + Y = {0}", x.Sum()) @@ -75,7 +75,7 @@ module ``String Tests`` = type Foo4 = | A = 1s | B = 2s - + [] let ``String of int16 based enum``() = let a = Foo4.A diff --git a/tests/fsharp/Compiler/Libraries/Core/Reflection/PreComputedTupleConstructorTests.fs b/tests/fsharp/Compiler/Libraries/Core/Reflection/PreComputedTupleConstructorTests.fs index 58e695c19d7..be4fd432bc1 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Reflection/PreComputedTupleConstructorTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Reflection/PreComputedTupleConstructorTests.fs @@ -18,7 +18,7 @@ module ``PreComputedTupleConstructor Tests`` = // Regression test for FSHARP1.0:5113 // MT DCR: Reflection.FSharpValue.PreComputeTupleConstructor fails when executed for NetFx 2.0 by a Dev10 compiler - let testDelegate = fun () -> + let testDelegate = fun () -> Reflection.FSharpValue.PreComputeTupleConstructor(typeof) [| box "text"; box 12; |] |> ignore Assert.Throws testDelegate |> ignore \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs b/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs index 781807492c7..9416728d8a9 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs @@ -8,23 +8,23 @@ open FSharp.Test module ``DefaultOf Tests`` = - type DUType = + type DUType = | A | B of int | C of DUType * DUType - + type RecordType = { A : int; B : string; C : DUType } - + type ClassType = string - + type InterfaceType = abstract DoStuff : unit -> unit - + type EnumType = | A = 1 | B = 2 | C = 4 - + type StructType = struct val m_ivalue : int val m_svalue : string diff --git a/tests/fsharp/Compiler/Regressions/ForInDoMutableRegressionTest.fs b/tests/fsharp/Compiler/Regressions/ForInDoMutableRegressionTest.fs index b43ed4a9f71..6676fe723a2 100644 --- a/tests/fsharp/Compiler/Regressions/ForInDoMutableRegressionTest.fs +++ b/tests/fsharp/Compiler/Regressions/ForInDoMutableRegressionTest.fs @@ -11,7 +11,7 @@ module ForInDoMutableRegressionTest = /// This test is to ensure we initialize locals inside loops. [] let Script_ForInDoMutableRegressionTest() = - let script = + let script = """ open System.Collections.Generic diff --git a/tests/fsharp/Compiler/Regressions/IndexerRegressionTests.fs b/tests/fsharp/Compiler/Regressions/IndexerRegressionTests.fs index 93acb0b609b..6ee55d37e40 100644 --- a/tests/fsharp/Compiler/Regressions/IndexerRegressionTests.fs +++ b/tests/fsharp/Compiler/Regressions/IndexerRegressionTests.fs @@ -10,7 +10,7 @@ module IndexerRegressionTests = [] let ``Indexer has qualified type value``() = - CompilerAssert.Pass + CompilerAssert.Pass """ let a = [| 1 |] let f y = a.[y:int] diff --git a/tests/fsharp/Compiler/Service/MultiProjectTests.fs b/tests/fsharp/Compiler/Service/MultiProjectTests.fs index 0fa5d0b1517..2633494f3e4 100644 --- a/tests/fsharp/Compiler/Service/MultiProjectTests.fs +++ b/tests/fsharp/Compiler/Service/MultiProjectTests.fs @@ -47,9 +47,9 @@ namespace CSharpTest let fsOptions = CompilerAssert.DefaultProjectOptions TargetFramework.Current let fsOptions = - { fsOptions with + { fsOptions with ProjectId = Some(Guid.NewGuid().ToString()) - OtherOptions = Array.append fsOptions.OtherOptions [|"""-r:Z:\csharp_test.dll"""|] + OtherOptions = Array.append fsOptions.OtherOptions [|"""-r:Z:\csharp_test.dll"""|] ReferencedProjects = [|csRefProj|] } let fsText = @@ -62,7 +62,7 @@ let test() = CSharpClass() """ |> SourceText.ofString - let _, checkAnswer = + let _, checkAnswer = CompilerAssert.Checker.ParseAndCheckFileInProject("test.fs", 0, fsText, fsOptions) |> Async.RunSynchronouslyImmediate @@ -137,7 +137,7 @@ let test() = let checker = CompilerAssert.Checker // Create an assembly with the module Script1 and function x. - let dllPath1 = + let dllPath1 = createOnDiskCompiledAsDll checker """ module Script1 @@ -146,25 +146,25 @@ let x = 1 """ // Create script with that uses Script1 and function x - let filePath1 = - createOnDisk + let filePath1 = + createOnDisk """ module Script2 let x = Script1.x """ - + try let fsOptions1 = CompilerAssert.DefaultProjectOptions TargetFramework.Current let fsOptions1 = - { fsOptions1 with + { fsOptions1 with ProjectId = Some(Guid.NewGuid().ToString()) OtherOptions = [|"-r:" + dllPath1|] ReferencedProjects = [||] - SourceFiles = [|filePath1|] } + SourceFiles = [|filePath1|] } // Verify that a script using Script1.x works - let checkProjectResults1 = + let checkProjectResults1 = checker.ParseAndCheckProject(fsOptions1) |> Async.RunSynchronouslyImmediate @@ -180,7 +180,7 @@ let y = Script1.y """ // Verify that a script using Script1.x and Script1.y fails - let checkProjectResults2 = + let checkProjectResults2 = checker.ParseAndCheckProject(fsOptions1) |> Async.RunSynchronouslyImmediate @@ -196,7 +196,7 @@ let y = 1 """ // Verify that a script using Script1.x and Script1.y fails - let checkProjectResults3 = + let checkProjectResults3 = checker.ParseAndCheckProject(fsOptions1) |> Async.RunSynchronouslyImmediate @@ -208,4 +208,4 @@ let y = 1 - + diff --git a/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs b/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs index 3025286de04..e954f068ffb 100644 --- a/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs +++ b/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs @@ -35,9 +35,9 @@ module SignatureGenerationTests = |> Array.map (fun s -> s.TrimEnd(' ')) Assert.shouldBeEquivalentTo expected2 actual - + [] - let ``can generate sigs with comments`` () = + let ``can generate sigs with comments`` () = """ namespace Sample @@ -126,9 +126,9 @@ module Inner = /// union member member Thing: int """ - + [] - let ``can generate signatures for autoproperties`` () = + let ``can generate signatures for autoproperties`` () = """ namespace Sample @@ -180,7 +180,7 @@ module Inner = member SomeAutoPropWithGetOnly: string""" [] - let ``can generate attributes for implicit namespace`` () = + let ``can generate attributes for implicit namespace`` () = """ [] module A.B @@ -204,7 +204,7 @@ module Say = val f: a: 'a -> 'a""" [] - let ``can generate attributes for implicit namespace with multiple modules`` () = + let ``can generate attributes for implicit namespace with multiple modules`` () = """ [] module A.B.C.D diff --git a/tests/fsharp/HandleExpects.fs b/tests/fsharp/HandleExpects.fs index 76c5267bacf..7e5853016b1 100644 --- a/tests/fsharp/HandleExpects.fs +++ b/tests/fsharp/HandleExpects.fs @@ -19,7 +19,7 @@ let tryParseSpan (span:string) = let isStringEmpty s = String.IsNullOrWhiteSpace(s) let isStringNotEmpty s = not (isStringEmpty s) let stringToLower s = if isStringNotEmpty s then s.ToLower() else s -let areStringsEqual s1 s2 = String.Compare(s1, s2, StringComparison.OrdinalIgnoreCase) = 0 +let areStringsEqual s1 s2 = String.Compare(s1, s2, StringComparison.OrdinalIgnoreCase) = 0 let areSpansEqual s1 s2 = let span1 = tryParseSpan s1 let span2 = tryParseSpan s2 @@ -39,7 +39,7 @@ let stripFromFileExpectations source = // So we just save it away, remove it from the xml, then read the xml and put it back // Save away the contents of the element and strip it out of expect pattern let content = (matched.Groups.[2]).ToString() - let nocontentxpect = + let nocontentxpect = if isStringEmpty content then expect else expect.Replace(content, "") @@ -94,7 +94,7 @@ let readErrorMessagesFromOutput output = let getMatchForName (name:string) = matched.Groups.[name].ToString() if matched.Success then Some { - source = (getMatchForName "tagSourceFileName") + source = (getMatchForName "tagSourceFileName") status = stringToLower (getMatchForName "tagStatus") id = stringToLower (getMatchForName "tagErrorNo") span = (getMatchForName "tagSpan") diff --git a/tests/fsharp/TypeProviderTests.fs b/tests/fsharp/TypeProviderTests.fs index e0057aef22f..38bb6b46f60 100644 --- a/tests/fsharp/TypeProviderTests.fs +++ b/tests/fsharp/TypeProviderTests.fs @@ -70,7 +70,7 @@ let diamondAssembly () = exec cfg ("." ++ "test3.exe") "" - + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test3.fsx"] @@ -224,7 +224,7 @@ let singleNegTest name = .Replace("",dirp) .Replace("",sprintf "file:///%s" dirp) |> fun txt -> FileSystem.OpenFileForWriteShim(sprintf "%s%s.%sbsl" dirp name pref).Write(txt) - + if name = "ProviderAttribute_EmptyConsume" || name = "providerAttributeErrorConsume" then () else fsc cfg "--define:%s --out:provider_%s.dll -a" name name ["provider.fsx"] @@ -285,14 +285,14 @@ let splitAssembly subdir project = fsc cfg "--out:test.exe -r:provider.dll" ["test.fsx"] begin - + execAndCheckPassed cfg ("." ++ "test.exe") "" end begin - + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] end @@ -323,14 +323,14 @@ let splitAssembly subdir project = fsc cfg "--out:test.exe -r:provider.dll" ["test.fsx"] - begin + begin execAndCheckPassed cfg ("." ++ "test.exe") "" end begin - + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] end diff --git a/tests/fsharp/core/anon/lib.fs b/tests/fsharp/core/anon/lib.fs index 80fb262b44d..e535d3e4d68 100644 --- a/tests/fsharp/core/anon/lib.fs +++ b/tests/fsharp/core/anon/lib.fs @@ -1,33 +1,33 @@ -module AnonLib +module AnonLib let failures = ref [] -let report_failure (s : string) = +let report_failure (s : string) = stderr.Write" NO: " stderr.WriteLine s failures := !failures @ [s] -let test (s : string) b = +let test (s : string) b = stderr.Write(s) if b then stderr.WriteLine " OK" else report_failure (s) -let check (s:string) x1 x2 = +let check (s:string) x1 x2 = stderr.Write(s) if (x1 = x2) then stderr.WriteLine " OK" else (stderr.WriteLine (sprintf " failed, expected %A, got %A" x2 x1); report_failure (s)) -let inline getX (x: ^TX) : ^X = +let inline getX (x: ^TX) : ^X = (^TX : (member get_X : unit -> ^X) (x)) -let inline Y (x: ^TX) : ^X = +let inline Y (x: ^TX) : ^X = (^TX : (member get_Y : unit -> ^X) (x)) -module KindB1 = +module KindB1 = let data1 = {| X = 1 |} @@ -92,25 +92,25 @@ module KindB1 = let testConstrainedAccess = getX {| X = 0 |}, getX data1, getX {| X = 2; Y = "2" |} - check "testConstrainedAccess1" (sprintf "%A" testConstrainedAccess) "(0, 1, 2)" + check "testConstrainedAccess1" (sprintf "%A" testConstrainedAccess) "(0, 1, 2)" let testConstrainedAccess2 = getX (struct {| X = 0 |}), getX data3, getX (struct {| X = 2; Y = "2" |}) - check "testConstrainedAccess2" (sprintf "%A" testConstrainedAccess2) "(0, 1, 2)" + check "testConstrainedAccess2" (sprintf "%A" testConstrainedAccess2) "(0, 1, 2)" -module TestInAttributes = +module TestInAttributes = type FooAttribute(ty: System.Type) = inherit System.Attribute() member x.Type = ty [)>] - type C() = + type C() = member x.P = 1 check "clkwweclk" ((typeof.GetCustomAttributes(typeof,true).[0] :?> FooAttribute).Type) (typeof<{| Field1: int; Field2 : string |}>) -module KindB2 = +module KindB2 = - // Gives object that has full C#-compatible anonymous metadata. Compiles to an instantiation of a generic type in the declaring assembly with appropriate .NET + // Gives object that has full C#-compatible anonymous metadata. Compiles to an instantiation of a generic type in the declaring assembly with appropriate .NET // metadata (property names). The types are CLIMutable to be C#-compatible. The identity of the types are implicitly assembly-qualified. let data1 = {| X = 1 |} @@ -133,7 +133,7 @@ module KindB2 = printfn "{| X = 10 |} = %A" ({| X = 10 |} ) printfn "{| X = 10 ; Y = \"abc\" |} = %A" ({| X = 10 ; Y = "abc"|} ) - + let testConstrainedAccess = getX ({| X = 0 |}), getX data1, getX ({| X = 2; Y = "2" |}) check "cew9cwoi" testConstrainedAccess (0, 1, 2) @@ -142,7 +142,7 @@ module KindB2 = check "cew9cwo3" testConstrainedAccess2 (0, 1, 2) -module CopyAndUpdateOfAnonRecord = +module CopyAndUpdateOfAnonRecord = let data = {| X = 1 |} let data2 = {| data with Y = "1" |} let data3 = {| data with X = "3" |} @@ -154,7 +154,7 @@ module CopyAndUpdateOfAnonRecord = check "fewjkvwno3443" data4.X "3" check "fewjkvwno3443" data4.Y "1" -module CopyAndUpdateOfAnonRecordStruct = +module CopyAndUpdateOfAnonRecordStruct = let data = struct {| X = 1 |} let data2 = struct {| data with Y = "1" |} let data3 = struct {| data with X = "3" |} @@ -166,7 +166,7 @@ module CopyAndUpdateOfAnonRecordStruct = check "fewjkvwno3444" data4.X "3" check "fewjkvwno3442" data4.Y "1" -module CopyAndUpdateOfAnonRecordFromRecord = +module CopyAndUpdateOfAnonRecordFromRecord = type Base = { X : int } let data = { X = 1 } let data2 = {| data with Y = "1" |} @@ -179,7 +179,7 @@ module CopyAndUpdateOfAnonRecordFromRecord = check "fewjkvwno344y" data4.X "3" check "fewjkvwno344b" data4.Y "1" -module CopyAndUpdateOfAnonRecordFromStructRecord = +module CopyAndUpdateOfAnonRecordFromStructRecord = [] type Base = { X : int } let data = { X = 1 } @@ -190,7 +190,7 @@ module CopyAndUpdateOfAnonRecordFromStructRecord = check "fewjkvwno33ej" data2.Y "1" check "fewjkvwno34rs" data3.X "3" -module QuotesNewRecord = +module QuotesNewRecord = open FSharp.Quotations open FSharp.Quotations.Patterns @@ -199,9 +199,9 @@ module QuotesNewRecord = check "gceoijew90ewcw1" (FSharp.Reflection.FSharpType.IsRecord(ty)) true check "gceoijew90ewcw2" (FSharp.Reflection.FSharpType.GetRecordFields(ty).Length) 2 check "gceoijew90ewcw2" ([ for p in FSharp.Reflection.FSharpType.GetRecordFields(ty) -> p.Name ]) [ "X"; "Y" ] - check "gceoijew90ewcw3" args [ <@@ 1 @@>; <@@ "two" @@> ] + check "gceoijew90ewcw3" args [ <@@ 1 @@>; <@@ "two" @@> ] -module QuotesNewRecord2 = +module QuotesNewRecord2 = open FSharp.Quotations open FSharp.Quotations.Patterns @@ -211,52 +211,52 @@ module QuotesNewRecord2 = check "qgceoijew90ewcw2" (FSharp.Reflection.FSharpType.GetRecordFields(ty).Length) 2 // Fields are sorted check "qgceoijew90ewcw2" ([ for p in FSharp.Reflection.FSharpType.GetRecordFields(ty) -> p.Name ]) [ "X"; "Y" ] - check "qgceoijew90ewcw3" args.[0] <@@ 1 @@> - check "qgceoijew90ewcw4" yarg <@@ "two" @@> + check "qgceoijew90ewcw3" args.[0] <@@ 1 @@> + check "qgceoijew90ewcw4" yarg <@@ "two" @@> -module QuotesFieldInitOrder = +module QuotesFieldInitOrder = let mutable x = 1 - let test() = + let test() = x <- 1 {| X = (check "clwknckl1" x 1; x <- x + 1; 3) - Y = (check "cwkencelwe2" x 2; x <- x + 1; 2) + Y = (check "cwkencelwe2" x 2; x <- x + 1; 2) |} |> check "ceweoiwe1" {| Y=2; X=3 |} x <- 1 {| X = (check "clwknckl3" x 1; x <- x + 1; 2) - W = (check "cwkencelwe4" x 2; x <- x + 1; 3) + W = (check "cwkencelwe4" x 2; x <- x + 1; 3) |} |> check "ceweoiwe2" {| W=3; X=2 |} x <- 1 {| X = (check "clwknckl5" x 1; x <- x + 1; 2) Y = (check "clwknckl6" x 2; x <- x + 1; 3) - W = (check "cwkencelwe7" x 3; x <- x + 1; 4) |} + W = (check "cwkencelwe7" x 3; x <- x + 1; 4) |} |> check "ceweoiwe" {| Y=3; X=2; W=4 |} x <- 1 - let a = + let a = {| Y = (check "clwknckl8" x 1; x <- x + 1; 2) X = (check "clwknckl9" x 2; x <- x + 1; 3) - W = (check "cwkencel10" x 3; x <- x + 1; 4) - |} + W = (check "cwkencel10" x 3; x <- x + 1; 4) + |} a |> check "ceweoiwe" {| Y=2; X=3; W=4 |} x <- 1 - let b = - {| a with + let b = + {| a with X = (check "clwknckl9" x 1; x <- x + 1; 6) - W = (check "cwkencel10" x 2; x <- x + 1; 7) - |} + W = (check "cwkencel10" x 2; x <- x + 1; 7) + |} b |> check "ceweoiwe87" {| Y=2; X=6; W=7 |} x <- 1 - let c = - {| a with + let c = + {| a with X = (check "clwknckl9" x 1; x <- x + 1; 6) - A = (check "cwkencel11" x 2; x <- x + 1; 8) - W = (check "cwkencel10" x 3; x <- x + 1; 7) - |} + A = (check "cwkencel11" x 2; x <- x + 1; 8) + W = (check "cwkencel10" x 3; x <- x + 1; 7) + |} c |> check "ceweoiwe87" {| Y=2; X=6; W=7; A=8 |} test() -module QuotesPropertyGet = +module QuotesPropertyGet = open FSharp.Quotations open FSharp.Quotations.Patterns @@ -265,23 +265,23 @@ module QuotesPropertyGet = check "wgceoijew90ewcw1" prop.Name "X" -module SampleAPI = +module SampleAPI = let SampleFunction (arg : {| A: int; B: string |}) = arg.A + arg.B.Length let SampleFunctionAcceptingList (args : {| A: int; B: string |} list) = args |> List.map (fun arg -> arg.A + arg.B.Length) let SampleFunctionReturningAnonRecd () = {| A=1; B = "abc" |} -module SampleAPIStruct = +module SampleAPIStruct = let SampleFunction (arg : (struct {| A: int; B: string |})) = arg.A + arg.B.Length let SampleFunctionAcceptingList (args : (struct {| A: int; B: string |}) list) = args |> List.map (fun arg -> arg.A + arg.B.Length) let SampleFunctionReturningAnonRecd () = struct {| A=1; B = "abc" |} -module SampleAPITupleStruct = +module SampleAPITupleStruct = let SampleFunction ((a,b) : (struct (int * string))) = a + b.Length let SampleFunctionAcceptingList (args : (struct (int * string)) list) = args |> List.map (fun (struct (a,b)) -> a + b.Length) let SampleFunctionReturningStructTuple () = struct (1, "abc") -module SyntaxCornerCaseTests = +module SyntaxCornerCaseTests = let _ = id<{| X: int |}> {| X = 3 |} // Check use as type argument diff --git a/tests/fsharp/core/attributes/testlib.fs b/tests/fsharp/core/attributes/testlib.fs index 076ade4ecd7..fe3d85dd5b8 100644 --- a/tests/fsharp/core/attributes/testlib.fs +++ b/tests/fsharp/core/attributes/testlib.fs @@ -2,7 +2,7 @@ module TestLibModule -module ValAttributesDifferent = +module ValAttributesDifferent = // expect no warning, and attribute to be in compiled code [] let x1 = 1 @@ -21,7 +21,7 @@ module ValAttributesDifferent = -module TyconAttributesDifferent = +module TyconAttributesDifferent = // expect no warning, and attribute to be in compiled code [] type C1 = A | B @@ -39,55 +39,55 @@ module TyconAttributesDifferent = type C4 = A | B -module ModuleAttributesDifferent = +module ModuleAttributesDifferent = // expect no warning, and attribute to be in compiled code [] - module M1 = + module M1 = let x = 1 // expect warning, and attribute from signature to be included [] - module M2 = + module M2 = let x = 1 // expect no warning, and attribute to be in compiled code [] - module M3 = + module M3 = let x = 1 // expect no warning, and attribute to be in compiled code //[] - module M4 = + module M4 = let x = 1 -module UnionCaseAttributesDifferent = +module UnionCaseAttributesDifferent = // expect no warning, and attribute to be in compiled code - type U1 = + type U1 = | [] A of int | B of string // expect warning, and attribute from signature to be included - type U2 = + type U2 = | [] A of int | B of string // expect no warning, and attribute to be in compiled code - type U3 = + type U3 = | [] A of int | B of string // expect no warning, and attribute to be in compiled code - type U4 = + type U4 = | //[] A of int | B of string -module ParamAttributesDifferent = - +module ParamAttributesDifferent = + // identical in signature and implementation let x1 ([] p : int) = p @@ -100,8 +100,8 @@ module ParamAttributesDifferent = // in signature but not implementation let x4 ((* [] *) p : int) = p -module TypeParamAttributesDifferent = - +module TypeParamAttributesDifferent = + // identical in signature and implementation let x1<[] 'T>(x:'T) = x @@ -119,7 +119,7 @@ type ThisLibAssembly = X | Y #if !NETCOREAPP -module Bug719 = +module Bug719 = open System.Runtime.InteropServices diff --git a/tests/fsharp/core/attributes/testlib.fsi b/tests/fsharp/core/attributes/testlib.fsi index 8ad279ae1dd..248535d328b 100644 --- a/tests/fsharp/core/attributes/testlib.fsi +++ b/tests/fsharp/core/attributes/testlib.fsi @@ -3,7 +3,7 @@ module TestLibModule -module ValAttributesDifferent = +module ValAttributesDifferent = [] val x1 : int @@ -16,7 +16,7 @@ module ValAttributesDifferent = [] val x4 : int -module TyconAttributesDifferent = +module TyconAttributesDifferent = [] type C1 = A | B @@ -29,50 +29,50 @@ module TyconAttributesDifferent = [] type C4 = A | B -module ModuleAttributesDifferent = +module ModuleAttributesDifferent = [] - module M1 = + module M1 = val x : int [] - module M2 = + module M2 = val x : int //[] - module M3 = + module M3 = val x : int [] - module M4 = + module M4 = val x : int -module UnionCaseAttributesDifferent = +module UnionCaseAttributesDifferent = // expect no warning, and attribute to be in compiled code - type U1 = + type U1 = | [] A of int | B of string // expect warning, and attribute from signature to be included - type U2 = + type U2 = | [] A of int | B of string // expect no warning, and attribute to be in compiled code - type U3 = + type U3 = // [] | A of int | B of string // expect no warning, and attribute to be in compiled code - type U4 = + type U4 = | [] A of int | B of string -module ParamAttributesDifferent = - +module ParamAttributesDifferent = + // identical in signature and implementation val x1 : [] p : int -> int @@ -85,8 +85,8 @@ module ParamAttributesDifferent = // in signature but not implementation val x4 : [] p : int -> int -module TypeParamAttributesDifferent = - +module TypeParamAttributesDifferent = + // identical in signature and implementation val x1< [] 'T> : 'T -> 'T @@ -99,12 +99,12 @@ module TypeParamAttributesDifferent = // in signature but not implementation val x4< [] 'T> : 'T -> 'T -type ThisLibAssembly +type ThisLibAssembly #if !NETSTANDARD -module Bug719 = +module Bug719 = open System.Runtime.InteropServices diff --git a/tests/fsharp/core/events/test.fs b/tests/fsharp/core/events/test.fs index be202c73261..913965f8525 100644 --- a/tests/fsharp/core/events/test.fs +++ b/tests/fsharp/core/events/test.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #Events #Regression #Interop +// #Regression #Conformance #Events #Regression #Interop module Test @@ -6,11 +6,11 @@ module Test let mutable failures = [] let report_failure s = failures <- failures @ [s] let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else stderr.WriteLine " NO"; report_failure s -let check s b1 b2 = - stderr.Write(s:string); - if b1 = b2 then - stderr.WriteLine " OK" - else +let check s b1 b2 = + stderr.Write(s:string); + if b1 = b2 then + stderr.WriteLine " OK" + else printfn ", FAILED: expected %A, got %A" b2 b1; report_failure s @@ -19,17 +19,17 @@ open System.Drawing open System.ComponentModel open System.Windows.Forms -module EventTest2 = +module EventTest2 = - type SomeComponent() = + type SomeComponent() = let ev1 = new Event() let ev2 = new Event() - [] + [] member x.SomeEvent = ev1.Publish - [] + [] member x.Paint = ev2.Publish member x.Fire() = ev1.Trigger("hello"); ev2.Trigger(new EventArgs()) - + let mk() = new SomeComponent() let fire (c:SomeComponent) = c.Fire() @@ -48,85 +48,85 @@ module AbstractEventTests = type ChannelChangedHandler = delegate of obj * int -> unit - type C() = + type C() = let channelChanged = new Event() static let defaultChannelChanged = new Event() - [] + [] member self.ChannelChanged = channelChanged.Publish member self.ChangeChannel(n) = channelChanged.Trigger(self,n) - [] + [] static member DefaultChannelChanged = defaultChannelChanged.Publish static member ChangeDefaultChannel(n) = defaultChannelChanged.Trigger(null,n) - type I = - [] + type I = + [] abstract member ChannelChanged : IEvent - type ImplI() = + type ImplI() = let channelChanged = new Event() member self.ChangeChannel(n) = channelChanged.Trigger(self,n) - interface I with - [] + interface I with + [] member self.ChannelChanged = channelChanged.Publish - type FrameworkImplI() = + type FrameworkImplI() = let channelChanged = new Event() member self.ChangeChannel(n) = channelChanged.Trigger(self,n) - interface System.ComponentModel.INotifyPropertyChanged with - [] + interface System.ComponentModel.INotifyPropertyChanged with + [] override self.PropertyChanged = channelChanged.Publish [] - type Base() = - [] + type Base() = + [] abstract member ChannelChanged : IEvent - type Derived() = + type Derived() = inherit Base() let channelChanged = new Event() member self.ChangeChannel(n) = channelChanged.Trigger(self,n) - [] + [] override self.ChannelChanged = channelChanged.Publish - let ObjectImplI() = + let ObjectImplI() = let channelChanged = new Event() - channelChanged.Trigger, - { new I with - [] + channelChanged.Trigger, + { new I with + [] member self.ChannelChanged = channelChanged.Publish } - let ObjectFrameworkImplI() = + let ObjectFrameworkImplI() = let channelChanged = new Event() channelChanged.Trigger, - { new System.ComponentModel.INotifyPropertyChanged with - [] + { new System.ComponentModel.INotifyPropertyChanged with + [] override self.PropertyChanged = channelChanged.Publish } - let ObjectDerived() = + let ObjectDerived() = let channelChanged = new Event() - channelChanged.Trigger, + channelChanged.Trigger, { new Base() with - [] + [] override self.ChannelChanged = channelChanged.Publish } - let test(ev:IEvent, change) = - let r = ref 0 + let test(ev:IEvent, change) = + let r = ref 0 let h1 = ChannelChangedHandler(fun sender channel -> r := channel) ev.AddHandler(h1) change(3) @@ -135,7 +135,7 @@ module AbstractEventTests = change(4) check "02374enw2" !r 3 - let r = ref 0 + let r = ref 0 let h1 = ChannelChangedHandler(fun sender channel -> r := channel) let h2 = ChannelChangedHandler(fun sender channel -> r := channel+1) ev.AddHandler(h1) @@ -163,85 +163,85 @@ module AbstractEventTests = test(ev3,d.ChangeChannel) test(ev4,impl.ChangeChannel) -module EventCombinators = +module EventCombinators = type ChannelChangedHandler = delegate of obj * int -> unit - module Observable = - let catch (e: IObservable<'T>) = - { new IObservable<_> with - member __.Subscribe(o:IObserver<_>) = - e.Subscribe({ new IObserver<_> with + module Observable = + let catch (e: IObservable<'T>) = + { new IObservable<_> with + member __.Subscribe(o:IObserver<_>) = + e.Subscribe({ new IObserver<_> with member x.OnNext(v) = o.OnNext(Choice1Of2 v) member x.OnError(e) = o.OnNext(Choice2Of2 e) member x.OnCompleted() = o.OnCompleted() }) } - - let empty () = - { new IObservable<_> with - member __.Subscribe(o:IObserver<_>) = o.OnCompleted(); { new System.IDisposable with + + let empty () = + { new IObservable<_> with + member __.Subscribe(o:IObserver<_>) = o.OnCompleted(); { new System.IDisposable with member __.Dispose() = () } } - - let error f (e: IObservable<'T>) = - e.Subscribe({ new IObserver<'T> with + + let error f (e: IObservable<'T>) = + e.Subscribe({ new IObserver<'T> with member x.OnNext(v) = () member x.OnError(e) = f e - member x.OnCompleted() = () }) + member x.OnCompleted() = () }) |> ignore - - let completed f (e: IObservable<'T>) = - e.Subscribe({ new IObserver<'T> with + + let completed f (e: IObservable<'T>) = + e.Subscribe({ new IObserver<'T> with member x.OnNext(v) = () member x.OnError(e) = () - member x.OnCompleted() = f () }) + member x.OnCompleted() = f () }) |> ignore - - let fail () = - { new IObservable<_> with - member __.Subscribe(o:IObserver<_>) = - o.OnError( Failure "fail"); - { new System.IDisposable with + + let fail () = + { new IObservable<_> with + member __.Subscribe(o:IObserver<_>) = + o.OnError( Failure "fail"); + { new System.IDisposable with member __.Dispose() = () } } // Observers should ignore subsequent failures - let failTwice () = - { new IObservable<_> with - member __.Subscribe(o:IObserver<_>) = - o.OnError( Failure "fail1"); - o.OnError( Failure "fail2"); - { new System.IDisposable with + let failTwice () = + { new IObservable<_> with + member __.Subscribe(o:IObserver<_>) = + o.OnError( Failure "fail1"); + o.OnError( Failure "fail2"); + { new System.IDisposable with member __.Dispose() = () } } - type C() = + type C() = let channelChanged = new Event() static let defaultChannelChanged = new Event() - [] + [] member self.ChannelChanged = channelChanged.Publish member self.ChangeChannel(n) = channelChanged.Trigger(self,n) - [] + [] static member DefaultChannelChanged = defaultChannelChanged.Publish static member ChangeDefaultChannel(n) = defaultChannelChanged.Trigger(null,n) - module TestListen = + module TestListen = let c1 = C() - - let result = ref 0 + + let result = ref 0 c1.ChannelChanged |> Observable.add (fun x -> result := x) c1.ChangeChannel(6) check "e89e0jrweoi1" !result 6 c1.ChannelChanged |> Observable.add (fun x -> result := x + 1) c1.ChangeChannel(6) check "e89e0jrweoi2" !result 7 - - module TestChoose = + + module TestChoose = let c2 = C() - - let result = ref 0 + + let result = ref 0 c2.ChannelChanged |> Observable.choose (fun x -> None) |> Observable.add (fun x -> result := x) c2.ChangeChannel(6) check "e89e0jrweoi3" !result 0 @@ -250,40 +250,40 @@ module EventCombinators = c2.ChangeChannel(6) check "e89e0jrweoi4d" !result 1 - + c2.ChannelChanged |> Observable.choose (fun x -> failwith "bad choice") |> Observable.error (fun e -> result := e.Message.Length) c2.ChangeChannel(6) check "e89e0jrweoi4e" !result (String.length "bad choice") - + result := 0 Observable.empty() |> Observable.completed (fun e -> result := 101 ) check "e89e0jrweoi4f" !result 101 - + result := 0 Observable.empty() |> Observable.choose (fun x -> Some 1) |> Observable.completed (fun e -> result := 101 ) check "e89e0jrweoi4g" !result 101 - - result := 0 + + result := 0 Observable.fail() |> Observable.choose (fun x -> Some 1) |> Observable.completed (fun e -> result := 101 ) // completed should not be called on error check "e89e0jrweoi4g" !result 0 - - result := 0 + + result := 0 Observable.fail() |> Observable.choose (fun x -> Some 1) |> Observable.error (fun e -> result := 101 ) // OnError should be called on error check "e89e0jrweoi4g" !result 101 - - result := 0 + + result := 0 Observable.failTwice() |> Observable.choose (fun x -> Some 1) |> Observable.error (fun e -> result := 101 ) // subsequent errors should be ignored check "e89e0jrweoi4g" !result 101 - - module TestFilter = + + module TestFilter = let c2 = C() - - let result = ref 0 + + let result = ref 0 c2.ChannelChanged |> Observable.filter (fun x -> false) |> Observable.add (fun x -> result := x) c2.ChangeChannel(6) check "e89e0jrweoi5" !result 0 @@ -291,12 +291,12 @@ module EventCombinators = c2.ChannelChanged |> Observable.filter (fun x -> true) |> Observable.add (fun x -> result := x) c2.ChangeChannel(6) check "e89e0jrweoi6" !result 6 - + c2.ChannelChanged |> Observable.filter (fun x -> failwith "bad choice") |> Observable.error (fun e -> result := e.Message.Length) c2.ChangeChannel(6) check "e89e0jrweoi4h" !result (String.length "bad choice") - + result := 0 Observable.empty() |> Observable.filter (fun x -> false) |> Observable.completed (fun e -> result := 101 ) check "e89e0jrweoi4i" !result 101 @@ -314,9 +314,9 @@ module EventCombinators = // completed should not be called on error check "e89e0jrweoi4jC" !result 0 - module TestMap = + module TestMap = let c2 = C() - + let result = ref "" c2.ChannelChanged |> Observable.map string |> Observable.add (fun x -> result := x) @@ -326,8 +326,8 @@ module EventCombinators = c2.ChannelChanged |> Observable.map (fun x -> string (x + 1)) |> Observable.add (fun x -> result := x) c2.ChangeChannel(6) check "e89e0jrweoi8" !result "7" - - + + c2.ChannelChanged |> Observable.map (fun x -> failwith "bad choice") |> Observable.error (fun e -> result := e.Message) c2.ChangeChannel(6) @@ -345,12 +345,12 @@ module EventCombinators = Observable.failTwice() |> Observable.map (fun x -> x + 1) |> Observable.completed (fun e -> result := !result + "101" ) // completed should not be called on error check "e89e0jrweoi4jD" !result "" - - - module TestMerge = + + + module TestMerge = let c2 = C() let c3 = C() - + let result = ref 0 (c2.ChannelChanged,c3.ChannelChanged) ||> Observable.merge |> Observable.add (fun x -> result := x) @@ -369,18 +369,18 @@ module EventCombinators = (Observable.fail(), Observable.fail()) ||> Observable.merge |> Observable.error (fun e -> result := !result + 101 ) // should only get one error signal check "e89e0jrweoi4n" !result 101 - + result := 0 (Observable.failTwice(), Observable.failTwice()) ||> Observable.merge |> Observable.error (fun e -> result := !result + 101 ) // should only get one error signal check "e89e0jrweoi4n" !result 101 - + result := 0 (Observable.failTwice(), Observable.failTwice()) ||> Observable.merge |> Observable.completed (fun e -> result := !result + 101 ) // completed should not be called on error check "e89e0jrweoi4nX" !result 0 - - module TestPairwise = + + module TestPairwise = let c2 = C() let result = ref (0,0) @@ -391,7 +391,7 @@ module EventCombinators = check "e89e0jrweoi12" !result (6,7) c2.ChangeChannel(8) check "e89e0jrweoi13" !result (7,8) - + result := (0,0) Observable.failTwice() |> Observable.pairwise |> Observable.error (fun e -> result := (fst !result + 101, snd !result + 102) ) check "e89e0jrweoi4jA" !result (101,102) @@ -405,13 +405,13 @@ module EventCombinators = Observable.fail() |> Observable.pairwise |> Observable.completed (fun e -> result := (10,11)) check "e89e0jrweoi4jA2" !result (0,0) - - module TestPartition = + + module TestPartition = let c2 = C() let resulta = ref 0 let resultb = ref 0 - let c2a, c2b = c2.ChannelChanged |> Observable.partition (fun x -> x < 2) + let c2a, c2b = c2.ChannelChanged |> Observable.partition (fun x -> x < 2) c2a |> Observable.add (fun x -> resulta := x) c2b |> Observable.add (fun x -> resultb := x) c2.ChangeChannel(6) @@ -430,13 +430,13 @@ module EventCombinators = c2.ChannelChanged |> Observable.partition (fun x -> failwith "bad choice") |> fst |> Observable.error (fun e -> resulta := e.Message.Length) c2.ChangeChannel(6) check "e89e0jrweoi4a" !resulta (String.length "bad choice") - + c2.ChannelChanged |> Observable.partition (fun x -> failwith "bad choice2") |> snd |> Observable.error (fun e -> resultb := e.Message.Length) c2.ChangeChannel(6) check "e89e0jrweoi4b" !resultb (String.length "bad choice2") - - - module TestScan = + + + module TestScan = let c2 = C() let result = ref 0 @@ -468,12 +468,12 @@ module CheckEventMembersAreNotMoreGeneric = type T() = [] member x.Event = Event<_>().Publish - + (T().Event : IEvent) |> ignore // this was previously giving an error saying "one type parameter expected" -module CLIEventIsInBaseType_FSHarp_1_0_6381 = - module ActualRepro = +module CLIEventIsInBaseType_FSHarp_1_0_6381 = + module ActualRepro = type IBase = abstract BaseProp : string [] @@ -489,7 +489,7 @@ module CLIEventIsInBaseType_FSHarp_1_0_6381 = printfn "%s" z.BaseProp // ok z.SettingChanged |> Event.add(fun x -> printfn "%d" x) // compiler went boom - module GenericCase = + module GenericCase = type IBase<'T> = abstract BaseProp : string [] @@ -518,7 +518,7 @@ module EventWithNonPublicDelegateTypes_DevDiv271288 = // Same as above, "public" instead of "internal" module WithPublic = - type public RequestFinishedDelegate = delegate of obj * unit -> unit + type public RequestFinishedDelegate = delegate of obj * unit -> unit let private requestFinishedEvent = Event() let _ = let p = requestFinishedEvent.Publish @@ -534,8 +534,8 @@ module EventWithNonPublicDelegateTypes_DevDiv271288 = use s = p.Subscribe(fun (_,_) -> printfn "called EventWithNonPublicDelegateTypes_DevDiv271288.AnotherVariation: OK") requestFinishedEvent.Trigger( null, ((), ()) ) -let _ = - if failures.Length > 0 then (printfn "Tests Failed: %A" failures; exit 1) - else (stdout.WriteLine "Test Passed"; - printf "TEST PASSED OK"; +let _ = + if failures.Length > 0 then (printfn "Tests Failed: %A" failures; exit 1) + else (stdout.WriteLine "Test Passed"; + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/forwarders/c.fs b/tests/fsharp/core/forwarders/c.fs index a7f3599c462..95f79b35af4 100644 --- a/tests/fsharp/core/forwarders/c.fs +++ b/tests/fsharp/core/forwarders/c.fs @@ -2,7 +2,7 @@ -module UseForwardedTypes +module UseForwardedTypes let CreateC() = new C() let CreateD() = new D() diff --git a/tests/fsharp/core/forwarders/test.fs b/tests/fsharp/core/forwarders/test.fs index 69d9895c01e..baba5abb2f7 100644 --- a/tests/fsharp/core/forwarders/test.fs +++ b/tests/fsharp/core/forwarders/test.fs @@ -1,4 +1,4 @@ -// #Conformance #Interop #Multitargeting +// #Conformance #Interop #Multitargeting // See notes in a.cs diff --git a/tests/fsharp/core/fsfromcs/lib.fs b/tests/fsharp/core/fsfromcs/lib.fs index 1ca7ef43135..2b9b4466016 100644 --- a/tests/fsharp/core/fsfromcs/lib.fs +++ b/tests/fsharp/core/fsfromcs/lib.fs @@ -12,7 +12,7 @@ type One = One type Int = Int of int type IntPair = IntPair of int * int type IntPear = | IntPear : Fst: int * Snd: int -> IntPear -type BigUnion = +type BigUnion = | A1 of int | A2 of int | A3 of int @@ -23,27 +23,27 @@ type BigUnion = | A8 of int | A9 of int -type BigEnum = - | E1 - | E2 - | E3 - | E4 - | E5 - | E6 - | E7 - | E8 - | E9 +type BigEnum = + | E1 + | E2 + | E3 + | E4 + | E5 + | E6 + | E7 + | E8 + | E9 type Bool = True | False type IntOption = Nothing | Something : Item: int -> IntOption type OptionalInt = SOME of int | NONE type Index = Index_A of int | Index_B of int -type GenericUnion<'T,'U> = - | Nothing +type GenericUnion<'T,'U> = + | Nothing | Something of 'T * 'U - | SomethingElse of 'T - | SomethingElseAgain of 'T + | SomethingElse of 'T + | SomethingElseAgain of 'T type Discr3_0_0_0 = Discr3_0_0_0_A | Discr3_0_0_0_B | Discr3_0_0_0_C type Discr3_0_1_0 = Discr3_0_1_0_A | Discr3_0_1_0_B of int | Discr3_0_0_0_C diff --git a/tests/fsharp/core/fsfromfsviacs/lib.fs b/tests/fsharp/core/fsfromfsviacs/lib.fs index 164c8bd90ef..8bd74c77beb 100644 --- a/tests/fsharp/core/fsfromfsviacs/lib.fs +++ b/tests/fsharp/core/fsfromfsviacs/lib.fs @@ -46,7 +46,7 @@ type OptionalParameterTests = static member MethodWithOptionalParam<'T>(?value : 'T) = value static member MethodWithOptionalParams<'T>(?value1 : 'T, ?value2 : int) = (value1, value2) - static member FSharpMethodThatConsumesOptionalParams() = + static member FSharpMethodThatConsumesOptionalParams() = let _ = OptionalParameterTests.MethodWithOptionalParams() let _ = OptionalParameterTests.MethodWithOptionalParams(42) let _ = OptionalParameterTests.MethodWithOptionalParams(value2 = 42) @@ -90,34 +90,34 @@ module NestedStructUnionsTests = type U2 = U2 of U1 * U1 - let testPattern1(u2:U2) = + let testPattern1(u2:U2) = match u2 with | U2(u1a,u1b) -> - match u1a, u1b with + match u1a, u1b with | U1(dt1,s1), U1(dt2,s2) -> (dt1 = dt2) && (s1 = "a") && (s2 = "b") - let testPattern2(u2:U2) = + let testPattern2(u2:U2) = match u2 with | U2(U1(dt1,s1),U1(dt2,s2)) -> (dt1 = dt2) && (s1 = "a") && (s2 = "b") - let testPattern3(u2:U2) = + let testPattern3(u2:U2) = match u2 with - | U2(U1(dt1,"a"),U1(dt2,"b")) -> (dt1 = dt2) + | U2(U1(dt1,"a"),U1(dt2,"b")) -> (dt1 = dt2) - let testPattern1mut(u2:U2) = + let testPattern1mut(u2:U2) = let mutable u2 = u2 match u2 with | U2(u1a,u1b) -> - match u1a, u1b with + match u1a, u1b with | U1(dt1,s1), U1(dt2,s2) -> (dt1 = dt2) && (s1 = "a") && (s2 = "b") - let testPattern2mut(u2:U2) = + let testPattern2mut(u2:U2) = let mutable u2 = u2 match u2 with | U2(U1(dt1,s1),U1(dt2,s2)) -> (dt1 = dt2) && (s1 = "a") && (s2 = "b") - let testPattern3mut(u2:U2) = + let testPattern3mut(u2:U2) = let mutable u2 = u2 match u2 with - | U2(U1(dt1,"a"),U1(dt2,"b")) -> (dt1 = dt2) \ No newline at end of file + | U2(U1(dt1,"a"),U1(dt2,"b")) -> (dt1 = dt2) \ No newline at end of file diff --git a/tests/fsharp/core/fsi-reference/ImplementationAssembly.fs b/tests/fsharp/core/fsi-reference/ImplementationAssembly.fs index fd34f01b9d0..3395319bf1d 100644 --- a/tests/fsharp/core/fsi-reference/ImplementationAssembly.fs +++ b/tests/fsharp/core/fsi-reference/ImplementationAssembly.fs @@ -1,4 +1,4 @@ namespace ReferenceAssembly -type MyClass() = +type MyClass() = member this.X = printfn "Implemented MyClass.X in F#" diff --git a/tests/fsharp/core/fsi-reference/ReferenceAssembly.fs b/tests/fsharp/core/fsi-reference/ReferenceAssembly.fs index 960b3baf7b4..1f0b8fde6b9 100644 --- a/tests/fsharp/core/fsi-reference/ReferenceAssembly.fs +++ b/tests/fsharp/core/fsi-reference/ReferenceAssembly.fs @@ -1,4 +1,4 @@ namespace ReferenceAssembly -type MyClass() = +type MyClass() = member this.X = raise (new System.NotImplementedException("Not Implemented !!!!!!!!!")) diff --git a/tests/fsharp/core/fsi-shadowcopy/Library1.fs b/tests/fsharp/core/fsi-shadowcopy/Library1.fs index 382add3251c..4347dfb5451 100644 --- a/tests/fsharp/core/fsi-shadowcopy/Library1.fs +++ b/tests/fsharp/core/fsi-shadowcopy/Library1.fs @@ -1,4 +1,4 @@ namespace Library1 -type Class1() = +type Class1() = member this.X = "C#" diff --git a/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs b/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs index 330bfa99801..b54cdc6953a 100644 --- a/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs +++ b/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs @@ -2,209 +2,209 @@ let rnd = new System.Random() -let expectedValues() = +let expectedValues() = let x = 1 - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else 4 printfn "expectedValues() = %A" (expectedValues()) printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs b/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs index 71c3dec00a3..55fd7cb06f4 100644 --- a/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs +++ b/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs @@ -2,423 +2,423 @@ let rnd = new System.Random() -let expectedValues() = +let expectedValues() = let x = 1 - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else - if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else + if rnd.Next(3) = 1 then 1 else 4 printfn "expectedValues() = %A" (expectedValues()) printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/lets/LargeLets-500.fs b/tests/fsharp/core/large/lets/LargeLets-500.fs index d4e5f29e270..fd02b6a25b2 100644 --- a/tests/fsharp/core/large/lets/LargeLets-500.fs +++ b/tests/fsharp/core/large/lets/LargeLets-500.fs @@ -2,508 +2,508 @@ let rnd = new System.Random() -let expectedValues() = +let expectedValues() = let x = 1 - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) printf "TEST PASSED OK" ; diff --git a/tests/fsharp/core/large/lets/LargeLets-maxtested.fs b/tests/fsharp/core/large/lets/LargeLets-maxtested.fs index 2c9a0ee6007..764445d1cd2 100644 --- a/tests/fsharp/core/large/lets/LargeLets-maxtested.fs +++ b/tests/fsharp/core/large/lets/LargeLets-maxtested.fs @@ -2,794 +2,794 @@ let rnd = new System.Random() -let expectedValues() = +let expectedValues() = let x = 1 - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) - let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) + let x = x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) printf "TEST PASSED OK" ; diff --git a/tests/fsharp/core/large/lists/LargeList-500.fs b/tests/fsharp/core/large/lists/LargeList-500.fs index 0b610e54c1d..aeb9b4fc093 100644 --- a/tests/fsharp/core/large/lists/LargeList-500.fs +++ b/tests/fsharp/core/large/lists/LargeList-500.fs @@ -1,507 +1,507 @@ module TestData -let expectedValues = +let expectedValues = [ - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 ] printfn "length = %d" expectedValues.Length printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/matches/LargeMatches-200.fs b/tests/fsharp/core/large/matches/LargeMatches-200.fs index 33624f1275b..6b9af558ed1 100644 --- a/tests/fsharp/core/large/matches/LargeMatches-200.fs +++ b/tests/fsharp/core/large/matches/LargeMatches-200.fs @@ -2,308 +2,308 @@ let rnd = new System.Random() let r() = if rnd.Next(3) > 1 then Some 4 else None -let expectedValues() = +let expectedValues() = let x = 1 - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> 4 printfn "expectedValues() = %A" (expectedValues()) printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs b/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs index 1c992ab7a43..73bac0483b0 100644 --- a/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs +++ b/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs @@ -2,464 +2,464 @@ let rnd = new System.Random() let r() = if rnd.Next(3) > 1 then Some 4 else None -let expectedValues() = +let expectedValues() = let x = 1 - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> - match r() with - | Some x -> x - | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> + match r() with + | Some x -> x + | None -> 4 printfn "expectedValues() = %A" (expectedValues()) printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs b/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs index 966651362be..7982de56f2d 100644 --- a/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs +++ b/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs @@ -2,1009 +2,1009 @@ let rnd = new System.Random() -let expectedValues() = +let expectedValues() = let mutable x = 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 x printfn "expectedValues() = %A" (expectedValues()) diff --git a/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs b/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs index 966651362be..7982de56f2d 100644 --- a/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs +++ b/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs @@ -2,1009 +2,1009 @@ let rnd = new System.Random() -let expectedValues() = +let expectedValues() = let mutable x = 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) let mutable x = x + 1 x printfn "expectedValues() = %A" (expectedValues()) diff --git a/tests/fsharp/core/large/sequential/LargeSequential-500.fs b/tests/fsharp/core/large/sequential/LargeSequential-500.fs index 98709915acc..6e186424a73 100644 --- a/tests/fsharp/core/large/sequential/LargeSequential-500.fs +++ b/tests/fsharp/core/large/sequential/LargeSequential-500.fs @@ -2,508 +2,508 @@ let rnd = new System.Random() -let expectedValues() = +let expectedValues() = let mutable x = 1 - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs b/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs index b5fcb01d945..5ad3bc76901 100644 --- a/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs +++ b/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs @@ -2,6714 +2,6714 @@ let rnd = new System.Random() -let expectedValues() = +let expectedValues() = let mutable x = 1 - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) - x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) + x <- x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/letrec-mutrec/test.fs b/tests/fsharp/core/letrec-mutrec/test.fs index 720b441cb38..b9f89cb0cb2 100644 --- a/tests/fsharp/core/letrec-mutrec/test.fs +++ b/tests/fsharp/core/letrec-mutrec/test.fs @@ -1,37 +1,37 @@ -// #Conformance #LetBindings #Recursion #TypeInference #ObjectConstructors #Classes #Records +// #Conformance #LetBindings #Recursion #TypeInference #ObjectConstructors #Classes #Records module rec Core_letrec_mutrec let failures = ref false -let report_failure s = +let report_failure s = stderr.WriteLine ("FAIL: "+s); failures := true -let test t s1 s2 = - if s1 <> s2 then +let test t s1 s2 = + if s1 <> s2 then (stderr.WriteLine ("test "+t+" failed"); failures := true) else - stdout.WriteLine ("test "+t+" succeeded") + stdout.WriteLine ("test "+t+" succeeded") -let f = - let x = ref 0 in +let f = + let x = ref 0 in fun () -> x := !x + 1; let rec g n = if (n = 0) then 1 else h(n-1) - and h n = if (n = 0) then 2 else g(n-1) in + and h n = if (n = 0) then 2 else g(n-1) in g !x -do if f() <> 2 then report_failure "ewiucew" -do if f() <> 1 then report_failure "ewiew8w" +do if f() <> 2 then report_failure "ewiucew" +do if f() <> 1 then report_failure "ewiew8w" -let nestedInnerRec2 = - let x = ref 0 in +let nestedInnerRec2 = + let x = ref 0 in fun () -> x := !x + 1; let rec g n = if (n = 0) then !x + 100 else h(n-1) - and h n = if (n = 0) then !x + 200 else g(n-1) in + and h n = if (n = 0) then !x + 200 else g(n-1) in g !x do if nestedInnerRec2() <> 201 then report_failure "ewiucew" @@ -48,8 +48,8 @@ type myRecType = { f1: int; f2: myRecType } let x = { f1=3; f2=x } let y1 = { f1=3; f2=y2 } let y2 = { f1=3; f2=y1 } -let f2 = - let x = ref 0 in +let f2 = + let x = ref 0 in fun () -> x := !x + 1; let rec y = { f1=3; f2=y } in @@ -84,7 +84,7 @@ do if z2.g2.contents.g1 <> 3 then report_failure "ceewieds32w8w" let apply f x = f x let dec n = (n:int) (* -1 *) - + let inner () = let rec odd n = if n=1 then true else not (even (dec n)) @@ -93,12 +93,12 @@ let inner () = even 99 (* -------------------------------------------------------------------- - * Polymorphic letrec where not all bindings get qualified by all type + * Polymorphic letrec where not all bindings get qualified by all type * variables. Surprisingly hard to get right in a type-preserving * compiler. * -------------------------------------------------------------------- *) -module PartiallyPolymorphicLetRecTest = +module PartiallyPolymorphicLetRecTest = let f x = g (fun y -> ()) let g h = () @@ -106,81 +106,81 @@ module PartiallyPolymorphicLetRecTest = let f2 x = g2 (fun y -> ()); g2 (fun z -> ()) let g2 h = () - + let f3 x = g3 (fun y -> ()); g3 (fun z -> ()) let g3 h = h3 (fun z -> ()) let h3 h = () -module GeneralizeObjectExpressions = +module GeneralizeObjectExpressions = - type IPattern<'a,'b> = + type IPattern<'a,'b> = abstract Query : ('b -> 'a option) abstract Make : ('a -> 'b) - let ApCons = { new IPattern<'a * 'a list, 'a list> with - member __.Query = fun xs -> match xs with y::ys -> Some (y,ys) | _ -> None + let ApCons = { new IPattern<'a * 'a list, 'a list> with + member __.Query = fun xs -> match xs with y::ys -> Some (y,ys) | _ -> None member __.Make = fun (x,xs) -> x::xs } - let ApNil = { new IPattern with - member __.Query = fun xs -> match xs with [] -> Some () | _ -> None + let ApNil = { new IPattern with + member __.Query = fun xs -> match xs with [] -> Some () | _ -> None member __.Make = fun () -> [] } let x1 = ApCons : IPattern - let x2 = ApCons : IPattern + let x2 = ApCons : IPattern let y1 = ApNil : IPattern let y2 = ApNil : IPattern - -module GeneralizeObjectExpressions2 = - type IPattern<'a,'b> = +module GeneralizeObjectExpressions2 = + + type IPattern<'a,'b> = abstract Query : ('b -> 'a option) abstract Make : ('a -> 'b) - let rec ApCons = { new IPattern<'a * 'a list, 'a list> with - member __.Query = fun xs -> match xs with y::ys -> Some (y,ys) | _ -> None + let rec ApCons = { new IPattern<'a * 'a list, 'a list> with + member __.Query = fun xs -> match xs with y::ys -> Some (y,ys) | _ -> None member __.Make = fun (x,xs) -> x::xs } - and ApNil = { new IPattern with - member __.Query = fun xs -> match xs with [] -> Some () | _ -> None + and ApNil = { new IPattern with + member __.Query = fun xs -> match xs with [] -> Some () | _ -> None member __.Make = fun () -> [] } let x1 = ApCons : IPattern let x2 = ApCons : IPattern let y1 = ApNil : IPattern let y2 = ApNil : IPattern - -module RecursiveInterfaceObjectExpressions = - + +module RecursiveInterfaceObjectExpressions = + type Expr = App of IOp * Expr | Const of float - type IOp = + type IOp = abstract Name : string; - abstract Deriv : Expr -> Expr - + abstract Deriv : Expr -> Expr - let NegOp = { new IOp with member __.Name = "neg" + + let NegOp = { new IOp with member __.Name = "neg" member __.Deriv(e) = Const (-1.0) } let Neg x = App(NegOp,x) - let CosOp = { new IOp with - member __.Name = "cos" + let CosOp = { new IOp with + member __.Name = "cos" member __.Deriv(e) = Neg(Sin(e)) } let Cos x = App(CosOp,x) let Sin x = App(SinOp,x) - let SinOp = { new IOp with - member __.Name = "sin" + let SinOp = { new IOp with + member __.Name = "sin" member __.Deriv(e) = Cos(e) } - - let f nm = - let NegOp = { new IOp with member __.Name = nm + + let f nm = + let NegOp = { new IOp with member __.Name = nm member __.Deriv(e) = Const (-1.0) } in let Neg x = App(NegOp,x) in - let rec CosOp = { new IOp with - member __.Name = nm - member __.Deriv(e) = Neg(Sin(e)) } + let rec CosOp = { new IOp with + member __.Name = nm + member __.Deriv(e) = Neg(Sin(e)) } and Cos x = App(CosOp,x) and Sin x = App(SinOp,x) - and SinOp = { new IOp with member __.Name = nm - member __.Deriv(e) = Cos(e) } in + and SinOp = { new IOp with member __.Name = nm + member __.Deriv(e) = Cos(e) } in CosOp,Cos,Sin,SinOp,Neg,NegOp let ops = f "abc" @@ -199,10 +199,10 @@ let aa = if !failures then (stdout.WriteLine "Test Failed"; exit 1) else (stdout.WriteLine "Test Passed"; exit 0) #else -do - if !failures then (stdout.WriteLine "Test Failed"; exit 1) +do + if !failures then (stdout.WriteLine "Test Failed"; exit 1) -do (stdout.WriteLine "Test Passed"; - printf "TEST PASSED OK"; +do (stdout.WriteLine "Test Passed"; + printf "TEST PASSED OK"; exit 0) #endif diff --git a/tests/fsharp/core/letrec-mutrec2/test.fs b/tests/fsharp/core/letrec-mutrec2/test.fs index c04592ad0f2..b8c97663bd5 100644 --- a/tests/fsharp/core/letrec-mutrec2/test.fs +++ b/tests/fsharp/core/letrec-mutrec2/test.fs @@ -1,19 +1,19 @@ -// #Conformance #LetBindings #Recursion #TypeInference #ObjectConstructors #Classes #Records +// #Conformance #LetBindings #Recursion #TypeInference #ObjectConstructors #Classes #Records module rec Core_letrec_mutrec2 let failures = ref false -let report_failure s = +let report_failure s = stderr.WriteLine ("FAIL: "+s); failures := true -let test t s1 s2 = - if s1 <> s2 then +let test t s1 s2 = + if s1 <> s2 then (stderr.WriteLine ("test "+t+" failed"); failures := true) else - stdout.WriteLine ("test "+t+" succeeded") + stdout.WriteLine ("test "+t+" succeeded") -let a1 = 1 +let a1 = 1 let b = a1 do if a1 <> 1 then report_failure "celkewieds32w8w" do if b <> a1 then report_failure "cel3f98u8w" @@ -25,11 +25,11 @@ let b2 = 2 -let nonRecursiveImmediate () = +let nonRecursiveImmediate () = stdout.WriteLine "Testing nonRecursiveImmediate"; - let x = ref 1 in - let rec a1 = (x := 3; !x) - and b = a1 in + let x = ref 1 in + let rec a1 = (x := 3; !x) + and b = a1 in if a1 <> 3 then report_failure "dqwij"; if b <> 3 then report_failure "dqwecqwij" @@ -43,36 +43,36 @@ do Printf.printf "recObj.ToString() = %s\n" (recObj.ToString()) do if recObj.GetHashCode() <> (recObj.ToString()).Length then report_failure "dqwij" -let WouldFailAtRuntimeTest () = - let rec a2 = (fun x -> stdout.WriteLine "a2app"; stderr.Flush(); a2 + 2) (stdout.WriteLine "a2arg"; stderr.Flush(); 1) in +let WouldFailAtRuntimeTest () = + let rec a2 = (fun x -> stdout.WriteLine "a2app"; stderr.Flush(); a2 + 2) (stdout.WriteLine "a2arg"; stderr.Flush(); 1) in a2 do try WouldFailAtRuntimeTest (); report_failure "fwoi-03" with _ -> stdout.WriteLine "caught ok!" -let WouldFailAtRuntimeTest2 () = - let rec a2 = (fun x -> a3 + 2) 1 - and a3 = (fun x -> a2 + 2) 1 in +let WouldFailAtRuntimeTest2 () = + let rec a2 = (fun x -> a3 + 2) 1 + and a3 = (fun x -> a2 + 2) 1 in a2 + a3 -module InitializationGraphAtTopLevel = +module InitializationGraphAtTopLevel = let nyi2 (callback) = callback let aaa = nyi2 (fun () -> ggg(); ) let ggg () = (bbb = false) let bbb = true - -module ClassInitTests = + +module ClassInitTests = // one initial do bindings - raises exception type FooFail1() as this = - do + do printfn "hi" this.Bar() let x = 3 - do + do printfn "bye" this.Bar() @@ -80,26 +80,26 @@ module ClassInitTests = // two initial do bindings - raises exception type FooFail2() as this = - do + do printfn "hi" this.Bar() - do + do printfn "hi" this.Bar() let x = 3 - do + do printfn "bye" this.Bar() member this.Bar() = printfn "Bar %d" x - + // one initial let _ bindings - raises exception - type FooFail3() as this = - let _ = + type FooFail3() as this = + let _ = printfn "hi" this.Bar() let x = 3 - do + do printfn "bye" this.Bar() @@ -109,11 +109,11 @@ module ClassInitTests = type FooFail4() as this = let _ = printfn "hi" - do + do printfn "hi" this.Bar() let x = 3 - do + do printfn "bye" this.Bar() @@ -124,11 +124,11 @@ module ClassInitTests = let _ = printfn "hi" this.Bar() - let _ = + let _ = printfn "hi" this.Bar() let x = 3 - do + do printfn "bye" this.Bar() @@ -139,20 +139,20 @@ module ClassInitTests = let _ = printfn "hi" this.Bar() - do + do printfn "hi" let x = 3 - do + do printfn "bye" this.Bar() member this.Bar() = printfn "Bar %d" x - + // no initial do bindings - succeeds type FooSucceeds() as this = let x = 3 - do + do printfn "bye" this.Bar() @@ -167,99 +167,99 @@ module ClassInitTests = test "cneqec27" (try new FooSucceeds() |> ignore; false with :? System.InvalidOperationException -> true) false -module BasicPermutations = +module BasicPermutations = - module Perm1 = - let A1 = 1 + module Perm1 = + let A1 = 1 let A2 = A1 - + test "vsdlknv01" (A1,A2) (1,1) - - module Perm2 = + + module Perm2 = let A1 = A2 let A2 = 1 - + test "vsdlknv02" (A1,A2) (1,1) - - module Perm3a = + + module Perm3a = let A1 = A2 let A2 = 1 let A3 = 1 - + test "vsdlknv03" (A1,A2,A3) (1,1,1) - - module Perm3b = + + module Perm3b = let A1 = A2 let A2 = A3 let A3 = 1 - + test "vsdlknv04" (A1,A2,A3) (1,1,1) - - module Perm3c = + + module Perm3c = let A1 = A2 let A2 = 1 let A3 = A2 - + test "vsdlknv05" (A1,A2,A3) (1,1,1) - - module Perm3d = + + module Perm3d = let A1 = A3 let A2 = 1 let A3 = 1 - + test "vsdlknv06" (A1,A2,A3) (1,1,1) - module Perm3e = + module Perm3e = let A1 = A3 let A2 = A3 let A3 = 1 - + test "vsdlknv07" (A1,A2,A3) (1,1,1) - module Perm3f = + module Perm3f = let A1 = A3 let A2 = 1 let A3 = A2 - + test "vsdlknv08" (A1,A2,A3) (1,1,1) - module Perm3g = + module Perm3g = let A1 = A3 let A2 = A3 let A3 = 1 - + test "vsdlknv09" (A1,A2,A3) (1,1,1) - module Perm3h = + module Perm3h = let A1 = 1 let A2 = A1 let A3 = A2 - + test "vsdlknv0q" (A1,A2,A3) (1,1,1) - module Perm3i = + module Perm3i = let A1 = 1 let A2 = A3 let A3 = 1 - + test "vsdlknv0w" (A1,A2,A3) (1,1,1) - module Perm4i = + module Perm4i = let A1 = A4 let A2 = 1 let A3 = A2 let A4 = A3 - + test "vsdlknv0e" (A1,A2,A3,A4) (1,1,1,1) - module PermMisc = + module PermMisc = let A1 = A4 + 1 let A2 = 1 let A3 = A2 + 1 let A4 = A3 + 1 - + test "vsdlknv0r" (A1,A2,A3,A4) (4,1,2,3) - + module bug162155 = type SuperType1() = @@ -268,7 +268,7 @@ module BasicPermutations = default x.Foo a = a + 1 - + type SubType1() = @@ -276,7 +276,7 @@ module BasicPermutations = override x.Foo a = base.Foo(a) - + type SuperType2() = @@ -284,7 +284,7 @@ module BasicPermutations = default x.Foo a = a + 1 - + type SubType2 = @@ -294,14 +294,14 @@ module BasicPermutations = override x.Foo a = base.Foo(a) - + type SuperType3() = abstract Foo : int -> int default x.Foo a = a + 1 - + type SubType3() = @@ -314,15 +314,15 @@ module BasicPermutations = type SuperType4() = abstract Foo : int -> int default x.Foo a = a + 1 - + type SubType4 = inherit SuperType4 new () = { inherit SuperType4() } - + // With visual studio SP1 this will not compile // with the following error: - // - // Error 1 'base' values may only be used to make direct calls + // + // Error 1 'base' values may only be used to make direct calls // to the base implementations of overridden members override x.Foo a = base.Foo(a) @@ -332,11 +332,11 @@ let aa = if !failures then (stdout.WriteLine "Test Failed"; exit 1) else (stdout.WriteLine "Test Passed"; exit 0) #else -let aa = - if !failures then (stdout.WriteLine "Test Failed"; exit 1) +let aa = + if !failures then (stdout.WriteLine "Test Failed"; exit 1) -do (stdout.WriteLine "Test Passed"; - printf "TEST PASSED OK"; +do (stdout.WriteLine "Test Passed"; + printf "TEST PASSED OK"; exit 0) #endif \ No newline at end of file diff --git a/tests/fsharp/core/load-script/FlagCheck.fs b/tests/fsharp/core/load-script/FlagCheck.fs index 257ac1d68ee..05618a86fe4 100644 --- a/tests/fsharp/core/load-script/FlagCheck.fs +++ b/tests/fsharp/core/load-script/FlagCheck.fs @@ -1,5 +1,5 @@ -// #Conformance #FSI -module FlagCheck +// #Conformance #FSI +module FlagCheck #nowarn "22" #if INTERACTIVE printfn "INTERACTIVE is defined" diff --git a/tests/fsharp/core/load-script/ProjectFile.fs b/tests/fsharp/core/load-script/ProjectFile.fs index b985d3564bf..aa6bdf97871 100644 --- a/tests/fsharp/core/load-script/ProjectFile.fs +++ b/tests/fsharp/core/load-script/ProjectFile.fs @@ -1,4 +1,4 @@ -// #Conformance #FSI +// #Conformance #FSI namespace Namespace -type Type = +type Type = static member Method() = 99 diff --git a/tests/fsharp/core/members/absil.fs b/tests/fsharp/core/members/absil.fs index ad00bf02267..b8763642774 100644 --- a/tests/fsharp/core/members/absil.fs +++ b/tests/fsharp/core/members/absil.fs @@ -8,27 +8,27 @@ member this.OnNoise() = noiseListeners.AsEvent member this.OnPaint() = paintListeners.AsEvent - let NewMyComponent () = - let noiseListeners = NewListenerList() in - let paintListeners = NewListenerListForDelegateType() in - let fireNoise() = noiseListeners.Fire(noiseLevel) in - let firePaint() = paintListeners.Fire(noiseLevel) in + let NewMyComponent () = + let noiseListeners = NewListenerList() in + let paintListeners = NewListenerListForDelegateType() in + let fireNoise() = noiseListeners.Fire(noiseLevel) in + let firePaint() = paintListeners.Fire(noiseLevel) in // Here we would connect to some other resource that triggers events // and call fireNoise and firePaint in response { noiseListeners = noiseListeners; paintListeners = paintListeners } -type code = +type code = | BasicBlock of basic_block | GroupBlock of local_debug_info list * code list | RestrictBlock of CodeLabel list * code | TryBlock of code * seh - + member this.X() = match this with ... static member op_Addition(a,b) = GroupBlock([],[a;b]) static member op_Implicit(a: code, b: ICode) = match this with ... - interface Object + interface Object with this.ToString() = () and this.GetHashCode() = () and this.Finalize() = () @@ -38,10 +38,10 @@ type code = member this.Name = () member this.X = () -type local = +type local = { localType: Type; localPinned: bool } - interface Object + interface Object with ToString(this) = () and GetHashCode(this) = () and Finalize(this) = () diff --git a/tests/fsharp/core/members/basics-hw-mutrec/test.fs b/tests/fsharp/core/members/basics-hw-mutrec/test.fs index cd66176d435..f5378d27d8c 100644 --- a/tests/fsharp/core/members/basics-hw-mutrec/test.fs +++ b/tests/fsharp/core/members/basics-hw-mutrec/test.fs @@ -1,4 +1,4 @@ - // #Regression #Conformance #SignatureFiles #Classes #ObjectConstructors #ObjectOrientedTypes #Fields #MemberDefinitions #MethodsAndProperties #Unions #InterfacesAndImplementations #Events #Overloading #Recursion #Regression + // #Regression #Conformance #SignatureFiles #Classes #ObjectConstructors #ObjectOrientedTypes #Fields #MemberDefinitions #MethodsAndProperties #Unions #InterfacesAndImplementations #Events #Overloading #Recursion #Regression @@ -11,7 +11,7 @@ open System.Diagnostics open System.Windows.Forms let failures = ref [] -let report_failure s = +let report_failure s = stderr.WriteLine " NO"; failures := s :: failures.Value let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else report_failure s let check s v1 v2 = test s (v1 = v2) @@ -24,19 +24,19 @@ module StaticInitializerTest3 = let x = ref 2 do x := 3 - type C() = + type C() = static let mutable v = x.Value + 1 static do v <- 3 - + member x.P = v static member P2 = v+x.Value check "lwnohivq16" (new C()).P 3 check "lwnohivq48" C.P2 6 -let _ = - if not failures.Value.IsEmpty then (eprintfn "Test Failed, failures = %A" failures.Value; exit 1) - else (stdout.WriteLine "Test Passed"; - printf "TEST PASSED OK"; +let _ = + if not failures.Value.IsEmpty then (eprintfn "Test Failed, failures = %A" failures.Value; exit 1) + else (stdout.WriteLine "Test Passed"; + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/members/basics/test.fs b/tests/fsharp/core/members/basics/test.fs index 466e6cdd5b7..8fdc4987210 100644 --- a/tests/fsharp/core/members/basics/test.fs +++ b/tests/fsharp/core/members/basics/test.fs @@ -1,16 +1,16 @@ -// #Conformance #SignatureFiles #Classes #ObjectConstructors #ObjectOrientedTypes #Fields #MemberDefinitions #MethodsAndProperties #Unions #InterfacesAndImplementations #Events #Overloading #Recursion #Regression +// #Conformance #SignatureFiles #Classes #ObjectConstructors #ObjectOrientedTypes #Fields #MemberDefinitions #MethodsAndProperties #Unions #InterfacesAndImplementations #Events #Overloading #Recursion #Regression module Global #nowarn "62" let failures = ref [] -let report_failure (s : string) = +let report_failure (s : string) = stderr.Write" NO: " stderr.WriteLine s failures := !failures @ [s] -let test (s : string) b = +let test (s : string) b = stderr.Write(s) if b then stderr.WriteLine " OK" else report_failure (s) @@ -38,7 +38,7 @@ do test "fweoew092" (rval2.b = 2) do rval2.b <- 3 do test "fweoew093" (rval2.b = 3) -let f(x) = +let f(x) = { new RecordType2<'a,int> with a = x and b = 2 } do test "fweoew091" ((f(1)).a = 1) @@ -63,10 +63,10 @@ let x1 = { new System.Windows.Forms.Form() with member __.GetHashCode() = 3 } type ClassType1 = class - inherit System.Object + inherit System.Object val someField : string - interface IEnumerable + interface IEnumerable abstract VirtualMethod1: string -> int abstract VirtualMethod2: string * string -> int @@ -79,15 +79,15 @@ type ClassType1 = end type ClassType1 - with + with default x.VirtualMethod1PostHoc(s) = 3 default x.VirtualMethod2PostHoc(s1,s2) = 3 new(s1,s2) = { inherit System.Object(); someField = "constructor2" + s1 + s2 } end type ClassType1 - with - interface IEnumerable with + with + interface IEnumerable with member x.GetEnumerator() = failwith "no implementation" end @@ -95,8 +95,8 @@ type ClassType1 let x2 = { new ClassType1("a") with member __.GetHashCode() = 3 } let x3 = { new ClassType1("a") with member __.VirtualMethod1(s) = 4 } -let x4 = { new ClassType1("a") with - member __.VirtualMethod1(s) = 5 +let x4 = { new ClassType1("a") with + member __.VirtualMethod1(s) = 5 member __.VirtualMethod2(s1,s2) = s1.Length + s2.Length } @@ -116,7 +116,7 @@ do test "e09wckj321" (x4.VirtualMethod2("abc","d") = 4) type ClassType2 = class - inherit ClassType1 + inherit ClassType1 val someField2 : string override x.VirtualMethod1(s) = 2001 @@ -129,7 +129,7 @@ type ClassType2 = let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 } let x32 = { new ClassType2("abc") with member __.VirtualMethod1(s) = 4002 } let x42 = { new ClassType2("abcd") with - member __.VirtualMethod1(s) = 5004 + member __.VirtualMethod1(s) = 5004 member __.VirtualMethod2(s1,s2) = 500 + s1.Length + s2.Length } do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true) @@ -152,10 +152,10 @@ module AbstractClassTest = begin [] type ClassType1 = class - inherit System.Object + inherit System.Object val someField : string - interface IEnumerable + interface IEnumerable abstract AbstractMethod1: string -> int abstract AbstractMethod2: string * string -> int @@ -164,8 +164,8 @@ module AbstractClassTest = begin end type ClassType1 - with - interface IEnumerable with + with + interface IEnumerable with member x.GetEnumerator() = failwith "no implementation" end @@ -174,8 +174,8 @@ module AbstractClassTest = begin //let shouldGiveError1 = { new ClassType1("a") with GetHashCode() = 3 } //let shouldGiveError2 = { new ClassType1("a") with AbstractMethod1(s) = 4 } //let shouldGiveError3a = new ClassType1("a") - let x4 = { new ClassType1("a") with - member __.AbstractMethod1(s) = 5 + let x4 = { new ClassType1("a") with + member __.AbstractMethod1(s) = 5 member __.AbstractMethod2(s1,s2) = s1.Length + s2.Length } @@ -188,7 +188,7 @@ module AbstractClassTest = begin type ClassType2 = class - inherit ClassType1 + inherit ClassType1 val someField2 : string override x.AbstractMethod1(s) = 2001 @@ -201,7 +201,7 @@ module AbstractClassTest = begin let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 } let x32 = { new ClassType2("abc") with member __.AbstractMethod1(s) = 4002 } let x42 = { new ClassType2("abcd") with - member __.AbstractMethod1(s) = 5004 + member __.AbstractMethod1(s) = 5004 member __.AbstractMethod2(s1,s2) = 500 + s1.Length + s2.Length } do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true) @@ -255,20 +255,20 @@ end // new(s: string) = { new ClassType1 with base=new Object() and x = "abc" } // new(s: string) = { new ClassType1 with base=new Form() and x = "abc" } // new(s: string) = ((new System.Object()) :?> ClassType1) - + //----------------------------------------- // Thorough testing of members for records. module RecordTypeTest = begin - type AbstractType = + type AbstractType = { instanceField: string; mutable mutableInstanceField: string; instanceArray: string array; instanceArray2: string array array; mutableInstanceArray: string array; - mutableInstanceArray2: string array array; + mutableInstanceArray2: string array array; recursiveInstance: AbstractType; } @@ -277,20 +277,20 @@ module RecordTypeTest = begin let staticArray = [| "staticArrayElement1"; "staticArrayElement2" |] let mutableStaticArray = [| "mutableStaticArrayElement1InitialValue"; "mutableStaticArrayElement2InitialValue" |] - let NewAbstractValue(s) = + let NewAbstractValue(s) = let rec self = { instanceField=s; mutableInstanceField=s; instanceArray=[| s;s |]; instanceArray2=[| [| s;s |];[| s;s |] |]; mutableInstanceArray =[| s;s |]; - mutableInstanceArray2 =[| [| s;s |];[| s;s |] |]; + mutableInstanceArray2 =[| [| s;s |];[| s;s |] |]; recursiveInstance=self; - } in + } in self - type AbstractType - with + type AbstractType + with // properties override x.ToString() = x.instanceField member x.InstanceProperty = x.instanceField + ".InstanceProperty" @@ -299,7 +299,7 @@ module RecordTypeTest = begin member x.MutableInstanceProperty with get() = x.mutableInstanceField and set(v:string) = x.mutableInstanceField <- v - + member x.InstanceIndexerCount = Array.length x.instanceArray member x.InstanceIndexer @@ -325,10 +325,10 @@ module RecordTypeTest = begin static member MutableStaticProperty with get() = !mutableStaticField and set(v:string) = mutableStaticField := v - + static member StaticIndexer with get(idx) = staticArray.[idx] - + static member StaticIndexerCount = Array.length staticArray static member MutableStaticIndexer @@ -346,7 +346,7 @@ module RecordTypeTest = begin member x.PrivateMutableInstanceProperty with get() = x.mutableInstanceField and set(v:string) = x.mutableInstanceField <- v - + member x.PrivateInstanceIndexerCount = Array.length x.instanceArray member x.PrivateInstanceIndexer @@ -372,10 +372,10 @@ module RecordTypeTest = begin static member PrivateMutableStaticProperty with get() = !mutableStaticField and set(v:string) = mutableStaticField := v - + static member PrivateStaticIndexer with get(idx) = staticArray.[idx] - + static member PrivateStaticIndexerCount = Array.length staticArray static member PrivateMutableStaticIndexer @@ -553,8 +553,8 @@ module UnionTypeTest = begin let NewAbstractValue(s) = B(s) - type AbstractType - with + type AbstractType + with // properties override x.ToString() = match x with A _ -> "A" | B(s) -> "B" member x.InstanceProperty = "instanceProperty" @@ -563,7 +563,7 @@ module UnionTypeTest = begin member x.MutableInstanceProperty with get() = x.InstanceProperty and set(v:string) = Printf.printf "called MutableInstanceProperty.set\n" - + member x.InstanceIndexerCount = 1 member x.InstanceIndexer @@ -589,10 +589,10 @@ module UnionTypeTest = begin static member MutableStaticProperty with get() = !mutableStaticField and set(v:string) = mutableStaticField := v - + static member StaticIndexer with get(idx) = staticArray.[idx] - + static member StaticIndexerCount = Array.length staticArray static member MutableStaticIndexer @@ -610,7 +610,7 @@ module UnionTypeTest = begin member x.PrivateMutableInstanceProperty with get() = "a" and set(v:string) = Printf.printf "called mutator\n" - + member x.PrivateInstanceIndexerCount = 1 member x.PrivateInstanceIndexer @@ -636,10 +636,10 @@ module UnionTypeTest = begin static member PrivateMutableStaticProperty with get() = !mutableStaticField and set(v:string) = mutableStaticField := v - + static member PrivateStaticIndexer with get(idx) = staticArray.[idx] - + static member PrivateStaticIndexerCount = Array.length staticArray static member PrivateMutableStaticIndexer @@ -807,14 +807,14 @@ end module OverrideIComparableOnClassTest = begin - type MyStringClass = - class - val cache: int - val v: string - interface IComparable with - member x.CompareTo(y:obj) = compare x.v (y :?> MyStringClass).v - end - override x.GetHashCode() = hash(x.v) + type MyStringClass = + class + val cache: int + val v: string + interface IComparable with + member x.CompareTo(y:obj) = compare x.v (y :?> MyStringClass).v + end + override x.GetHashCode() = hash(x.v) override x.Equals(y:obj) = (compare x.v (y :?> MyStringClass).v) = 0 member x.Length = x.cache new(s:string) = { inherit Object(); cache=s.Length; v=s } @@ -826,7 +826,7 @@ module OverrideIComparableOnClassTest = begin let s4 = new MyStringClass("abcd") do test "cepoiwelk" (s1.Length = 3) do test "cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringClass) (s2:MyStringClass) = + let testc (s1:MyStringClass) (s2:MyStringClass) = test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -836,30 +836,30 @@ module OverrideIComparableOnClassTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "cepoiwelk7" (hash(s1) = hash(s1.v)); - test "cepoiwelk8" (hash(s2) = hash(s2.v)) + test "cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIStructuralComparableOnClassTest = begin - type MyStringClass = - class - val cache: int - val v: string - interface IStructuralComparable with - member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringClass).v - end - interface IStructuralEquatable with - member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) + type MyStringClass = + class + val cache: int + val v: string + interface IStructuralComparable with + member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringClass).v + end + interface IStructuralEquatable with + member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringClass).v) = 0 - end + end member x.Length = x.cache new(s:string) = { inherit Object(); cache=s.Length; v=s } end @@ -870,7 +870,7 @@ module OverrideIStructuralComparableOnClassTest = begin let s4 = new MyStringClass("abcd") do test "cepoiwelk" (s1.Length = 3) do test "cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringClass) (s2:MyStringClass) = + let testc (s1:MyStringClass) (s2:MyStringClass) = test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -880,28 +880,28 @@ module OverrideIStructuralComparableOnClassTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "cepoiwelk7" (hash(s1) = hash(s1.v)); - test "cepoiwelk8" (hash(s2) = hash(s2.v)) + test "cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIComparableOnStructTest = begin [] - type MyStringStruct = + type MyStringStruct = struct - val cache: int - val v: string - interface IComparable with - member x.CompareTo(y:obj) = compare x.v (y :?> MyStringStruct).v - end - override x.GetHashCode() = hash(x.v) + val cache: int + val v: string + interface IComparable with + member x.CompareTo(y:obj) = compare x.v (y :?> MyStringStruct).v + end + override x.GetHashCode() = hash(x.v) override x.Equals(y:obj) = (compare x.v (y :?> MyStringStruct).v) = 0 member x.Length = x.cache new(s:string) = { cache=s.Length; v=s } @@ -913,7 +913,7 @@ module OverrideIComparableOnStructTest = begin let s4 = new MyStringStruct("abcd") do test "cepoiwelk" (s1.Length = 3) do test "cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringStruct) (s2:MyStringStruct) = + let testc (s1:MyStringStruct) (s2:MyStringStruct) = test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -923,31 +923,31 @@ module OverrideIComparableOnStructTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "cepoiwelk7" (hash(s1) = hash(s1.v)); - test "cepoiwelk8" (hash(s2) = hash(s2.v)) + test "cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIStructuralComparableOnStructTest = begin [] - type MyStringStruct = + type MyStringStruct = struct - val cache: int - val v: string - interface IStructuralComparable with - member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringStruct).v - end - interface IStructuralEquatable with - member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) + val cache: int + val v: string + interface IStructuralComparable with + member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringStruct).v + end + interface IStructuralEquatable with + member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringStruct).v) = 0 - end + end member x.Length = x.cache new(s:string) = { cache=s.Length; v=s } end @@ -958,7 +958,7 @@ module OverrideIStructuralComparableOnStructTest = begin let s4 = new MyStringStruct("abcd") do test "cepoiwelk" (s1.Length = 3) do test "cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringStruct) (s2:MyStringStruct) = + let testc (s1:MyStringStruct) (s2:MyStringStruct) = test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -968,26 +968,26 @@ module OverrideIStructuralComparableOnStructTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "cepoiwelk7" (hash(s1) = hash(s1.v)); - test "cepoiwelk8" (hash(s2) = hash(s2.v)) + test "cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIComparableOnRecordTest = begin [] type MyStringRecord = { cache: int; v: string } - with - interface IComparable with - member x.CompareTo(y:obj) = compare x.v (y :?> MyStringRecord).v - end - override x.GetHashCode() = hash(x.v) + with + interface IComparable with + member x.CompareTo(y:obj) = compare x.v (y :?> MyStringRecord).v + end + override x.GetHashCode() = hash(x.v) override x.Equals(y:obj) = (compare x.v (y :?> MyStringRecord).v) = 0 member x.Length = x.cache static member Create(s:string) = { cache=s.Length; v=s } @@ -1000,7 +1000,7 @@ module OverrideIComparableOnRecordTest = begin let s4 = MyStringRecord.Create("abcd") do test "recd-cepoiwelk" (s1.Length = 3) do test "recd-cepoiwelk" (s2.Length = 3) - let testc s1 s2 = + let testc s1 s2 = test "recd-cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "recd-cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "recd-cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -1010,29 +1010,29 @@ module OverrideIComparableOnRecordTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "recd-cepoiwelk7" (hash(s1) = hash(s1.v)); - test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) + test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIStructuralComparableOnRecordTest = begin [] type MyStringRecord = { cache: int; v: string } - with - interface IStructuralComparable with - member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringRecord).v - end - interface IStructuralEquatable with - member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) + with + interface IStructuralComparable with + member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringRecord).v + end + interface IStructuralEquatable with + member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringRecord).v) = 0 - end + end member x.Length = x.cache static member Create(s:string) = { cache=s.Length; v=s } end @@ -1044,7 +1044,7 @@ module OverrideIStructuralComparableOnRecordTest = begin let s4 = MyStringRecord.Create("abcd") do test "recd-cepoiwelk" (s1.Length = 3) do test "recd-cepoiwelk" (s2.Length = 3) - let testc s1 s2 = + let testc s1 s2 = test "recd-cepoiwelk1" ((s1 = s2) = (s1.v = s2.v)); test "recd-cepoiwelk2" ((s1 < s2) = (s1.v < s2.v)); test "recd-cepoiwelk3" ((s1 > s2) = (s1.v > s2.v)); @@ -1054,31 +1054,31 @@ module OverrideIStructuralComparableOnRecordTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.v = %d\n" (hash(s1.v)); test "recd-cepoiwelk7" (hash(s1) = hash(s1.v)); - test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) + test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end module OverrideIComparableOnUnionTest = begin [] type MyStringUnion = A of int * string | B of int * string - with - member x.Value = match x with A(_,s) | B(_,s) -> s + with + member x.Value = match x with A(_,s) | B(_,s) -> s override x.GetHashCode() = hash(x.Value) override x.Equals(y:obj) = x.Value = (y :?> MyStringUnion).Value interface IComparable with - member x.CompareTo(y:obj) = + member x.CompareTo(y:obj) = compare x.Value (y :?> MyStringUnion).Value - end + end member x.Length = match x with A(n,_) | B(n,_) -> n static member Create(s:string) = A(s.Length,s) end @@ -1090,7 +1090,7 @@ module OverrideIComparableOnUnionTest = begin let s4 = MyStringUnion.Create("abcd") do test "union-cepoiwelk" (s1.Length = 3) do test "union-cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringUnion) (s2:MyStringUnion) = + let testc (s1:MyStringUnion) (s2:MyStringUnion) = test "union-cepoiwelk1" ((s1 = s2) = (s1.Value = s2.Value)); test "union-cepoiwelk2" ((s1 < s2) = (s1.Value < s2.Value)); test "union-cepoiwelk3" ((s1 > s2) = (s1.Value > s2.Value)); @@ -1101,18 +1101,18 @@ module OverrideIComparableOnUnionTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.Value = %d\n" (hash(s1.Value)); test "union-cepoiwelk7" (hash(s1) = hash(s1.Value)); - test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) + test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end -module TwoCaseUnionTest = +module TwoCaseUnionTest = [] type MyUnion = A | B @@ -1152,7 +1152,7 @@ module ToStringOnUnionTestOverride = begin type MyUnion = A of string | B with override x.ToString() = expected1 - + let expected2 = "MyStructUnion" type MyStructUnion = C of string | D @@ -1195,14 +1195,14 @@ module ToStringOnRecordTestOverride = begin type MyRecord = { A: string; B: int } with override x.ToString() = expected1 - + let expected2 = "MyStructRecord" [] type MyStructRecord = { C: string; D: int } with override x.ToString() = expected2 - + let a1 = {A = "201"; B = 7} let c1 = {C = "20"; D = 17} @@ -1217,18 +1217,18 @@ module OverrideIStructuralComparableOnUnionTest = begin [] type MyStringUnion = A of int * string | B of int * string - with - member x.Value = match x with A(_,s) | B(_,s) -> s + with + member x.Value = match x with A(_,s) | B(_,s) -> s interface IStructuralEquatable with member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.Value) member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = x.Value = (y :?> MyStringUnion).Value - end + end interface IStructuralComparable with - member x.CompareTo(y:obj,comp:System.Collections.IComparer) = + member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.Value (y :?> MyStringUnion).Value - end + end member x.Length = match x with A(n,_) | B(n,_) -> n static member Create(s:string) = A(s.Length,s) end @@ -1240,7 +1240,7 @@ module OverrideIStructuralComparableOnUnionTest = begin let s4 = MyStringUnion.Create("abcd") do test "union-cepoiwelk" (s1.Length = 3) do test "union-cepoiwelk" (s2.Length = 3) - let testc (s1:MyStringUnion) (s2:MyStringUnion) = + let testc (s1:MyStringUnion) (s2:MyStringUnion) = test "union-cepoiwelk1" ((s1 = s2) = (s1.Value = s2.Value)); //test "union-cepoiwelk2" ((s1 < s2) = (s1.Value < s2.Value)); //test "union-cepoiwelk3" ((s1 > s2) = (s1.Value > s2.Value)); @@ -1251,25 +1251,25 @@ module OverrideIStructuralComparableOnUnionTest = begin Printf.printf "hash s1 = %d\n" (hash(s1)); Printf.printf "hash s1.Value = %d\n" (hash(s1.Value)); test "union-cepoiwelk7" (hash(s1) = hash(s1.Value)); - test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) + test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) do testc s1 s2 do testc s1 s3 do testc s2 s3 - do testc s2 s1 - do testc s3 s1 - do testc s3 s2 - do testc s4 s2 + do testc s2 s1 + do testc s3 s1 + do testc s3 s2 + do testc s4 s2 end //--------------------------------------------------------------------- // Test we can define an attribute -type DontPressThisButtonAttribute = - class +type DontPressThisButtonAttribute = + class inherit System.Attribute - val v: string + val v: string member x.Message = x.v new(s:string) = { inherit System.Attribute(); v=s } end @@ -1283,9 +1283,9 @@ let [] button () = 1 open System.Windows.Forms -type MyCanvas2 = - class - inherit Form +type MyCanvas2 = + class + inherit Form override x.OnPaint(args) = Printf.printf "OnPaint\n"; base.OnPaint(args) new() = { inherit Form(); } @@ -1307,16 +1307,16 @@ let (|>) x f = f x (* type MyEventListeners<'a> = class - inherit Event<'a> + inherit Event<'a> - val mutable listeners2: (Handler<'a>) list + val mutable listeners2: (Handler<'a>) list - member l.Fire(x : 'a) = - let arg = new SimpleEventArgs<_>(x) in - l.listeners2 |> List.iter (fun d -> ignore(d.Invoke((null:obj),arg))) + member l.Fire(x : 'a) = + let arg = new SimpleEventArgs<_>(x) in + l.listeners2 |> List.iter (fun d -> ignore(d.Invoke((null:obj),arg))) - new() = - { inherit Event<'a>(); + new() = + { inherit Event<'a>(); listeners2 = [] } end @@ -1324,8 +1324,8 @@ type MyEventListeners<'a> = *) (* -type MyCanvas2 = - class +type MyCanvas2 = + class inherit Form member x.Redraw : Event new: unit -> MyCanvas2 @@ -1333,8 +1333,8 @@ type MyCanvas2 = *) (* -type MyCanvas2 = - class +type MyCanvas2 = + class inherit Form val redrawListeners: MyEventListeners member x.Redraw = x.redrawListeners @@ -1346,7 +1346,7 @@ type MyCanvas2 = (* class MyCanvas2() = - let l = MyEventListeners() in + let l = MyEventListeners() in object inherit Form() member x.Redraw = l @@ -1354,7 +1354,7 @@ class MyCanvas2() = end class MyCanvas2 = - let l = MyEventListeners() in + let l = MyEventListeners() in object inherit Form member x.Redraw = l @@ -1380,9 +1380,9 @@ do Application.Run(form) // Test we can define an exception type MyException = - class + class inherit System.Exception - val v: string + val v: string override x.Message = x.v new(s:string) = { inherit System.Exception(); v=s } end @@ -1408,7 +1408,7 @@ type IMyInterface = //--------------------------------------------------------------------- // Test we can define and subscribe to a generic interface - + //--------------------------------------------------------------------- // Test we can define a struct @@ -1428,8 +1428,8 @@ type MyStruct = //--------------------------------------------------------------------- // Test we can define a class with no fields -type NoFieldClass = - class +type NoFieldClass = + class new() = { inherit System.Object() } end @@ -1440,12 +1440,12 @@ module MultiInterfaceTest = begin type PrivateInterfaceA1 = interface abstract M1 : unit -> unit end type PrivateInterfaceA2 = interface abstract M2 : unit -> unit end - type C1 = - class - interface PrivateInterfaceA1 with + type C1 = + class + interface PrivateInterfaceA1 with member x.M1() = () end - interface PrivateInterfaceA2 with + interface PrivateInterfaceA2 with member x.M2() = () end end @@ -1455,12 +1455,12 @@ module MultiInterfaceTestNameConflict = begin type PrivateInterfaceA1 = interface abstract M : unit -> unit end type PrivateInterfaceA2 = interface abstract M : unit -> unit end - type C1 = - class - interface PrivateInterfaceA1 with + type C1 = + class + interface PrivateInterfaceA1 with member x.M() = () end - interface PrivateInterfaceA2 with + interface PrivateInterfaceA2 with member x.M() = () end end @@ -1471,12 +1471,12 @@ module GenericMultiInterfaceTestNameConflict = begin type PrivateInterfaceA1<'a> = interface abstract M : 'a -> 'a end type PrivateInterfaceA2<'a> = interface abstract M : 'a -> 'a end - type C1 = - class - interface PrivateInterfaceA1 with + type C1 = + class + interface PrivateInterfaceA1 with member x.M(y) = y end - interface PrivateInterfaceA2 with + interface PrivateInterfaceA2 with member x.M(y) = y end end @@ -1488,30 +1488,30 @@ module DeepInterfaceInheritance = begin type InterfaceA2 = interface inherit InterfaceA1 abstract M2 : int -> int end type InterfaceA3 = interface inherit InterfaceA1 inherit InterfaceA2 abstract M3 : int -> int end - type C1 = - class - interface InterfaceA2 with - member x.M1(y) = y - member x.M2(y) = y + y + type C1 = + class + interface InterfaceA2 with + member x.M1(y) = y + member x.M2(y) = y + y end new() = { inherit Object(); } end - type C2 = - class - interface InterfaceA3 with + type C2 = + class + interface InterfaceA3 with member x.M1(y) = y member x.M2(y) = y + y member x.M3(y) = y + y + y end new() = { inherit Object(); } end - type C3 = - class - interface InterfaceA2 with + type C3 = + class + interface InterfaceA2 with member x.M1(y) = y member x.M2(y) = y + y end - interface InterfaceA3 with + interface InterfaceA3 with member x.M3(y) = y + y + y end new() = { inherit Object(); } @@ -1519,19 +1519,19 @@ module DeepInterfaceInheritance = begin do test "fewopvrej1" (((new C1()) :> InterfaceA1).M1(4) = 4) do test "fewopvrej2" (((new C1()) :> InterfaceA2).M2(4) = 8) - + do test "fewopvrej3" (((new C2()) :> InterfaceA1).M1(4) = 4) do test "fewopvrej4" (((new C2()) :> InterfaceA2).M2(4) = 8) do test "fewopvrej5" (((new C2()) :> InterfaceA3).M3(4) = 12) do test "fewopvrej6" (((new C2()) :> InterfaceA3).M1(4) = 4) do test "fewopvrej7" (((new C2()) :> InterfaceA3).M2(4) = 8) - + do test "fewopvrej8" (((new C3()) :> InterfaceA1).M1(4) = 4) do test "fewopvrej9" (((new C3()) :> InterfaceA2).M2(4) = 8) do test "fewopvrej10" (((new C3()) :> InterfaceA3).M3(4) = 12) do test "fewopvrej11" (((new C3()) :> InterfaceA3).M1(4) = 4) do test "fewopvrej12" (((new C3()) :> InterfaceA3).M2(4) = 8) - + end module DeepGenericInterfaceInheritance = begin @@ -1539,30 +1539,30 @@ module DeepGenericInterfaceInheritance = begin type InterfaceA2<'b> = interface inherit InterfaceA1<'b list> abstract M2 : 'b * 'b list -> 'b list end type InterfaceA3 = interface inherit InterfaceA2 abstract M3 : string list -> string list end - type C1 = - class - interface InterfaceA2 with - member obj.M1(y) = 1::y + type C1 = + class + interface InterfaceA2 with + member obj.M1(y) = 1::y member obj.M2(x,y) = x::y end new() = { inherit Object(); } end - type C2 = - class - interface InterfaceA3 with + type C2 = + class + interface InterfaceA3 with member obj.M1(y) = "a" :: y member obj.M2(x,y) = x :: y member obj.M3(y) = "a" :: "b" :: "c" :: y end new() = { inherit Object(); } end - type C3 = - class - interface InterfaceA2 with + type C3 = + class + interface InterfaceA2 with member obj.M1(y) = "a" :: y member obj.M2(x,y) = x :: y end - interface InterfaceA3 with + interface InterfaceA3 with member obj.M3(y) = "a" :: "b" :: "c" :: y end new() = { inherit Object(); } @@ -1570,21 +1570,21 @@ module DeepGenericInterfaceInheritance = begin do test "fewopvrej1" (((new C1()) :> InterfaceA1).M1([1]) = [1;1]) do test "fewopvrej2" (((new C1()) :> InterfaceA2).M2(3,[1]) = [3;1]) - + do test "fewopvrej3" (((new C2()) :> InterfaceA1).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej4" (((new C2()) :> InterfaceA2).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej4" (((new C2()) :> InterfaceA2).M2("a",["hi"]) = ["a";"hi"]) do test "fewopvrej5" (((new C2()) :> InterfaceA3).M3(["hi"]) = ["a";"b";"c";"hi"]) do test "fewopvrej6" (((new C2()) :> InterfaceA3).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej7" (((new C2()) :> InterfaceA3).M2("a",["hi"]) = ["a";"hi"]) - + do test "fewopvrej8" (((new C3()) :> InterfaceA1).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej8" (((new C3()) :> InterfaceA2).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej9" (((new C3()) :> InterfaceA2).M2("a",["hi"]) = ["a";"hi"]) do test "fewopvrej10" (((new C3()) :> InterfaceA3).M3(["hi"]) = ["a";"b";"c";"hi"]) do test "fewopvrej11" (((new C3()) :> InterfaceA3).M1(["hi"]) = ["a";"hi"]) do test "fewopvrej12" (((new C3()) :> InterfaceA3).M2("a",["hi"]) = ["a";"hi"]) - + end @@ -1593,7 +1593,7 @@ module PointTest = begin type Point = class - new(x_init) = { inherit System.Object(); x_init = x_init; x = x_init } + new(x_init) = { inherit System.Object(); x_init = x_init; x = x_init } val x_init : int val mutable x : int member p.X = p.x @@ -1611,7 +1611,7 @@ module PointTest = begin type Point_with_no_inherits_clause = class - new x_init = { x_init = x_init; x = x_init } + new x_init = { x_init = x_init; x = x_init } val x_init : int val mutable x : int member p.X = p.x @@ -1619,9 +1619,9 @@ module PointTest = begin member p.Move d1 d2 = p.x <- p.x + d1 + d2 end - do - let p = (new Point_with_no_inherits_clause(3)) in - let f = p.Move 4 in + do + let p = (new Point_with_no_inherits_clause(3)) in + let f = p.Move 4 in test "wdfjcdwkj1" (p.X = 3); f 4; test "wdfjcdwkj2" (p.X = 11); @@ -1631,7 +1631,7 @@ module PointTest = begin test "wdfjcdwkj5" (Point.TwoPatternArgs [1] [2] = 3); test "wdfjcdwkj6" (Point.ThreeArgs 1 2 3 = 6); test "wdfjcdwkj7" (Point.ThreePatternArgs [1] [2] [3] = 6); - let p2 = (new Point(16)) in + let p2 = (new Point(16)) in test "wdfjcdwkj4" (p2.InstanceTwoArgs 1 2 = 16 + 3); test "wdfjcdwkj5" (p2.InstanceTwoPatternArgs [1] [2] = 16 + 3); test "wdfjcdwkj6" (p2.InstanceThreeArgs 1 2 3 = 16 + 6); @@ -1646,20 +1646,20 @@ end open System.Diagnostics -type +type [) >] MyIntList = MyNil | MyCons of int * MyIntList and MyIntListDebugView = - class + class val v: MyIntList - new(x) = { v = x } - [] - member x.Items = - let rec length x acc = match x with MyNil -> acc | MyCons(a,b) -> length b (acc+1) in - let len = length x.v 0 in - let items = Array.zeroCreate len in - let rec go n l = match l with MyNil -> () | MyCons(a,b) -> items.[n] <- a; go (n+1) b in + new(x) = { v = x } + [] + member x.Items = + let rec length x acc = match x with MyNil -> acc | MyCons(a,b) -> length b (acc+1) in + let len = length x.v 0 in + let items = Array.zeroCreate len in + let rec go n l = match l with MyNil -> () | MyCons(a,b) -> items.[n] <- a; go (n+1) b in go 0 x.v; items end @@ -1679,10 +1679,10 @@ end module ThenDoTest = begin let res = ref 2 - type P = - class - val x1: int; val x2: string; - new(a,b) = {x1=a; x2=(test "ewqonce1" (!res = 2); b) } then res := !res + 1 + type P = + class + val x1: int; val x2: string; + new(a,b) = {x1=a; x2=(test "ewqonce1" (!res = 2); b) } then res := !res + 1 end do ignore(new P(3,"5")) @@ -1695,17 +1695,17 @@ end module ThenDoTest2 = begin let res = ref 2 - type P = - class - val x1: int; val x2: string; - new(a,b) as x = - { x1= !res; - x2=(test "ewqonce3" (!res = 2); b) } - then + type P = + class + val x1: int; val x2: string; + new(a,b) as x = + { x1= !res; + x2=(test "ewqonce3" (!res = 2); b) } + then test "ewqonce4" (!res = 2); - res := !res + 1; + res := !res + 1; test "ewqonce5" (!res = 3); - test "ewqonce6" (x.x1 = 2) + test "ewqonce6" (x.x1 = 2) end do ignore(new P(3,"5")) @@ -1716,14 +1716,14 @@ end module GenericInterfaceTest = begin type Foo<'a> = - interface + interface abstract fun1 : 'a -> 'a abstract fun2 : int -> int end type Bar<'b> = - class + class val store : 'b interface Foo<'b> with member self.fun1(x) = x @@ -1734,7 +1734,7 @@ module GenericInterfaceTest = begin type Bar2<'b> = - class + class val store : 'b interface Foo<'b> with member self.fun1(x:'b) = x @@ -1744,7 +1744,7 @@ module GenericInterfaceTest = begin end type Bar3<'b> = - class + class val store : int interface Foo<'b> with member self.fun1(x) = x @@ -1758,7 +1758,7 @@ end //--------------------------------------------------------------------- // - + module Inventory = begin @@ -1766,7 +1766,7 @@ module Inventory = begin type item = A | B type image = A | B - type ItemDetails = + type ItemDetails = { ItemIndex: item; InventoryImage: image; Name : string } @@ -1774,21 +1774,21 @@ module Inventory = begin type IInventory = interface abstract Contains : item -> bool abstract Remove : item -> unit - abstract GetDetails : item -> ItemDetails - abstract Add : ItemDetails -> unit - abstract GetTuple : unit -> (item * image * string) list + abstract GetDetails : item -> ItemDetails + abstract Add : ItemDetails -> unit + abstract GetTuple : unit -> (item * image * string) list end - module List = + module List = let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection")) - let rec assoc x l = - match l with + let rec assoc x l = + match l with | [] -> indexNotFound() | ((h,r)::t) -> if x = h then r else assoc x t - let rec remove_assoc x l = - match l with + let rec remove_assoc x l = + match l with | [] -> [] | (((h,_) as p) ::t) -> if x = h then t else p:: remove_assoc x t @@ -1812,21 +1812,21 @@ end module SamplerTest = begin - type Sampler<'a,'b> = + type Sampler<'a,'b> = interface - abstract Sample : 'a -> unit + abstract Sample : 'a -> unit abstract GetStatistic : unit -> 'b end - - let NewAverage(toFloat) = + + let NewAverage(toFloat) = let count = ref 0 in - let total = ref 0.0 in + let total = ref 0.0 in { new Sampler<_,float> with member __.Sample(x) = incr count; total := !total + toFloat x member __.GetStatistic() = !total / float(!count) } - type Average<'a> = + type Average<'a> = class val mutable total : float val mutable count : int @@ -1845,10 +1845,10 @@ end // This simple case of forward-reference revealed a bug type callconv = AA - with - member x.IsInstance = x.ThisConv + with + member x.IsInstance = x.ThisConv member x.ThisConv = 1 - end + end // Likewise @@ -1857,7 +1857,7 @@ module OverloadZeroOneTestSoohyoung = begin type Point = class val mutable mx: int - + new () = { mx = 0 } new (ix) = { mx = ix } end @@ -1865,16 +1865,16 @@ module OverloadZeroOneTestSoohyoung = begin end //--------------------------------------------------------------------- -// Bad error message case +// Bad error message case -module Ralf = begin +module Ralf = begin type Matrix = M | N [] - type Distribution = - class + type Distribution = + class new () = { } abstract member NumberOfDimensions : unit -> int @@ -1887,13 +1887,13 @@ module Ralf = begin end type Gaussian1D = - class + class inherit Distribution val PrecisionMean : float val Precision : float new (precisionMean, precision) = { PrecisionMean = 0.0; Precision = 0.0 } override x.NumberOfDimensions() = 1 - override x.Density point = 1.0 + override x.Density point = 1.0 override x.AbsoluteDifference distribution = 0.0 override x.Clone() = new Gaussian1D (0.0,0.0) :> Distribution override x.CloneConstant() = new Gaussian1D (x.PrecisionMean,x.Precision) :> Distribution @@ -1945,14 +1945,14 @@ module OverloadedOperatorTests = begin let _ = SCGL.[0] let _ = SCGL.[0] <- 3 - let f (x: 'a) = - let SCGL = new System.Collections.Generic.List<'a>() in - let _ = SCGL.Add(x) in - let _ = SCGL.[0] in - let _ = SCGL.[0] <- x in + let f (x: 'a) = + let SCGL = new System.Collections.Generic.List<'a>() in + let _ = SCGL.Add(x) in + let _ = SCGL.[0] in + let _ = SCGL.[0] <- x in () - // check we have generalized + // check we have generalized do f 1 do f "3" @@ -1960,8 +1960,8 @@ module OverloadedOperatorTests = begin let _ = SCGD.Add("hello",3.0) let _ = SCGD.["hello"] - let g (k: 'a) (v:'b)= - let SCGD = new System.Collections.Generic.Dictionary<'a,'b>() in + let g (k: 'a) (v:'b)= + let SCGD = new System.Collections.Generic.Dictionary<'a,'b>() in let _ = SCGD.Add(k,v) in let _ = SCGD.[k] in let _ = SCGD.[k] <- v in @@ -1969,20 +1969,20 @@ module OverloadedOperatorTests = begin - // check we have generalized + // check we have generalized do g 1 "3" do g "3" 1 do g "3" "1" do g 1 1 - let h (v:'b)= - let arr = [| v;v;v |] in - let elem = arr.[0] in - let _ = arr.[0] <- v in + let h (v:'b)= + let arr = [| v;v;v |] in + let elem = arr.[0] in + let _ = arr.[0] <- v in () - // check we have generalized + // check we have generalized do h 1 do h "3" @@ -2000,7 +2000,7 @@ module PropertyOverrideTests = begin abstract G2 : string-> float with get abstract G3 : string * string -> float with get end - + type IA = interface abstract S1 : float with set abstract S2 : string-> float with set @@ -2009,22 +2009,22 @@ module PropertyOverrideTests = begin abstract G2 : string-> float with get abstract G3 : string * string -> float with get end - - type CTest = + + type CTest = class inherit A - override x.S1 with set v = () - override x.S2 with set s v = () - override x.S3 with set (s1,s2) v = () + override x.S1 with set v = () + override x.S2 with set s v = () + override x.S3 with set (s1,s2) v = () override x.G1 with get () = 1.0 override x.G2 with get (s:string) = 2.0 override x.G3 with get (s1,s2) = 3.0 - interface IA with - override x.S1 with set v = () - override x.S2 with set s v = () - override x.S3 with set (s1,s2) v = () + interface IA with + override x.S1 with set v = () + override x.S2 with set s v = () + override x.S3 with set (s1,s2) v = () override x.G1 with get () = 1.0 override x.G2 with get (s:string) = 2.0 override x.G3 with get (s1,s2) = 3.0 @@ -2038,7 +2038,7 @@ module FieldsInClassesDontContributeToRecordFieldInference = begin type container = class val capacity : float - new(cap) = { capacity = cap } + new(cap) = { capacity = cap } end type cargo = class @@ -2055,8 +2055,8 @@ end module LucianRecords1 = begin type MyRecord1 = {a:int; x:int} type MyRecord2 = {a:int; y:string} - let f (m:MyRecord1) : MyRecord1 = {m with a=3} - let g (m:MyRecord2) : MyRecord2 = {m with a=3} + let f (m:MyRecord1) : MyRecord1 = {m with a=3} + let g (m:MyRecord2) : MyRecord2 = {m with a=3} let h (m:MyRecord1) = m.a type Tab = {a:string; b:string} @@ -2078,7 +2078,7 @@ module DefaultConstructorConstraints = begin let y2 = (f2() : int) let y3 = (f2() : DateTime) let y4 = (f2() : System.Windows.Forms.Form) - + end module AccessBugOnFSharpList = begin @@ -2087,31 +2087,31 @@ module AccessBugOnFSharpList = begin open System.Web.Hosting open System.Data.SqlClient - type TopicPathProvider = + type TopicPathProvider = class - inherit VirtualPathProvider - - new() = { inherit VirtualPathProvider(); } - + inherit VirtualPathProvider + + new() = { inherit VirtualPathProvider(); } + member x.TopicExists topic = let cmd = new SqlCommand() in cmd.CommandText <- "SELECT COUNT(*) FROM Topic WHERE Topic.Name = @name"; (cmd.Parameters.Add("@name", System.Data.SqlDbType.NVarChar, 255)).Value <- topic; unbox(cmd.ExecuteScalar()) > 0 - + override x.FileExists((virtualPath: string)) = let relPath = VirtualPathUtility.ToAppRelative(virtualPath) in if relPath.StartsWith("~/topic") then x.TopicExists (relPath.Substring(7)) else x.Previous.FileExists(virtualPath) - + override x.DirectoryExists((virtualDir: string)) = let relPath = VirtualPathUtility.ToAppRelative(virtualDir) in relPath.StartsWith("~/topic") || x.DirectoryExists(virtualDir) end - let AppInitialize() = + let AppInitialize() = let provider = new TopicPathProvider() in HostingEnvironment.RegisterVirtualPathProvider(provider) @@ -2125,9 +2125,9 @@ module TupledTests = begin let _ = C1.Foo((1,2)) - - - + + + end @@ -2144,7 +2144,7 @@ let fails = ff.Invoke() module RecursiveClassDefinitions = begin - type t1 = + type t1 = class val t2: t2 member t1.M1(t2:t2) = t2.M2() @@ -2153,9 +2153,9 @@ module RecursiveClassDefinitions = begin member t1.P1 = t1.t2.P2 member t1.P2 = t1.P1 member t1.P3 = t1.t2.P3 + 1 - new() = { t2 = new t2() } - end - and t2 = + new() = { t2 = new t2() } + end + and t2 = class val t1: t1 member t2.M1() = t2.t1.M2() @@ -2164,10 +2164,10 @@ module RecursiveClassDefinitions = begin member t2.P1 : int = t2.P2 member t2.P2 = t2.t1.P1 member t2.P3 = t2.P3 - new() = { t1 = new t1() } - end + new() = { t1 = new t1() } + end - //let t2 = new t2() + //let t2 = new t2() //let b = (t2.P1 = 3) end @@ -2181,7 +2181,7 @@ module RecursiveAugmentationDefinitions = begin member t1.P1 = t1.t2.P2 member t1.P2 = t1.P1 member t1.P3 = t1.t2.P3 + 1 - end + end and t2 = { t1:t1 } with member t2.M1() = t2.t1.M2() @@ -2190,15 +2190,15 @@ module RecursiveAugmentationDefinitions = begin member t2.P1 : int = t2.P2 member t2.P2 = t2.t1.P1 member t2.P3 = t2.P3 - end + end - //let t2 = new t2() + //let t2 = new t2() //let b = (t2.P1 = 3) end module RecursiveAbstractClassDefinitions = begin - type t1 = + type t1 = class val t2: t2 abstract M1 : t2 -> t1 @@ -2209,21 +2209,21 @@ module RecursiveAbstractClassDefinitions = begin abstract P3 : int default t1.M1(t2:t2) = t2.M2() default t1.M2() = t1.M1(t1.t2) - default t1.M3(t2:t2) = + default t1.M3(t2:t2) = // Note we can use object expressions within the recursive // definition of the type itself. This requires real care - the // exact set of abstract members that still need implementing // must have been determined correctly before any expressions are // analyzed. - { new t1() with - member x.P1 = 4 + { new t1() with + member x.P1 = 4 end } default t1.P1 = t1.t2.P2 default t1.P2 = t1.P1 default t1.P3 = t1.t2.P3 + 1 new() = { t2 = new t2() } - end - and t2 = + end + and t2 = class val t1: t1 abstract M1 : unit -> t1 @@ -2239,22 +2239,22 @@ module RecursiveAbstractClassDefinitions = begin default t2.P2 = t2.t1.P1 default t2.P3 = t2.P3 new() = { t1 = new t1() } - end + end end module RecursiveAbstractClassDefinitions2 = begin (* same test as above but in different order and some missing implementations *) [] - type t1 = + type t1 = class val t2: t2 default t1.M1(t2:t2) = t2.M2() - default x.M3(t2:t2) = { new t1() with - member x.P1 = 4 + default x.M3(t2:t2) = { new t1() with + member x.P1 = 4 member x.M2() = t1.MakeT1() } - static member MakeT1() = { new t1() with - member x.P1 = 4 + static member MakeT1() = { new t1() with + member x.P1 = 4 member x.M2() = t1.MakeT1() } default t1.P2 = t1.P1 default t1.P3 = t1.t2.P3 + 1 @@ -2265,8 +2265,8 @@ module RecursiveAbstractClassDefinitions2 = begin abstract P1 : int abstract P2 : int abstract P3 : int - end - and t2 = + end + and t2 = class val t1: t1 default t2.M1() = t2.t1.M2() @@ -2282,9 +2282,9 @@ module RecursiveAbstractClassDefinitions2 = begin abstract P2 : int abstract P3 : int new() = { t1 = t1.MakeT1() } - end + end - //let t2 = new t2() + //let t2 = new t2() //let b = (t2.P1 = 3) end @@ -2317,8 +2317,8 @@ end module TestConstrainedItemProperty = begin - type Foo = - interface + type Foo = + interface abstract Item : int -> string with get end @@ -2346,10 +2346,10 @@ module DefaultStructCtor = begin let i2 = new System.Nullable() do test "cwehoiewc" (i1.HasValue=false) do test "cwehoiewc" (i2.HasValue=false) - type S = - struct - new(v:int) = { v=v } - val v : int + type S = + struct + new(v:int) = { v=v } + val v : int end let i3 = new S() let i3b = new S(3) @@ -2359,56 +2359,56 @@ end module MiscNullableTests = begin open System - let (>=?!) (x : Nullable<'a>) (y: 'a) = + let (>=?!) (x : Nullable<'a>) (y: 'a) = x.HasValue && x.Value >= y - let (>?!) (x : Nullable<'a>) (y: 'a) = + let (>?!) (x : Nullable<'a>) (y: 'a) = x.HasValue && x.Value > y - let (<=?!) (x : Nullable<'a>) (y: 'a) = + let (<=?!) (x : Nullable<'a>) (y: 'a) = not x.HasValue || x.Value <= y - let () (y: 'a) = + let () (y: 'a) = not x.HasValue || x.Value < y - let (=?!) (x : Nullable<'a>) (y: 'a) = + let (=?!) (x : Nullable<'a>) (y: 'a) = x.HasValue && x.Value = y - let (<>?!) (x : Nullable<'a>) (y: 'a) = + let (<>?!) (x : Nullable<'a>) (y: 'a) = not x.HasValue || x.Value <> y /// This overloaded operator divides Nullable values by non-Nullable values /// using the overloaded operator "/". Inlined to allow use over any type, /// as this resolves the overloading on "/". - let inline (/?!) (x : Nullable<'a>) (y: 'a) = + let inline (/?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value / y) - else x + else x /// This overloaded operator adds Nullable values by non-Nullable values /// using the overloaded operator "+". Inlined to allow use over any type, /// as this resolves the overloading on "+". - let inline (+?!) (x : Nullable<'a>) (y: 'a) = + let inline (+?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value + y) else x /// This overloaded operator adds Nullable values by non-Nullable values /// using the overloaded operator "-". Inlined to allow use over any type, /// as this resolves the overloading on "-". - let inline (-?!) (x : Nullable<'a>) (y: 'a) = + let inline (-?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value - y) else x /// This overloaded operator adds Nullable values by non-Nullable values /// using the overloaded operator "*". Inlined to allow use over any type, /// as this resolves the overloading on "*". - let inline ( *?!) (x : Nullable<'a>) (y: 'a) = + let inline ( *?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value * y) else x /// This overloaded operator adds Nullable values by non-Nullable values /// using the overloaded operator "%". Inlined to allow use over any type, /// as this resolves the overloading on "%". - let inline ( %?!) (x : Nullable<'a>) (y: 'a) = + let inline ( %?!) (x : Nullable<'a>) (y: 'a) = if x.HasValue then new Nullable<'a>(x.Value % y) else x @@ -2423,7 +2423,7 @@ module BaseCallWorkaround = begin end type C2 = class - inherit C1 + inherit C1 new() = {inherit C1()} override this.Blah() = ignore <| printf "From C2\n"; @@ -2435,7 +2435,7 @@ module BaseCallWorkaround = begin end module BaseCallTest = begin - let res = ref 0 + let res = ref 0 type C1 = class new() = {} abstract Blah : unit -> unit @@ -2445,7 +2445,7 @@ module BaseCallTest = begin end type C2 = class - inherit C1 + inherit C1 new() = {inherit C1()} override this.Blah() = ignore <| printf "From C2\n"; @@ -2461,7 +2461,7 @@ module BaseCallTest = begin end module BaseCallTest2 = begin - let res = ref 0 + let res = ref 0 type C1 = class new() = {} abstract Blah : unit -> unit @@ -2476,7 +2476,7 @@ module BaseCallTest2 = begin end type C2 = class - inherit C1 + inherit C1 new() = {inherit C1()} override this.Blah() = ignore <| printf "From C2b\n"; @@ -2490,7 +2490,7 @@ module BaseCallTest2 = begin type C3 = class - inherit C2 + inherit C2 new() = {inherit C2()} override this.Blah() = ignore <| printf "From C3c\n"; @@ -2510,12 +2510,12 @@ end open System open System.Windows.Forms -type Bug856 = - class +type Bug856 = + class inherit CheckBox new() = { inherit CheckBox(); } member x.PerformClick() = x.OnClick(new EventArgs()) // peverify failed - end + end do let form = new Form() in let checkBox = new Bug856(Text="Test") in form.Controls.Add(checkBox); @@ -2526,11 +2526,11 @@ module SelfInitCalls = begin open System.IO type File2 = class - val path: string + val path: string val innerFile: FileInfo // note this calls another constructor. new() = new File2("default.txt") - new(path) = + new(path) = { path = path ; innerFile = new FileInfo(path) } end @@ -2590,11 +2590,11 @@ end // Finish up -type SmoothForm = class +type SmoothForm = class inherit Form - new() as x = - { inherit Form(); } - then + new() as x = + { inherit Form(); } + then x.SetStyle(ControlStyles.AllPaintingInWmPaint ||| ControlStyles.Opaque, true); end @@ -2657,7 +2657,7 @@ module AccessingProtectedMembersFromOtherObjects = begin a.GetSchemaSerializable() |> ignore; t.GetSchemaSerializable() |> ignore; () - + end end @@ -2674,27 +2674,27 @@ module SomeMoreCtorCases = begin type C = class val xx : int - new(x,y) = - if y then + new(x,y) = + if y then { xx = x} else { xx = x+x} - new(x) = + new(x) = let six = 3 + 3 in { xx = x} - static member Create() = + static member Create() = let six = 3 + 3 in new C(3+3) - new() = + new() = let six = 3 + 3 in new C(3+3) new(a,b,c) = new C(a+b+c) - new(a,b,c,d) = + new(a,b,c,d) = new C(a+b+c+d) then printf "hello" end - + end module StillMoreCtorCases = begin @@ -2717,9 +2717,9 @@ module StephenTolksdorfBug1112 = begin abstract Read4: IList<('U * 'T)> -> unit end - - + + /// other manifestation of the same bug type ITest2 = interface abstract Foo<'t> : 't -> 't @@ -2748,7 +2748,7 @@ module Bug1281Test = begin [] type node = struct - + val mutable key: int new (keyIn) = {key=keyIn} member n.Item with get(i:int) = if i=0 then 1 else @@ -2763,9 +2763,9 @@ module Bug960Test1 = begin [] type B<'a, 'b> = class new () = { } - + abstract A : 'a with get,set - abstract M : unit -> 'a + abstract M : unit -> 'a end @@ -2774,7 +2774,7 @@ module Bug960Test1 = begin override x.A with get() = 3 - and set(v : int) = (invalidArg "arg" "C.A.set" : unit) + and set(v : int) = (invalidArg "arg" "C.A.set" : unit) override x.M() = 3 end @@ -2803,7 +2803,7 @@ module Bug960Test2 = begin inherit B new() = { inherit B(3,4) } - + override x.A with get() = 3 and set(v : int) = (invalidArg "arg" "C.A.set" : unit) end @@ -2813,24 +2813,24 @@ end module RandomAdditionalNameResolutionTests = begin module M = begin - type Foo() = + type Foo() = class member x.Name = "a" end - type Foo<'a>() = + type Foo<'a>() = class member x.Name = "a" end - type Goo<'a>() = + type Goo<'a>() = class member x.Name = "a" end - type Goo() = + type Goo() = class member x.Name = "a" end end - + let f2 = new M.Foo() let f3 = new M.Foo< >() let f4 = new M.Foo() @@ -2917,11 +2917,11 @@ end module LeakyAbbreviation_bug1542_FSharp_1_0 = begin - type MM<'a,'b>() = + type MM<'a,'b>() = class static member Create() = 1 end - + type Graph<'a> = MM<'a,'a> let g = Graph.Create() @@ -2929,13 +2929,13 @@ end module CheckoptionalArgumentAttributeDeclaresOptionalArgument = begin - type C() = + type C() = class static member M([] x : int option) = x end - + let v = C.M(x=3) - + end module PropertySetter_FSharp1_0_bug_1422 = begin @@ -2946,7 +2946,7 @@ module PropertySetter_FSharp1_0_bug_1422 = begin end type Variable<'a>() = - class + class inherit Variable() static member Random(y:Variable<'b>) = new Variable<'a>() end @@ -2954,7 +2954,7 @@ module PropertySetter_FSharp1_0_bug_1422 = begin let x : Variable = new Variable() let _ = Variable.Random (x, Name = "m_") - + end @@ -2974,26 +2974,26 @@ module StructKeywordAsConstraintTest = begin struct val x : int end - + type Class1<'a when 'a : struct> = class val x : int end - + type Class2<'a when 'a : not struct> = class val x : int end let inline f<'a when 'a : null> () : 'a = null - let v1 = f () - let v2 = f () - + let v1 = f () + let v2 = f () + end module MutateStructFieldOnPropertySet = begin - type C() = class + type C() = class [] val mutable F : int end @@ -3009,15 +3009,15 @@ module Bug618 = begin type c<'a> when 'a :> c<'a> () = class end type d() = class inherit c() end let x = new c() - + end -(* +(* module Bug618b = begin type c<'a> when 'a :> c<'a>() = class end type d() = class inherit c() end let x = new c() - + end *) @@ -3076,7 +3076,7 @@ module MiscGenericMethodInference = begin member x.TextWriter = tw member x.Print fmt = Printf.fprintfn tw fmt end - + let test2 () = let pr = Printer() in pr.Print "test %s" "test"; @@ -3089,24 +3089,24 @@ module CondensationTest = begin open System open System.Reflection - + [] type public APropAttribute() = class - inherit Attribute() + inherit Attribute() end [] type public AMethodAttribute() = class - inherit Attribute() + inherit Attribute() end - + type AType() = class - - [] + + [] member this.Prop = "Hello" - [] + [] member this.Meth() = "Boo" end let getAttribute<'t> (memb: MemberInfo) = @@ -3115,16 +3115,16 @@ module CondensationTest = begin match attrib with | [| theAttrib |] -> Some(memb, (theAttrib :?> 't)) | _ -> None - + let hasAttribute<'t> (memb: MemberInfo) = match getAttribute<'t> memb with | Some(_) -> true | None -> false - + let t = AType() let p = t.GetType().GetProperties() |> Array.filter (hasAttribute) let m = t.GetType().GetMethods() |> Array.filter (hasAttribute) - + end @@ -3132,8 +3132,8 @@ module OptionalArgumentWithSubTyping = begin type Base() = class end - type Child() = - class + type Child() = + class inherit Base() end @@ -3180,7 +3180,7 @@ module ParamArgs = begin let () = check "vskncvewq" (System.String.Format("{0},{1},{2}",box 1,box 2,box 3)) "1,2,3" let () = check "vskncveww" (System.String.Format("{0},{1},{2},{3}",box 1,box 2,box 3,box 4)) "1,2,3,4" let () = check "vskncvewe" (System.String.Format("{0},{1},{2},{3},{4}",box 1,box 2,box 3,box 4,box 5)) "1,2,3,4,5" - + type C() = class static member M( fmt:string, [] args : obj[]) = System.String.Format(fmt,args) end @@ -3199,7 +3199,7 @@ module ParamArgs = begin let () = check "vskncvewd" (C.M("{0},{1},{2}",box 1,box 2,box 3)) "1,2,3" let () = check "vskncvewf" (C.M("{0},{1},{2},{3}",box 1,box 2,box 3,box 4)) "1,2,3,4" let () = check "vskncvewg" (C.M("{0},{1},{2},{3},{4}",box 1,box 2,box 3,box 4,box 5)) "1,2,3,4,5" - + type C2() = class static member M( fmt:string, [] args : int[]) = System.String.Format(fmt,Array.map box args) static member M2( fmt:string, [] args : System.ValueType[]) = System.String.Format(fmt,Array.map box args) @@ -3230,7 +3230,7 @@ module ParamArgs = begin let () = check "vskncvewT" (C2.M3("")) "" let () = check "vskncvewY" (C2.M3("{0}","1")) "1" let () = check "vskncvewU" (C2.M3("{0},{1}","1","2")) "1,2" - + end module MiscTest = begin @@ -3264,7 +3264,7 @@ end module TestTupleOverloadRules_Bug5985 = begin - type C() = + type C() = class member device.CheckCooperativeLevel() = true member device.CheckCooperativeLevel([] x:byref) = true @@ -3273,7 +3273,7 @@ module TestTupleOverloadRules_Bug5985 = begin let c = C() let z = c.CheckCooperativeLevel() - let _ : bool = z + let _ : bool = z let a,b = c.CheckCooperativeLevel() end @@ -3282,22 +3282,22 @@ module AutoProps = begin type C(ppppp:int) = /// Test doc StaticProperty static let ssss = 11 - member val Property = printfn "Property..."; ppppp + member val Property = printfn "Property..."; ppppp member val PropertyExplicitGet = printfn "PropertyExplicitGet..."; ppppp with get static member val StaticProperty = printfn "StaticProperty..."; 3 + ssss static member val StaticPropertyExplicitGet = printfn "StaticPropertyExplicitGet..."; 3 + ssss with get /// Test doc SettableProperty - member val SettableProperty = printfn "SettableProperty..."; ppppp with get, set - + member val SettableProperty = printfn "SettableProperty..."; ppppp with get, set + /// Test doc MutableStaticProperty - static member val SettableStaticProperty = printfn "SettableStaticProperty..."; 4 + 5 with get, set + static member val SettableStaticProperty = printfn "SettableStaticProperty..."; 4 + 5 with get, set // --- these have type definitions /// Test doc PropertyWithType - member val PropertyWithType : int = ppppp + member val PropertyWithType : int = ppppp /// Test doc StaticPropertyWithType static member val StaticPropertyWithType : int = 6 @@ -3306,7 +3306,7 @@ module AutoProps = begin /// Test doc SettableStaticPropertyWithType static member val SettableStaticPropertyWithType : int = 7 + 8 with get,set - // --- use them + // --- use them member this.PUse = printfn "PUse..."; this.Property + 9 member this.PEGUse = printfn "PUse..."; this.PropertyExplicitGet + 9 @@ -3378,7 +3378,7 @@ module AutoProps_2 = begin let c1 = D1() check "autoprops_210" c1.Property 10 - // override - getter + // override - getter [] type C2() = abstract Property : int with get @@ -3397,7 +3397,7 @@ module AutoProps_2 = begin let c21 = D21() check "autoprops_221" c21.Property 8 - // override - setter + // override - setter [] type C3() = abstract Property : int with get, set @@ -3465,25 +3465,25 @@ module AutoProps_2 = begin let c61 = C6(23) :> I6 check "autoprops_261" c61.Property 23 c61.Property <- c61.Property + 21 - check "autoprops_262" c61.Property 44 + check "autoprops_262" c61.Property 44 end -module MoreKindInferenceTests = +module MoreKindInferenceTests = type C1<'a> = class member _.Foo(x:'a) = x end - + #if TESTS_AS_APP let RUN() = !failures #else let aa = - match !failures with - | [] -> + match !failures with + | [] -> stdout.WriteLine "Test Passed" printf "TEST PASSED OK" ; exit 0 - | _ -> + | _ -> stdout.WriteLine "Test Failed" exit 1 #endif diff --git a/tests/fsharp/core/members/basics/test.fsi b/tests/fsharp/core/members/basics/test.fsi index b18bf68d4ac..339ac73625d 100644 --- a/tests/fsharp/core/members/basics/test.fsi +++ b/tests/fsharp/core/members/basics/test.fsi @@ -49,30 +49,30 @@ module RecordTypeTest = begin member InstanceIndexer2Count2: int member MutableInstanceIndexer : int -> string - with get,set + with get,set member MutableInstanceIndexerCount: int member MutableInstanceIndexer2 : int * int -> string - with get,set + with get,set member MutableInstanceIndexer2Count1: int member MutableInstanceIndexer2Count2: int static member StaticProperty : string - + static member MutableStaticProperty : string with get,set - + static member StaticIndexer : int -> string with get static member StaticIndexerCount : int - + static member MutableStaticIndexer: int -> string - with get,set + with get,set static member MutableStaticIndexerCount : int // methods member InstanceMethod : string -> string - + static member StaticMethod : string * string -> string end @@ -82,7 +82,7 @@ end module UnionTypeTest = begin [] - type AbstractType = + type AbstractType = begin // properties member InstanceProperty : string @@ -99,31 +99,31 @@ module UnionTypeTest = begin member InstanceIndexer2Count2: int member MutableInstanceIndexer : int -> string - with get,set + with get,set member MutableInstanceIndexerCount: int member MutableInstanceIndexer2 : int * int -> string - with get,set + with get,set member MutableInstanceIndexer2Count1: int member MutableInstanceIndexer2Count2: int static member StaticProperty : string - - + + static member MutableStaticProperty : string with get,set - + static member StaticIndexer : int -> string with get static member StaticIndexerCount : int - + static member MutableStaticIndexer: int -> string - with get,set + with get,set static member MutableStaticIndexerCount : int // methods member InstanceMethod : string -> string - + static member StaticMethod : string * string -> string end @@ -132,10 +132,10 @@ end module ToStringOnUnionTest = begin type MyUnion = A of string | B - + end module ToStringOnUnionTestOverride = begin type MyUnion = A of string | B - + end \ No newline at end of file diff --git a/tests/fsharp/core/members/console/console2.fs b/tests/fsharp/core/members/console/console2.fs index f59af562225..c8d59870797 100644 --- a/tests/fsharp/core/members/console/console2.fs +++ b/tests/fsharp/core/members/console/console2.fs @@ -2,10 +2,10 @@ module ConsoleApp -type ControlEvent = CTRL_C | CTRL_BREAK | CTRL_CLOSE |CTRL_LOGOFF | CTRL_SHUTDOWN - with - member x.ToInt = - match x with +type ControlEvent = CTRL_C | CTRL_BREAK | CTRL_CLOSE |CTRL_LOGOFF | CTRL_SHUTDOWN + with + member x.ToInt = + match x with | CTRL_C -> 0 | CTRL_BREAK -> 1 | CTRL_CLOSE -> 2 @@ -13,11 +13,11 @@ type ControlEvent = CTRL_C | CTRL_BREAK | CTRL_CLOSE |CTRL_LOGOFF | CTRL_SHUTDOW | CTRL_SHUTDOWN -> 4 static member OfInt(n) = match n with - | 0 -> CTRL_C - | 1 -> CTRL_BREAK - | 2 -> CTRL_CLOSE - | 3 -> CTRL_LOGOFF - | 4 -> CTRL_SHUTDOWN + | 0 -> CTRL_C + | 1 -> CTRL_BREAK + | 2 -> CTRL_CLOSE + | 3 -> CTRL_LOGOFF + | 4 -> CTRL_SHUTDOWN | _ -> invalid_arg "ControlEvent.ToInt" end @@ -32,7 +32,7 @@ let SetConsoleCtrlHandler((callback:ControlEventHandler),(add: bool)) : unit = ( /// Class to catch console control events (ie CTRL-C) in C#. /// Calls SetConsoleCtrlHandler() in Win32 API -type ConsoleCtrl() = +type ConsoleCtrl() = begin /// Handler to be called when a console event occurs. val listeners = new EventListeners<_>() @@ -44,26 +44,26 @@ type ConsoleCtrl() = do SetConsoleCtrlHandler(eventHandler,true) /// Remove the event handler - member x.Dispose(disposing) = - match x.eventHandler with - | Some h -> + member x.Dispose(disposing) = + match x.eventHandler with + | Some h -> SetConsoleCtrlHandler(h, false); x.eventHandler <- None | None -> () - interface IDisposable with + interface IDisposable with member x.Dispose() = x.Dispose(true) end override x.Finalize() = x.Dispose(false) end -let main() = - let cc = new ConsoleCtrl() in +let main() = + let cc = new ConsoleCtrl() in cc.ControlEvent.Add(fun ce -> Console.WriteLine("Event: {0}", ce)); Console.WriteLine("Enter 'E' to exit"); while (true) do - let s = Console.ReadLine() in + let s = Console.ReadLine() in if (s == "E") then exit 1; done diff --git a/tests/fsharp/core/members/factors-mutrec/test.fs b/tests/fsharp/core/members/factors-mutrec/test.fs index e8532addec1..c26f1604ece 100644 --- a/tests/fsharp/core/members/factors-mutrec/test.fs +++ b/tests/fsharp/core/members/factors-mutrec/test.fs @@ -1,4 +1,4 @@ -// #Regression #Conformance #MemberDefinitions #ObjectOrientedTypes #Classes +// #Regression #Conformance #MemberDefinitions #ObjectOrientedTypes #Classes //--------------------------------------------------------------- @@ -11,9 +11,9 @@ open System open System.Collections.Generic let failures = ref false -let report_failure () = +let report_failure () = stderr.WriteLine " NO"; failures := true -let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else report_failure() +let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else report_failure() /// The list of distribution operations (at the moment, this is just the constant distribution). type DistributionOps<'Distribution> = @@ -26,14 +26,14 @@ type Gaussian1D = val tau : float /// The precision of the Gaussian val pi : float - + /// The standard constructor. - new () = + new () = { tau = 0.0; pi = 0.0; } /// The parameterized constructor. - new (precisionMean, precision) = + new (precisionMean, precision) = { tau = precisionMean; pi = precision; } - + /// Precision of the Gaussian. member x.Precision with get() = x.pi /// Precision times mean of the Gaussian. @@ -43,29 +43,29 @@ type Gaussian1D = /// Variance of the Gaussian (Sigma^2). member x.Variance with get () = 1.0 / x.pi - member x.Density (point:Matrix) = + member x.Density (point:Matrix) = if (point.NoRows > 1 || point.NoColumns > 1) then failwith "This is a 1D distribution which cannot have a density of multidimensional points." else - let diff = point.Item(1,1) - x.Mean in + let diff = point.Item(1,1) - x.Mean in sqrt (x.Precision / (2.0 * System.Math.PI)) * exp (-diff * x.Precision * diff / 2.0) - - /// Absolute difference between two Gaussians - member x.AbsoluteDifference (y: Gaussian1D) = - max (abs (x.PrecisionMean - y.PrecisionMean)) (abs (x.Precision - y.Precision)) - + + /// Absolute difference between two Gaussians + member x.AbsoluteDifference (y: Gaussian1D) = + max (abs (x.PrecisionMean - y.PrecisionMean)) (abs (x.Precision - y.Precision)) + /// Samples a 1D Gaussian member x.Sample (numberOfSamples:int) random = M 1 - - interface IDistribution with + + interface IDistribution with override x.Density point = x.Density (point) - override x.AbsoluteDifference distribution = + override x.AbsoluteDifference distribution = match distribution with | :? Gaussian1D as gaussian1D -> x.AbsoluteDifference (gaussian1D) | _ -> failwith "Wrong distribution" override x.Sample numberOfSamples random = x.Sample numberOfSamples random - + /// String representation of a 1D Gaussian override x.ToString() = "[" + x.Mean.ToString () + "," + (sqrt (x.Variance)).ToString () + "]" @@ -89,13 +89,13 @@ type IFactorNode = /// The list of messages from the factor to all its variables. abstract Messages : IEnumerable< IDistribution > /// Abstract update (computation) mechanism - abstract UpdateMessage : int -> float + abstract UpdateMessage : int -> float let OneVariableNode((var: VariableNode<_>),f) = { new IFactorNode with member __.UpdateMessage i = - if i > 0 then + if i > 0 then raise (new ArgumentOutOfRangeException ("iVariableIndex", "This factor only points to one variable.")); let oldMarginal = var.distribution in let newMarginal = f oldMarginal in @@ -105,53 +105,53 @@ let OneVariableNode((var: VariableNode<_>),f) = member __.VariableNodes = Seq.ofList [ (var :> IVariableNode) ] } -module ResizeArray = +module ResizeArray = /// Iterates the function f for every element of the ResizeArray. let iter f (r:ResizeArray<_>) = r.ForEach (fun x -> f x) /// Creates a ResizeArray from a List. let of_list l :ResizeArray<_> = new ResizeArray<_>(List.toArray l) -type Matrix = +type Matrix = | M of int - member x.NoRows = 0 - member x.NoColumns = 0 + member x.NoRows = 0 + member x.NoColumns = 0 member x.Item with get((i:int),(j:int)) = 0.0 - + /// An abstract class for probability distributions in the exponential family. -type IDistribution = +type IDistribution = /// Gets a sample from the distribution. abstract member Sample : int -> System.Random -> Matrix /// Computes the probability density value at a particular point. abstract member Density : Matrix -> float /// Computes the absolute change between two distributions. abstract member AbsoluteDifference : IDistribution -> float - + /// A single variable in a factor graph. type VariableNode<'Distribution> when 'Distribution :> IDistribution = interface IVariableNode with /// Just return the distribution member x.Distribution = x.distribution :> IDistribution - + /// The marginal distribution of the variable. val mutable distribution : 'Distribution - + /// Sets up a new variable node new (dOps : DistributionOps<_>) = { distribution = dOps.One; } let Gaussian1DPriorFactorNode((var: VariableNode), mean, variance) = let update (oldMarginal : Gaussian1D) = new Gaussian1D (mean / variance + oldMarginal.PrecisionMean, 1.0 / variance + oldMarginal.Precision) in OneVariableNode(var, update) - + //--------------------------------------------------------------------- // Finish up -let _ = - if !failures then (stdout.WriteLine "Test Failed"; exit 1) - else (stdout.WriteLine "Test Passed"; - printf "TEST PASSED OK"; +let _ = + if !failures then (stdout.WriteLine "Test Failed"; exit 1) + else (stdout.WriteLine "Test Passed"; + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/members/ops-mutrec/test.fs b/tests/fsharp/core/members/ops-mutrec/test.fs index b4eae93feb8..674809b7444 100644 --- a/tests/fsharp/core/members/ops-mutrec/test.fs +++ b/tests/fsharp/core/members/ops-mutrec/test.fs @@ -1,18 +1,18 @@ -// #Conformance #MemberDefinitions #Overloading #ComputationExpressions +// #Conformance #MemberDefinitions #Overloading #ComputationExpressions //--------------------------------------------------------------- -// Same test as "members\ops" but with "rec" added +// Same test as "members\ops" but with "rec" added module rec OpsMutrec // <----- NOTE THE "rec" open Microsoft.FSharp.Math let failures = ref false -let report_failure () = +let report_failure () = stderr.WriteLine " NO"; failures := true -let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else report_failure() +let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else report_failure() -module FuncTest = +module FuncTest = type func = class @@ -20,9 +20,9 @@ module FuncTest = val impl: int -> int option member x.Invoke(y) = incr x.numCalls; x.impl(y) new(f) = { numCalls = ref 0; impl=f } - static member (>>>>) ((f: func), (g: func)) = + static member (>>>>) ((f: func), (g: func)) = new func(fun x -> match f.Invoke(x) with None -> None | Some b -> g.Invoke(b)) - static member (<<<<) ((f: func), (g: func)) = + static member (<<<<) ((f: func), (g: func)) = new func(fun x -> match g.Invoke(x) with None -> None | Some b -> f.Invoke(b)) end @@ -39,12 +39,12 @@ module FuncTest = -module OverloadSamples = +module OverloadSamples = open System //----------------------------------------------------------------------- - // Examples 1-5: Simple overloading + // Examples 1-5: Simple overloading let f1 x = x + 1.0 // add on floats let f2 x = x + 1.0f // add on 32-bit floats @@ -54,15 +54,15 @@ module OverloadSamples = //----------------------------------------------------------------------- // Example 6: overloading on types you've defined yourself. Normally - // we would use the standard F# pattern of defining a type + // we would use the standard F# pattern of defining a type // (i.e. it's data representation), then defining - // a module that carries the operations associated with the type, then + // a module that carries the operations associated with the type, then // using an augmentation to associate the operations with the type. However // here we've just added the augmentation straight away. - type IntVector = + type IntVector = | V of int array - static member (+) (V x, V y) = + static member (+) (V x, V y) = if x.Length <> y.Length then invalidArg "arg" "IntVectorOps.add"; V(Array.init x.Length (fun i -> x.[i] + y.[i])) @@ -76,13 +76,13 @@ module OverloadSamples = // The solution is to have your generic types carry a dictionary of operations. // Overloads on the generic type can then be correctly defined. This is a lot // like writing the translation of Haskell type classes by hand, with the advantage - // that you get complete control over the instantiations and where the + // that you get complete control over the instantiations and where the // dictionaries are created and passed, but with the disadvantage that // it is a little more verbose. // Here is the dictionary of operations: - type 'a NumberOps = + type 'a NumberOps = { zero: 'a; one: 'a; add : 'a -> 'a -> 'a; @@ -91,44 +91,44 @@ module OverloadSamples = // Here are two instantiations of this dictionary of operations: - let intOps = + let intOps = { zero = 0; one = 1; add = (+); mul = ( * ); neg = (~-); } - - let floatOps = + + let floatOps = { zero = 0.0; one = 1.0; add = (+); mul = ( * ); neg = (~-); } - + // Now the GenericVector type itself, its operations and the augmentation // giving the operator overload: - type 'a GenericVector = + type 'a GenericVector = { ops: 'a NumberOps; arr: 'a array } - let add x y = + let add x y = if x.arr.Length <> y.arr.Length then invalidArg "arg" "Matrix.(+)"; {ops=x.ops; arr=Array.init x.arr.Length (fun i -> x.ops.add x.arr.[i] y.arr.[i]) } - let create ops arr = + let create ops arr = {ops=ops; arr=arr } - type 'a GenericVector + type 'a GenericVector with - // Nb. For an operator associated with a generic type - // the type parameters involved in the operator's definition must be the same + // Nb. For an operator associated with a generic type + // the type parameters involved in the operator's definition must be the same // as the type parameters of the enclosing class. static member (+) ((x : 'a GenericVector),(y : 'a GenericVector)) = add x y end - let IGV arr = create intOps arr - let FGV arr = create floatOps arr + let IGV arr = create intOps arr + let FGV arr = create floatOps arr // Now the GenericVector type itself, its operations and the augmentation // giving the operator overload: @@ -143,11 +143,11 @@ module OverloadSamples = -module StateMonadTest = +module StateMonadTest = - type 'a IO = + type 'a IO = { impl: unit -> 'a } - with + with member f.Invoke() = f.impl() static member Result(r) = { impl = (fun () -> r) } member f.Bind(g) : 'b IO = g(f.impl()) @@ -157,41 +157,41 @@ module StateMonadTest = let (>>=) (f: 'a IO) g = f.Bind(g) let result x = {impl = (fun () -> x) } let mcons (p: 'a IO) (q : 'a list IO) = p >>= (fun x -> q >>= (fun y -> result (x::y))) - let sequence (l: 'a IO list) : 'a list IO = + let sequence (l: 'a IO list) : 'a list IO = List.foldBack mcons l (result []) -module StreamMonadTest = +module StreamMonadTest = - type 'a NumberOps = + type 'a NumberOps = { zero: 'a; one: 'a; add : 'a -> 'a -> 'a; mul : 'a -> 'a -> 'a; neg : 'a -> 'a; } - let intOps = + let intOps = { zero = 0; one = 1; add = (+); mul = ( * ); neg = (~-); } - - let floatOps = + + let floatOps = { zero = 0.0; one = 1.0; add = (+); mul = ( * ); neg = (~-); } - -module AnotherFuncTest = + +module AnotherFuncTest = type func = class @@ -199,15 +199,15 @@ module AnotherFuncTest = val impl: int -> int option member x.Invoke(y) = incr x.numCalls; x.impl(y) new(f) = { numCalls = ref 0; impl=f } - static member (++) ((f: func), (g: func)) = + static member (++) ((f: func), (g: func)) = new func(fun x -> match f.Invoke(x) with None -> None | Some b -> g.Invoke(b)) end - -module BasicOverloadTests = + +module BasicOverloadTests = let f4 x = 1 + x @@ -245,37 +245,37 @@ module BasicOverloadTests = // This one is tricky because the type of "s" is unknown, and could in theory resolve to a // nominal type which has an extra interesting "op_Addition(string,C)" overload. - // However, non-conservative resolution is applied prior to method overload resolution in + // However, non-conservative resolution is applied prior to method overload resolution in // expressions. This means the overload constraint is resolved OK to op_Addition(string,string). let f26 s = stdout.Write("-"+s) let f27 x = x + x - let f28 x = + let f28 x = let g x = x + x in g x - let f29 x = + let f29 x = let g x = x + 1.0 in g x - - let f30 x = + + let f30 x = let g x = x + "a" in g x + "3" - -module SubtypingAndOperatorOverloads = + +module SubtypingAndOperatorOverloads = type C() = class static member (+) (x:C,y:C) = new C() end - + type D() = class inherit C() static member (+) (x:D,y:D) = new D() - end + end let f201 (x1: C) (x2: C) = D.op_Addition(x1,x2) let f202 (x1: D) (x2: C) = D.op_Addition(x1,x2) @@ -283,7 +283,7 @@ module SubtypingAndOperatorOverloads = let f204 (x1: C) (x2: D) = D.op_Addition(x1,x2) let f205 (x1: C) (x2: _) = D.op_Addition(x1,x2) let f206 (x1: _) (x2: C) = D.op_Addition(x1,x2) - + let f301 (x1: C) (x2: C) = x1 + x2 let f302 (x1: D) (x2: C) = x1 + x2 @@ -301,8 +301,8 @@ module SubtypingAndOperatorOverloads = // TODO: investigate let f308 (x1: _) (x2: D) = x1 + x2 - -module OperatorOverloadsWithFloat = + +module OperatorOverloadsWithFloat = type C() = class static member (+) (x:C,y:float) = new C() @@ -311,7 +311,7 @@ module OperatorOverloadsWithFloat = static member (+) (x:C,y:C) = new C() end - + let f201 (x1: C) (x2: C) = C.op_Addition(x1,x2) let f202 (x1: float) (x2: C) = C.op_Addition(x1,x2) @@ -322,22 +322,22 @@ module OperatorOverloadsWithFloat = #endif let f207 (x1: float) (x2: _) = C.op_Addition(x1,x2) let f208 (x1: _) (x2: float) = C.op_Addition(x1,x2) - + let f301 (x1: C) (x2: C) = x1 + x2 let f302 (x1: float) (x2: C) = x1 + x2 let f304 (x1: C) (x2: float) = x1 + x2 - + // TODO: investigate let f305 (x1: C) (x2: _) = x1 + x2 // TODO: investigate let f306 (x1: _) (x2: C) = x1 + x2 - -module MiscOperatorOverloadTests = - let rec findBounding2Power b tp = if b<=tp then tp else findBounding2Power b (tp*2) +module MiscOperatorOverloadTests = + + let rec findBounding2Power b tp = if b<=tp then tp else findBounding2Power b (tp*2) let leastBounding2Power b = findBounding2Power b 1 @@ -351,7 +351,7 @@ module MiscOperatorOverloadTests = -module EnumerationOperatorTests = +module EnumerationOperatorTests = let x1 : System.DateTimeKind = enum 3 let x2 : System.DateTimeKind = enum<_> 3 let x3 = enum 3 @@ -360,28 +360,28 @@ module EnumerationOperatorTests = -module TraitCallsAndConstructors = +module TraitCallsAndConstructors = open System let inline clone (v : ^a) = (^a : (new : string * Exception -> ^a) ("", v)) let _ : InvalidOperationException = clone (InvalidOperationException()) type Base(x : float) = member this.x : float = x - + let inline (~-.) (v:^b) = (^b:(new : float -> ^b)(-((v:>Base).x))) - + type Inherited(x : float) = inherit Base(x) - + //let aBase = Base(5.0) //let aInherited = Inherited(5.0) - - + + //let _ : Inherited = -aInherited -let _ = - if !failures then (stdout.WriteLine "Test Failed"; exit 1) - else (stdout.WriteLine "Test Passed"; +let _ = + if !failures then (stdout.WriteLine "Test Failed"; exit 1) + else (stdout.WriteLine "Test Passed"; printf "TEST PASSED OK" exit 0) diff --git a/tests/fsharp/core/namespaces/test.fs b/tests/fsharp/core/namespaces/test.fs index 542b4495b61..269d6cfd663 100644 --- a/tests/fsharp/core/namespaces/test.fs +++ b/tests/fsharp/core/namespaces/test.fs @@ -1,17 +1,17 @@ -// #Conformance #Namespaces #SignatureFiles +// #Conformance #Namespaces #SignatureFiles namespace Hello.Goodbye - module Utils = + module Utils = let failures = ref [] - let report_failure (s : string) = + let report_failure (s : string) = stderr.Write" NO: " stderr.WriteLine s failures := !failures @ [s] - let test (s : string) b = + let test (s : string) b = stderr.Write(s) if b then stderr.WriteLine " OK" else report_failure (s) @@ -20,15 +20,15 @@ namespace Hello.Goodbye type A = A | B | C - module X = - let x = 1 + module X = + let x = 1 type UnionTypeHiddenWithDiscriminatorsPartlyRevealed = | A1 | B1 | C1 - module M = + module M = let v = A1.IsA1 type UnionTypeHiddenWithDiscriminatorsFullyRevealed = | A1 @@ -39,20 +39,20 @@ namespace Hello.Beatles type Song = HeyJude | Yesterday - module X = - let x = 2 + module X = + let x = 2 namespace UseMe open Hello.Goodbye - - module Tests = + + module Tests = Hello.Goodbye.Utils.test "test292jwe" (Hello.Goodbye.X.x + 1 = Hello.Beatles.X.x) Hello.Goodbye.Utils.test "test292jwe" (Hello.Beatles.HeyJude <> Hello.Beatles.Yesterday) - module MoreTests = + module MoreTests = open global.Microsoft.FSharp.Core let arr1 = global.Microsoft.FSharp.Collections.Array.map (global.Microsoft.FSharp.Core.Operators.(+) 1) [| 1;2;3;4 |] @@ -66,8 +66,8 @@ namespace UseMe let test4 : global.Microsoft.FSharp.Collections.list = [3] - let test5 x = - match x with + let test5 x = + match x with | global.Microsoft.FSharp.Core.None -> 1 | global.Microsoft.FSharp.Core.Some _ -> 1 @@ -76,8 +76,8 @@ namespace global type A = A | B | C - module X = - let x = 1 + module X = + let x = 1 @@ -86,10 +86,10 @@ namespace CheckRecursiveNameResolution1 module rec Test = - module N = + module N = let x = Test.M.C() - module M = + module M = [] type C() = member x.P = M.C() @@ -102,10 +102,10 @@ namespace CheckRecursiveNameResolution2 open M - module N = + module N = let x = C() - module M = + module M = [] type C() = member x.P = C() @@ -118,10 +118,10 @@ namespace rec CheckRecursiveNameResolution3 open M - module N = + module N = let x = C() - module M = + module M = [] type C() = member x.P = C() @@ -133,10 +133,10 @@ namespace rec CheckRecursiveNameResolution4 open Test.M // The name Test should be in scope - module N = + module N = let x = C(4) - module M = + module M = [] type C(c:int) = member x.P = C(0) @@ -145,7 +145,7 @@ namespace rec CheckRecursiveNameResolution4 do Hello.Goodbye.Utils.test "test292jwf" (Test.N.x.V = 4) - module UnionTestsWithSignature = + module UnionTestsWithSignature = // Check accessing the *.Is* properties of unions not through a signature let a = Hello.Goodbye.A @@ -159,10 +159,10 @@ namespace rec CheckRecursiveNameResolution5 open CheckRecursiveNameResolution5.Test.M // The name Test should be in scope - module N = + module N = let x = C(4) - module M = + module M = [] type C(c:int) = member x.P = C(0) @@ -181,12 +181,12 @@ namespace rec global open Test.M // The name Test should be in scope open M // The name M should be in scope - module N = + module N = let x = C(4) let x2 = M.C(4) let x3 = Test.M.C(4) - module M = + module M = [] type C(c:int) = member x.P = C(0) diff --git a/tests/fsharp/core/namespaces/test.fsi b/tests/fsharp/core/namespaces/test.fsi index 18e379d8525..03c29f5988f 100644 --- a/tests/fsharp/core/namespaces/test.fsi +++ b/tests/fsharp/core/namespaces/test.fsi @@ -40,10 +40,10 @@ namespace rec CheckRecursiveNameResolution1 module Test = - module N = + module N = val x : Test.M.C - module M = + module M = type C @@ -52,10 +52,10 @@ namespace rec CheckRecursiveNameResolution2 module Test = - module N = + module N = val x : M.C - module M = + module M = type C @@ -66,10 +66,10 @@ namespace rec CheckRecursiveNameResolution3 open M - module N = + module N = val x : C - module M = + module M = type C // Check recursive name resolution @@ -79,10 +79,10 @@ namespace rec CheckRecursiveNameResolution4 open Test.M - module N = + module N = val x : C - module M = + module M = type C @@ -93,10 +93,10 @@ namespace rec CheckRecursiveNameResolution5 open Test.M - module N = + module N = val x : C - module M = + module M = type C // Check recursive name resolution @@ -108,11 +108,11 @@ namespace rec global open Test.M open M - module N = + module N = val x : Test.M.C val x2 : M.C val x3 : C - module M = + module M = type C diff --git a/tests/fsharp/core/namespaces/test2.fs b/tests/fsharp/core/namespaces/test2.fs index 90a5d6bfe41..19f2621f238 100644 --- a/tests/fsharp/core/namespaces/test2.fs +++ b/tests/fsharp/core/namespaces/test2.fs @@ -3,15 +3,15 @@ module rec Test2 open Test2.M // the name "Test2" should be in scope, and its nested modules should be accessible -module N = +module N = let x = C() -module M = +module M = [] type C() = member x.P = C() -module UnionTestsWithSignature = +module UnionTestsWithSignature = // Check accessing the *.Is* properties of unions through a signature let a = Hello.Goodbye.A @@ -23,10 +23,10 @@ module UnionTestsWithSignature = let RUN() = !Hello.Goodbye.Utils.failures #else let aa = - if not (!Hello.Goodbye.Utils.failures).IsEmpty then + if not (!Hello.Goodbye.Utils.failures).IsEmpty then stdout.WriteLine "Test Failed" exit 1 - else + else stdout.WriteLine "Test Passed" printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/namespaces/test2.fsi b/tests/fsharp/core/namespaces/test2.fsi index 08e4399fac5..d271f665a24 100644 --- a/tests/fsharp/core/namespaces/test2.fsi +++ b/tests/fsharp/core/namespaces/test2.fsi @@ -3,9 +3,9 @@ module rec Test2 open Test2.M -module N = +module N = val x : C -module M = +module M = type C diff --git a/tests/fsharp/core/reflect/test.fs b/tests/fsharp/core/reflect/test.fs index c072562676d..e171aac0b92 100644 --- a/tests/fsharp/core/reflect/test.fs +++ b/tests/fsharp/core/reflect/test.fs @@ -1,4 +1,4 @@ -// #Conformance #Reflection #Unions #Tuples +// #Conformance #Reflection #Unions #Tuples module Test #nowarn "44" diff --git a/tests/fsharp/core/reflect/test2.fs b/tests/fsharp/core/reflect/test2.fs index 78e876605a9..a0f7ef6cffe 100644 --- a/tests/fsharp/core/reflect/test2.fs +++ b/tests/fsharp/core/reflect/test2.fs @@ -1,15 +1,15 @@ -// #Conformance #Reflection #Unions #Tuples +// #Conformance #Reflection #Unions #Tuples module Test2 #nowarn "44" let failures = ref [] -let report_failure (s : string) = +let report_failure (s : string) = stderr.Write" NO: " stderr.WriteLine s failures := !failures @ [s] -let test (s : string) b = +let test (s : string) b = stderr.Write(s) if b then stderr.WriteLine " OK" else report_failure (s) @@ -22,43 +22,43 @@ open Test open Microsoft.FSharp.Reflection -module NewTests = +module NewTests = let (|C|) (c:UnionCaseInfo) = c.Name, c.GetFields() let (|M|) (c:System.Reflection.MethodInfo) = c.Name, c.MemberType let (|P|) (c:System.Reflection.PropertyInfo) = c.Name, c.MemberType let (|String|_|) (v:obj) = match v with :? string as s -> Some(s) | _ -> None let (|Int|_|) (v:obj) = match v with :? int as s -> Some(s) | _ -> None - let showAll = + let showAll = #if NETCOREAPP true #else - System.Reflection.BindingFlags.Public ||| System.Reflection.BindingFlags.NonPublic + System.Reflection.BindingFlags.Public ||| System.Reflection.BindingFlags.NonPublic #endif - do test "ncwowe932aq" (FSharpType.IsUnion (typeof)) - do test "ncwowe932aw" (FSharpType.IsUnion (XX("1","2").GetType())) + do test "ncwowe932aq" (FSharpType.IsUnion (typeof)) + do test "ncwowe932aw" (FSharpType.IsUnion (XX("1","2").GetType())) do test "ncwowe932ae" (FSharpType.IsUnion ((XX2 "1").GetType())) - do test "ncwowe932ar" (FSharpType.IsRecord (typeof)) - do test "ncwowe932at" (FSharpType.IsRecord (typeof>)) - do test "ncwowe932at" (FSharpType.IsRecord (typeof>)) + do test "ncwowe932ar" (FSharpType.IsRecord (typeof)) + do test "ncwowe932at" (FSharpType.IsRecord (typeof>)) + do test "ncwowe932at" (FSharpType.IsRecord (typeof>)) do test "ncwowe932at" (not (FSharpType.IsFunction (typeof>)) ) do test "ncwowe932at" (not (FSharpType.IsExceptionRepresentation (typeof>)) ) do test "ncwowe932at" (not (FSharpType.IsUnion (typeof>)) ) - - do test "ncwowe932ay" (FSharpType.IsFunction (typeof<(int -> int)>)) + + do test "ncwowe932ay" (FSharpType.IsFunction (typeof<(int -> int)>)) do test "ncwowe932au" (FSharpType.IsFunction ( (fun x -> x).GetType())) do test "ncwowe932ai" (FSharpType.IsExceptionRepresentation (typeof< MatchFailureException>)) - do test "ncwowe932a1" (not (FSharpType.IsExceptionRepresentation (typeof))) - do test "ncwowe932a2" (not (FSharpType.IsFunction (typeof))) - do test "ncwowe932a3" (not (FSharpType.IsUnion (typeof))) - do test "ncwowe932a4" (not (FSharpType.IsUnion (typeof))) - do test "ncwowe932a5" (not (FSharpType.IsRecord (typeof))) - do test "ncwowe932a6" (not (FSharpType.IsRecord (typeof))) - do test "ncwowe932a7" (not (FSharpType.IsFunction (typeof))) - do test "ncwowe932a8" (not (FSharpType.IsUnion (typeof))) - + do test "ncwowe932a1" (not (FSharpType.IsExceptionRepresentation (typeof))) + do test "ncwowe932a2" (not (FSharpType.IsFunction (typeof))) + do test "ncwowe932a3" (not (FSharpType.IsUnion (typeof))) + do test "ncwowe932a4" (not (FSharpType.IsUnion (typeof))) + do test "ncwowe932a5" (not (FSharpType.IsRecord (typeof))) + do test "ncwowe932a6" (not (FSharpType.IsRecord (typeof))) + do test "ncwowe932a7" (not (FSharpType.IsFunction (typeof))) + do test "ncwowe932a8" (not (FSharpType.IsUnion (typeof))) + do test "ncwowe932a" (match FSharpType.GetUnionCases (typeof) with [| C("X",[| _ |]); C("XX",[|_; _|]) |] -> true | _ -> false) do test "ncwowe932gb" (match FSharpType.GetUnionCases (typeof) with [| C("X2",[||]); C("XX2",[|_|]) |]-> true | _ -> false) @@ -116,7 +116,7 @@ module NewTests = let UCI (ty,i) = FSharpType.GetUnionCases(ty).[i] - + do test "ncqmkee32ao1" (FSharpValue.PreComputeUnionConstructor(UCI(typeof, 0)) [| box "1" |] = box (X "1")) do test "ncqmkee32ao2" (FSharpValue.PreComputeUnionConstructor(UCI(typeof, 1)) [| box "1"; box "2" |] = box (XX ("1","2"))) do test "ncqmkee32ao3" (FSharpValue.PreComputeUnionConstructor(UCI(typeof, 0)) [| |] = box X2) @@ -139,7 +139,7 @@ module NewTests = do test "ncqmkee33h9" (FSharpValue.PreComputeTupleConstructor(typeof) [| box "1"; box "2"; box "3"; box "4"; box "5"; box "6"; box "7"; box "8"; box "9"; box "10"; box "11"; box "12"; box "13"; box "14"; box "15"; box "16"|] = box ("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16")) let badarg f = try ignore(f()); false with :? System.ArgumentException -> true - + do test "mcwowe932a" (badarg (fun () -> FSharpType.GetUnionCases (typeof))) do test "mcwowe932gb" (badarg (fun () -> FSharpType.GetUnionCases (typeof))) do test "mcwowe932w" (badarg (fun () -> FSharpType.GetUnionCases (typeof>))) @@ -153,7 +153,7 @@ module NewTests = do test "mcqmkee32ap" (badarg (fun () -> FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof).[0]))) do test "mcqmkee32aq" (badarg (fun () -> FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof).[1]))) do test "mcqmkee32ar" (badarg (fun () -> FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof).[0]))) - + do test "mcqmkee32ao1" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof, 0)))) do test "mcqmkee32ao2" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof, 1)))) do test "mcqmkee32ao3" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof, 0)))) @@ -206,7 +206,7 @@ module NewTests = let UCI (ty,i) = FSharpType.GetUnionCases(ty).[i] - + do test "ncqmkee32ao1" (FSharpValue.PreComputeUnionConstructor(UCI(typeof, 0),showAll) [| box "1" |] = box (X "1")) do test "ncqmkee32ao2" (FSharpValue.PreComputeUnionConstructor(UCI(typeof, 1),showAll) [| box "1"; box "2" |] = box (XX ("1","2"))) do test "ncqmkee32ao3" (FSharpValue.PreComputeUnionConstructor(UCI(typeof, 0),showAll) [| |] = box X2) @@ -216,7 +216,7 @@ module NewTests = do test "ncqmkee32ao7" (FSharpValue.PreComputeRecordConstructor(typeof,showAll) [| box 1; |] = box {r1a = 1 }) do test "ncqmkee32ao8a" (FSharpValue.PreComputeRecordConstructor(typeof,showAll) [| box "1"; box 1 |] = box {r2b = "1"; r2a = 1 }) do test "ncqmkee32ao8b" (FSharpValue.PreComputeRecordConstructor(typeof>,showAll) [| box "1"; box 1 |] = box {r3b = "1"; r3a = 1 }) - do test "ncqmkee32ao8c" (typeof>.GetConstructor([| |]) <> null) + do test "ncqmkee32ao8c" (typeof>.GetConstructor([| |]) <> null) open System.Reflection do printfn "%A" (FSharpType.GetUnionCases (typeof, showAll)) @@ -231,7 +231,7 @@ module NewTests = let UCI2 (ty,i) = FSharpType.GetUnionCases(ty, showAll).[i] - + do test "qcqmkee32ao" (match FSharpValue.PreComputeUnionReader (UCI2(typeof, 1),showAll) (box (InternalXX ("1","2"))) with [| String("1");String("2") |] -> true | _ -> false) do test "qcqmkee32ap" (match FSharpValue.PreComputeUnionReader (UCI2(typeof, 0),showAll) (box (InternalX "1")) with [| String("1") |] -> true | _ -> false) do test "qcqmkee32aq" (match FSharpValue.PreComputeUnionReader (UCI2(typeof, 1),showAll) (box (InternalXX2 "1")) with [| String("1") |] -> true | _ -> false) @@ -260,22 +260,22 @@ module TwoCasedUnionWithNullAsTrueValueAnnotation = with _ -> false test "TwoCasedUnionWithNullAsTrueValueAnnotation" result -module TEst = +module TEst = - type token = + type token = | X | DOUBLELITERAL of (System.Double) | DECIMALLITERAL of (System.Decimal) | Y of (int) | INTEGERLITERAL - | VARNAME - | QNAME of (string) + | VARNAME + | QNAME of (string) let tok2 = (X:token) let _ = printfn "%A" tok2 let printany x = (printf "%A" x;stderr.Write "\n") - + let _ = printany (1 : int) let _ = printany (true : bool) let _ = printany (27.3 : float) @@ -286,7 +286,7 @@ module TEst = rr_strs = ["skdf";"kshkshfskhf"]; rr_thunk = fun () -> ()} let _ = printany rrv - + let _ = printany ["Lists";"have";"special";"treatment";"hence";"this";"test";"case"] let _ = printany [] let _ = printany (Some "options likewise") @@ -300,7 +300,7 @@ module TEst = let _ = printany printany (* =) *) -module DynamicCall = +module DynamicCall = open System open System.Reflection @@ -314,7 +314,7 @@ module DynamicCall = let genericCallMethod = typeof.DeclaringType.GetMethod "call" let callMethod = genericCallMethod.MakeGenericMethod [| typeof |] - try + try callMethod.Invoke (null, [| Object () |]) |> ignore failwith "expected an exception" with :? TargetInvocationException as ex -> @@ -327,12 +327,12 @@ module DynamicCall = let RUN() = !failures #else let aa = - match !failures with - | [] -> + match !failures with + | [] -> stdout.WriteLine "Test Passed" printf "TEST PASSED OK" ; exit 0 - | _ -> + | _ -> stdout.WriteLine "Test Failed" exit 1 #endif diff --git a/tests/fsharp/core/refnormalization/AscendentAssembly.fs b/tests/fsharp/core/refnormalization/AscendentAssembly.fs index 8fa5173ce90..2a870538feb 100644 --- a/tests/fsharp/core/refnormalization/AscendentAssembly.fs +++ b/tests/fsharp/core/refnormalization/AscendentAssembly.fs @@ -2,5 +2,5 @@ namespace AscendentAssembly module Ascendent = - let hello () = + let hello () = DependentAssembly.Say.hello "Ascendent" diff --git a/tests/fsharp/core/refnormalization/test.fs b/tests/fsharp/core/refnormalization/test.fs index 994868999e5..1198e4cafbc 100644 --- a/tests/fsharp/core/refnormalization/test.fs +++ b/tests/fsharp/core/refnormalization/test.fs @@ -24,6 +24,6 @@ let main args = printfn "Expected: %A " args printfn "Actual: %A " versions 1 - else + else printf "TEST PASSED OK" ; 0 diff --git a/tests/fsharp/core/topinit/lib69514.fs b/tests/fsharp/core/topinit/lib69514.fs index c6f0420d581..58cccd55db1 100644 --- a/tests/fsharp/core/topinit/lib69514.fs +++ b/tests/fsharp/core/topinit/lib69514.fs @@ -1,7 +1,7 @@ namespace Lib - + module File1 = - + let mutable discState = System.DateTime.Now @@ -9,6 +9,6 @@ module File2 = [] type DiscState(rep : int) = member this.Rep = rep - + let mutable discState = DiscState(0) - + diff --git a/tests/fsharp/core/topinit/lib69514.fsi b/tests/fsharp/core/topinit/lib69514.fsi index fc9cc450520..3929fda34b9 100644 --- a/tests/fsharp/core/topinit/lib69514.fsi +++ b/tests/fsharp/core/topinit/lib69514.fsi @@ -1,6 +1,6 @@ namespace Lib -module File1 = +module File1 = val mutable discState : System.DateTime @@ -9,8 +9,8 @@ module File2 = type DiscState = new : int -> DiscState member Rep : int - + val mutable discState : DiscState - + diff --git a/tests/fsharp/core/topinit/lib_deterministic_init16.fs b/tests/fsharp/core/topinit/lib_deterministic_init16.fs index 23e07466b67..d600f3d7f04 100644 --- a/tests/fsharp/core/topinit/lib_deterministic_init16.fs +++ b/tests/fsharp/core/topinit/lib_deterministic_init16.fs @@ -5,7 +5,7 @@ let c = 1 let b = true // This is a value we will access from the outside. // We expect accessing the value 'x' will _not_ trigger initialization of this module -let x = enum(0) +let x = enum(0) // This is a value we can access from the outside to definitely force initialization of the module let mutable forceInit = 1 // This sets a value in another module to indicate that initialization has happened diff --git a/tests/fsharp/core/topinit/static-main.fs b/tests/fsharp/core/topinit/static-main.fs index e66cfb03da3..becd7d9adeb 100644 --- a/tests/fsharp/core/topinit/static-main.fs +++ b/tests/fsharp/core/topinit/static-main.fs @@ -1,6 +1,6 @@  [] -let main _ = +let main _ = InstanceTests.checkAll() try printfn "trigger = %A" StaticTest1.trigger with _ -> printfn "Good, got a static initialization failure" StaticTest1.checkAll() diff --git a/tests/fsharp/core/topinit/test0.fs b/tests/fsharp/core/topinit/test0.fs index ac6444bb996..eecf1e515c3 100644 --- a/tests/fsharp/core/topinit/test0.fs +++ b/tests/fsharp/core/topinit/test0.fs @@ -1,96 +1,96 @@ -// #Conformance #Interop +// #Conformance #Interop module InstanceTests let mutable trigger = 1 -let check s b1 b2 = +let check s b1 b2 = if b1 = b2 then printfn "%s OK" s else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1) -module ClassWithInheritAndImmediateReferenceToThisInLet = - type B() = +module ClassWithInheritAndImmediateReferenceToThisInLet = + type B() = member __.P = 1 let id x = x - type C() as x = + type C() as x = inherit B() let y = id x // it is ok to access the this pointer and pass it to external code as long as it doesn't call any members member __.ThisPointer1 = x member __.ThisPointer2 = y - let checkA() = + let checkA() = let c = C() check "cwknecw021" c.ThisPointer1 c.ThisPointer2 - -module ClassWithNoInheritAndImmediateReferenceToThisInLet = - type C() as x = + +module ClassWithNoInheritAndImmediateReferenceToThisInLet = + type C() as x = let y = id x // it is ok to access the this pointer and pass it to external code as long as it doesn't call any members member __.ThisPointer1 = x member __.ThisPointer2 = y - let checkB() = + let checkB() = let c = C() check "cwknecw021" c.ThisPointer1 c.ThisPointer2 - -module ClassWithInheritAndDelayedReferenceToThisInLet = - type B() = + +module ClassWithInheritAndDelayedReferenceToThisInLet = + type B() = member __.P = 1 let id x = x - type C() as x = + type C() as x = inherit B() - let y() = x + let y() = x member __.ThisPointer1 = x member __.ThisPointer2 = y() - let checkC() = + let checkC() = let c = C() check "cwknecw021" c.ThisPointer1 c.ThisPointer2 - -module TestPassingThisToBase = - type B(thisC: unit -> obj) = + +module TestPassingThisToBase = + type B(thisC: unit -> obj) = member __.ThisPointerFromC = thisC() let id x = x - type C() as this = + type C() as this = inherit B(fun () -> box this) member c.ThisPointer1 = (c.ThisPointerFromC :?> C) member c.ThisPointer2 = this - let checkD() = + let checkD() = let c = C() check "cwknecw022" c.ThisPointer1 c.ThisPointer2 -module TestAccessingMemberFromBaseAfterInit = +module TestAccessingMemberFromBaseAfterInit = let id x = x - type B(thisC: unit -> C) = + type B(thisC: unit -> C) = member __.ThisPointerFromC = thisC() - and C() as this = + and C() as this = inherit B(fun () -> this) do check "cwknecw023" this.ThisPointer1 this.ThisPointer2 - member c.ThisPointer1 = c.ThisPointerFromC + member c.ThisPointer1 = c.ThisPointerFromC member c.ThisPointer2 = this - let checkE() = + let checkE() = let c = C() () -let checkAll() = +let checkAll() = ClassWithInheritAndImmediateReferenceToThisInLet.checkA() ClassWithNoInheritAndImmediateReferenceToThisInLet.checkB() ClassWithInheritAndDelayedReferenceToThisInLet.checkC() TestPassingThisToBase.checkD() TestAccessingMemberFromBaseAfterInit.checkE() - + diff --git a/tests/fsharp/core/topinit/test1.fs b/tests/fsharp/core/topinit/test1.fs index a6fbd1e1edc..3e1f9660d98 100644 --- a/tests/fsharp/core/topinit/test1.fs +++ b/tests/fsharp/core/topinit/test1.fs @@ -1,24 +1,24 @@ -// #Conformance #Interop +// #Conformance #Interop module StaticTest1 let mutable trigger = 1 -let check s b1 b2 = +let check s b1 b2 = if b1 = b2 then printfn "%s OK" s else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1) -module CheckStatic1 = - type B() = +module CheckStatic1 = + type B() = static let x = B.P static member P = x - let check1() = + let check1() = check "cwknecw021a1Try" (try B.P |> ignore; false with :? System.InvalidOperationException -> true) true check "cwknecw021a2Try" (try B.P |> ignore; false with :? System.InvalidOperationException -> true) true check "cwknecw021a3Try" (try B.P |> ignore; false with :? System.InvalidOperationException -> true) true -let checkAll() = +let checkAll() = CheckStatic1.check1() - + diff --git a/tests/fsharp/core/topinit/test2.fs b/tests/fsharp/core/topinit/test2.fs index 98fa4d1a60e..7583022546f 100644 --- a/tests/fsharp/core/topinit/test2.fs +++ b/tests/fsharp/core/topinit/test2.fs @@ -1,30 +1,30 @@ -// #Conformance #Interop +// #Conformance #Interop module StaticTest2 let mutable trigger = 1 -let check s b1 b2 = +let check s b1 b2 = if b1 = b2 then printfn "%s OK" s else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1) -module CheckStatic2 = - type B() = +module CheckStatic2 = + type B() = static let x = 1 - static let x2 = B.P1 + 1 // should be ok - static let x3 = B.P1 + 2 // should be ok + static let x2 = B.P1 + 1 // should be ok + static let x3 = B.P1 + 2 // should be ok static member P1 = x static member P2 = x2 static member P3 = x3 - let check2() = + let check2() = check "cwknecw021b" B.P1 1 check "cwknecw021c" B.P2 2 - check "cwknecw021d" B.P3 3 + check "cwknecw021d" B.P3 3 -let checkAll() = +let checkAll() = CheckStatic2.check2() - + diff --git a/tests/fsharp/core/topinit/test3.fs b/tests/fsharp/core/topinit/test3.fs index 166a516b4ff..d56043e9e02 100644 --- a/tests/fsharp/core/topinit/test3.fs +++ b/tests/fsharp/core/topinit/test3.fs @@ -1,24 +1,24 @@ -// #Conformance #Interop +// #Conformance #Interop module StaticTest3 let mutable trigger = 1 -let check s b1 b2 = +let check s b1 b2 = if b1 = b2 then printfn "%s OK" s else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1) -module CheckStatic3 = - type B() = +module CheckStatic3 = + type B() = static let x = 1 // should be ok static let x2 = B.P2 + 1 // should fail - static let x3 = B.P1 + 2 // should be ok + static let x3 = B.P1 + 2 // should be ok static member P1 = x static member P2 = x2 static member P3 = x3 - let check3() = + let check3() = check "cwknecw021e2" B.P1 1 // the static initialization failed, caught in main, but subsequent accesses succeed! check "cwknecw021e2" B.P1 1 // subsequent accesses succeed! check "cwknecw021e3Try" (try B.P2 |> ignore; false with :? System.InvalidOperationException -> true) true @@ -26,7 +26,7 @@ module CheckStatic3 = check "cwknecw021e2Try" (try B.P3 |> ignore; false with :? System.InvalidOperationException -> true) true check "cwknecw021e3Try" (try B.P3 |> ignore; false with :? System.InvalidOperationException -> true) true -let checkAll() = +let checkAll() = CheckStatic3.check3() - + diff --git a/tests/fsharp/core/topinit/test4.fs b/tests/fsharp/core/topinit/test4.fs index 4e597c0edc0..a52da0780c8 100644 --- a/tests/fsharp/core/topinit/test4.fs +++ b/tests/fsharp/core/topinit/test4.fs @@ -1,32 +1,32 @@ -// #Conformance #Interop +// #Conformance #Interop module GenericStaticTest4 -let check s b1 b2 = +let check s b1 b2 = if b1 = b2 then printfn "%s OK" s else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1) -module CheckStatic4 = - type B<'T>() = +module CheckStatic4 = + type B<'T>() = static do printfn "Running initializer for %A (part 1)" typeof> static let x = 1 // should be ok static do printfn "Running initializer for %A (part 2)" typeof> static let x2 = B<'T>.P2 + 1 // should fail static do printfn "Running initializer for %A (part 3)" typeof> - static let x3 = B<'T>.P1 + 2 // should be ok + static let x3 = B<'T>.P1 + 2 // should be ok static do printfn "Done initializer for %A" typeof> static member P1 = x static member P2 = x2 static member P3 = x3 - let check4() = + let check4() = // This is static initialization in a generic type, and the first access happens here check "cwknecw021e1TryA" (try B.P1 |> ignore; false with :? System.TypeInitializationException -> true) true - // NOTE NOTE NOTE: the rest of this test may be flakey under + // NOTE NOTE NOTE: the rest of this test may be flakey under // - NGEN of code // - Different CLRs @@ -47,8 +47,8 @@ module CheckStatic4 = check "cwknecw021e2TryA55" (try B.P3 |> ignore; false with :? System.TypeInitializationException -> true) true check "cwknecw021e3TryA66" (try B.P3 |> ignore; false with :? System.TypeInitializationException -> true) true -let checkAll() = +let checkAll() = //CheckStatic4.check4() // BUG: FSHARP1.0:5705 () - + diff --git a/tests/fsharp/core/topinit/test5.fs b/tests/fsharp/core/topinit/test5.fs index 49b7df7b7f0..78316a57122 100644 --- a/tests/fsharp/core/topinit/test5.fs +++ b/tests/fsharp/core/topinit/test5.fs @@ -1,26 +1,26 @@ -// #Conformance #Interop +// #Conformance #Interop module StaticTest5 let mutable trigger = 1 -let check s b1 b2 = +let check s b1 b2 = if b1 = b2 then printfn "%s OK" s else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1) -module CheckStatic5 = - type B() = +module CheckStatic5 = + type B() = static let x = 1 // should be ok static let x2 = C.P2 + 1 // should fail static member P1 = x static member P2 = x2 - and C() = - static let x3 = B.P1 + 2 // should be ok + and C() = + static let x3 = B.P1 + 2 // should be ok static member P2 = B.P2 static member P3 = x3 - let check5() = + let check5() = check "StaticTest5.cwknecDw021e2" B.P1 1 // subsequent accesses succeed! check "StaticTest5.cwknecDw021e2" B.P1 1 // subsequent accesses succeed! check "StaticTest5.cwknecDw021e3TryB" (try C.P2 |> ignore; false with :? System.InvalidOperationException -> true) true @@ -29,8 +29,8 @@ module CheckStatic5 = check "StaticTest5.cwknecDw021e3TryE" (try C.P3 |> ignore; false with :? System.InvalidOperationException -> true) true -let checkAll() = +let checkAll() = CheckStatic5.check5() - + diff --git a/tests/fsharp/core/topinit/test6.fs b/tests/fsharp/core/topinit/test6.fs index 108cd4b6f5b..9a1c10b6a66 100644 --- a/tests/fsharp/core/topinit/test6.fs +++ b/tests/fsharp/core/topinit/test6.fs @@ -1,28 +1,28 @@ -// #Conformance #Interop +// #Conformance #Interop module GenericStaticTest6 -let check s b1 b2 = +let check s b1 b2 = if b1 = b2 then printfn "%s OK" s else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1) -module CheckStatic6 = - type B<'T>() = +module CheckStatic6 = + type B<'T>() = static let x = 1 // should be ok static let x2 = C<'T>.P2 + 1 // should fail static member P1 = x static member P2 = x2 - and C<'T>() = - static let x3 = B<'T>.P1 + 2 // should be ok + and C<'T>() = + static let x3 = B<'T>.P1 + 2 // should be ok static member P2 = B<'T>.P2 static member P3 = x3 - let check6() = + let check6() = // This is static initialization in a generic type, and the first access happens here check "GenericStaticTest6.cwknecDw021e1TryA" (try B.P1 |> ignore; false with :? System.TypeInitializationException -> true) true - // NOTE NOTE NOTE: the rest of this test may be flakey under + // NOTE NOTE NOTE: the rest of this test may be flakey under // - NGEN of code // - Different CLRs @@ -36,7 +36,7 @@ module CheckStatic6 = // This is static initialization in a generic type, and the first access happens here check "GenericStaticTest6.cwknecDw021e1TryA" (try B.P1 |> ignore; false with :? System.TypeInitializationException -> true) true - // NOTE NOTE NOTE: the rest of this test may be flakey under + // NOTE NOTE NOTE: the rest of this test may be flakey under // - NGEN of code // - Different CLRs @@ -49,8 +49,8 @@ module CheckStatic6 = //check "GenericStaticTest6.cwknecDw021e3TryE" C.P3 3 #endif -let checkAll() = +let checkAll() = //CheckStatic6.check6() // BUG: FSHARP1.0:5705 () - + diff --git a/tests/fsharp/core/topinit/test_deterministic_init.fs b/tests/fsharp/core/topinit/test_deterministic_init.fs index 55474ff38a2..85fad119ea3 100644 --- a/tests/fsharp/core/topinit/test_deterministic_init.fs +++ b/tests/fsharp/core/topinit/test_deterministic_init.fs @@ -1,4 +1,4 @@ -// #Conformance #Interop +// #Conformance #Interop let checkNotInitialized s isInitialized = if isInitialized then (printf "FAILED: %s, expected module not to be initialized" s; exit 1) let checkInitialized s isInitialized = if not isInitialized then (printf "FAILED: %s, expected module to be initialized" s; exit 1) //----------------- diff --git a/tests/fsharp/core/unicode/kanji-unicode-utf7-codepage-65000.fs b/tests/fsharp/core/unicode/kanji-unicode-utf7-codepage-65000.fs index 09da3189ba2..1dfd21b605c 100644 --- a/tests/fsharp/core/unicode/kanji-unicode-utf7-codepage-65000.fs +++ b/tests/fsharp/core/unicode/kanji-unicode-utf7-codepage-65000.fs @@ -3,4 +3,3 @@ module Kanjii let +AF8- +AD0- System.Console.WriteLine +ACJvIgAi- do exit 0 - \ No newline at end of file diff --git a/tests/fsharp/core/unicode/kanji-unicode-utf8-nosig-codepage-65001.fs b/tests/fsharp/core/unicode/kanji-unicode-utf8-nosig-codepage-65001.fs index 184f0a87308..d3c9fddc3a1 100644 --- a/tests/fsharp/core/unicode/kanji-unicode-utf8-nosig-codepage-65001.fs +++ b/tests/fsharp/core/unicode/kanji-unicode-utf8-nosig-codepage-65001.fs @@ -1,6 +1,6 @@ module Kanji let _ = stdout.WriteLine "漢" -let f a c vef e = stdout.WriteLine "漢"; a c vef e +let f a c vef e = stdout.WriteLine "漢"; a c vef e do exit 0 diff --git a/tests/fsharp/core/unicode/kanji-unicode-utf8-withsig-codepage-65001.fs b/tests/fsharp/core/unicode/kanji-unicode-utf8-withsig-codepage-65001.fs index 9c67c5a5708..c8c6c243160 100644 --- a/tests/fsharp/core/unicode/kanji-unicode-utf8-withsig-codepage-65001.fs +++ b/tests/fsharp/core/unicode/kanji-unicode-utf8-withsig-codepage-65001.fs @@ -1,6 +1,6 @@ module Kanjii let _ = stdout.WriteLine "漢" -let f a c vef e = stdout.WriteLine "漢"; a c vef e +let f a c vef e = stdout.WriteLine "漢"; a c vef e do exit 0 diff --git a/tests/fsharp/core/unitsOfMeasure/test.fs b/tests/fsharp/core/unitsOfMeasure/test.fs index fa7244122aa..04286125fd9 100644 --- a/tests/fsharp/core/unitsOfMeasure/test.fs +++ b/tests/fsharp/core/unitsOfMeasure/test.fs @@ -1,7 +1,7 @@ let mutable failures = [] -let report_failure (s : string) = +let report_failure (s : string) = stderr.Write" NO: " stderr.WriteLine s failures <- failures @ [s] @@ -9,16 +9,16 @@ let report_failure (s : string) = let test s b = stderr.Write(s:string) if b then stderr.WriteLine " OK" else report_failure s - stderr.WriteLine "" + stderr.WriteLine "" -let check s v1 v2 = - stderr.Write(s:string); - if (v1 = v2) then - stderr.WriteLine " OK" - stderr.WriteLine "" +let check s v1 v2 = + stderr.Write(s:string); + if (v1 = v2) then + stderr.WriteLine " OK" + stderr.WriteLine "" else - eprintf " FAILED: got %A, expected %A" v1 v2 - stderr.WriteLine "" + eprintf " FAILED: got %A, expected %A" v1 v2 + stderr.WriteLine "" report_failure s @@ -35,7 +35,7 @@ type T() = type TheType = { A : int; B : int; D : int; G : seq } with static member Create a b _ d _ _ g = { A = a; B = b; D = d; G = g } - + let CreateBadImageFormatException () = let create a b c d (e:int<_>) (f:int) g = TheType.Create a b (int c) d e f g seq { yield create 0 0 0 0 0 0 [0] } @@ -72,7 +72,7 @@ module TopLevelTypeFunctionGenericOnlyByMeasure = abstract Invoke: float<'u> list -> int let rec loop<[]'u> = - { new C<'u> with + { new C<'u> with member _.Invoke(xs) = match xs with | [] -> 1 @@ -86,60 +86,60 @@ module TopLevelTypeFunctionGenericOnlyByMeasure = module TestLibrary = - [] + [] type unit = - //converts an integer into a unit of measureof type int - static member convertLP x = LanguagePrimitives.Int32WithMeasure x - static member convert x = x * 1 - static member convertFromInt (x: int) = x * 1 //not generic - + //converts an integer into a unit of measureof type int + static member convertLP x = LanguagePrimitives.Int32WithMeasure x + static member convert x = x * 1 + static member convertFromInt (x: int) = x * 1 //not generic + //add a unit of measure to a number and convert it back again - let test1 num = + let test1 num = let output = unit.convertLP(num) int output - let test2 num = + let test2 num = let output = unit.convert(num) int output //convert the number in a sub function - let test3 num = - let convert i = + let test3 num = + let convert i = unit.convertLP(i) let output = convert num //BadImageFormatException is thrown here int output //type of output inferred as int ?! - let test4 num = + let test4 num = let convert (i : int) = //type of i is specified unit.convertLP(i) let output = convert num //BadImageFormatException is thrown here int output //type of output inferred as int ?! - let test5 num = //type of num is inferred as int but no compile errors are reported - let convert i = + let test5 num = //type of num is inferred as int but no compile errors are reported + let convert i = unit.convert(i) let output = convert num //BadImageFormatException is thrown here - int output + int output - let test6 (num : int) = + let test6 (num : int) = let convert i = //inference looks incorrect - unit.convert(i) + unit.convert(i) let output = convert num //BadImageFormatException is thrown here - int output + int output //two workarounds to the problem - let test7 num = + let test7 num = let convert (i : int) = //with the type specified here, this doesn't crash unit.convert(i) - let output = convert num - int output + let output = convert num + int output - let test8 num = - let convert i = + let test8 num = + let convert i = unit.convertFromInt(i) //with the type specified in the converter no exception - let output = convert num + let output = convert num int output @@ -164,13 +164,13 @@ module InterfacesOfMeasureAnnotatedTypes = inherit IEquatable<'T> type Prim() = - interface IComparable with + interface IComparable with member x.CompareTo(y) = 0 - interface IDerivedComparable with + interface IDerivedComparable with member x.CompareTo(y) = 0 - interface IDerivedEquatable with + interface IDerivedEquatable with member x.Equals(y) = true - interface IRandomOtherInterface with + interface IRandomOtherInterface with member x.M(y) = y override x.Equals(y) = true override x.GetHashCode() = 0 @@ -191,21 +191,21 @@ module CheckModuleNames = module WithMeasure = () type A = class end - + test "celjcelwj" (typeof.DeclaringType.GetNestedType("WithMeasureModule") <> null) [] -let main argv = +let main argv = // test1 let _ = T().F (LanguagePrimitives.Int32WithMeasure 0) // test2 for _ in CreateBadImageFormatException () do () - printf "TEST PASSED OK"; + printf "TEST PASSED OK"; - match failures with - | [] -> + match failures with + | [] -> stdout.WriteLine "Test Passed" - | _ -> + | _ -> stdout.WriteLine "Test Failed" 0 \ No newline at end of file diff --git a/tests/fsharp/core/verify/xmlverify.fs b/tests/fsharp/core/verify/xmlverify.fs index 69a87abe008..c44543e01df 100644 --- a/tests/fsharp/core/verify/xmlverify.fs +++ b/tests/fsharp/core/verify/xmlverify.fs @@ -1,12 +1,12 @@ -// #Conformance +// #Conformance open System.Xml try - let doc = new XmlDocument() + let doc = new XmlDocument() let file = System.Environment.GetCommandLineArgs().[1] printf "Testing %s..." file doc.Load(file) printfn "OK!" -with +with | e -> printfn "ERROR LOADING XML!: %A" e.Message exit 1 diff --git a/tests/fsharp/optimize/analyses/effects.fs b/tests/fsharp/optimize/analyses/effects.fs index 8382fb61b31..34d2aa14098 100644 --- a/tests/fsharp/optimize/analyses/effects.fs +++ b/tests/fsharp/optimize/analyses/effects.fs @@ -1,15 +1,15 @@ open System -module BasicSizeTests = - let constantUnit () = () // note, size 0 - seems reasonable - let constantInteger () = 1 // note, size 0 - seems reasonable +module BasicSizeTests = + let constantUnit () = () // note, size 0 - seems reasonable + let constantInteger () = 1 // note, size 0 - seems reasonable let constantValue x = x // note, size 1 - seems reasonable (this may be a field lookup to access an environment variable) - let fieldLookup1 x = x.contents // note, size 2 - seems reasonable + let fieldLookup1 x = x.contents // note, size 2 - seems reasonable let libraryCall1 x = System.Console.WriteLine(x:string) // size 2, seems reasonable let libraryCall2 x = new System.Object() // size 1, seems reasonable let constantData1 () = Some 1 // note, size 2, seems reasonable, perhaps too low - let constantData2 () = None // note, size 2, seems reasonable, perhaps too high + let constantData2 () = None // note, size 2, seems reasonable, perhaps too high let constantTuple1 () = (1,2) // note, size 1, seems reasonable, perhaps too low let constantTuple2 () = (1,2,3,4) // note, size 1, seems reasonable, perhaps too low @@ -22,9 +22,9 @@ module BasicSizeTests = let forLoop1 f x = for i = 1 to 5 do f () // note, size 7, seems reasonable let whileLoop1 f x = while true do f () // note, size 6, seems reasonable -module BasicAnalysisTests = +module BasicAnalysisTests = - let indirectCallInNonTailcallPosition f x y = f x y; 1+2 + let indirectCallInNonTailcallPosition f x y = f x y; 1+2 let rec infiniteLoop (x:int) : int = infiniteLoop x let rec genericInfiniteLoop (x:'a) : 'a = genericInfiniteLoop x @@ -65,48 +65,48 @@ module BasicAnalysisTests = let simpleLibraryUse18 x = x % x let simpleLibraryUse19 (x:string) = x + x - type SetTree<'T> = - | SetEmpty // complexDataAnalysisFunction = 0 - | SetNode of 'T * SetTree<'T> * SetTree<'T> * int // complexDataAnalysisFunction = int - | SetOne of 'T // complexDataAnalysisFunction = 1 + type SetTree<'T> = + | SetEmpty // complexDataAnalysisFunction = 0 + | SetNode of 'T * SetTree<'T> * SetTree<'T> * int // complexDataAnalysisFunction = int + | SetOne of 'T // complexDataAnalysisFunction = 1 - let complexDataAnalysisFunction t = - match t with + let complexDataAnalysisFunction t = + match t with | SetEmpty -> 0 | SetOne _ -> 1 | SetNode (_,_,_,h) -> h let tolerance = 2 - let complexDataConstructionFunction l k r = - match l,r with + let complexDataConstructionFunction l k r = + match l,r with | SetEmpty,SetEmpty -> SetOne (k) - | _ -> - let hl = complexDataAnalysisFunction l - let hr = complexDataAnalysisFunction r - let m = if hl < hr then hr else hl + | _ -> + let hl = complexDataAnalysisFunction l + let hr = complexDataAnalysisFunction r + let m = if hl < hr then hr else hl SetNode(k,l,r,m+1) let veryComplexDataConstructionFunction t1 k t2 = - let t1h = complexDataAnalysisFunction t1 - let t2h = complexDataAnalysisFunction t2 - if t2h > t1h + tolerance then // right is heavier than left - match t2 with - | SetNode(t2k,t2l,t2r,t2h) -> - if complexDataAnalysisFunction t2l > t1h + 1 then - match t2l with + let t1h = complexDataAnalysisFunction t1 + let t2h = complexDataAnalysisFunction t2 + if t2h > t1h + tolerance then // right is heavier than left + match t2 with + | SetNode(t2k,t2l,t2r,t2h) -> + if complexDataAnalysisFunction t2l > t1h + 1 then + match t2l with | SetNode(t2lk,t2ll,t2lr,t2lh) -> - complexDataConstructionFunction (complexDataConstructionFunction t1 k t2ll) t2lk (complexDataConstructionFunction t2lr t2k t2r) + complexDataConstructionFunction (complexDataConstructionFunction t1 k t2ll) t2lk (complexDataConstructionFunction t2lr t2k t2r) | _ -> failwith "veryComplexDataConstructionFunction" - else // rotate left + else // rotate left complexDataConstructionFunction (complexDataConstructionFunction t1 k t2l) t2k t2r | _ -> failwith "veryComplexDataConstructionFunction" else - if t1h > t2h + tolerance then // left is heavier than right - match t1 with - | SetNode(t1k,t1l,t1r,t1h) -> - if complexDataAnalysisFunction t1r > t2h + 1 then - match t1r with + if t1h > t2h + tolerance then // left is heavier than right + match t1 with + | SetNode(t1k,t1l,t1r,t1h) -> + if complexDataAnalysisFunction t1r > t2h + 1 then + match t1r with | SetNode(t1rk,t1rl,t1rr,t1rh) -> complexDataConstructionFunction (complexDataConstructionFunction t1l t1k t1rl) t1rk (complexDataConstructionFunction t1rr k t2) | _ -> failwith "veryComplexDataConstructionFunction" @@ -114,7 +114,7 @@ module BasicAnalysisTests = complexDataConstructionFunction t1l t1k (complexDataConstructionFunction t1r k t2) | _ -> failwith "veryComplexDataConstructionFunction" else complexDataConstructionFunction t1 k t2 - + type NullNotPossible(i:int) = member __.X = i // no effects abstract member A : int @@ -131,13 +131,13 @@ module BasicAnalysisTests = member __.X = i // yes effects abstract member A : int default __.A = i // yes effects - + type DerivedFromNullPossible(i:int) = inherit NullPossible(i) member __.Y = i // no effects member __.Z = base.X // yes effects override __.A = i // no effects - + [] type DerivedFromNullPossibleAttrFalse(i:int) = inherit NullPossible(i) diff --git a/tests/fsharp/optimize/analyses/sizes.fs b/tests/fsharp/optimize/analyses/sizes.fs index 15ac0762d7d..c24b46c2ae9 100644 --- a/tests/fsharp/optimize/analyses/sizes.fs +++ b/tests/fsharp/optimize/analyses/sizes.fs @@ -2,15 +2,15 @@ open System -module BasicSizeTests = - let constantUnit () = () // note, size 0 - seems reasonable - let constantInteger () = 1 // note, size 0 - seems reasonable +module BasicSizeTests = + let constantUnit () = () // note, size 0 - seems reasonable + let constantInteger () = 1 // note, size 0 - seems reasonable let constantValue x = x // note, size 1 - seems reasonable (this may be a field lookup to access an environment variable) - let fieldLookup1 x = x.contents // note, size 2 - seems reasonable + let fieldLookup1 x = x.contents // note, size 2 - seems reasonable let libraryCall1 x = System.Console.WriteLine(x:string) // size 2, seems reasonable let libraryCall2 x = new System.Object() // size 1, seems reasonable let constantData1 () = Some 1 // note, size 2, seems reasonable, perhaps too low - let constantData2 () = None // note, size 2, seems reasonable, perhaps too high + let constantData2 () = None // note, size 2, seems reasonable, perhaps too high let constantTuple1 () = (1,2) // note, size 1, seems reasonable, perhaps too low let constantTuple2 () = (1,2,3,4) // note, size 1, seems reasonable, perhaps too low diff --git a/tests/fsharp/optimize/analyses/tailcalls.fs b/tests/fsharp/optimize/analyses/tailcalls.fs index c308513ff4c..0b871989b0e 100644 --- a/tests/fsharp/optimize/analyses/tailcalls.fs +++ b/tests/fsharp/optimize/analyses/tailcalls.fs @@ -2,37 +2,37 @@ open System -module BasicSizeTests = - let constantUnit () = () - let constantInteger () = 1 - let constantValue x = x - let fieldLookup1 x = x.contents - let libraryCall1 x = System.Console.WriteLine(x:string) - let libraryCall2 x = new System.Object() - let constantData1 () = Some 1 - let constantData2 () = None - let constantTuple1 () = (1,2) - let constantTuple2 () = (1,2,3,4) +module BasicSizeTests = + let constantUnit () = () + let constantInteger () = 1 + let constantValue x = x + let fieldLookup1 x = x.contents + let libraryCall1 x = System.Console.WriteLine(x:string) + let libraryCall2 x = new System.Object() + let constantData1 () = Some 1 + let constantData2 () = None + let constantTuple1 () = (1,2) + let constantTuple2 () = (1,2,3,4) - let indirectCall1 f = f() - let indirectCall2 f x = f x - let indirectCall3 f x y = f x y - let sequenceOfIndirectCalls1 f x = f x; f x - let ifThenElse x = if x then 1 else 2 - let patternMatch1 x = match x with 1 -> 2 | 2 -> 1 | _ -> 3 - let forLoop1 f x = for i = 1 to 5 do f () - let whileLoop1 f x = while true do f () - let overAppliedCall f x = id f () - let exactlyAppliedCall f x = id f - let underAppliedCall f x = id + let indirectCall1 f = f() + let indirectCall2 f x = f x + let indirectCall3 f x y = f x y + let sequenceOfIndirectCalls1 f x = f x; f x + let ifThenElse x = if x then 1 else 2 + let patternMatch1 x = match x with 1 -> 2 | 2 -> 1 | _ -> 3 + let forLoop1 f x = for i = 1 to 5 do f () + let whileLoop1 f x = while true do f () + let overAppliedCall f x = id f () + let exactlyAppliedCall f x = id f + let underAppliedCall f x = id -module BasicAnalysisTests = +module BasicAnalysisTests = - let indirectCallInNonTailcallPosition f x y = f x y; 1+2 + let indirectCallInNonTailcallPosition f x y = f x y; 1+2 let rec infiniteLoop (x:int) : int = infiniteLoop x let rec genericInfiniteLoop (x:'a) : 'a = genericInfiniteLoop x @@ -73,48 +73,48 @@ module BasicAnalysisTests = let simpleLibraryUse18 x = x % x let simpleLibraryUse19 (x:string) = x + x - type SetTree<'T> = - | SetEmpty // complexDataAnalysisFunction = 0 - | SetNode of 'T * SetTree<'T> * SetTree<'T> * int // complexDataAnalysisFunction = int - | SetOne of 'T // complexDataAnalysisFunction = 1 + type SetTree<'T> = + | SetEmpty // complexDataAnalysisFunction = 0 + | SetNode of 'T * SetTree<'T> * SetTree<'T> * int // complexDataAnalysisFunction = int + | SetOne of 'T // complexDataAnalysisFunction = 1 - let complexDataAnalysisFunction t = - match t with + let complexDataAnalysisFunction t = + match t with | SetEmpty -> 0 | SetOne _ -> 1 | SetNode (_,_,_,h) -> h let tolerance = 2 - let complexDataConstructionFunction l k r = - match l,r with + let complexDataConstructionFunction l k r = + match l,r with | SetEmpty,SetEmpty -> SetOne (k) - | _ -> - let hl = complexDataAnalysisFunction l - let hr = complexDataAnalysisFunction r - let m = if hl < hr then hr else hl + | _ -> + let hl = complexDataAnalysisFunction l + let hr = complexDataAnalysisFunction r + let m = if hl < hr then hr else hl SetNode(k,l,r,m+1) let veryComplexDataConstructionFunction t1 k t2 = - let t1h = complexDataAnalysisFunction t1 - let t2h = complexDataAnalysisFunction t2 - if t2h > t1h + tolerance then // right is heavier than left - match t2 with - | SetNode(t2k,t2l,t2r,t2h) -> - if complexDataAnalysisFunction t2l > t1h + 1 then - match t2l with + let t1h = complexDataAnalysisFunction t1 + let t2h = complexDataAnalysisFunction t2 + if t2h > t1h + tolerance then // right is heavier than left + match t2 with + | SetNode(t2k,t2l,t2r,t2h) -> + if complexDataAnalysisFunction t2l > t1h + 1 then + match t2l with | SetNode(t2lk,t2ll,t2lr,t2lh) -> - complexDataConstructionFunction (complexDataConstructionFunction t1 k t2ll) t2lk (complexDataConstructionFunction t2lr t2k t2r) + complexDataConstructionFunction (complexDataConstructionFunction t1 k t2ll) t2lk (complexDataConstructionFunction t2lr t2k t2r) | _ -> failwith "veryComplexDataConstructionFunction" - else // rotate left + else // rotate left complexDataConstructionFunction (complexDataConstructionFunction t1 k t2l) t2k t2r | _ -> failwith "veryComplexDataConstructionFunction" else - if t1h > t2h + tolerance then // left is heavier than right - match t1 with - | SetNode(t1k,t1l,t1r,t1h) -> - if complexDataAnalysisFunction t1r > t2h + 1 then - match t1r with + if t1h > t2h + tolerance then // left is heavier than right + match t1 with + | SetNode(t1k,t1l,t1r,t1h) -> + if complexDataAnalysisFunction t1r > t2h + 1 then + match t1r with | SetNode(t1rk,t1rl,t1rr,t1rh) -> complexDataConstructionFunction (complexDataConstructionFunction t1l t1k t1rl) t1rk (complexDataConstructionFunction t1rr k t2) | _ -> failwith "veryComplexDataConstructionFunction" diff --git a/tests/fsharp/optimize/inline/lib.fs b/tests/fsharp/optimize/inline/lib.fs index d04958a782f..da3c865b608 100644 --- a/tests/fsharp/optimize/inline/lib.fs +++ b/tests/fsharp/optimize/inline/lib.fs @@ -117,15 +117,15 @@ module Vector3StructRecordGeneric = let inline dot (v1: Vector3StructRecordGeneric) (v2: Vector3StructRecordGeneric) = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z -type HiddenRecord = - private { x : int } +type HiddenRecord = + private { x : int } member this.X = this.x -type HiddenUnion = +type HiddenUnion = private A of int | B of string member this.X = match this with A x -> x | B s -> s.Length -type internal Foo private () = +type internal Foo private () = static member FooMethod() = () [] @@ -144,7 +144,7 @@ type StructInt32 = static member inline InlineWrite(value, x: StructInt32 byref) = x.Value <- value; -module PeverifyTest = +module PeverifyTest = // The test here is simply to peverify the code let ``StaticWriteResultANewValue`` () = let mutable v = StructInt32(3); diff --git a/tests/fsharp/optimize/inline/lib2.fs b/tests/fsharp/optimize/inline/lib2.fs index f51e010d55b..9188932baa2 100644 --- a/tests/fsharp/optimize/inline/lib2.fs +++ b/tests/fsharp/optimize/inline/lib2.fs @@ -1,9 +1,9 @@ namespace ThisNamespaceHasToBeTheSame -module Factory = - let NewRecord () = { x = 0 } +module Factory = + let NewRecord () = { x = 0 } let NewUnionA () = A 1 let NewUnionB () = B "1" -type Bar () = +type Bar () = member x.BarMethod() = Foo.FooMethod() \ No newline at end of file diff --git a/tests/fsharp/optimize/inline/lib3.fs b/tests/fsharp/optimize/inline/lib3.fs index 947496da57e..904d36b1686 100644 --- a/tests/fsharp/optimize/inline/lib3.fs +++ b/tests/fsharp/optimize/inline/lib3.fs @@ -2,6 +2,6 @@ namespace ASecondLibrary open ThisNamespaceHasToBeTheSame -type Bar () = +type Bar () = member x.BarMethod() = Foo.FooMethod() \ No newline at end of file diff --git a/tests/fsharp/optimize/inline/test.fs b/tests/fsharp/optimize/inline/test.fs index 103dde17c70..2949a8677b1 100644 --- a/tests/fsharp/optimize/inline/test.fs +++ b/tests/fsharp/optimize/inline/test.fs @@ -20,7 +20,7 @@ let testVector3GenericInline2 (v1: Vector3Generic) = // This was the failing case for the first bug reported in https://github.com/Microsoft/visualfsharp/issues/532 // -let testAccessingSomethingInlinableThatUsesAPrivateInlinedConstructFromAThirdModule = +let testAccessingSomethingInlinableThatUsesAPrivateInlinedConstructFromAThirdModule = let boom1 = ThisNamespaceHasToBeTheSame.Factory.NewRecord () let boom2 = ThisNamespaceHasToBeTheSame.Factory.NewUnionA () let boom3 = ThisNamespaceHasToBeTheSame.Factory.NewUnionB () @@ -28,7 +28,7 @@ let testAccessingSomethingInlinableThatUsesAPrivateInlinedConstructFromAThirdMod // This is the failing case for the second bug reported in https://github.com/Microsoft/visualfsharp/issues/532 // -//let testAccessingSomethingInlinableThatUsesAInternalConstructFromAnInternalsVisibleToAssembly = +//let testAccessingSomethingInlinableThatUsesAInternalConstructFromAnInternalsVisibleToAssembly = // Bar().BarMethod() let testVector3StructRecord v1 v2 = diff --git a/tests/fsharp/regression/12383/test.fs b/tests/fsharp/regression/12383/test.fs index b94d328988d..56f64f9e862 100644 --- a/tests/fsharp/regression/12383/test.fs +++ b/tests/fsharp/regression/12383/test.fs @@ -76,2263 +76,2263 @@ type Opcode = | CMOVL = 72 | CMOVLE = 73 | CMOVNC = 74 - + | CMOVNO = 75 - + | CMOVNP = 76 - + | CMOVNS = 77 - + | CMOVNZ = 78 - + | CMOVO = 79 - + | CMOVP = 80 - + | CMOVS = 81 - + | CMOVZ = 82 - + | CMP = 83 - + | CMPPD = 84 - + | CMPPS = 85 - + | CMPSB = 86 - + | CMPSD = 87 - + | CMPSQ = 88 - + | CMPSS = 89 - + | CMPSW = 90 - + | CMPXCHG = 91 - + | CMPXCHG16B = 92 - + | CMPXCHG8B = 93 - + | COMISD = 94 - + | COMISS = 95 - + | CPUID = 96 - + | CQO = 97 - + | CRC32 = 98 - + | CVTDQ2PD = 99 - + | CVTDQ2PS = 100 - + | CVTPD2DQ = 101 - + | CVTPD2PI = 102 - + | CVTPD2PS = 103 - + | CVTPI2PD = 104 - + | CVTPI2PS = 105 - + | CVTPS2DQ = 106 - + | CVTPS2PD = 107 - + | CVTPS2PI = 108 - + | CVTSD2SI = 109 - + | CVTSD2SS = 110 - + | CVTSI2SD = 111 - + | CVTSI2SS = 112 - + | CVTSS2SD = 113 - + | CVTSS2SI = 114 - + | CVTTPD2DQ = 115 - + | CVTTPD2PI = 116 - + | CVTTPS2DQ = 117 - + | CVTTPS2PI = 118 - + | CVTTSD2SI = 119 - + | CVTTSS2SI = 120 - + | CWD = 121 - + | CWDE = 122 - + | DAA = 123 - + | DAS = 124 - + | DEC = 125 - + | DIV = 126 - + | DIVPD = 127 - + | DIVPS = 128 - + | DIVSD = 129 - + | DIVSS = 130 - + | DPPD = 131 - + | DPPS = 132 - + | EMMS = 133 - + | ENCLS = 134 - + | ENCLU = 135 - + | ENDBR32 = 136 - + | ENDBR64 = 137 - + | ENTER = 138 - + | EXTRACTPS = 139 - + | F2XM1 = 140 - + | FABS = 141 - + | FADD = 142 - + | FADDP = 143 - + | FBLD = 144 - + | FBSTP = 145 - + | FCHS = 146 - + | FCLEX = 147 - + | FCMOVB = 148 - + | FCMOVBE = 149 - + | FCMOVE = 150 - + | FCMOVNB = 151 - + | FCMOVNBE = 152 - + | FCMOVNE = 153 - + | FCMOVNU = 154 - + | FCMOVU = 155 - + | FCOM = 156 - + | FCOMI = 157 - + | FCOMIP = 158 - + | FCOMP = 159 - + | FCOMPP = 160 - + | FCOS = 161 - + | FDECSTP = 162 - + | FDIV = 163 - + | FDIVP = 164 - + | FDIVR = 165 - + | FDIVRP = 166 - + | FFREE = 167 - + | FIADD = 168 - + | FICOM = 169 - + | FICOMP = 170 - + | FIDIV = 171 - + | FIDIVR = 172 - + | FILD = 173 - + | FIMUL = 174 - + | FINCSTP = 175 - + | FINIT = 176 - + | FIST = 177 - + | FISTP = 178 - + | FISTTP = 179 - + | FISUB = 180 - + | FISUBR = 181 - + | FLD = 182 - + | FLD1 = 183 - + | FLDCW = 184 - + | FLDENV = 185 - + | FLDL2E = 186 - + | FLDL2T = 187 - + | FLDLG2 = 188 - + | FLDLN2 = 189 - + | FLDPI = 190 - + | FLDZ = 191 - + | FMUL = 192 - + | FMULP = 193 - + | FNCLEX = 194 - + | FNINIT = 195 - + | FNOP = 196 - + | FNSAVE = 197 - + | FNSTCW = 198 - + | FNSTENV = 199 - + | FNSTSW = 200 - + | FPATAN = 201 - + | FPREM = 202 - + | FPREM1 = 203 - + | FPTAN = 204 - + | FRNDINT = 205 - + | FRSTOR = 206 - + | FSAVE = 207 - + | FSCALE = 208 - + | FSIN = 209 - + | FSINCOS = 210 - + | FSQRT = 211 - + | FST = 212 - + | FSTCW = 213 - + | FSTENV = 214 - + | FSTP = 215 - + | FSTSW = 216 - + | FSUB = 217 - + | FSUBP = 218 - + | FSUBR = 219 - + | FSUBRP = 220 - + | FTST = 221 - + | FUCOM = 222 - + | FUCOMI = 223 - + | FUCOMIP = 224 - + | FUCOMP = 225 - + | FUCOMPP = 226 - + | FWAIT = 227 - + | FXAM = 228 - + | FXCH = 229 - + | FXRSTOR = 230 - + | FXRSTOR64 = 231 - + | FXSAVE = 232 - + | FXSAVE64 = 233 - + | FXTRACT = 234 - + | FYL2X = 235 - + | FYL2XP1 = 236 - + | GETSEC = 237 - + | GF2P8AFFINEINVQB = 238 - + | GF2P8AFFINEQB = 239 - + | GF2P8MULB = 240 - + | HADDPD = 241 - + | HADDPS = 242 - + | HLT = 243 - + | HSUBPD = 244 - + | HSUBPS = 245 - + | IDIV = 246 - + | IMUL = 247 - + | IN = 248 - + | INC = 249 - + | INCSSPD = 250 - + | INCSSPQ = 251 - + | INS = 252 - + | INSB = 253 - + | INSD = 254 - + | INSERTPS = 255 - + | INSW = 256 - + | INT = 257 - + | INT3 = 258 - + | INTO = 259 - + | INVD = 260 - + | INVEPT = 261 - + | INVLPG = 262 - + | INVPCID = 263 - + | INVVPID = 264 - + | IRET = 265 - + | IRETD = 266 - + | IRETQ = 267 - + | IRETW = 268 - + | JAE = 269 | JNC = 269 | JNB = 269 - + | JC = 270 | JNAE = 270 | JB = 270 - + | JCXZ = 271 - + | JECXZ = 272 - + | JGE = 273 | JNL = 273 - + | JMPFar = 274 - + | JMPNear = 275 - + | JNA = 276 | JBE = 276 - + | JNBE = 277 | JA = 277 - + | JNG = 278 | JLE = 278 - + | JNGE = 279 | JL = 279 - + | JNLE = 280 | JG = 280 - + | JNO = 281 - + | JNS = 282 - + | JNZ = 283 | JNE = 283 - + | JO = 284 - + | JP = 285 | JPE = 285 - + | JPO = 286 | JNP = 286 - + | JRCXZ = 287 - + | JS = 288 - + | JZ = 289 | JE = 289 - + | KADDB = 290 - + | KADDD = 291 - + | KADDQ = 292 - + | KADDW = 293 - + | KANDB = 294 - + | KANDD = 295 - + | KANDNB = 296 - + | KANDND = 297 - + | KANDNQ = 298 - + | KANDNW = 299 - + | KANDQ = 300 - + | KANDW = 301 - + | KMOVB = 302 - + | KMOVD = 303 - + | KMOVQ = 304 - + | KMOVW = 305 - + | KNOTB = 306 - + | KNOTD = 307 - + | KNOTQ = 308 - + | KNOTW = 309 - + | KORB = 310 - + | KORD = 311 - + | KORQ = 312 - + | KORTESTB = 313 - + | KORTESTD = 314 - + | KORTESTQ = 315 - + | KORTESTW = 316 - + | KORW = 317 - + | KSHIFTLB = 318 - + | KSHIFTLD = 319 - + | KSHIFTLQ = 320 - + | KSHIFTLW = 321 - + | KSHIFTRB = 322 - + | KSHIFTRD = 323 - + | KSHIFTRQ = 324 - + | KSHIFTRW = 325 - + | KTESTB = 326 - + | KTESTD = 327 - + | KTESTQ = 328 - + | KTESTW = 329 - + | KUNPCKBW = 330 - + | KUNPCKDQ = 331 - + | KUNPCKWD = 332 - + | KXNORB = 333 - + | KXNORD = 334 - + | KXNORQ = 335 - + | KXNORW = 336 - + | KXORB = 337 - + | KXORD = 338 - + | KXORQ = 339 - + | KXORW = 340 - + | LAHF = 341 - + | LAR = 342 - + | LDDQU = 343 - + | LDMXCSR = 344 - + | LDS = 345 - + | LEA = 346 - + | LEAVE = 347 - + | LES = 348 - + | LFENCE = 349 - + | LFS = 350 - + | LGDT = 351 - + | LGS = 352 - + | LIDT = 353 - + | LLDT = 354 - + | LMSW = 355 - + | LOCK = 356 - + | LODSB = 357 - + | LODSD = 358 - + | LODSQ = 359 - + | LODSW = 360 - + | LOOP = 361 - + | LOOPE = 362 - + | LOOPNE = 363 - + | LSL = 364 - + | LSS = 365 - + | LTR = 366 - + | LZCNT = 367 - + | MASKMOVDQU = 368 - + | MASKMOVQ = 369 - + | MAXPD = 370 - + | MAXPS = 371 - + | MAXSD = 372 - + | MAXSS = 373 - + | MFENCE = 374 - + | MINPD = 375 - + | MINPS = 376 - + | MINSD = 377 - + | MINSS = 378 - + | MONITOR = 379 - + | MOV = 380 - + | MOVAPD = 381 - + | MOVAPS = 382 - + | MOVBE = 383 - + | MOVD = 384 - + | MOVDDUP = 385 - + | MOVDQ2Q = 386 - + | MOVDQA = 387 - + | MOVDQU = 388 - + | MOVHLPS = 389 - + | MOVHPD = 390 - + | MOVHPS = 391 - + | MOVLHPS = 392 - + | MOVLPD = 393 - + | MOVLPS = 394 - + | MOVMSKPD = 395 - + | MOVMSKPS = 396 - + | MOVNTDQ = 397 - + | MOVNTDQA = 398 - + | MOVNTI = 399 - + | MOVNTPD = 400 - + | MOVNTPS = 401 - + | MOVNTQ = 402 - + | MOVQ = 403 - + | MOVQ2DQ = 404 - + | MOVSB = 405 - + | MOVSD = 406 - + | MOVSHDUP = 407 - + | MOVSLDUP = 408 - + | MOVSQ = 409 - + | MOVSS = 410 - + | MOVSW = 411 - + | MOVSX = 412 - + | MOVSXD = 413 - + | MOVUPD = 414 - + | MOVUPS = 415 - + | MOVZX = 416 - + | MPSADBW = 417 - + | MUL = 418 - + | MULPD = 419 - + | MULPS = 420 - + | MULSD = 421 - + | MULSS = 422 - + | MULX = 423 - + | MWAIT = 424 - + | NEG = 425 - + | NOP = 426 - + | NOT = 427 - + | OR = 428 - + | ORPD = 429 - + | ORPS = 430 - + | OUT = 431 - + | OUTS = 432 - + | OUTSB = 433 - + | OUTSD = 434 - + | OUTSW = 435 - + | PABSB = 436 - + | PABSD = 437 - + | PABSW = 438 - + | PACKSSDW = 439 - + | PACKSSWB = 440 - + | PACKUSDW = 441 - + | PACKUSWB = 442 - + | PADDB = 443 - + | PADDD = 444 - + | PADDQ = 445 - + | PADDSB = 446 - + | PADDSW = 447 - + | PADDUSB = 448 - + | PADDUSW = 449 - + | PADDW = 450 - + | PALIGNR = 451 - + | PAND = 452 - + | PANDN = 453 - + | PAUSE = 454 - + | PAVGB = 455 - + | PAVGW = 456 - + | PBLENDVB = 457 - + | PBLENDW = 458 - + | PCLMULQDQ = 459 - + | PCMPEQB = 460 - + | PCMPEQD = 461 - + | PCMPEQQ = 462 - + | PCMPEQW = 463 - + | PCMPESTRI = 464 - + | PCMPESTRM = 465 - + | PCMPGTB = 466 - + | PCMPGTD = 467 - + | PCMPGTQ = 468 - + | PCMPGTW = 469 - + | PCMPISTRI = 470 - + | PCMPISTRM = 471 - + | PDEP = 472 - + | PEXT = 473 - + | PEXTRB = 474 - + | PEXTRD = 475 - + | PEXTRQ = 476 - + | PEXTRW = 477 - + | PHADDD = 478 - + | PHADDSW = 479 - + | PHADDW = 480 - + | PHMINPOSUW = 481 - + | PHSUBD = 482 - + | PHSUBSW = 483 - + | PHSUBW = 484 - + | PINSRB = 485 - + | PINSRD = 486 - + | PINSRQ = 487 - + | PINSRW = 488 - + | PMADDUBSW = 489 - + | PMADDWD = 490 - + | PMAXSB = 491 - + | PMAXSD = 492 - + | PMAXSW = 493 - + | PMAXUB = 494 - + | PMAXUD = 495 - + | PMAXUW = 496 - + | PMINSB = 497 - + | PMINSD = 498 - + | PMINSW = 499 - + | PMINUB = 500 - + | PMINUD = 501 - + | PMINUW = 502 - + | PMOVMSKB = 503 - + | PMOVSXBD = 504 - + | PMOVSXBQ = 505 - + | PMOVSXBW = 506 - + | PMOVSXDQ = 507 - + | PMOVSXWD = 508 - + | PMOVSXWQ = 509 - + | PMOVZXBD = 510 - + | PMOVZXBQ = 511 - + | PMOVZXBW = 512 - + | PMOVZXDQ = 513 - + | PMOVZXWD = 514 - + | PMOVZXWQ = 515 - + | PMULDQ = 516 - + | PMULHRSW = 517 - + | PMULHUW = 518 - + | PMULHW = 519 - + | PMULLD = 520 - + | PMULLW = 521 - + | PMULUDQ = 522 - + | POP = 523 - + | POPA = 524 - + | POPAD = 525 - + | POPCNT = 526 - + | POPF = 527 - + | POPFD = 528 - + | POPFQ = 529 - + | POR = 530 - + | PREFETCHNTA = 531 - + | PREFETCHT0 = 532 - + | PREFETCHT1 = 533 - + | PREFETCHT2 = 534 - + | PREFETCHW = 535 - + | PREFETCHWT1 = 536 - + | PSADBW = 537 - + | PSHUFB = 538 - + | PSHUFD = 539 - + | PSHUFHW = 540 - + | PSHUFLW = 541 - + | PSHUFW = 542 - + | PSIGNB = 543 - + | PSIGND = 544 - + | PSIGNW = 545 - + | PSLLD = 546 - + | PSLLDQ = 547 - + | PSLLQ = 548 - + | PSLLW = 549 - + | PSRAD = 550 - + | PSRAW = 551 - + | PSRLD = 552 - + | PSRLDQ = 553 - + | PSRLQ = 554 - + | PSRLW = 555 - + | PSUBB = 556 - + | PSUBD = 557 - + | PSUBQ = 558 - + | PSUBSB = 559 - + | PSUBSW = 560 - + | PSUBUSB = 561 - + | PSUBUSW = 562 - + | PSUBW = 563 - + | PTEST = 564 - + | PUNPCKHBW = 565 - + | PUNPCKHDQ = 566 - + | PUNPCKHQDQ = 567 - + | PUNPCKHWD = 568 - + | PUNPCKLBW = 569 - + | PUNPCKLDQ = 570 - + | PUNPCKLQDQ = 571 - + | PUNPCKLWD = 572 - + | PUSH = 573 - + | PUSHA = 574 - + | PUSHAD = 575 - + | PUSHF = 576 - + | PUSHFD = 577 - + | PUSHFQ = 578 - + | PXOR = 579 - + | RCL = 580 - + | RCPPS = 581 - + | RCPSS = 582 - + | RCR = 583 - + | RDFSBASE = 584 - + | RDGSBASE = 585 - + | RDMSR = 586 - + | RDPKRU = 587 - + | RDPMC = 588 - + | RDRAND = 589 - + | RDSEED = 590 - + | RDSSPD = 591 - + | RDSSPQ = 592 - + | RDTSC = 593 - + | RDTSCP = 594 - + | REP = 595 - + | REPE = 596 - + | REPNE = 597 - + | REPNZ = 598 - + | REPZ = 599 - + | RETFar = 600 - + | RETFarImm = 601 - + | RETNear = 602 - + | RETNearImm = 603 - + | ROL = 604 - + | ROR = 605 - + | RORX = 606 - + | ROUNDPD = 607 - + | ROUNDPS = 608 - + | ROUNDSD = 609 - + | ROUNDSS = 610 - + | RSM = 611 - + | RSQRTPS = 612 - + | RSQRTSS = 613 - + | RSTORSSP = 614 - + | SAHF = 615 - + | SAR = 616 - + | SARX = 617 - + | SAVEPREVSSP = 618 - + | SBB = 619 - + | SCASB = 620 - + | SCASD = 621 - + | SCASQ = 622 - + | SCASW = 623 - + | SETA = 624 - + | SETB = 625 - + | SETBE = 626 - + | SETG = 627 - + | SETL = 628 - + | SETLE = 629 - + | SETNB = 630 - + | SETNL = 631 - + | SETNO = 632 - + | SETNP = 633 - + | SETNS = 634 - + | SETNZ = 635 - + | SETO = 636 - + | SETP = 637 - + | SETS = 638 - + | SETSSBSY = 639 - + | SETZ = 640 - + | SFENCE = 641 - + | SGDT = 642 - + | SHA1MSG1 = 643 - + | SHA1MSG2 = 644 - + | SHA1NEXTE = 645 - + | SHA1RNDS4 = 646 - + | SHA256MSG1 = 647 - + | SHA256MSG2 = 648 - + | SHA256RNDS2 = 649 - + | SHL = 650 - + | SHLD = 651 - + | SHLX = 652 - + | SHR = 653 - + | SHRD = 654 - + | SHRX = 655 - + | SHUFPD = 656 - + | SHUFPS = 657 - + | SIDT = 658 - + | SLDT = 659 - + | SMSW = 660 - + | SQRTPD = 661 - + | SQRTPS = 662 - + | SQRTSD = 663 - + | SQRTSS = 664 - + | STAC = 665 - + | STC = 666 - + | STD = 667 - + | STI = 668 - + | STMXCSR = 669 - + | STOSB = 670 - + | STOSD = 671 - + | STOSQ = 672 - + | STOSW = 673 - + | STR = 674 - + | SUB = 675 - + | SUBPD = 676 - + | SUBPS = 677 - + | SUBSD = 678 - + | SUBSS = 679 - + | SWAPGS = 680 - + | SYSCALL = 681 - + | SYSENTER = 682 - + | SYSEXIT = 683 - + | SYSRET = 684 - + | TEST = 685 - + | TZCNT = 686 - + | UCOMISD = 687 - + | UCOMISS = 688 - + | UD = 689 - + | UD2 = 690 - + | UNPCKHPD = 691 - + | UNPCKHPS = 692 - + | UNPCKLPD = 693 - + | UNPCKLPS = 694 - + | VADDPD = 695 - + | VADDPS = 696 - + | VADDSD = 697 - + | VADDSS = 698 - + | VALIGND = 699 - + | VALIGNQ = 700 - + | VANDNPD = 701 - + | VANDNPS = 702 - + | VANDPD = 703 - + | VANDPS = 704 - + | VBLENDMPD = 705 - + | VBLENDMPS = 706 - + | VBLENDVPD = 707 - + | VBROADCASTI128 = 708 - + | VBROADCASTSD = 709 - + | VBROADCASTSS = 710 - + | VCMPPD = 711 - + | VCMPPS = 712 - + | VCMPSD = 713 - + | VCMPSS = 714 - + | VCOMISD = 715 - + | VCOMISS = 716 - + | VCOMPRESSPD = 717 - + | VCOMPRESSPS = 718 - + | VCVTDQ2PD = 719 - + | VCVTDQ2PS = 720 - + | VCVTPD2PS = 721 - + | VCVTPD2QQ = 722 - + | VCVTPD2UDQ = 723 - + | VCVTPD2UQQ = 724 - + | VCVTPH2PS = 725 - + | VCVTPS2PD = 726 - + | VCVTPS2PH = 727 - + | VCVTPS2QQ = 728 - + | VCVTPS2UDQ = 729 - + | VCVTPS2UQQ = 730 - + | VCVTQQ2PD = 731 - + | VCVTQQ2PS = 732 - + | VCVTSD2SI = 733 - + | VCVTSD2SS = 734 - + | VCVTSD2USI = 735 - + | VCVTSI2SD = 736 - + | VCVTSI2SS = 737 - + | VCVTSS2SD = 738 - + | VCVTSS2SI = 739 - + | VCVTSS2USI = 740 - + | VCVTTPD2DQ = 741 - + | VCVTTPD2QQ = 742 - + | VCVTTPD2UDQ = 743 - + | VCVTTPD2UQQ = 744 - + | VCVTTPS2QQ = 745 - + | VCVTTPS2UDQ = 746 - + | VCVTTPS2UQQ = 747 - + | VCVTTSD2SI = 748 - + | VCVTTSD2USI = 749 - + | VCVTTSS2SI = 750 - + | VCVTTSS2USI = 751 - + | VCVTUDQ2PD = 752 - + | VCVTUDQ2PS = 753 - + | VCVTUQQ2PD = 754 - + | VCVTUQQ2PS = 755 - + | VCVTUSI2USD = 756 - + | VCVTUSI2USS = 757 - + | VDBPSADBW = 758 - + | VDIVPD = 759 - + | VDIVPS = 760 - + | VDIVSD = 761 - + | VDIVSS = 762 - + | VERR = 763 - + | VERW = 764 - + | VEXP2PD = 765 - + | VEXP2PS = 766 - + | VEXP2SD = 767 - + | VEXP2SS = 768 - + | VEXPANDPD = 769 - + | VEXPANDPS = 770 - + | VEXTRACTF128 = 771 - + | VEXTRACTF32X4 = 772 - + | VEXTRACTF32X8 = 773 - + | VEXTRACTF64X2 = 774 - + | VEXTRACTF64X4 = 775 - + | VEXTRACTI32X4 = 776 - + | VEXTRACTI32X8 = 777 - + | VEXTRACTI64X2 = 778 - + | VEXTRACTI64X4 = 779 - + | VFIXUPIMMPD = 780 - + | VFIXUPIMMPS = 781 - + | VFIXUPIMMSD = 782 - + | VFIXUPIMMSS = 783 - + | VFMADD132PD = 784 - + | VFMADD132SD = 785 - + | VFMADD132SS = 786 - + | VFMADD213PD = 787 - + | VFMADD213PS = 788 - + | VFMADD213SD = 789 - + | VFMADD213SS = 790 - + | VFMADD231PD = 791 - + | VFMADD231SD = 792 - + | VFMADD231SS = 793 - + | VFMSUB132SS = 794 - + | VFMSUB213PD = 795 - + | VFMSUB213SD = 796 - + | VFMSUB231PD = 797 - + | VFMSUB231SD = 798 - + | VFNMADD132PD = 799 - + | VFNMADD132SD = 800 - + | VFNMADD213PD = 801 - + | VFNMADD213SD = 802 - + | VFNMADD231PD = 803 - + | VFNMADD231SD = 804 - + | VFPCLASSPD = 805 - + | VFPCLASSPS = 806 - + | VFPCLASSSD = 807 - + | VFPCLASSSS = 808 - + | VGATHERDPS = 809 - + | VGATHERQPD = 810 - + | VGETEXPPD = 811 - + | VGETEXPPS = 812 - + | VGETEXPSD = 813 - + | VGETEXPSS = 814 - + | VGETMANTPD = 815 - + | VGETMANTPS = 816 - + | VGETMANTSD = 817 - + | VGETMANTSS = 818 - + | VINSERTF128 = 819 - + | VINSERTF32X4 = 820 - + | VINSERTF64X2 = 821 - + | VINSERTF64X4 = 822 - + | VINSERTI128 = 823 - + | VINSERTI32X8 = 824 - + | VINSERTI64X2 = 825 - + | VINSERTI64X4 = 826 - + | VLDDQU = 827 - + | VMAXPD = 828 - + | VMAXPS = 829 - + | VMAXSD = 830 - + | VMAXSS = 831 - + | VMCALL = 832 - + | VMCLEAR = 833 - + | VMFUNC = 834 - + | VMINPD = 835 - + | VMINPS = 836 - + | VMINSD = 837 - + | VMINSS = 838 - + | VMLAUNCH = 839 - + | VMOVAPD = 840 - + | VMOVAPS = 841 - + | VMOVD = 842 - + | VMOVDDUP = 843 - + | VMOVDQA = 844 - + | VMOVDQA32 = 845 - + | VMOVDQA64 = 846 - + | VMOVDQU = 847 - + | VMOVDQU16 = 848 - + | VMOVDQU32 = 849 - + | VMOVDQU64 = 850 - + | VMOVDQU8 = 851 - + | VMOVHLPS = 852 - + | VMOVHPD = 853 - + | VMOVHPS = 854 - + | VMOVLHPS = 855 - + | VMOVLPD = 856 - + | VMOVLPS = 857 - + | VMOVMSKPD = 858 - + | VMOVMSKPS = 859 - + | VMOVNTDQ = 860 - + | VMOVNTPD = 861 - + | VMOVNTPS = 862 - + | VMOVQ = 863 - + | VMOVSD = 864 - + | VMOVSHDUP = 865 - + | VMOVSLDUP = 866 - + | VMOVSS = 867 - + | VMOVUPD = 868 - + | VMOVUPS = 869 - + | VMPTRLD = 870 - + | VMPTRST = 871 - + | VMREAD = 872 - + | VMRESUME = 873 - + | VMULPD = 874 - + | VMULPS = 875 - + | VMULSD = 876 - + | VMULSS = 877 - + | VMWRITE = 878 - + | VMXOFF = 879 - + | VMXON = 880 - + | VORPD = 881 - + | VORPS = 882 - + | VPABSB = 883 - + | VPABSD = 884 - + | VPABSW = 885 - + | VPACKSSDW = 886 - + | VPACKSSWB = 887 - + | VPACKUSDW = 888 - + | VPACKUSWB = 889 - + | VPADDB = 890 - + | VPADDD = 891 - + | VPADDQ = 892 - + | VPADDSB = 893 - + | VPADDSW = 894 - + | VPADDUSB = 895 - + | VPADDUSW = 896 - + | VPADDW = 897 - + | VPALIGNR = 898 - + | VPAND = 899 - + | VPANDN = 900 - + | VPAVGB = 901 - + | VPAVGW = 902 - + | VPBLENDMB = 903 - + | VPBLENDMD = 904 - + | VPBLENDMQ = 905 - + | VPBLENDMW = 906 - + | VPBROADCASTB = 907 - + | VPBROADCASTD = 908 - + | VPBROADCASTM = 909 - + | VPBROADCASTQ = 910 - + | VPBROADCASTW = 911 - + | VPCMPB = 912 - + | VPCMPD = 913 - + | VPCMPEQB = 914 - + | VPCMPEQD = 915 - + | VPCMPEQQ = 916 - + | VPCMPEQW = 917 - + | VPCMPESTRI = 918 - + | VPCMPESTRM = 919 - + | VPCMPGTB = 920 - + | VPCMPGTD = 921 - + | VPCMPGTQ = 922 - + | VPCMPGTW = 923 - + | VPCMPISTRI = 924 - + | VPCMPISTRM = 925 - + | VPCMPQ = 926 - + | VPCMPW = 927 - + | VPCMUB = 928 - + | VPCMUD = 929 - + | VPCMUQ = 930 - + | VPCMUW = 931 - + | VPCOMPRESSD = 932 - + | VPCOMPRESSQ = 933 - + | VPCONFLICTD = 934 - + | VPCONFLICTQ = 935 - + | VPERMI2B = 936 - + | VPERMI2D = 937 - + | VPERMI2PD = 938 - + | VPERMI2PS = 939 - + | VPERMI2Q = 940 - + | VPERMI2W = 941 - + | VPERMT2D = 942 - + | VPERMT2PD = 943 - + | VPERMT2PS = 944 - + | VPERMT2Q = 945 - + | VPERMW = 946 - + | VPEXPANDD = 947 - + | VPEXPANDQ = 948 - + | VPEXTRD = 949 - + | VPEXTRW = 950 - + | VPGATHERDD = 951 - + | VPHADDD = 952 - + | VPHADDSW = 953 - + | VPHADDW = 954 - + | VPHMINPOSUW = 955 - + | VPHSUBD = 956 - + | VPHSUBSW = 957 - + | VPHSUBW = 958 - + | VPINSRB = 959 - + | VPINSRD = 960 - + | VPINSRQ = 961 - + | VPINSRW = 962 - + | VPLZCNTD = 963 - + | VPLZCNTQ = 964 - + | VPMADDWD = 965 - + | VPMAXSB = 966 - + | VPMAXSD = 967 - + | VPMAXSQ = 968 - + | VPMAXSW = 969 - + | VPMAXUB = 970 - + | VPMAXUD = 971 - + | VPMAXUQ = 972 - + | VPMAXUW = 973 - + | VPMINSB = 974 - + | VPMINSD = 975 - + | VPMINSQ = 976 - + | VPMINSW = 977 - + | VPMINUB = 978 - + | VPMINUD = 979 - + | VPMINUQ = 980 - + | VPMINUW = 981 - + | VPMOVB2D = 982 - + | VPMOVB2M = 983 - + | VPMOVDB = 984 - + | VPMOVDW = 985 - + | VPMOVM2B = 986 - + | VPMOVM2D = 987 - + | VPMOVM2Q = 988 - + | VPMOVM2W = 989 - + | VPMOVMSKB = 990 - + | VPMOVQ2M = 991 - + | VPMOVQB = 992 - + | VPMOVQD = 993 - + | VPMOVQW = 994 - + | VPMOVSDB = 995 - + | VPMOVSDW = 996 - + | VPMOVSQB = 997 - + | VPMOVSQD = 998 - + | VPMOVSQW = 999 - + | VPMOVSWB = 1000 - + | VPMOVSXBD = 1001 - + | VPMOVSXBQ = 1002 - + | VPMOVSXBW = 1003 - + | VPMOVSXDQ = 1004 - + | VPMOVSXWD = 1005 - + | VPMOVSXWQ = 1006 - + | VPMOVUSDB = 1007 - + | VPMOVUSDW = 1008 - + | VPMOVUSQB = 1009 - + | VPMOVUSQD = 1010 - + | VPMOVUSQW = 1011 - + | VPMOVUSWB = 1012 - + | VPMOVW2M = 1013 - + | VPMOVWB = 1014 - + | VPMOVZXBD = 1015 - + | VPMOVZXBQ = 1016 - + | VPMOVZXBW = 1017 - + | VPMOVZXDQ = 1018 - + | VPMOVZXWD = 1019 - + | VPMOVZXWQ = 1020 - + | VPMULDQ = 1021 - + | VPMULHRSW = 1022 - + | VPMULHUW = 1023 - + | VPMULHW = 1024 - + | VPMULLD = 1025 - + | VPMULLQ = 1026 - + | VPMULLW = 1027 - + | VPMULUDQ = 1028 - + | VPOR = 1029 - + | VPROLD = 1030 - + | VPROLQ = 1031 - + | VPROLVD = 1032 - + | VPROLVQ = 1033 - + | VPRORD = 1034 - + | VPRORQ = 1035 - + | VPRORRD = 1036 - + | VPRORRQ = 1037 - + | VPSADBW = 1038 - + | VPSCATTERDD = 1039 - + | VPSCATTERDQ = 1040 - + | VPSCATTERQD = 1041 - + | VPSCATTERQQ = 1042 - + | VPSHUFB = 1043 - + | VPSHUFD = 1044 - + | VPSHUFHW = 1045 - + | VPSHUFLW = 1046 - + | VPSIGNB = 1047 - + | VPSIGND = 1048 - + | VPSIGNW = 1049 - + | VPSLLD = 1050 - + | VPSLLDQ = 1051 - + | VPSLLQ = 1052 - + | VPSLLVW = 1053 - + | VPSLLW = 1054 - + | VPSRAD = 1055 - + | VPSRAQ = 1056 - + | VPSRAVQ = 1057 - + | VPSRAVW = 1058 - + | VPSRAW = 1059 - + | VPSRLD = 1060 - + | VPSRLDQ = 1061 - + | VPSRLQ = 1062 - + | VPSRLVW = 1063 - + | VPSRLW = 1064 - + | VPSUBB = 1065 - + | VPSUBD = 1066 - + | VPSUBQ = 1067 - + | VPSUBSB = 1068 - + | VPSUBSW = 1069 - + | VPSUBUSB = 1070 - + | VPSUBUSW = 1071 - + | VPSUBW = 1072 - + | VPTERLOGD = 1073 - + | VPTERLOGQ = 1074 - + | VPTERNLOGD = 1075 - + | VPTEST = 1076 - + | VPTESTMB = 1077 - + | VPTESTMD = 1078 - + | VPTESTMQ = 1079 - + | VPTESTMW = 1080 - + | VPTESTNMB = 1081 - + | VPTESTNMD = 1082 - + | VPTESTNMQ = 1083 - + | VPTESTNMW = 1084 - + | VPUNPCKHBW = 1085 - + | VPUNPCKHDQ = 1086 - + | VPUNPCKHQDQ = 1087 - + | VPUNPCKHWD = 1088 - + | VPUNPCKLBW = 1089 - + | VPUNPCKLDQ = 1090 - + | VPUNPCKLQDQ = 1091 - + | VPUNPCKLWD = 1092 - + | VPXOR = 1093 - + | VPXORD = 1094 - + | VPXORQ = 1095 - + | VRANGEPD = 1096 - + | VRANGEPS = 1097 - + | VRANGESD = 1098 - + | VRANGESS = 1099 - + | VRCP14PD = 1100 - + | VRCP14PS = 1101 - + | VRCP14SD = 1102 - + | VRCP14SS = 1103 - + | VRCP28PD = 1104 - + | VRCP28PS = 1105 - + | VRCP28SD = 1106 - + | VRCP28SS = 1107 - + | VRCPPS = 1108 - + | VRCPSS = 1109 - + | VREDUCEPD = 1110 - + | VREDUCEPS = 1111 - + | VREDUCESD = 1112 - + | VREDUCESS = 1113 - + | VRNDSCALEPD = 1114 - + | VRNDSCALEPS = 1115 - + | VRNDSCALESD = 1116 - + | VRNDSCALESS = 1117 - + | VROUNDPD = 1118 - + | VROUNDPS = 1119 - + | VROUNDSD = 1120 - + | VRSQRT14PD = 1121 - + | VRSQRT14PS = 1122 - + | VRSQRT14SD = 1123 - + | VRSQRT14SS = 1124 - + | VRSQRT28PD = 1125 - + | VRSQRT28PS = 1126 - + | VRSQRT28SD = 1127 - + | VRSQRT28SS = 1128 - + | VRSQRTPS = 1129 - + | VRSQRTSS = 1130 - + | VSCALEPD = 1131 - + | VSCALEPS = 1132 - + | VSCALESD = 1133 - + | VSCALESS = 1134 - + | VSCATTERDD = 1135 - + | VSCATTERDQ = 1136 - + | VSCATTERQD = 1137 - + | VSCATTERQQ = 1138 - + | VSHUFF32X4 = 1139 - + | VSHUFF64X2 = 1140 - + | VSHUFI32X4 = 1141 - + | VSHUFI64X2 = 1142 - + | VSHUFPD = 1143 - + | VSHUFPS = 1144 - + | VSQRTPD = 1145 - + | VSQRTPS = 1146 - + | VSQRTSD = 1147 - + | VSQRTSS = 1148 - + | VSUBPD = 1149 - + | VSUBPS = 1150 - + | VSUBSD = 1151 - + | VSUBSS = 1152 - + | VUCOMISD = 1153 - + | VUCOMISS = 1154 - + | VUNPCKHPD = 1155 - + | VUNPCKHPS = 1156 - + | VUNPCKLPD = 1157 - + | VUNPCKLPS = 1158 - + | VXORPD = 1159 - + | VXORPS = 1160 - + | VZEROUPPER = 1161 - + | WAIT = 1162 - + | WBINVD = 1163 - + | WRFSBASE = 1164 - + | WRGSBASE = 1165 - + | WRMSR = 1166 - + | WRPKRU = 1167 - + | WRSSD = 1168 - + | WRSSQ = 1169 - + | WRUSSD = 1170 - + | WRUSSQ = 1171 - + | XABORT = 1172 - + | XACQUIRE = 1173 - + | XADD = 1174 - + | XBEGIN = 1175 - + | XCHG = 1176 - + | XEND = 1177 - + | XGETBV = 1178 - + | XLAT = 1179 - + | XLATB = 1180 - + | XOR = 1181 - + | XORPD = 1182 - + | XORPS = 1183 - + | XRELEASE = 1184 - + | XRSTOR = 1185 - + | XRSTORS = 1186 - + | XRSTORS64 = 1187 - + | XSAVE = 1188 - + | XSAVEC = 1189 - + | XSAVEC64 = 1190 - + | XSAVEOPT = 1191 - + | XSAVES = 1192 - + | XSAVES64 = 1193 - + | XSETBV = 1194 - + | XTEST = 1195 - + | InvalOP = 1196 @@ -2604,11 +2604,11 @@ let inline translate opcode = | Opcode.CMPSD -> 1 | Opcode.COMISS | Opcode.VCOMISS -> 1 - | Opcode.COMISD | Opcode.VCOMISD -> + | Opcode.COMISD | Opcode.VCOMISD -> 1 | Opcode.UCOMISS | Opcode.VUCOMISS -> 1 - | Opcode.UCOMISD | Opcode.VUCOMISD -> + | Opcode.UCOMISD | Opcode.VUCOMISD -> 1 | Opcode.ANDPS -> 1 | Opcode.ANDPD -> 1 @@ -2645,11 +2645,11 @@ let inline translate opcode = 1 | Opcode.CVTSS2SD -> 1 | Opcode.CVTSD2SS -> 1 - | Opcode.CVTSD2SI | Opcode.VCVTSD2SI -> + | Opcode.CVTSD2SI | Opcode.VCVTSD2SI -> 1 | Opcode.CVTTSS2SI | Opcode.VCVTTSS2SI -> 1 - | Opcode.CVTTSD2SI | Opcode.VCVTTSD2SI -> + | Opcode.CVTTSD2SI | Opcode.VCVTTSD2SI -> 1 | Opcode.LDMXCSR -> 1 | Opcode.STMXCSR -> 1 @@ -2939,7 +2939,7 @@ let inline translate opcode = // vim: set tw=80 sts=2 sw=2: let translate2 opcode = translate opcode -do (System.Console.Out.WriteLine "Test Passed"; - printf "TEST PASSED OK" ; +do (System.Console.Out.WriteLine "Test Passed"; + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/4715/main.fs b/tests/fsharp/regression/4715/main.fs index 52a1165cdaa..1150bf60655 100644 --- a/tests/fsharp/regression/4715/main.fs +++ b/tests/fsharp/regression/4715/main.fs @@ -15,8 +15,8 @@ let private init_dates rdate pdate = [] let main argv = try - - let rdate = Some (date.yesterday ()) + + let rdate = Some (date.yesterday ()) let pdate = Some (date.today () ) init_dates rdate pdate with diff --git a/tests/fsharp/regression/5531/test.fs b/tests/fsharp/regression/5531/test.fs index a8dfbdc5429..8dd40c7a56b 100644 --- a/tests/fsharp/regression/5531/test.fs +++ b/tests/fsharp/regression/5531/test.fs @@ -1,14 +1,14 @@ type Base() = abstract member Foo : unit -> unit default this.Foo() = printfn "Base" - + type Derived() = inherit Base() member this.Foo() = printfn "Derived" - + let inline callFoo<^T when ^T : (member Foo: unit -> unit) > (t: ^T) = (^T : (member Foo: unit -> unit) (t)) - + let b = Base() let d = Derived() let bd = d :> Base diff --git a/tests/fsharp/regression/literal-value-bug-1/test.fs b/tests/fsharp/regression/literal-value-bug-1/test.fs index cca0b9e0e2f..211e88ff5ec 100644 --- a/tests/fsharp/regression/literal-value-bug-1/test.fs +++ b/tests/fsharp/regression/literal-value-bug-1/test.fs @@ -2,5 +2,5 @@ let x = 7 [] -let main argv = +let main argv = 0 \ No newline at end of file diff --git a/tests/fsharp/regression/struct-measure-bug-1/test.fs b/tests/fsharp/regression/struct-measure-bug-1/test.fs index b8f3629ef6c..ebe43eeb003 100644 --- a/tests/fsharp/regression/struct-measure-bug-1/test.fs +++ b/tests/fsharp/regression/struct-measure-bug-1/test.fs @@ -1,8 +1,8 @@ -type AStruct<[]'u> = +type AStruct<[]'u> = struct end [] -let main argv = +let main argv = let x = AStruct() // This doesn't work 0 \ No newline at end of file diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index e8d26711979..eddb0dc6080 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -249,7 +249,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = let targetsBody = generateTargets let overridesBody = generateOverrides - + let targetsFileName = Path.Combine(directory, "Directory.Build.targets") let propsFileName = Path.Combine(directory, "Directory.Build.props") let overridesFileName = Path.Combine(directory, "Directory.Overrides.targets") diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index ff3bdb4cc0e..f9a30b9ed4b 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -35,7 +35,7 @@ module CoreTests = let ``subtype-langversion-checknulls`` () = let cfg = testConfig "core/subtype" - + fsc cfg "%s -o:test-checknulls.exe -g --checknulls" cfg.fsc_flags ["test.fsx"] @@ -46,7 +46,7 @@ module CoreTests = let ``subtype-langversion-no-checknulls`` () = let cfg = testConfig "core/subtype" - + fsc cfg "%s -o:test-no-checknulls.exe -g --checknulls-" cfg.fsc_flags ["test.fsx"] @@ -83,7 +83,7 @@ module CoreTests = let cfg = { cfg with fsc_flags = sprintf "%s --preferreduilang:en-US --test:StackSpan" cfg.fsc_flags} begin - + singleNegTest cfg "test" @@ -123,7 +123,7 @@ module CoreTests = let asyncStackTraces () = let cfg = testConfig "core/asyncStackTraces" - + fsc cfg "%s -o:test.exe -g --tailcalls- --optimize-" cfg.fsc_flags ["test.fsx"] @@ -144,10 +144,10 @@ module CoreTests = [] - let ``state-machines-optimized`` () = + let ``state-machines-optimized`` () = let cfg = testConfig "core/state-machines" - + fsc cfg "%s -o:test.exe -g --tailcalls+ --optimize+" cfg.fsc_flags ["test.fsx"] @@ -170,77 +170,77 @@ module CoreTests = [] let ``lots-of-conditionals``() = let cfg = testConfig "core/large/conditionals" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeConditionals-200.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-conditionals-maxtested``() = let cfg = testConfig "core/large/conditionals" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeConditionals-maxtested.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lets``() = let cfg = testConfig "core/large/lets" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeLets-500.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lets-maxtested``() = let cfg = testConfig "core/large/lets" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeLets-maxtested.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lists``() = let cfg = testConfig "core/large/lists" - + fsc cfg "%s -o:test-500.exe " cfg.fsc_flags ["LargeList-500.fs"] execAndCheckPassed cfg ("." ++ "test-500.exe") "" [] let ``lots-of-matches``() = let cfg = testConfig "core/large/matches" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeMatches-200.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-matches-maxtested``() = let cfg = testConfig "core/large/matches" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeMatches-maxtested.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-and-let``() = let cfg = testConfig "core/large/mixed" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequentialLet-500.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-and-let-maxtested``() = let cfg = testConfig "core/large/mixed" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequentialLet-maxtested.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential``() = let cfg = testConfig "core/large/sequential" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequential-500.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-maxtested``() = let cfg = testConfig "core/large/sequential" - + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequential-maxtested.fs"] execAndCheckPassed cfg ("." ++ "test.exe") "" @@ -268,14 +268,14 @@ module CoreTests = peverify cfg "test.exe" begin - + execAndCheckPassed cfg ("." ++ "test.exe") "" end begin - + fsiCheckPassed cfg "-r:lib.dll" ["test.fsx"] @@ -293,7 +293,7 @@ module CoreTests = peverify cfg "testcs.exe" - + fsiCheckPassed cfg "" ["test.fs"] @@ -475,10 +475,10 @@ module CoreTests = [] let ``fsi-reload`` () = let cfg = testConfig "core/fsi-reload" - + fsiCheckPassed cfg "%s --maxerrors:1" cfg.fsi_flags ["load1.fsx"] - + fsiCheckPassed cfg "%s --maxerrors:1" cfg.fsi_flags ["load2.fsx"] fsc cfg "" ["load1.fsx"] @@ -515,21 +515,21 @@ module CoreTests = singleNegTest cfg "negativetest" begin - + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] end begin - + execAndCheckPassed cfg ("." ++ "test.exe") "" end begin - + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" @@ -613,7 +613,7 @@ module CoreTests = runPrintingTest "--use:preludePrintSize1000.fsx" "output.1000" [] - let ``printing-width-200`` () = + let ``printing-width-200`` () = runPrintingTest "--use:preludePrintSize200.fsx" "output.200" [] @@ -731,7 +731,7 @@ module CoreTests = peverify cfg "test.exe" begin - + execAndCheckPassed cfg ("." ++ "test.exe") "" end @@ -744,25 +744,25 @@ module CoreTests = peverify cfg "test--optimize.exe" begin - + fsiCheckPassed cfg "%s -r cslib.dll" cfg.fsi_flags ["test.fsx"] end begin - + execAndCheckPassed cfg ("." ++ "test-with-debug-data.exe") "" end begin - + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" end // Previously a comment here said: // "This test stays in FsharpSuite for a later migration phases, it uses hardcoded #r to a C# compiled cslib.dll inside" - // This is resolved by compiling cslib.dll separately in each test. + // This is resolved by compiling cslib.dll separately in each test. [] let ``quotes-FSC-FSC_DEBUG`` () = let cfg = testConfig "core/quotes" @@ -882,7 +882,7 @@ module CoreTests = let ``libtest-langversion-checknulls`` () = let cfg = testConfig "core/libtest" - + fsc cfg "%s -o:test-checknulls.exe -g --checknulls" cfg.fsc_flags ["test.fsx"] @@ -1140,7 +1140,7 @@ module CoreTests = peverify cfg "test--optimize.exe" - + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] @@ -1162,7 +1162,7 @@ module CoreTests = peverify cfg "test--optimize.exe" - + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] @@ -1188,7 +1188,7 @@ module CoreTests = peverify cfg "test--optimize.exe" - + fsiCheckPassed cfg "%s --quotations-debug+" cfg.fsi_flags ["test.fsx"] @@ -1225,21 +1225,21 @@ module CoreTests = peverify cfg "module2-opt.exe" - + fsiCheckPassed cfg "%s -r module1.dll" cfg.fsi_flags ["module2.fsx"] - + execAndCheckPassed cfg ("." ++ "module2.exe") "" - + execAndCheckPassed cfg ("." ++ "module2-opt.exe") "" - + execAndCheckPassed cfg ("." ++ "module2-staticlink.exe") "" @@ -1400,7 +1400,7 @@ module CoreTests = peverify cfg "test.exe" - + execAndCheckPassed cfg ("." ++ "test.exe") "" @@ -1420,8 +1420,8 @@ module CoreTests = fsc cfg "%s -o:xmlverify.exe -g" cfg.fsc_flags ["xmlverify.fs"] peverifyWithArgs cfg "/nologo" "xmlverify.exe" - - + + [] let ``property setter in method or constructor`` () = let cfg = testConfig "core/members/set-only-property" @@ -1517,28 +1517,28 @@ module RegressionTests = singleTestBuildAndRunAux cfg (FSC_BUILDONLY false) [] - let ``Large inputs 12322 fscAnyCpu.exe 64-bit .NET Framework generating optimized code, portable PDB`` () = + let ``Large inputs 12322 fscAnyCpu.exe 64-bit .NET Framework generating optimized code, portable PDB`` () = let cfg = testConfig "regression/12322" let cfg = { cfg with FSC = cfg.FSCANYCPU } let cfg = { cfg with fsc_flags = cfg.fsc_flags + " --debug:portable --define:PORTABLE_PDB" } singleTestBuildAndRunAux cfg (FSC_BUILDONLY true) [] - let ``Large inputs 12322 fscAnyCpu.exe 64-bit .NET Framework generating optimized code, full PDB`` () = + let ``Large inputs 12322 fscAnyCpu.exe 64-bit .NET Framework generating optimized code, full PDB`` () = let cfg = testConfig "regression/12322" let cfg = { cfg with FSC = cfg.FSCANYCPU } let cfg = { cfg with fsc_flags = cfg.fsc_flags + " --debug:full " } singleTestBuildAndRunAux cfg (FSC_BUILDONLY true) [] - let ``12322 fscAnyCpu.exe 64-bit .NET Framework generating debug code, portable PDB`` () = + let ``12322 fscAnyCpu.exe 64-bit .NET Framework generating debug code, portable PDB`` () = let cfg = testConfig "regression/12322" let cfg = { cfg with FSC = cfg.FSCANYCPU } let cfg = { cfg with fsc_flags = cfg.fsc_flags + " --debug:portable --define:PORTABLE_PDB" } singleTestBuildAndRunAux cfg (FSC_BUILDONLY false) [] - let ``12322 fscAnyCpu.exe 64-bit .NET Framework generating debug code, full PDB`` () = + let ``12322 fscAnyCpu.exe 64-bit .NET Framework generating debug code, full PDB`` () = let cfg = testConfig "regression/12322" let cfg = { cfg with FSC = cfg.FSCANYCPU } let cfg = { cfg with fsc_flags = cfg.fsc_flags + " --debug:full" } @@ -1549,9 +1549,9 @@ module RegressionTests = [] let ``SRTP doesn't handle calling member hiding inherited members`` () = - let cfg = + let cfg = testConfig "regression/5531" - + let outFile = "compilation.output.test.txt" let expectedFile = "compilation.output.test.bsl" @@ -1837,7 +1837,7 @@ module TypecheckTests = fsc cfg "%s --langversion:8.0 --target:exe -o:pos40.exe" cfg.fsc_flags ["pos40.fs"] peverify cfg "pos40.exe" exec cfg ("." ++ "pos40.exe") "" - + [] let ``sigs pos41`` () = let cfg = testConfig "typecheck/sigs" @@ -1982,7 +1982,7 @@ module TypecheckTests = fsc cfg "%s -a -o:pos05.dll" cfg.fsc_flags ["pos05.fs"] [] - let ``type check neg01`` () = singleNegTest (testConfig "typecheck/sigs") "neg01" + let ``type check neg01`` () = singleNegTest (testConfig "typecheck/sigs") "neg01" [] let ``type check neg08`` () = singleNegTest (testConfig "typecheck/sigs") "neg08" @@ -1991,10 +1991,10 @@ module TypecheckTests = let ``type check neg09`` () = singleNegTest (testConfig "typecheck/sigs") "neg09" [] - let ``type check neg10`` () = singleNegTest (testConfig "typecheck/sigs") "neg10" - + let ``type check neg10`` () = singleNegTest (testConfig "typecheck/sigs") "neg10" + [] - let ``type check neg14`` () = singleNegTest (testConfig "typecheck/sigs") "neg14" + let ``type check neg14`` () = singleNegTest (testConfig "typecheck/sigs") "neg14" [] let ``type check neg17`` () = singleNegTest (testConfig "typecheck/sigs") "neg17" @@ -2013,10 +2013,10 @@ module TypecheckTests = let ``type check neg31`` () = singleNegTest (testConfig "typecheck/sigs") "neg31" [] - let ``type check neg33`` () = singleNegTest (testConfig "typecheck/sigs") "neg33" + let ``type check neg33`` () = singleNegTest (testConfig "typecheck/sigs") "neg33" [] - let ``type check neg43`` () = singleNegTest (testConfig "typecheck/sigs") "neg43" + let ``type check neg43`` () = singleNegTest (testConfig "typecheck/sigs") "neg43" #if !DEBUG // requires release version of compiler to avoid very deep stacks [] @@ -2027,7 +2027,7 @@ module TypecheckTests = let ``type check neg49`` () = singleNegTest (testConfig "typecheck/sigs") "neg49" [] - let ``type check neg94`` () = singleNegTest (testConfig "typecheck/sigs") "neg94" + let ``type check neg94`` () = singleNegTest (testConfig "typecheck/sigs") "neg94" [] let ``type check neg100`` () = @@ -2037,12 +2037,12 @@ module TypecheckTests = [] let ``type check neg107`` () = singleNegTest (testConfig "typecheck/sigs") "neg107" - + [] let ``type check neg134`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "preview" "neg134" [] - let ``type check neg135`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "preview" "neg135" + let ``type check neg135`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "preview" "neg135" module FscTests = [] diff --git a/tests/fsharp/typeProviders/helloWorld/TypeMagic.fs b/tests/fsharp/typeProviders/helloWorld/TypeMagic.fs index 21777803bd5..1f6fb696f27 100644 --- a/tests/fsharp/typeProviders/helloWorld/TypeMagic.fs +++ b/tests/fsharp/typeProviders/helloWorld/TypeMagic.fs @@ -1,5 +1,5 @@  -namespace FSharp.TypeMagic +namespace FSharp.TypeMagic open System open System.Text open System.Reflection @@ -8,31 +8,31 @@ open System.Linq.Expressions open System.Collections.Generic open Microsoft.FSharp.Core.CompilerServices -module internal Formatting = +module internal Formatting = let genericSomeType = (Some 1).GetType().GetGenericTypeDefinition() - let rec formatObject (o:obj) = + let rec formatObject (o:obj) = if o = null then "null" else let typ = o.GetType() - if typ.IsGenericType then + if typ.IsGenericType then let gt = typ.GetGenericTypeDefinition() - if genericSomeType = gt then + if genericSomeType = gt then let getter = typ.GetProperty("Value").GetGetMethod() let result = getter.Invoke(o,[||]) - formatObject result + formatObject result else o.ToString() - else + else o.ToString() -type internal ReifiedInstance(obj:obj, hostedType:Type) = +type internal ReifiedInstance(obj:obj, hostedType:Type) = member __.GetReifiedType() = hostedType member __.GetObject() = obj override __.ToString() = if obj = null then "null:" + hostedType.Name - else + else let sb = StringBuilder() for prop in hostedType.GetProperties() do if prop.CanRead then @@ -43,33 +43,33 @@ type internal ReifiedInstance(obj:obj, hostedType:Type) = else sb.Append(", ") |> ignore sb.AppendFormat("{0}={1}", prop.Name, result) |> ignore - if sb.Length <> 0 then sb.Append("}")|>ignore + if sb.Length <> 0 then sb.Append("}")|>ignore (sb.ToString()) + ":" + hostedType.Name type internal ITypeStatistics = abstract CallsToGetMembers : int -type internal ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = +type internal ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = inherit ConstructorInfo() - let getCustomAttributes = + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes | None -> fun _ -> [||] - override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = - match invoke with + override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + match invoke with | Some(invoke) -> invoke(null,invokeAttr,binder,parameters,culture) | None -> failwith "Invoke is not supported here." - override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = - match invoke with + override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + match invoke with | Some(invoke) -> invoke(obj,invokeAttr,binder,parameters,culture) | None -> failwith "Invoke is not supported here." override this.GetMethodImplementationFlags() = failwith "not implemented GetMethodImplementationFlags" override this.GetParameters() = [||] override this.MethodHandle = failwith "not implemented MethodHandle" override this.Attributes = MethodAttributes.Public ||| MethodAttributes.RTSpecialName - override this.Name = + override this.Name = if this.IsStatic then ".cctor" else ".ctor" override this.DeclaringType = declaringType @@ -84,7 +84,7 @@ type TypeContainer = | Namespace of System.Reflection.Module * string // namespace | Type of System.Type -type internal TypeImpl(container:TypeContainer, +type internal TypeImpl(container:TypeContainer, className, baseType, members : Type -> BindingFlags -> MemberTypes -> string option -> MemberInfo array, @@ -92,9 +92,9 @@ type internal TypeImpl(container:TypeContainer, ?invokeMember, ?attributes, ?isErased, - ?extras:obj) as this= + ?extras:obj) as this= inherit Type() - + // Validate do @@ -103,12 +103,12 @@ type internal TypeImpl(container:TypeContainer, if theModule = null then failwith "Null modules not allowed" if rootNamespace<>null && rootNamespace.Length=0 then failwith "Use 'null' for global namespace" | TypeContainer.Type _ -> () - + let theModule = match container with | TypeContainer.Namespace (m, _) -> m | TypeContainer.Type st -> st.Module - + // Statistics let mutable callsToGetMembers = 0 let rootNamespace = @@ -117,104 +117,104 @@ type internal TypeImpl(container:TypeContainer, | TypeContainer.Type st -> st.Namespace let defaultInvokeMembers(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) = - let matches = - this.GetMethods(invokeAttr) - |> Array.filter(fun m->m.Name = name) + let matches = + this.GetMethods(invokeAttr) + |> Array.filter(fun m->m.Name = name) |> List.ofArray - match matches with + match matches with | [oneMatch] -> oneMatch.Invoke(target,args) | [] -> failwith (sprintf "Found no method named '%s'." name) | _ -> failwith (sprintf "Found multiple overloads of method named '%s'." name) - - let mutable invokeMember = - match invokeMember with + + let mutable invokeMember = + match invokeMember with | Some(invokeMember) -> invokeMember | None -> defaultInvokeMembers /// Replace the default InvokeMember method. - member this.ReplaceInvokeMember(newInvokeMember) = + member this.ReplaceInvokeMember(newInvokeMember) = invokeMember <- newInvokeMember - + // Members of Type and parents override this.GUID : Guid= failwith "Not implemented GUID" override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj = invokeMember(name,invokeAttr,binder,target,args,modifiers,culture,namedParameters) override this.Assembly : Assembly = theModule.Assembly - override this.FullName : string = + override this.FullName : string = match container with | TypeContainer.Type declaringType -> declaringType.FullName+"+"+className - | TypeContainer.Namespace (_,``namespace``) -> + | TypeContainer.Namespace (_,``namespace``) -> match ``namespace`` with | null -> className | _ -> ``namespace``+"."+className override this.Namespace : string = rootNamespace override this.AssemblyQualifiedName : string = failwith "Not implemented" override this.BaseType : Type = baseType - override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = + override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = ConstructorImpl(this) :> ConstructorInfo - override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= + override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= [| for m in members this bindingAttr MemberTypes.Constructor None do if m.MemberType = MemberTypes.Constructor then yield downcast m |] - override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= - let result = + override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= + let result = [ for m in members this bindingAttr MemberTypes.Method (Some name) do if m.MemberType = MemberTypes.Method && m.Name = name then yield m ] - match result with + match result with | [] -> null | [one] -> downcast one - | several -> + | several -> System.Diagnostics.Debug.Assert(false, "TypeBuilder does not yet support overload resolution") downcast (List.head several) - override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = - this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m) + override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = + this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m) - override this.GetField(name, bindingAttr) : FieldInfo = - let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] + override this.GetField(name, bindingAttr) : FieldInfo = + let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] if fields.Length > 0 then downcast fields.[0] else null - override this.GetFields(bindingAttr) : FieldInfo[] = - [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] + override this.GetFields(bindingAttr) : FieldInfo[] = + [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] override this.GetInterface(name, ignoreCase) : Type = this.BaseType.GetInterface(name, ignoreCase) override this.GetInterfaces() : Type[] = this.BaseType.GetInterfaces() - override this.GetEvent(name, bindingAttr) = - let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) + override this.GetEvent(name, bindingAttr) = + let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) if events.Length > 0 then downcast events.[0] else null - override this.GetEvents(bindingAttr) = + override this.GetEvents(bindingAttr) = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Event then yield downcast m |] - - override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = + + override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = if returnType <> null then failwith "Need to handle specified return type in GetPropertyImpl" if types <> null then failwith "Need to handle specified parameter types in GetPropertyImpl" if modifiers <> null then failwith "Need to handle specified modifiers in GetPropertyImpl" - let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) + let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) if props.Length > 0 then downcast props.[0] else null - override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= + override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Property then yield downcast m |] - override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = - this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || + override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = + this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || // Allow 'fake' nested types that are actually real .NET types m.MemberType = MemberTypes.TypeInfo) |> Array.map(fun m->downcast m) - override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = + override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = let nt = this.GetMember(name, MemberTypes.NestedType ||| MemberTypes.TypeInfo, bindingAttr) match nt.Length with | 0 -> null | 1 -> downcast nt.[0] | _ -> failwith (sprintf "There is more than one nested type called %s" name) - override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = + override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = let thisMembers = members (downcast this) bindingAttr MemberTypes.All None if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then Array.concat [thisMembers;this.BaseType.GetMembers(bindingAttr) |> Array.filter(fun m -> int (m.MemberType &&& MemberTypes.Constructor) = 0 )] else thisMembers - override this.GetAttributeFlagsImpl() = - let defaultAttributes = - (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| - TypeAttributes.Class ||| + override this.GetAttributeFlagsImpl() = + let defaultAttributes = + (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| + TypeAttributes.Class ||| TypeAttributes.Sealed ||| (enum (if isErased = Some false then 0 else int32 TypeProviderTypeAttributes.IsErased)) defaultArg attributes defaultAttributes @@ -223,34 +223,34 @@ type internal TypeImpl(container:TypeContainer, override this.IsPointerImpl() : bool= false override this.IsPrimitiveImpl() : bool= false override this.IsCOMObjectImpl() : bool= false - override this.GetElementType() : Type= failwith "Not implemented GetElementType" + override this.GetElementType() : Type= failwith "Not implemented GetElementType" override this.HasElementTypeImpl() : bool= false override this.UnderlyingSystemType : Type = typeof override this.Name : string = className override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType" override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType" override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> - override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" + override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" override this.Module : Module = theModule - override this.DeclaringType = + override this.DeclaringType = match container with | TypeContainer.Type (declaringType)->declaringType | TypeContainer.Namespace _ -> null override this.MemberType : MemberTypes = - if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo + if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo override this.GetHashCode() = rootNamespace.GetHashCode() ^^^ className.GetHashCode() - override this.Equals(that:obj) = + override this.Equals(that:obj) = match that with | null -> false | :? TypeImpl as ti -> String.CompareOrdinal(this.FullName, ti.FullName) = 0 | _ -> false - override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = - let mt = - if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then + override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = + let mt = + if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then mt ||| MemberTypes.TypeInfo else mt - let thisMember : MemberInfo array = + let thisMember : MemberInfo array = members this bindingAttr mt (Some name) |> Array.filter(fun m->0<>(int(m.MemberType &&& mt)) && m.Name = name) if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then @@ -258,27 +258,27 @@ type internal TypeImpl(container:TypeContainer, else thisMember override this.GetGenericArguments() = [||] - override this.ToString() = + override this.ToString() = this.FullName member this.Extras = extras interface ITypeStatistics with - override this.CallsToGetMembers = callsToGetMembers - -and internal PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = + override this.CallsToGetMembers = callsToGetMembers + +and internal PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = inherit System.Reflection.PropertyInfo() - let getCustomAttributes = + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes | None -> fun _ -> [||] override this.PropertyType : Type= propertyType override this.SetValue(obj: obj, value: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : unit= failwith "Not implemented SetValue" override this.GetAccessors(nonPublic: bool) : MethodInfo []= failwith "Not implemented GetAccessors" - override this.GetGetMethod(nonPublic: bool) : MethodInfo = + override this.GetGetMethod(nonPublic: bool) : MethodInfo = match propertyGetter with | Some(propertyGetter) -> propertyGetter | None -> null - override this.GetSetMethod(nonPublic: bool) : MethodInfo = + override this.GetSetMethod(nonPublic: bool) : MethodInfo = match propertySetter with | Some(propertySetter) -> propertySetter | None -> null @@ -295,14 +295,14 @@ and internal PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomA override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" override this.MemberType : MemberTypes = MemberTypes.Property - + and internal MethodInfoImpl(declaringType, methodName, returnType, getCustomAttributes, attributes, invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj, - parameters) = + parameters) = inherit System.Reflection.MethodInfo() override this.ReturnTypeCustomAttributes= failwith "Not implemented ReturnTypeCustomAttributes" @@ -311,7 +311,7 @@ and internal MethodInfoImpl(declaringType, override this.GetMethodImplementationFlags() : MethodImplAttributes= failwith "Not implemented GetMethodImplementationFlags" override this.MethodHandle : RuntimeMethodHandle= failwith "Not implemented RuntimeMethodHandle" override this.Attributes : MethodAttributes = attributes - override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = invoke(obj,invokeAttr,binder,parameters,culture) override this.Name : string = methodName override this.DeclaringType : Type= declaringType @@ -321,17 +321,17 @@ and internal MethodInfoImpl(declaringType, override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool=true override this.MemberType : MemberTypes = MemberTypes.Method - override this.CallingConvention = + override this.CallingConvention = let mutable cc = CallingConventions.Standard - if not(this.IsStatic) then + if not(this.IsStatic) then cc <- cc ||| CallingConventions.HasThis cc override this.ReturnType = returnType - override this.ReturnParameter = null - override this.ToString() = + override this.ReturnParameter = null + override this.ToString() = "Method " + this.Name -type internal ParameterInfoImpl(name:string,parameterType:Type,?isOut:bool,?optionalValue:obj,?getCustomAttributes) = +type internal ParameterInfoImpl(name:string,parameterType:Type,?isOut:bool,?optionalValue:obj,?getCustomAttributes) = inherit System.Reflection.ParameterInfo() let isOut = defaultArg isOut false let getCustomAttributes = defaultArg getCustomAttributes (fun _ -> [||]) @@ -341,66 +341,66 @@ type internal ParameterInfoImpl(name:string,parameterType:Type,?isOut:bool,?opti override this.Attributes = (base.Attributes ||| (if isOut then ParameterAttributes.Out else enum 0) ||| (match optionalValue with None -> enum 0 | Some _ -> ParameterAttributes.Optional ||| ParameterAttributes.HasDefault)) override this.RawDefaultValue = defaultArg optionalValue null - -module internal Flags = + +module internal Flags = let combineWhenOptionTrue optionalFlag append original = - match optionalFlag with + match optionalFlag with | Some(true) -> original ||| append | _ -> original - + [] -type internal TypeBuilder = - - - static member CreateType(container,className,?baseType,?members,?getProperty,?getCustomAttributes,?extras,?isErased) : Type = - let baseType = +type internal TypeBuilder = + + + static member CreateType(container,className,?baseType,?members,?getProperty,?getCustomAttributes,?extras,?isErased) : Type = + let baseType = match baseType with | Some(baseType) -> baseType | None -> typeof - - let members = - match members with - | Some(members) -> members + + let members = + match members with + | Some(members) -> members | _ -> fun _ _ _ _ -> [||] - - let getCustomAttributes = + + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes) -> getCustomAttributes - | None -> fun _ -> [||] - + | None -> fun _ -> [||] + let result = TypeImpl(container,className,baseType,members,getCustomAttributes,?extras=extras,?isErased=isErased) - - upcast result - static member CreateSimpleType(container,className,?baseType,?members,?getCustomAttributes,?isErased) : Type = + upcast result + + static member CreateSimpleType(container,className,?baseType,?members,?getCustomAttributes,?isErased) : Type = let members = defaultArg members (lazy [| |]) - let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = + let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = match nameOption with | None -> members.Force() | Some name -> members.Force() |> Array.filter(fun m->m.Name=name) TypeBuilder.CreateType(container, className, ?baseType=baseType, members=getTypeMembers, ?getCustomAttributes=getCustomAttributes, ?isErased=isErased) - - static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = + + static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = let attributes = MethodAttributes.Public - let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static - let miGetter = + let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static + let miGetter = match getInvoke with - | Some(getInvoke) -> + | Some(getInvoke) -> let attributes = attributes ||| MethodAttributes.SpecialName match getterGetCustomAttributes with | Some(getCustomAttributes) -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, getCustomAttributes=getCustomAttributes, ?isStatic=isStatic)) | None -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, ?isStatic=isStatic)) | None -> None - let miSetter = + let miSetter = match setInvoke with - | Some(setInvoke) -> + | Some(setInvoke) -> let attributes = attributes ||| MethodAttributes.SpecialName - Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, - typeof, - attributes = attributes, + Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, + typeof, + attributes = attributes, parameters=[|TypeBuilder.CreateParameter("value",propertyType)|], - invoke=setInvoke, + invoke=setInvoke, ?isStatic=isStatic)) | None -> None match miGetter,miSetter with @@ -410,56 +410,56 @@ type internal TypeBuilder = | None,None -> failwith "Property must have a getter or setter" // A synthetic property is one without callable "invoke" methods - static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = + static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = let getter = defaultArg getter true let setter = defaultArg setter false if not getter && not setter then invalidArg "getter" "property must have either a getter or a setter" let dummyGetInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2" - TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) + TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) - static member CreateStaticParameter(parameterName, parameterType, parameterPosition, ?parameterDefaultValue, ?defaultValue) = - { new ParameterInfo() with + static member CreateStaticParameter(parameterName, parameterType, parameterPosition, ?parameterDefaultValue, ?defaultValue) = + { new ParameterInfo() with member __.RawDefaultValue = defaultArg defaultValue null member __.Attributes = if defaultValue.IsNone then enum 0 else ParameterAttributes.Optional member __.DefaultValue = defaultArg parameterDefaultValue null member __.Position = parameterPosition member __.ParameterType = parameterType member __.Name = parameterName } - - static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = - let attributes = - match attributes with - | Some(attributes) -> attributes - | None -> MethodAttributes.Public - let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static - - let getCustomAttributes = + + static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = + let attributes = + match attributes with + | Some(attributes) -> attributes + | None -> MethodAttributes.Public + let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static + + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes - | None -> fun _ -> [||] + | None -> fun _ -> [||] - let invoke = + let invoke = match invoke with | Some(invoke)->invoke - | None -> fun _ -> failwith "No invoke for this method." - - let parameters = - match parameters with - | Some(parameters) -> parameters + | None -> fun _ -> failwith "No invoke for this method." + + let parameters = + match parameters with + | Some(parameters) -> parameters | None -> [||] - + upcast MethodInfoImpl(declaringType,methodName,returnType,getCustomAttributes,attributes,invoke,parameters) // A synthetic method is one without a callable "invoke" method - static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = + static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = let dummyInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2" - TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) + TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) static member CreateParameter(name:string,parameterType:Type,?isOut:bool,?optionalValue:obj,?getCustomAttributes) = upcast ParameterInfoImpl(name,parameterType,?isOut=isOut,?optionalValue=optionalValue, ?getCustomAttributes=getCustomAttributes) static member CreateConstructor(declaringType, getCustomAttributes) : ConstructorInfo = upcast ConstructorImpl(declaringType,getCustomAttributes=getCustomAttributes) - + static member MemberInfosOfProperty(property:PropertyInfo) = [ if property.CanRead then yield property.GetGetMethod() :> MemberInfo if property.CanWrite then yield property.GetSetMethod() :> MemberInfo @@ -468,27 +468,27 @@ type internal TypeBuilder = static member JoinPropertiesIntoMemberInfos(properties:seq) = [| for property in properties do yield! TypeBuilder.MemberInfosOfProperty property |] - static member CacheMembers f = + static member CacheMembers f = let cache = ref None fun this _bindingAttr _kind _nmOpt -> - match !cache with + match !cache with | Some res -> res | None -> let res = f this in cache := Some res; res - static member CacheWithArg f = + static member CacheWithArg f = let cache = ref None fun x -> - match !cache with + match !cache with | Some res -> res | None -> let res = f x in cache := Some res; res - static member StandardGenerativeGetInvokerExpression(methodBase: MemberInfo, parameters: Quotations.Expr[]) = + static member StandardGenerativeGetInvokerExpression(methodBase: MemberInfo, parameters: Quotations.Expr[]) = match methodBase with - | :? ConstructorInfo as cinfo -> - Quotations.Expr.NewObject(cinfo, Array.toList parameters) - | :? System.Reflection.MethodInfo as minfo -> - if minfo.IsStatic then - Quotations.Expr.Call(minfo, Array.toList parameters) + | :? ConstructorInfo as cinfo -> + Quotations.Expr.NewObject(cinfo, Array.toList parameters) + | :? System.Reflection.MethodInfo as minfo -> + if minfo.IsStatic then + Quotations.Expr.Call(minfo, Array.toList parameters) else Quotations.Expr.Call(parameters.[0], minfo, Array.toList parameters.[1..]) | _ -> failwith ("TypeProviderForNamespaces.GetInvokerExpression: not a ProvidedMethod/ProvidedConstructor/ConstructorInfo/MethodInfo, name=" + methodBase.Name + " class=" + methodBase.GetType().FullName) diff --git a/tests/fsharp/typeProviders/helloWorld/provided.fs b/tests/fsharp/typeProviders/helloWorld/provided.fs index 4601e26f89a..f8907c6f2b9 100644 --- a/tests/fsharp/typeProviders/helloWorld/provided.fs +++ b/tests/fsharp/typeProviders/helloWorld/provided.fs @@ -3,77 +3,77 @@ namespace global [] do () -type TheGeneratedType1() = +type TheGeneratedType1() = member x.Prop1 = 1 static member (+) (x1:TheGeneratedType1,x2:TheGeneratedType1) = x1 static member (-) (x1:TheGeneratedType1,x2:TheGeneratedType1) = x2 -type TheGeneratedType2() = +type TheGeneratedType2() = member x.Prop1 = 1 static member (+) (x1:TheGeneratedType2,x2:TheGeneratedType2) = x1 static member (-) (x1:TheGeneratedType2,x2:TheGeneratedType2) = x2 -type TheGeneratedType3InContainerType1() = +type TheGeneratedType3InContainerType1() = member x.Prop1 = 1 static member (+) (x1:TheGeneratedType3InContainerType1,x2:TheGeneratedType3InContainerType1) = x1 static member (-) (x1:TheGeneratedType3InContainerType1,x2:TheGeneratedType3InContainerType1) = x2 -type TheGeneratedType3InContainerType2() = +type TheGeneratedType3InContainerType2() = member x.Prop1 = 1 static member (+) (x1:TheGeneratedType3InContainerType2,x2:TheGeneratedType3InContainerType2) = x1 static member (-) (x1:TheGeneratedType3InContainerType2,x2:TheGeneratedType3InContainerType2) = x2 -type TheGeneratedType4() = +type TheGeneratedType4() = member x.Prop1 = 1 static member (+) (x1:TheGeneratedType4,x2:TheGeneratedType4) = x1 static member (-) (x1:TheGeneratedType4,x2:TheGeneratedType4) = x2 -type TheGeneratedType1WithIndexer() = +type TheGeneratedType1WithIndexer() = let dict = System.Collections.Generic.Dictionary() [] val mutable MutableProperty1 : int member x.Prop2 = 1 - member x.Item - with get (v:int) = if dict.ContainsKey v then dict.[v] else string v + member x.Item + with get (v:int) = if dict.ContainsKey v then dict.[v] else string v and set (idx:int) (v:string) = dict.[idx] <- v -type TheGeneratedType2WithIndexer() = +type TheGeneratedType2WithIndexer() = let dict = System.Collections.Generic.Dictionary() [] val mutable MutableProperty1 : int member x.Prop2 = 1 - member x.Item - with get (v:int) = if dict.ContainsKey v then dict.[v] else string v + member x.Item + with get (v:int) = if dict.ContainsKey v then dict.[v] else string v and set (idx:int) (v:string) = dict.[idx] <- v -type TheGeneratedType3WithIndexer() = +type TheGeneratedType3WithIndexer() = let dict = System.Collections.Generic.Dictionary() [] val mutable MutableProperty1 : int member x.Prop2 = 1 - member x.Item - with get (v:int) = if dict.ContainsKey v then dict.[v] else string v + member x.Item + with get (v:int) = if dict.ContainsKey v then dict.[v] else string v and set (idx:int) (v:string) = dict.[idx] <- v -type TheGeneratedType5() = +type TheGeneratedType5() = member x.Prop1 = 1 static member (+) (x1:TheGeneratedType5,x2:TheGeneratedType5) = x1 static member (-) (x1:TheGeneratedType5,x2:TheGeneratedType5) = x2 -type TheGeneratedType5WithIndexer() = +type TheGeneratedType5WithIndexer() = let dict = System.Collections.Generic.Dictionary() [] val mutable MutableProperty1 : int member x.Prop2 = 1 - member x.Item - with get (v:int) = if dict.ContainsKey v then dict.[v] else string v + member x.Item + with get (v:int) = if dict.ContainsKey v then dict.[v] else string v and set (idx:int) (v:string) = dict.[idx] <- v -type TheGeneratedTypeWithEvent() = +type TheGeneratedTypeWithEvent() = let ev = new Event, System.EventArgs >() member sender.Trigger () = ev.Trigger(sender,System.EventArgs()) [] @@ -81,37 +81,37 @@ type TheGeneratedTypeWithEvent() = [] -type TheGeneratedStructType(x:int) = +type TheGeneratedStructType(x:int) = member __.StructProperty1 = x + 1 [] val mutable StructMutableProperty1 : int type TheGeneratedDelegateType = delegate of arg1:int -> int -type TheGeneratedEnumType = +type TheGeneratedEnumType = | Item0 = 0 | Item1 = 1 | Item2 = 2 -module GeneratedRelatedTypes = +module GeneratedRelatedTypes = - type TheGeneratedInterfaceType = + type TheGeneratedInterfaceType = abstract member InterfaceMethod0 : unit -> int abstract member InterfaceMethod1 : arg1:int -> int abstract member InterfaceMethod2 : arg1:int * arg2:int -> int abstract member InterfaceProperty1 : int - type TheGeneratedInterfaceSubType = + type TheGeneratedInterfaceSubType = inherit TheGeneratedInterfaceType abstract member InterfaceMethod3 : arg1:int * arg2:int * arg3:int -> int - type TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceType() = + type TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceType() = interface TheGeneratedInterfaceType with member __.InterfaceMethod0() = 3 member __.InterfaceMethod1 arg1 = arg1 + 4 member __.InterfaceMethod2 (arg1, arg2) = arg1+arg2 member __.InterfaceProperty1 = 4 - type TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceSubType() = + type TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceSubType() = interface TheGeneratedInterfaceSubType with member __.InterfaceMethod0() = 3 member __.InterfaceMethod1 arg1 = arg1 + 4 @@ -119,57 +119,57 @@ module GeneratedRelatedTypes = member __.InterfaceMethod3 (arg1, arg2, arg3) = arg1+arg2+arg3 member __.InterfaceProperty1 = 4 - type TheGeneratedInterfaceTypeWithEvent = + type TheGeneratedInterfaceTypeWithEvent = abstract member InterfaceProperty1 : int [] abstract member MyEvent : IEvent, System.EventArgs> [] - type TheGeneratedAbstractClass() = + type TheGeneratedAbstractClass() = abstract member AbstractMethod0 : unit -> int abstract member AbstractMethod1 : arg1:int -> int abstract member AbstractMethod2 : arg1:int * arg2:int -> int abstract member AbstractProperty1 : int [] - type TheGeneratedAbstractClassWithEvent() = + type TheGeneratedAbstractClassWithEvent() = [] abstract member MyEvent : IEvent, System.EventArgs> -module TheOuterType = +module TheOuterType = - type TheNestedGeneratedType() = + type TheNestedGeneratedType() = member x.Prop1 = 1 static member (+) (x1:TheNestedGeneratedType,x2:TheNestedGeneratedType) = x1 static member (-) (x1:TheNestedGeneratedType,x2:TheNestedGeneratedType) = x2 - type TheNestedGeneratedType1() = + type TheNestedGeneratedType1() = member x.Prop1 = 1 - type TheNestedGeneratedTypeWithIndexer() = + type TheNestedGeneratedTypeWithIndexer() = let dict = System.Collections.Generic.Dictionary() member x.Prop2 = 1 [] val mutable MutableProperty1 : int - member x.Item - with get (v:int) = if dict.ContainsKey v then dict.[v] else string v + member x.Item + with get (v:int) = if dict.ContainsKey v then dict.[v] else string v and set (idx:int) (v:string) = dict.[idx] <- v [] - type TheNestedGeneratedStructType(x:int) = + type TheNestedGeneratedStructType(x:int) = member __.StructProperty1 = x [] val mutable StructMutableProperty1 : int - type TheNestedGeneratedInterfaceType = + type TheNestedGeneratedInterfaceType = abstract member InterfaceMethod0 : unit -> int abstract member InterfaceMethod1 : arg1:int -> int abstract member InterfaceMethod2 : arg1:int * arg2:int -> int abstract member InterfaceProperty1 : int - type TheNestedGeneratedInterfaceTypeWithEvent = + type TheNestedGeneratedInterfaceTypeWithEvent = abstract member InterfaceProperty1 : int [] abstract member MyEvent : IEvent, System.EventArgs> @@ -177,24 +177,24 @@ module TheOuterType = type TheNestedGeneratedDelegateType = delegate of arg1:int -> int [] - type TheNestedGeneratedAbstractClass() = + type TheNestedGeneratedAbstractClass() = abstract member AbstractMethod0 : unit -> int abstract member AbstractMethod1 : arg1:int -> int abstract member AbstractMethod2 : arg1:int * arg2:int -> int abstract member AbstractProperty1 : int [] - type TheNestedGeneratedAbstractClassWithEvent() = + type TheNestedGeneratedAbstractClassWithEvent() = abstract member AbstractProperty1 : int [] abstract member MyEvent : IEvent, System.EventArgs> - type TheNestedGeneratedEnumType = + type TheNestedGeneratedEnumType = | Item0 = 0 | Item1 = 1 | Item2 = 2 -module DllImportSmokeTest = +module DllImportSmokeTest = [] extern System.UInt32 GetLastError() diff --git a/tests/fsharp/typeProviders/helloWorld/providedJ.fs b/tests/fsharp/typeProviders/helloWorld/providedJ.fs index cf965ce4458..87877d8d084 100644 --- a/tests/fsharp/typeProviders/helloWorld/providedJ.fs +++ b/tests/fsharp/typeProviders/helloWorld/providedJ.fs @@ -1,11 +1,11 @@ namespace global /// The type provided when GenerativeProviderWithStaticParameter is instantiated at "J" -type TheGeneratedTypeJ() = +type TheGeneratedTypeJ() = member x.Item1 = 1 // some code with an intra-assembly reference to a generated type -module IntraAssemblyCode = +module IntraAssemblyCode = let f (x:TheGeneratedTypeJ) = x diff --git a/tests/fsharp/typeProviders/helloWorld/providedK.fs b/tests/fsharp/typeProviders/helloWorld/providedK.fs index 78910be527e..078e10e9a51 100644 --- a/tests/fsharp/typeProviders/helloWorld/providedK.fs +++ b/tests/fsharp/typeProviders/helloWorld/providedK.fs @@ -1,7 +1,7 @@ namespace global /// The type provided when GenerativeProviderWithStaticParameter is instantiated at "K" -type TheGeneratedTypeK() = +type TheGeneratedTypeK() = member x.Item1 = 1 diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/magic.fs b/tests/fsharp/typeProviders/helloWorldCSharp/magic.fs index 16dc55f49a2..856d7465821 100644 --- a/tests/fsharp/typeProviders/helloWorldCSharp/magic.fs +++ b/tests/fsharp/typeProviders/helloWorldCSharp/magic.fs @@ -1,5 +1,5 @@  -namespace FSharp.TypeMagic +namespace FSharp.TypeMagic open System open System.Text open System.Reflection @@ -7,31 +7,31 @@ open System.Linq open System.Collections.Generic open Microsoft.FSharp.Core.CompilerServices -module Formatting = +module Formatting = let genericSomeType = (Some 1).GetType().GetGenericTypeDefinition() - let rec formatObject (o:obj) = + let rec formatObject (o:obj) = if o = null then "null" else let typ = o.GetType() - if typ.IsGenericType then + if typ.IsGenericType then let gt = typ.GetGenericTypeDefinition() - if genericSomeType = gt then + if genericSomeType = gt then let getter = typ.GetProperty("Value").GetGetMethod() let result = getter.Invoke(o,[||]) - formatObject result + formatObject result else o.ToString() - else + else o.ToString() -type ReifiedInstance(obj:obj, hostedType:Type) = +type ReifiedInstance(obj:obj, hostedType:Type) = member __.GetReifiedType() = hostedType member __.GetObject() = obj override __.ToString() = if obj = null then "null:" + hostedType.Name - else + else let sb = StringBuilder() for prop in hostedType.GetProperties() do if prop.CanRead then @@ -42,33 +42,33 @@ type ReifiedInstance(obj:obj, hostedType:Type) = else sb.Append(", ") |> ignore sb.AppendFormat("{0}={1}", prop.Name, result) |> ignore - if sb.Length <> 0 then sb.Append("}")|>ignore + if sb.Length <> 0 then sb.Append("}")|>ignore (sb.ToString()) + ":" + hostedType.Name type ITypeStatistics = abstract CallsToGetMembers : int -type ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = +type ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = inherit ConstructorInfo() - let getCustomAttributes = + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes | None -> fun _ -> [||] - override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = - match invoke with + override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + match invoke with | Some(invoke) -> invoke(null,invokeAttr,binder,parameters,culture) | None -> failwith "Invoke is not supported here." - override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = - match invoke with + override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + match invoke with | Some(invoke) -> invoke(obj,invokeAttr,binder,parameters,culture) | None -> failwith "Invoke is not supported here." override this.GetMethodImplementationFlags() = failwith "not implemented GetMethodImplementationFlags" override this.GetParameters() = [||] override this.MethodHandle = failwith "not implemented MethodHandle" override this.Attributes = MethodAttributes.Public ||| MethodAttributes.RTSpecialName - override this.Name = + override this.Name = if this.IsStatic then ".cctor" else ".ctor" override this.DeclaringType = declaringType @@ -83,15 +83,15 @@ type TypeContainer = | Namespace of System.Reflection.Module * string // namespace | Type of System.Type -type TypeImpl(container:TypeContainer, +type TypeImpl(container:TypeContainer, className, baseType, members : Type -> BindingFlags -> MemberTypes -> string option -> MemberInfo array, getCustomAttributes, ?invokeMember, - ?attributes,?extras:obj) as this= + ?attributes,?extras:obj) as this= inherit Type() - + // Validate do @@ -100,12 +100,12 @@ type TypeImpl(container:TypeContainer, if ``module`` = null then failwith "Null modules not allowed" if rootNamespace<>null && rootNamespace.Length=0 then failwith "Use 'null' for global namespace" | TypeContainer.Type _ -> () - + let ``module`` = match container with | TypeContainer.Namespace (m, _) -> m | TypeContainer.Type st -> st.Module - + // Statistics let mutable callsToGetMembers = 0 let rootNamespace = @@ -118,104 +118,104 @@ type TypeImpl(container:TypeContainer, let ClassName = className let defaultInvokeMembers(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) = - let matches = - this.GetMethods(invokeAttr) - |> Array.filter(fun m->m.Name = name) + let matches = + this.GetMethods(invokeAttr) + |> Array.filter(fun m->m.Name = name) |> List.ofArray - match matches with + match matches with | [oneMatch] -> oneMatch.Invoke(target,args) | [] -> failwith (sprintf "Found no method named '%s'." name) | _ -> failwith (sprintf "Found multiple overloads of method named '%s'." name) - - let mutable invokeMember = - match invokeMember with + + let mutable invokeMember = + match invokeMember with | Some(invokeMember) -> invokeMember | None -> defaultInvokeMembers /// Replace the default InvokeMember method. - member this.ReplaceInvokeMember(newInvokeMember) = + member this.ReplaceInvokeMember(newInvokeMember) = invokeMember <- newInvokeMember - + // Members of Type and parents override this.GUID : Guid= failwith "Not implemented GUID" override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj = invokeMember(name,invokeAttr,binder,target,args,modifiers,culture,namedParameters) override this.Assembly : Assembly = ``module``.Assembly - override this.FullName : string = + override this.FullName : string = match container with | TypeContainer.Type declaringType -> declaringType.FullName+"+"+ClassName - | TypeContainer.Namespace (_,``namespace``) -> + | TypeContainer.Namespace (_,``namespace``) -> match ``namespace`` with | null -> ClassName | _ -> ``namespace``+"."+ClassName override this.Namespace : string = RootNamespace override this.AssemblyQualifiedName : string = failwith "Not implemented" override this.BaseType : Type = baseType - override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = + override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = ConstructorImpl(this) :> ConstructorInfo - override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= + override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= [| for m in members this bindingAttr MemberTypes.Constructor None do if m.MemberType = MemberTypes.Constructor then yield downcast m |] - override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= - let result = + override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= + let result = [ for m in members this bindingAttr MemberTypes.Method (Some name) do if m.MemberType = MemberTypes.Method && m.Name = name then yield m ] - match result with + match result with | [] -> null | [one] -> downcast one - | several -> + | several -> System.Diagnostics.Debug.Assert(false, "TypeBuilder does not yet support overload resolution") downcast (List.head several) - override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = - this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m) + override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = + this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m) - override this.GetField(name, bindingAttr) : FieldInfo = - let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] + override this.GetField(name, bindingAttr) : FieldInfo = + let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] if fields.Length > 0 then downcast fields.[0] else null - override this.GetFields(bindingAttr) : FieldInfo[] = - [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] + override this.GetFields(bindingAttr) : FieldInfo[] = + [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] override this.GetInterface(name, ignoreCase) : Type = this.BaseType.GetInterface(name, ignoreCase) override this.GetInterfaces() : Type[] = this.BaseType.GetInterfaces() - override this.GetEvent(name, bindingAttr) = - let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) + override this.GetEvent(name, bindingAttr) = + let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) if events.Length > 0 then downcast events.[0] else null - override this.GetEvents(bindingAttr) = + override this.GetEvents(bindingAttr) = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Event then yield downcast m |] - - override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = + + override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = if returnType <> null then failwith "Need to handle specified return type in GetPropertyImpl" if types <> null then failwith "Need to handle specified parameter types in GetPropertyImpl" if modifiers <> null then failwith "Need to handle specified modifiers in GetPropertyImpl" - let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) + let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) if props.Length > 0 then downcast props.[0] else null - override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= + override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Property then yield downcast m |] - override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = - this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || + override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = + this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || // Allow 'fake' nested types that are actually real .NET types m.MemberType = MemberTypes.TypeInfo) |> Array.map(fun m->downcast m) - override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = + override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = let nt = this.GetMember(name, MemberTypes.NestedType ||| MemberTypes.TypeInfo, bindingAttr) match nt.Length with | 0 -> null | 1 -> downcast nt.[0] | _ -> failwith (sprintf "There is more than one nested type called %s" name) - override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = + override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = let thisMembers = members (downcast this) bindingAttr MemberTypes.All None if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then Array.concat [thisMembers;this.BaseType.GetMembers(bindingAttr) |> Array.filter(fun m -> int (m.MemberType &&& MemberTypes.Constructor) = 0 )] else thisMembers - override this.GetAttributeFlagsImpl() : TypeAttributes = - let defaultAttributes = - (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| - TypeAttributes.Class ||| + override this.GetAttributeFlagsImpl() : TypeAttributes = + let defaultAttributes = + (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| + TypeAttributes.Class ||| TypeAttributes.Sealed ||| enum (int32 TypeProviderTypeAttributes.IsErased) defaultArg attributes defaultAttributes @@ -224,34 +224,34 @@ type TypeImpl(container:TypeContainer, override this.IsPointerImpl() : bool= false override this.IsPrimitiveImpl() : bool= false override this.IsCOMObjectImpl() : bool= false - override this.GetElementType() : Type= failwith "Not implemented GetElementType" + override this.GetElementType() : Type= failwith "Not implemented GetElementType" override this.HasElementTypeImpl() : bool= false override this.UnderlyingSystemType : Type = typeof override this.Name : string = ClassName override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType" override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType" override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> - override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" + override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" override this.Module : Module = ``module`` - override this.DeclaringType = + override this.DeclaringType = match container with | TypeContainer.Type (declaringType)->declaringType | TypeContainer.Namespace _ -> null override this.MemberType : MemberTypes = - if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo + if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo override this.GetHashCode() = rootNamespace.GetHashCode() ^^^ className.GetHashCode() - override this.Equals(that:obj) = + override this.Equals(that:obj) = match that with | null -> false | :? TypeImpl as ti -> String.CompareOrdinal(this.FullName, ti.FullName) = 0 | _ -> false - override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = - let mt = - if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then + override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = + let mt = + if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then mt ||| MemberTypes.TypeInfo else mt - let thisMember : MemberInfo array = + let thisMember : MemberInfo array = members this bindingAttr mt (Some name) |> Array.filter(fun m->0<>(int(m.MemberType &&& mt)) && m.Name = name) if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then @@ -259,27 +259,27 @@ type TypeImpl(container:TypeContainer, else thisMember override this.GetGenericArguments() = [||] - override this.ToString() = + override this.ToString() = this.FullName member this.Extras = extras interface ITypeStatistics with - override this.CallsToGetMembers = callsToGetMembers - -and PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = + override this.CallsToGetMembers = callsToGetMembers + +and PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = inherit System.Reflection.PropertyInfo() - let getCustomAttributes = + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes | None -> fun _ -> [||] override this.PropertyType : Type= propertyType override this.SetValue(obj: obj, value: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : unit= failwith "Not implemented SetValue" override this.GetAccessors(nonPublic: bool) : MethodInfo []= failwith "Not implemented GetAccessors" - override this.GetGetMethod(nonPublic: bool) : MethodInfo = + override this.GetGetMethod(nonPublic: bool) : MethodInfo = match propertyGetter with | Some(propertyGetter) -> propertyGetter | None -> null - override this.GetSetMethod(nonPublic: bool) : MethodInfo = + override this.GetSetMethod(nonPublic: bool) : MethodInfo = match propertySetter with | Some(propertySetter) -> propertySetter | None -> null @@ -296,14 +296,14 @@ and PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" override this.MemberType : MemberTypes = MemberTypes.Property - + and MethodInfoImpl(declaringType, methodName, returnType, getCustomAttributes, attributes, invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj, - parameters) = + parameters) = inherit System.Reflection.MethodInfo() override this.ReturnTypeCustomAttributes= failwith "Not implemented ReturnTypeCustomAttributes" @@ -312,7 +312,7 @@ and MethodInfoImpl(declaringType, override this.GetMethodImplementationFlags() : MethodImplAttributes= failwith "Not implemented GetMethodImplementationFlags" override this.MethodHandle : RuntimeMethodHandle= failwith "Not implemented RuntimeMethodHandle" override this.Attributes : MethodAttributes = attributes - override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = invoke(obj,invokeAttr,binder,parameters,culture) override this.Name : string = methodName override this.DeclaringType : Type= declaringType @@ -322,80 +322,80 @@ and MethodInfoImpl(declaringType, override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool=true override this.MemberType : MemberTypes = MemberTypes.Method - override this.CallingConvention = + override this.CallingConvention = let mutable cc = CallingConventions.Standard - if not(this.IsStatic) then + if not(this.IsStatic) then cc <- cc ||| CallingConventions.HasThis cc override this.ReturnType = returnType - override this.ReturnParameter = null - override this.ToString() = + override this.ReturnParameter = null + override this.ToString() = "Method " + this.Name -type ParameterInfoImpl(name:string,parameterType:Type) = +type ParameterInfoImpl(name:string,parameterType:Type) = inherit System.Reflection.ParameterInfo() override this.Name = name override this.ParameterType = parameterType - -module Flags = + +module Flags = let combineWhenOptionTrue optionalFlag append original = - match optionalFlag with + match optionalFlag with | Some(true) -> original ||| append | _ -> original - + [] -type TypeBuilder = - - - static member CreateType(container,className,?baseType,?members,?getProperty,?getCustomAttributes,?extras) : Type = - let baseType = +type TypeBuilder = + + + static member CreateType(container,className,?baseType,?members,?getProperty,?getCustomAttributes,?extras) : Type = + let baseType = match baseType with | Some(baseType) -> baseType | None -> typeof - - let members = - match members with - | Some(members) -> members + + let members = + match members with + | Some(members) -> members | _ -> fun _ _ _ _ -> [||] - - let getCustomAttributes = + + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes) -> getCustomAttributes - | None -> fun _ -> [||] - + | None -> fun _ -> [||] + let result = TypeImpl(container,className,baseType,members,getCustomAttributes,?extras=extras) - - upcast result - static member CreateSimpleType(container,className,?baseType,?members,?getCustomAttributes) : Type = + upcast result + + static member CreateSimpleType(container,className,?baseType,?members,?getCustomAttributes) : Type = let members = defaultArg members (lazy [| |]) - let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = + let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = match nameOption with | None -> members.Force() | Some name -> members.Force() |> Array.filter(fun m->m.Name=name) TypeBuilder.CreateType(container, className, ?baseType=baseType, members=getTypeMembers, ?getCustomAttributes=getCustomAttributes) - - static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = + + static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = let attributes = MethodAttributes.Public - let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static - let miGetter = + let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static + let miGetter = match getInvoke with - | Some(getInvoke) -> + | Some(getInvoke) -> let attributes = attributes ||| MethodAttributes.SpecialName match getterGetCustomAttributes with | Some(getCustomAttributes) -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, getCustomAttributes=getCustomAttributes, ?isStatic=isStatic)) | None -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, ?isStatic=isStatic)) | None -> None - let miSetter = + let miSetter = match setInvoke with - | Some(setInvoke) -> + | Some(setInvoke) -> let attributes = attributes ||| MethodAttributes.SpecialName - Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, - typeof, - attributes = attributes, + Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, + typeof, + attributes = attributes, parameters=[|TypeBuilder.CreateParameter("value",propertyType)|], - invoke=setInvoke, + invoke=setInvoke, ?isStatic=isStatic)) | None -> None match miGetter,miSetter with @@ -405,47 +405,47 @@ type TypeBuilder = | None,None -> failwith "Property must have a getter or setter" // A synthetic property is one without callable "invoke" methods - static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = + static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = let getter = defaultArg getter true let setter = defaultArg setter false if not getter && not setter then invalidArg "getter" "property must have either a getter or a setter" let dummyGetInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2" - TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) - - static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = - let attributes = - match attributes with - | Some(attributes) -> attributes - | None -> MethodAttributes.Public - let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static + TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) + + static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = + let attributes = + match attributes with + | Some(attributes) -> attributes + | None -> MethodAttributes.Public + let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static - let getCustomAttributes = + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes - | None -> fun _ -> [||] + | None -> fun _ -> [||] - let invoke = + let invoke = match invoke with | Some(invoke)->invoke - | None -> fun _ -> failwith "No invoke for this method." - - let parameters = - match parameters with - | Some(parameters) -> parameters + | None -> fun _ -> failwith "No invoke for this method." + + let parameters = + match parameters with + | Some(parameters) -> parameters | None -> [||] - + upcast MethodInfoImpl(declaringType,methodName,returnType,getCustomAttributes,attributes,invoke,parameters) // A synthetic method is one without a callable "invoke" method - static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = + static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = let dummyInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2" - TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) + TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) static member CreateParameter(name:string,parameterType:Type) = upcast ParameterInfoImpl(name,parameterType) static member CreateConstructor(declaringType, getCustomAttributes) : ConstructorInfo = upcast ConstructorImpl(declaringType,getCustomAttributes=getCustomAttributes) - + static member MemberInfosOfProperty(property:PropertyInfo) = [ if property.CanRead then yield property.GetGetMethod() :> MemberInfo if property.CanWrite then yield property.GetSetMethod() :> MemberInfo @@ -455,26 +455,26 @@ type TypeBuilder = static member JoinPropertiesIntoMemberInfos(properties:PropertyInfo seq) = // CHANGE TO THIS (though it reorders - does that matter?) // [| for property in properties do yield! MemberInfosOfProperty property |] - + let properties = properties |> List.ofSeq - let accessMethods : MemberInfo list = [for property in properties do + let accessMethods : MemberInfo list = [for property in properties do if property.CanRead then yield property.GetGetMethod() :> MemberInfo - if property.CanWrite then yield property.GetSetMethod() :> MemberInfo] + if property.CanWrite then yield property.GetSetMethod() :> MemberInfo] let properties : MemberInfo list = properties |> List.map(fun f->upcast f) [accessMethods;properties] |> List.concat |> List.toArray - static member CacheMembers f = + static member CacheMembers f = let cache = ref None fun this _bindingAttr _kind _nmOpt -> - match !cache with + match !cache with | Some res -> res | None -> let res = f this in cache := Some res; res - static member CacheWithArg f = + static member CacheWithArg f = let cache = ref None fun x -> - match !cache with + match !cache with | Some res -> res | None -> let res = f x in cache := Some res; res diff --git a/tests/fsharp/typeProviders/negTests/TypeEvil.fs b/tests/fsharp/typeProviders/negTests/TypeEvil.fs index 33a8b469a0d..8f521843365 100644 --- a/tests/fsharp/typeProviders/negTests/TypeEvil.fs +++ b/tests/fsharp/typeProviders/negTests/TypeEvil.fs @@ -7,31 +7,31 @@ open System.Linq open System.Collections.Generic open Microsoft.FSharp.Core.CompilerServices -module internal Formatting = +module internal Formatting = let genericSomeType = (Some 1).GetType().GetGenericTypeDefinition() - let rec formatObject (o:obj) = + let rec formatObject (o:obj) = if o = null then "null" else let typ = o.GetType() - if typ.IsGenericType then + if typ.IsGenericType then let gt = typ.GetGenericTypeDefinition() - if genericSomeType = gt then + if genericSomeType = gt then let getter = typ.GetProperty("Value").GetGetMethod() let result = getter.Invoke(o,[||]) - formatObject result + formatObject result else o.ToString() - else + else o.ToString() -type internal ReifiedInstance(obj:obj, hostedType:Type) = +type internal ReifiedInstance(obj:obj, hostedType:Type) = member __.GetReifiedType() = hostedType member __.GetObject() = obj override __.ToString() = if obj = null then "null:" + hostedType.Name - else + else let sb = StringBuilder() for prop in hostedType.GetProperties() do if prop.CanRead then @@ -42,33 +42,33 @@ type internal ReifiedInstance(obj:obj, hostedType:Type) = else sb.Append(", ") |> ignore sb.AppendFormat("{0}={1}", prop.Name, result) |> ignore - if sb.Length <> 0 then sb.Append("}")|>ignore + if sb.Length <> 0 then sb.Append("}")|>ignore (sb.ToString()) + ":" + hostedType.Name type internal ITypeStatistics = abstract CallsToGetMembers : int -type internal ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = +type internal ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = inherit ConstructorInfo() - let getCustomAttributes = + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes | None -> fun _ -> [||] - override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = - match invoke with + override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + match invoke with | Some(invoke) -> invoke(null,invokeAttr,binder,parameters,culture) | None -> failwith "Invoke is not supported here." - override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = - match invoke with + override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + match invoke with | Some(invoke) -> invoke(obj,invokeAttr,binder,parameters,culture) | None -> failwith "Invoke is not supported here." override this.GetMethodImplementationFlags() = failwith "not implemented GetMethodImplementationFlags" override this.GetParameters() = [||] override this.MethodHandle = failwith "not implemented MethodHandle" override this.Attributes = MethodAttributes.Public ||| MethodAttributes.RTSpecialName - override this.Name = + override this.Name = if this.IsStatic then ".cctor" else ".ctor" override this.DeclaringType = declaringType @@ -83,15 +83,15 @@ type TypeContainer = | Namespace of System.Reflection.Module * string // namespace | Type of System.Type -type internal TypeImpl(container:TypeContainer, +type internal TypeImpl(container:TypeContainer, className, baseType, members : Type -> BindingFlags -> MemberTypes -> string option -> MemberInfo array, getCustomAttributes, ?invokeMember, - ?attributes,?extras:obj) as this= + ?attributes,?extras:obj) as this= inherit Type() - + // Validate do @@ -100,12 +100,12 @@ type internal TypeImpl(container:TypeContainer, if theModule = null then failwith "Null modules not allowed" if rootNamespace<>null && rootNamespace.Length=0 then failwith "Use 'null' for global namespace" | TypeContainer.Type _ -> () - + let theModule = match container with | TypeContainer.Namespace (m, _) -> m | TypeContainer.Type st -> st.Module - + // Statistics let mutable callsToGetMembers = 0 let rootNamespace = @@ -114,105 +114,105 @@ type internal TypeImpl(container:TypeContainer, | TypeContainer.Type st -> st.Namespace // Other state - let attributes = - let defaultAttributes = - (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| - TypeAttributes.Class ||| + let attributes = + let defaultAttributes = + (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| + TypeAttributes.Class ||| TypeAttributes.Sealed ||| enum (int32 TypeProviderTypeAttributes.IsErased) defaultArg attributes defaultAttributes let defaultInvokeMembers(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) = - let matches = - this.GetMethods(invokeAttr) - |> Array.filter(fun m->m.Name = name) + let matches = + this.GetMethods(invokeAttr) + |> Array.filter(fun m->m.Name = name) |> List.ofArray - match matches with + match matches with | [oneMatch] -> oneMatch.Invoke(target,args) | [] -> failwith (sprintf "Found no method named '%s'." name) | _ -> failwith (sprintf "Found multiple overloads of method named '%s'." name) - - let mutable invokeMember = - match invokeMember with + + let mutable invokeMember = + match invokeMember with | Some(invokeMember) -> invokeMember | None -> defaultInvokeMembers /// Replace the default InvokeMember method. - member this.ReplaceInvokeMember(newInvokeMember) = + member this.ReplaceInvokeMember(newInvokeMember) = invokeMember <- newInvokeMember - + // Members of Type and parents override this.GUID : Guid= failwith "Not implemented GUID" override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj = invokeMember(name,invokeAttr,binder,target,args,modifiers,culture,namedParameters) override this.Assembly : Assembly = theModule.Assembly - override this.FullName : string = + override this.FullName : string = match container with | TypeContainer.Type declaringType -> declaringType.FullName+"+"+className - | TypeContainer.Namespace (_,``namespace``) -> + | TypeContainer.Namespace (_,``namespace``) -> match ``namespace`` with | null -> className | _ -> ``namespace``+"."+className override this.Namespace : string = rootNamespace override this.AssemblyQualifiedName : string = failwith "Not implemented" override this.BaseType : Type = baseType - override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = + override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = ConstructorImpl(this) :> ConstructorInfo - override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= + override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= [| for m in members this bindingAttr MemberTypes.Constructor None do if m.MemberType = MemberTypes.Constructor then yield downcast m |] - override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= - let result = + override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= + let result = [ for m in members this bindingAttr MemberTypes.Method (Some name) do if m.MemberType = MemberTypes.Method && m.Name = name then yield m ] - match result with + match result with | [] -> null | [one] -> downcast one - | several -> + | several -> System.Diagnostics.Debug.Assert(false, "TypeBuilder does not yet support overload resolution") downcast (List.head several) - override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = - this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m) + override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = + this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m) - override this.GetField(name, bindingAttr) : FieldInfo = - let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] + override this.GetField(name, bindingAttr) : FieldInfo = + let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] if fields.Length > 0 then downcast fields.[0] else null - override this.GetFields(bindingAttr) : FieldInfo[] = - [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] + override this.GetFields(bindingAttr) : FieldInfo[] = + [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] override this.GetInterface(name, ignoreCase) : Type = this.BaseType.GetInterface(name, ignoreCase) override this.GetInterfaces() : Type[] = this.BaseType.GetInterfaces() - override this.GetEvent(name, bindingAttr) = - let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) + override this.GetEvent(name, bindingAttr) = + let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) if events.Length > 0 then downcast events.[0] else null - override this.GetEvents(bindingAttr) = + override this.GetEvents(bindingAttr) = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Event then yield downcast m |] - - override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = + + override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = if returnType <> null then failwith "Need to handle specified return type in GetPropertyImpl" if types <> null then failwith "Need to handle specified parameter types in GetPropertyImpl" if modifiers <> null then failwith "Need to handle specified modifiers in GetPropertyImpl" - let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) + let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) if props.Length > 0 then downcast props.[0] else null - override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= + override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Property then yield downcast m |] - override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = - this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || + override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = + this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || // Allow 'fake' nested types that are actually real .NET types m.MemberType = MemberTypes.TypeInfo) |> Array.map(fun m->downcast m) - override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = + override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = let nt = this.GetMember(name, MemberTypes.NestedType ||| MemberTypes.TypeInfo, bindingAttr) match nt.Length with | 0 -> null | 1 -> downcast nt.[0] | _ -> failwith (sprintf "There is more than one nested type called %s" name) - override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = + override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = let thisMembers = members (downcast this) bindingAttr MemberTypes.All None if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then Array.concat [thisMembers;this.BaseType.GetMembers(bindingAttr) |> Array.filter(fun m -> int (m.MemberType &&& MemberTypes.Constructor) = 0 )] @@ -223,34 +223,34 @@ type internal TypeImpl(container:TypeContainer, override this.IsPointerImpl() : bool= false override this.IsPrimitiveImpl() : bool= false override this.IsCOMObjectImpl() : bool= false - override this.GetElementType() : Type= failwith "Not implemented GetElementType" + override this.GetElementType() : Type= failwith "Not implemented GetElementType" override this.HasElementTypeImpl() : bool= false override this.UnderlyingSystemType : Type = typeof override this.Name : string = className override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType" override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType" override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> - override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" + override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" override this.Module : Module = theModule - override this.DeclaringType = + override this.DeclaringType = match container with | TypeContainer.Type (declaringType)->declaringType | TypeContainer.Namespace _ -> null override this.MemberType : MemberTypes = - if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo + if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo override this.GetHashCode() = rootNamespace.GetHashCode() ^^^ className.GetHashCode() - override this.Equals(that:obj) = + override this.Equals(that:obj) = match that with | null -> false | :? TypeImpl as ti -> String.CompareOrdinal(this.FullName, ti.FullName) = 0 | _ -> false - override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = - let mt = - if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then + override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = + let mt = + if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then mt ||| MemberTypes.TypeInfo else mt - let thisMember : MemberInfo array = + let thisMember : MemberInfo array = members this bindingAttr mt (Some name) |> Array.filter(fun m->0<>(int(m.MemberType &&& mt)) && m.Name = name) if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then @@ -258,27 +258,27 @@ type internal TypeImpl(container:TypeContainer, else thisMember override this.GetGenericArguments() = [||] - override this.ToString() = + override this.ToString() = this.FullName member this.Extras = extras interface ITypeStatistics with - override this.CallsToGetMembers = callsToGetMembers - -and internal PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = + override this.CallsToGetMembers = callsToGetMembers + +and internal PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = inherit System.Reflection.PropertyInfo() - let getCustomAttributes = + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes | None -> fun _ -> [||] override this.PropertyType : Type= propertyType override this.SetValue(obj: obj, value: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : unit= failwith "Not implemented SetValue" override this.GetAccessors(nonPublic: bool) : MethodInfo []= failwith "Not implemented GetAccessors" - override this.GetGetMethod(nonPublic: bool) : MethodInfo = + override this.GetGetMethod(nonPublic: bool) : MethodInfo = match propertyGetter with | Some(propertyGetter) -> propertyGetter | None -> null - override this.GetSetMethod(nonPublic: bool) : MethodInfo = + override this.GetSetMethod(nonPublic: bool) : MethodInfo = match propertySetter with | Some(propertySetter) -> propertySetter | None -> null @@ -295,14 +295,14 @@ and internal PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomA override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined" override this.MemberType : MemberTypes = MemberTypes.Property - + and internal MethodInfoImpl(declaringType, methodName, returnType, getCustomAttributes, attributes, invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj, - parameters) = + parameters) = inherit System.Reflection.MethodInfo() override this.ReturnTypeCustomAttributes= failwith "Not implemented ReturnTypeCustomAttributes" @@ -311,7 +311,7 @@ and internal MethodInfoImpl(declaringType, override this.GetMethodImplementationFlags() : MethodImplAttributes= failwith "Not implemented GetMethodImplementationFlags" override this.MethodHandle : RuntimeMethodHandle= failwith "Not implemented RuntimeMethodHandle" override this.Attributes : MethodAttributes = attributes - override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = + override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = invoke(obj,invokeAttr,binder,parameters,culture) override this.Name : string = methodName override this.DeclaringType : Type= declaringType @@ -321,80 +321,80 @@ and internal MethodInfoImpl(declaringType, override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_> override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool=true override this.MemberType : MemberTypes = MemberTypes.Method - override this.CallingConvention = + override this.CallingConvention = let mutable cc = CallingConventions.Standard - if not(this.IsStatic) then + if not(this.IsStatic) then cc <- cc ||| CallingConventions.HasThis cc override this.ReturnType = returnType - override this.ReturnParameter = null - override this.ToString() = + override this.ReturnParameter = null + override this.ToString() = "Method " + this.Name -type internal ParameterInfoImpl(name:string,parameterType:Type) = +type internal ParameterInfoImpl(name:string,parameterType:Type) = inherit System.Reflection.ParameterInfo() override this.Name = name override this.ParameterType = parameterType - -module internal Flags = + +module internal Flags = let combineWhenOptionTrue optionalFlag append original = - match optionalFlag with + match optionalFlag with | Some(true) -> original ||| append | _ -> original - + [] -type internal TypeBuilder = - - - static member CreateType(container,className,?baseType,?declaringType,?members,?getProperty,?getCustomAttributes,?extras) : Type = - let baseType = +type internal TypeBuilder = + + + static member CreateType(container,className,?baseType,?declaringType,?members,?getProperty,?getCustomAttributes,?extras) : Type = + let baseType = match baseType with | Some(baseType) -> baseType | None -> typeof - - let members = - match members with - | Some(members) -> members + + let members = + match members with + | Some(members) -> members | _ -> fun _ _ _ _ -> [||] - - let getCustomAttributes = + + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes) -> getCustomAttributes - | None -> fun _ -> [||] - + | None -> fun _ -> [||] + let result = TypeImpl(container,className,baseType,members,getCustomAttributes,?extras=extras) - - upcast result - static member CreateSimpleType(container,className,?baseType,?declaringType,?members,?getCustomAttributes) : Type = + upcast result + + static member CreateSimpleType(container,className,?baseType,?declaringType,?members,?getCustomAttributes) : Type = let members = defaultArg members (lazy [| |]) - let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = + let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = match nameOption with | None -> members.Force() | Some name -> members.Force() |> Array.filter(fun m->m.Name=name) TypeBuilder.CreateType(container, className, ?baseType=baseType, ?declaringType=declaringType, members=getTypeMembers, ?getCustomAttributes=getCustomAttributes) - - static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = + + static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = let attributes = MethodAttributes.Public - let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static - let miGetter = + let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static + let miGetter = match getInvoke with - | Some(getInvoke) -> + | Some(getInvoke) -> let attributes = attributes ||| MethodAttributes.SpecialName match getterGetCustomAttributes with | Some(getCustomAttributes) -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, getCustomAttributes=getCustomAttributes, ?isStatic=isStatic)) | None -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, ?isStatic=isStatic)) | None -> None - let miSetter = + let miSetter = match setInvoke with - | Some(setInvoke) -> + | Some(setInvoke) -> let attributes = attributes ||| MethodAttributes.SpecialName - Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, - typeof, - attributes = attributes, + Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, + typeof, + attributes = attributes, parameters=[|TypeBuilder.CreateParameter("value",propertyType)|], - invoke=setInvoke, + invoke=setInvoke, ?isStatic=isStatic)) | None -> None match miGetter,miSetter with @@ -404,47 +404,47 @@ type internal TypeBuilder = | None,None -> failwith "Property must have a getter or setter" // A synthetic property is one without callable "invoke" methods - static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = + static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = let getter = defaultArg getter true let setter = defaultArg setter false if not getter && not setter then invalidArg "getter" "property must have either a getter or a setter" let dummyGetInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2" - TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) - - static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = - let attributes = - match attributes with - | Some(attributes) -> attributes - | None -> MethodAttributes.Public - let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static + TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) + + static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = + let attributes = + match attributes with + | Some(attributes) -> attributes + | None -> MethodAttributes.Public + let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static - let getCustomAttributes = + let getCustomAttributes = match getCustomAttributes with | Some(getCustomAttributes)->getCustomAttributes - | None -> fun _ -> [||] + | None -> fun _ -> [||] - let invoke = + let invoke = match invoke with | Some(invoke)->invoke - | None -> fun _ -> failwith "No invoke for this method." - - let parameters = - match parameters with - | Some(parameters) -> parameters + | None -> fun _ -> failwith "No invoke for this method." + + let parameters = + match parameters with + | Some(parameters) -> parameters | None -> [||] - + upcast MethodInfoImpl(declaringType,methodName,returnType,getCustomAttributes,attributes,invoke,parameters) // A synthetic method is one without a callable "invoke" method - static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = + static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = let dummyInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2" - TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) + TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) static member CreateParameter(name:string,parameterType:Type) = upcast ParameterInfoImpl(name,parameterType) static member CreateConstructor(declaringType, getCustomAttributes) : ConstructorInfo = upcast ConstructorImpl(declaringType,getCustomAttributes=getCustomAttributes) - + static member MemberInfosOfProperty(property:PropertyInfo) = [ if property.CanRead then yield property.GetGetMethod() :> MemberInfo if property.CanWrite then yield property.GetSetMethod() :> MemberInfo @@ -454,40 +454,40 @@ type internal TypeBuilder = static member JoinPropertiesIntoMemberInfos(properties:PropertyInfo seq) = // CHANGE TO THIS (though it reorders - does that matter?) // [| for property in properties do yield! MemberInfosOfProperty property |] - + let properties = properties |> List.ofSeq - let accessMethods : MemberInfo list = [for property in properties do + let accessMethods : MemberInfo list = [for property in properties do if property.CanRead then yield property.GetGetMethod() :> MemberInfo - if property.CanWrite then yield property.GetSetMethod() :> MemberInfo] + if property.CanWrite then yield property.GetSetMethod() :> MemberInfo] let properties : MemberInfo list = properties |> List.map(fun f->upcast f) [accessMethods;properties] |> List.concat |> List.toArray - static member CacheMembers f = + static member CacheMembers f = let cache = ref None fun this _bindingAttr _kind _nmOpt -> - match !cache with + match !cache with | Some res -> res | None -> let res = f this in cache := Some res; res - static member CacheWithArg f = + static member CacheWithArg f = let cache = ref None fun x -> - match !cache with + match !cache with | Some res -> res | None -> let res = f x in cache := Some res; res // A delegating System.Type that lets you intercept anything -type TypeEvil() = +type TypeEvil() = - static member Intercept(st: System.Type, nm, ?get_Name, ?get_IsArrayImpl, ?get_IsGenericType, ?get_Assembly, ?get_FullName, ?get_Namespace, - ?get_GUID, ?get_AssemblyQualifiedName, ?get_BaseType, ?get_IsByRefImpl, ?get_IsPointerImpl, - ?get_IsPrimitiveImpl, ?get_IsCOMObjectImpl, ?get_GetElementType, ?get_HasElementTypeImpl, + static member Intercept(st: System.Type, nm, ?get_Name, ?get_IsArrayImpl, ?get_IsGenericType, ?get_Assembly, ?get_FullName, ?get_Namespace, + ?get_GUID, ?get_AssemblyQualifiedName, ?get_BaseType, ?get_IsByRefImpl, ?get_IsPointerImpl, + ?get_IsPrimitiveImpl, ?get_IsCOMObjectImpl, ?get_GetElementType, ?get_HasElementTypeImpl, ?get_UnderlyingSystemType, ?get_Module, ?get_DeclaringType, ?get_MemberType, ?GetMethods,?GetEvents,?GetProperties,?GetFields,?GetNestedTypes,?GetInterfaces,?GetMembers,?GetGenericArguments, - ?GetConstructors) = - { new System.Type() with + ?GetConstructors) = + { new System.Type() with // Members of Type and parents override this.GUID = match get_GUID with Some f -> f() | None -> st.GUID @@ -496,19 +496,19 @@ type TypeEvil() = override this.Namespace = match get_Namespace with Some f -> f() | None -> st.Namespace override this.AssemblyQualifiedName = match get_AssemblyQualifiedName with Some f -> f() | None -> st.AssemblyQualifiedName override this.BaseType = match get_BaseType with Some f -> f() | None -> st.BaseType - override this.IsGenericType = match get_IsGenericType with Some f -> f() | None -> st.IsGenericType - override this.IsArrayImpl() = match get_IsArrayImpl with Some f -> f() | None -> st.IsArrayImpl() - override this.IsByRefImpl() = match get_IsByRefImpl with Some f -> f() | None -> st.IsByRefImpl() - override this.IsPointerImpl() = match get_IsPointerImpl with Some f -> f() | None -> st.IsPointerImpl() - override this.IsPrimitiveImpl() = match get_IsPrimitiveImpl with Some f -> f() | None -> st.IsPrimitiveImpl() - override this.IsCOMObjectImpl() = match get_IsCOMObjectImpl with Some f -> f() | None -> st.IsCOMObjectImpl() - override this.GetElementType() = match get_GetElementType with Some f -> f() | None -> st.GetElementType() - override this.HasElementTypeImpl() = match get_HasElementTypeImpl with Some f -> f() | None -> st.HasElementTypeImpl() - override this.UnderlyingSystemType = match get_UnderlyingSystemType with Some f -> f() | None -> st.UnderlyingSystemType + override this.IsGenericType = match get_IsGenericType with Some f -> f() | None -> st.IsGenericType + override this.IsArrayImpl() = match get_IsArrayImpl with Some f -> f() | None -> st.IsArrayImpl() + override this.IsByRefImpl() = match get_IsByRefImpl with Some f -> f() | None -> st.IsByRefImpl() + override this.IsPointerImpl() = match get_IsPointerImpl with Some f -> f() | None -> st.IsPointerImpl() + override this.IsPrimitiveImpl() = match get_IsPrimitiveImpl with Some f -> f() | None -> st.IsPrimitiveImpl() + override this.IsCOMObjectImpl() = match get_IsCOMObjectImpl with Some f -> f() | None -> st.IsCOMObjectImpl() + override this.GetElementType() = match get_GetElementType with Some f -> f() | None -> st.GetElementType() + override this.HasElementTypeImpl() = match get_HasElementTypeImpl with Some f -> f() | None -> st.HasElementTypeImpl() + override this.UnderlyingSystemType = match get_UnderlyingSystemType with Some f -> f() | None -> st.UnderlyingSystemType override this.Name = match get_Name with Some f -> f() | None -> nm - override this.Module = match get_Module with Some f -> f() | None -> st.Module - override this.DeclaringType = match get_DeclaringType with Some f -> f() | None -> st.DeclaringType - override this.MemberType = match get_MemberType with Some f -> f() | None -> this.MemberType + override this.Module = match get_Module with Some f -> f() | None -> st.Module + override this.DeclaringType = match get_DeclaringType with Some f -> f() | None -> st.DeclaringType + override this.MemberType = match get_MemberType with Some f -> f() | None -> this.MemberType override this.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters) = st.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters) override this.GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers) = st.GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers) @@ -518,21 +518,21 @@ type TypeEvil() = override this.GetField(name, bindingAttr) = st.GetField(name, bindingAttr) override this.GetFields(bindingAttr) = match GetFields with Some f -> f() | None -> st.GetFields(bindingAttr) override this.GetInterface(name, ignoreCase) = st.GetInterface(name, ignoreCase) - override this.GetInterfaces() = match GetInterfaces with Some f -> f() | None -> st.GetInterfaces() - override this.GetEvent(name, bindingAttr) = st.GetEvent(name, bindingAttr) - override this.GetEvents(bindingAttr) = match GetEvents with Some f -> f() | None -> st.GetEvents(bindingAttr) - override this.GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers) = st.GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers) - override this.GetProperties(bindingAttr) = match GetProperties with Some f -> f() | None -> st.GetProperties(bindingAttr) + override this.GetInterfaces() = match GetInterfaces with Some f -> f() | None -> st.GetInterfaces() + override this.GetEvent(name, bindingAttr) = st.GetEvent(name, bindingAttr) + override this.GetEvents(bindingAttr) = match GetEvents with Some f -> f() | None -> st.GetEvents(bindingAttr) + override this.GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers) = st.GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers) + override this.GetProperties(bindingAttr) = match GetProperties with Some f -> f() | None -> st.GetProperties(bindingAttr) override this.GetNestedTypes(bindingAttr) = match GetNestedTypes with Some f -> f() | None -> st.GetNestedTypes(bindingAttr) - override this.GetNestedType(name, bindingAttr) = st.GetNestedType(name, bindingAttr) - override this.GetMembers(bindingAttr) = match GetMembers with Some f -> f() | None -> st.GetMembers(bindingAttr) - override this.GetAttributeFlagsImpl() = st.GetAttributeFlagsImpl() - override this.GetCustomAttributes(``inherit``) = st.GetCustomAttributes(``inherit``) - override this.GetCustomAttributes(attributeType, ``inherit``) = st.GetCustomAttributes(attributeType, ``inherit``) - override this.GetCustomAttributesData() = st.GetCustomAttributesData() - override this.IsDefined(attributeType, ``inherit``) = st.IsDefined(attributeType, ``inherit``) - override this.GetHashCode() = st.GetHashCode() + override this.GetNestedType(name, bindingAttr) = st.GetNestedType(name, bindingAttr) + override this.GetMembers(bindingAttr) = match GetMembers with Some f -> f() | None -> st.GetMembers(bindingAttr) + override this.GetAttributeFlagsImpl() = st.GetAttributeFlagsImpl() + override this.GetCustomAttributes(``inherit``) = st.GetCustomAttributes(``inherit``) + override this.GetCustomAttributes(attributeType, ``inherit``) = st.GetCustomAttributes(attributeType, ``inherit``) + override this.GetCustomAttributesData() = st.GetCustomAttributesData() + override this.IsDefined(attributeType, ``inherit``) = st.IsDefined(attributeType, ``inherit``) + override this.GetHashCode() = st.GetHashCode() override this.Equals(that:obj) = st.Equals(that:obj) - override this.GetMember(name,mt,bindingAttr) = st.GetMember(name,mt,bindingAttr) - override this.GetGenericArguments() = match GetGenericArguments with Some f -> f() | None -> st.GetGenericArguments() + override this.GetMember(name,mt,bindingAttr) = st.GetMember(name,mt,bindingAttr) + override this.GetGenericArguments() = match GetGenericArguments with Some f -> f() | None -> st.GetGenericArguments() override this.ToString() = st.ToString() } diff --git a/tests/fsharp/typeProviders/splitAssemblyTools/provider.fs b/tests/fsharp/typeProviders/splitAssemblyTools/provider.fs index 732486441a9..199178999ff 100644 --- a/tests/fsharp/typeProviders/splitAssemblyTools/provider.fs +++ b/tests/fsharp/typeProviders/splitAssemblyTools/provider.fs @@ -4,8 +4,8 @@ type TypeProviderAssemblyAttribute(assemblyName) = inherit System.Attribute() new() = TypeProviderAssemblyAttribute(null) - member this.AssemblyName - with get () = assemblyName + member this.AssemblyName + with get () = assemblyName [] do() diff --git a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.fs b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.fs index 732486441a9..199178999ff 100644 --- a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.fs +++ b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.fs @@ -4,8 +4,8 @@ type TypeProviderAssemblyAttribute(assemblyName) = inherit System.Attribute() new() = TypeProviderAssemblyAttribute(null) - member this.AssemblyName - with get () = assemblyName + member this.AssemblyName + with get () = assemblyName [] do() diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2a-restricted.fsi b/tests/fsharp/typeProviders/wedgeAssembly/test2a-restricted.fsi index 84397d047fe..bf65ce5e0a4 100644 --- a/tests/fsharp/typeProviders/wedgeAssembly/test2a-restricted.fsi +++ b/tests/fsharp/typeProviders/wedgeAssembly/test2a-restricted.fsi @@ -1,48 +1,48 @@ module Test2a -module ErasedTypes = +module ErasedTypes = val f : unit -> FSharp.HelloWorld.HelloWorldType val testTypeEquiv : FSharp.HelloWorld.HelloWorldType * FSharp.HelloWorld.HelloWorldType -> bool (* // this test hides this internal part of the signature: -module InternalGenerativeTypes = - +module InternalGenerativeTypes = + type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1"> val internal f2 : unit -> TheGeneratedType1 val internal f3 : unit -> TheGeneratedType1 val internal testTypeEquiv2 : TheGeneratedType1 * TheGeneratedType1 -> bool *) -module PublicGenerativeTypes = - +module PublicGenerativeTypes = + type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2"> val f2 : unit -> TheGeneratedType2 val f3 : unit -> TheGeneratedType2 val testTypeEquiv2 : TheGeneratedType2 * TheGeneratedType2 -> bool -module PublicErasedQuotations = +module PublicErasedQuotations = val q1 : Quotations.Expr FSharp.HelloWorld.HelloWorldSubType> val q2 : Quotations.Expr FSharp.HelloWorld.HelloWorldType.NestedType> -module PublicErasedTypesWithStaticParameters = - val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> - val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> +module PublicErasedTypesWithStaticParameters = + val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> + val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2"> val testTypeEquivString1 : AbbrevString1 * AbbrevString1 -> bool val testTypeEquivString2 : AbbrevString2 * AbbrevString2 -> bool -module GenerativeTypesWithStaticParameters = +module GenerativeTypesWithStaticParameters = (* // this test hides this internal part of the signature: - + type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J"> - val internal v1 : TheGeneratedTypeJ + val internal v1 : TheGeneratedTypeJ val v2 : int *) - + type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K"> - val v3 : TheGeneratedTypeK + val v3 : TheGeneratedTypeK val v4 : int diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2a.fs b/tests/fsharp/typeProviders/wedgeAssembly/test2a.fs index ecc46c6c17a..5affac6c02c 100644 --- a/tests/fsharp/typeProviders/wedgeAssembly/test2a.fs +++ b/tests/fsharp/typeProviders/wedgeAssembly/test2a.fs @@ -1,14 +1,14 @@ module Test2a -module ErasedTypes = +module ErasedTypes = let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_> let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b) -module PublicErasedQuotations = +module PublicErasedQuotations = let q1 = <@ (fun (x : FSharp.HelloWorld.HelloWorldSubType) -> x) @> let q2 = <@ (fun (x : FSharp.HelloWorld.HelloWorldType.NestedType) -> x) @> -module PublicErasedTypesWithStaticParameters = +module PublicErasedTypesWithStaticParameters = let f1() : FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> = Unchecked.defaultof<_> let f2() : FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> = Unchecked.defaultof<_> type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> @@ -17,8 +17,8 @@ module PublicErasedTypesWithStaticParameters = let testTypeEquivString2(a:AbbrevString2,b:AbbrevString2) = (a = b) -module InternalGenerativeTypes = - +module InternalGenerativeTypes = + type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1"> let internal f2() : TheGeneratedType1 = Unchecked.defaultof<_> @@ -26,8 +26,8 @@ module InternalGenerativeTypes = let internal testTypeEquiv2(a:TheGeneratedType1,b:TheGeneratedType1) = (a = b) -module PublicGenerativeTypes = - +module PublicGenerativeTypes = + type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2"> let f2() : TheGeneratedType2 = Unchecked.defaultof<_> @@ -35,15 +35,15 @@ module PublicGenerativeTypes = let testTypeEquiv2(a:TheGeneratedType2,b:TheGeneratedType2) = (a = b) -module GenerativeTypesWithStaticParameters = - +module GenerativeTypesWithStaticParameters = + type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J"> let internal v1 : TheGeneratedTypeJ = TheGeneratedTypeJ() let v2 = v1.Item1 - + type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K"> let v3 : TheGeneratedTypeK = TheGeneratedTypeK() diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2a.fsi b/tests/fsharp/typeProviders/wedgeAssembly/test2a.fsi index 1565ca66e1d..710edd6a229 100644 --- a/tests/fsharp/typeProviders/wedgeAssembly/test2a.fsi +++ b/tests/fsharp/typeProviders/wedgeAssembly/test2a.fsi @@ -1,44 +1,44 @@ module Test2a -module ErasedTypes = +module ErasedTypes = val f : unit -> FSharp.HelloWorld.HelloWorldType val testTypeEquiv : FSharp.HelloWorld.HelloWorldType * FSharp.HelloWorld.HelloWorldType -> bool -module InternalGenerativeTypes = - +module InternalGenerativeTypes = + type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1"> val internal f2 : unit -> TheGeneratedType1 val internal f3 : unit -> TheGeneratedType1 val internal testTypeEquiv2 : TheGeneratedType1 * TheGeneratedType1 -> bool -module PublicGenerativeTypes = - +module PublicGenerativeTypes = + type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2"> val f2 : unit -> TheGeneratedType2 val f3 : unit -> TheGeneratedType2 val testTypeEquiv2 : TheGeneratedType2 * TheGeneratedType2 -> bool -module PublicErasedQuotations = +module PublicErasedQuotations = val q1 : Quotations.Expr FSharp.HelloWorld.HelloWorldSubType> val q2 : Quotations.Expr FSharp.HelloWorld.HelloWorldType.NestedType> -module PublicErasedTypesWithStaticParameters = - val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> - val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> +module PublicErasedTypesWithStaticParameters = + val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> + val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2"> val testTypeEquivString1 : AbbrevString1 * AbbrevString1 -> bool val testTypeEquivString2 : AbbrevString2 * AbbrevString2 -> bool -module GenerativeTypesWithStaticParameters = - +module GenerativeTypesWithStaticParameters = + type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J"> - val internal v1 : TheGeneratedTypeJ + val internal v1 : TheGeneratedTypeJ val v2 : int - + type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K"> - val v3 : TheGeneratedTypeK + val v3 : TheGeneratedTypeK val v4 : int diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2b-restricted.fsi b/tests/fsharp/typeProviders/wedgeAssembly/test2b-restricted.fsi index c3316ea4fa5..82321ada497 100644 --- a/tests/fsharp/typeProviders/wedgeAssembly/test2b-restricted.fsi +++ b/tests/fsharp/typeProviders/wedgeAssembly/test2b-restricted.fsi @@ -1,50 +1,50 @@ module Test2b -module ErasedTypes = +module ErasedTypes = val f : unit -> FSharp.HelloWorld.HelloWorldType val testTypeEquiv : FSharp.HelloWorld.HelloWorldType * FSharp.HelloWorld.HelloWorldType -> bool (* // this test hides this internal part of the signature: -module InternalGenerativeTypes = - +module InternalGenerativeTypes = + type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1"> val internal f2 : unit -> TheGeneratedType1 val internal f3 : unit -> TheGeneratedType1 val internal testTypeEquiv2 : TheGeneratedType1 * TheGeneratedType1 -> bool *) -module PublicGenerativeTypes = - +module PublicGenerativeTypes = + type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2"> val f2 : unit -> TheGeneratedType2 val f3 : unit -> TheGeneratedType2 val testTypeEquiv2 : TheGeneratedType2 * TheGeneratedType2 -> bool -module PublicErasedQuotations = +module PublicErasedQuotations = val q1 : Quotations.Expr FSharp.HelloWorld.HelloWorldSubType> val q2 : Quotations.Expr FSharp.HelloWorld.HelloWorldType.NestedType> -module PublicErasedTypesWithStaticParameters = - val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> - val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> +module PublicErasedTypesWithStaticParameters = + val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> + val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2"> val testTypeEquivString1 : AbbrevString1 * AbbrevString1 -> bool val testTypeEquivString2 : AbbrevString2 * AbbrevString2 -> bool -module GenerativeTypesWithStaticParameters = +module GenerativeTypesWithStaticParameters = (* // this test hides this internal part of the signature: - + type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J"> - val internal v1 : TheGeneratedTypeJ + val internal v1 : TheGeneratedTypeJ val v2 : int *) - + type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K"> - val v3 : TheGeneratedTypeK + val v3 : TheGeneratedTypeK val v4 : int diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2b.fs b/tests/fsharp/typeProviders/wedgeAssembly/test2b.fs index bc7bb2c0555..39be5d4dbb0 100644 --- a/tests/fsharp/typeProviders/wedgeAssembly/test2b.fs +++ b/tests/fsharp/typeProviders/wedgeAssembly/test2b.fs @@ -1,14 +1,14 @@ module Test2b -module ErasedTypes = +module ErasedTypes = let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_> let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b) -module PublicErasedQuotations = +module PublicErasedQuotations = let q1 = <@ (fun (x : FSharp.HelloWorld.HelloWorldSubType) -> x) @> let q2 = <@ (fun (x : FSharp.HelloWorld.HelloWorldType.NestedType) -> x) @> -module PublicErasedTypesWithStaticParameters = +module PublicErasedTypesWithStaticParameters = let f1() : FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> = Unchecked.defaultof<_> let f2() : FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> = Unchecked.defaultof<_> type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> @@ -17,8 +17,8 @@ module PublicErasedTypesWithStaticParameters = let testTypeEquivString2(a:AbbrevString2,b:AbbrevString2) = (a = b) -module InternalGenerativeTypes = - +module InternalGenerativeTypes = + type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1"> let internal f2() : TheGeneratedType1 = Unchecked.defaultof<_> @@ -26,8 +26,8 @@ module InternalGenerativeTypes = let internal testTypeEquiv2(a:TheGeneratedType1,b:TheGeneratedType1) = (a = b) -module PublicGenerativeTypes = - +module PublicGenerativeTypes = + type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2"> let f2() : TheGeneratedType2 = Unchecked.defaultof<_> @@ -35,15 +35,15 @@ module PublicGenerativeTypes = let testTypeEquiv2(a:TheGeneratedType2,b:TheGeneratedType2) = (a = b) -module GenerativeTypesWithStaticParameters = - +module GenerativeTypesWithStaticParameters = + type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J"> let internal v1 : TheGeneratedTypeJ = TheGeneratedTypeJ() let v2 = v1.Item1 - + type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K"> let v3 : TheGeneratedTypeK = TheGeneratedTypeK() diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2b.fsi b/tests/fsharp/typeProviders/wedgeAssembly/test2b.fsi index 05921806762..dbfb2645682 100644 --- a/tests/fsharp/typeProviders/wedgeAssembly/test2b.fsi +++ b/tests/fsharp/typeProviders/wedgeAssembly/test2b.fsi @@ -1,44 +1,44 @@ module Test2b -module ErasedTypes = +module ErasedTypes = val f : unit -> FSharp.HelloWorld.HelloWorldType val testTypeEquiv : FSharp.HelloWorld.HelloWorldType * FSharp.HelloWorld.HelloWorldType -> bool -module InternalGenerativeTypes = - +module InternalGenerativeTypes = + type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1"> val internal f2 : unit -> TheGeneratedType1 val internal f3 : unit -> TheGeneratedType1 val internal testTypeEquiv2 : TheGeneratedType1 * TheGeneratedType1 -> bool -module PublicGenerativeTypes = - +module PublicGenerativeTypes = + type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2"> val f2 : unit -> TheGeneratedType2 val f3 : unit -> TheGeneratedType2 val testTypeEquiv2 : TheGeneratedType2 * TheGeneratedType2 -> bool -module PublicErasedQuotations = +module PublicErasedQuotations = val q1 : Quotations.Expr FSharp.HelloWorld.HelloWorldSubType> val q2 : Quotations.Expr FSharp.HelloWorld.HelloWorldType.NestedType> -module PublicErasedTypesWithStaticParameters = - val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> - val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> +module PublicErasedTypesWithStaticParameters = + val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> + val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2"> val testTypeEquivString1 : AbbrevString1 * AbbrevString1 -> bool val testTypeEquivString2 : AbbrevString2 * AbbrevString2 -> bool -module GenerativeTypesWithStaticParameters = - +module GenerativeTypesWithStaticParameters = + type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J"> - val internal v1 : TheGeneratedTypeJ + val internal v1 : TheGeneratedTypeJ val v2 : int - + type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K"> - val v3 : TheGeneratedTypeK + val v3 : TheGeneratedTypeK val v4 : int diff --git a/tests/fsharp/typecheck/constructors/neg_invalid_constructor.fs b/tests/fsharp/typecheck/constructors/neg_invalid_constructor.fs index 02be510295d..d62a9c42ccc 100644 --- a/tests/fsharp/typecheck/constructors/neg_invalid_constructor.fs +++ b/tests/fsharp/typecheck/constructors/neg_invalid_constructor.fs @@ -1,7 +1,7 @@ -type ImmutableStack<'a> private(items: 'a list) = - +type ImmutableStack<'a> private(items: 'a list) = + member this.Push item = ImmutableStack(item::items) member this.Pop = match items with | [] -> failwith "No elements in stack" | x::xs -> x,ImmutableStack(xs) - + // Notice type annotation is commented out, which results in an error new(col (*: seq<'a>*)) = ImmutableStack(List.ofSeq col) diff --git a/tests/fsharp/typecheck/sigs/neg01a.fs b/tests/fsharp/typecheck/sigs/neg01a.fs index 7bc1a37e4d9..00382c4c124 100644 --- a/tests/fsharp/typecheck/sigs/neg01a.fs +++ b/tests/fsharp/typecheck/sigs/neg01a.fs @@ -1,14 +1,14 @@ module Lib -type okType = X | Y +type okType = X | Y type missingConstructorInSignature = A | B | C type missingFieldInSignature = { a: int; b: int } type 'a missingTypeVariableInSignature = { f1: int } type missingInterfaceInSignature<'t> = class - interface System.IComparable with + interface System.IComparable with member x.CompareTo(y) = 0 end end @@ -17,7 +17,7 @@ type missingInterfaceInImplementation<'t> = A | B -type NestedTypes = +type NestedTypes = class static type NestedTypesNotYetSupported = T of int end diff --git a/tests/fsharp/typecheck/sigs/neg01a.fsi b/tests/fsharp/typecheck/sigs/neg01a.fsi index 9108135267a..9b18a197b3f 100644 --- a/tests/fsharp/typecheck/sigs/neg01a.fsi +++ b/tests/fsharp/typecheck/sigs/neg01a.fsi @@ -19,7 +19,7 @@ type missingInterfaceInImplementation<'t> = type z = A | B -type NestedTypes = +type NestedTypes = class static type NestedTypesNotYetSupported = T of int end diff --git a/tests/fsharp/typecheck/sigs/neg02.fs b/tests/fsharp/typecheck/sigs/neg02.fs index 3df2a19671b..693f1b1b4be 100644 --- a/tests/fsharp/typecheck/sigs/neg02.fs +++ b/tests/fsharp/typecheck/sigs/neg02.fs @@ -1,19 +1,19 @@ module Lib -type TestBadKeywords = +type TestBadKeywords = class virtual x.M() = 3 end -type TestBadKeywords2 = +type TestBadKeywords2 = class method x.M() = 3 end type staticInInterface = class - interface System.ComponentModel.INotifyPropertyChanged with + interface System.ComponentModel.INotifyPropertyChanged with static member Foo() = () member x.add_PropertyChanged(_) = () member x.remove_PropertyChanged(_) = () diff --git a/tests/fsharp/typecheck/sigs/neg04.fs b/tests/fsharp/typecheck/sigs/neg04.fs index d484b257376..932c297814e 100644 --- a/tests/fsharp/typecheck/sigs/neg04.fs +++ b/tests/fsharp/typecheck/sigs/neg04.fs @@ -16,13 +16,13 @@ type myRecord3 = { field1: int; field2: string } type myRecord4 = { field1: int; field2: string } with override x.ToString() = x.field2 end -type myRecord5 = +type myRecord5 = { field1: int; field2: string } - with + with let x = 1 end -type System.Int32 with +type System.Int32 with let x = 1 end @@ -36,26 +36,26 @@ Double.Nan;; //type GrowingArray<'a> = System.Collections.Generic.List<'a> //let nextPrime (sofar : GrowingArray) n = failwith "nyi" //let primes = Seq.unfold -// (fun (soFar,n) -> -// let next = nextPrime soFar n in +// (fun (soFar,n) -> +// let next = nextPrime soFar n in // Some(next, (soFar.Add(n), next+1))) - - -let f2 x = - let approxs = Seq.unfold (fun (i,y,z,sum) -> Some (sum + (y / z),(i + 1N,x * y,(i + 1N) * z))) (0N,1N,1N) in + + +let f2 x = + let approxs = Seq.unfold (fun (i,y,z,sum) -> Some (sum + (y / z),(i + 1N,x * y,(i + 1N) * z))) (0N,1N,1N) in approxs |> Seq.take 100 |> List.fold (+) 0N;; type ClassType1 = class - inherit System.Object + inherit System.Object new(s: string) = { inherit System.Object() } end type ClassType2 = class - inherit ClassType1 + inherit ClassType1 val rf : int // Check that a wrong type for 'inherits' gets reported in a decent location new(s) = { inherit System.Object(); rf = 1 } @@ -96,36 +96,36 @@ end module InterfaceCastTests = begin - type IBar = + type IBar = interface end - type IFoo = + type IFoo = interface end - type Struct = + type Struct = struct val x : int end - - type R = + + type R = { c : int } - - type U = + + type U = A | B - - + + let staticallyIllegalPatternTestInterfaceToSealedRecord(l:IBar list) = match l with | [:? R] -> None | _ -> None - + let staticallyIllegalPatternTestInterfaceToSealedUnion(l:IBar list) = match l with | [:? U] -> None | _ -> None - + let staticallyIllegalPatternTestInterfaceToStruct(l:IBar list) = match l with | [:? Struct] -> None @@ -133,22 +133,22 @@ module InterfaceCastTests = begin let staticallyIllegalCoercionInterfaceToSealedRecord(l:IBar ) = (l :? R) - + let staticallyIllegalCoercionInterfaceToSealedUnion(l:IBar) = (l :? U) - + let staticallyIllegalCoercionInterfaceToStruct(l:IBar) = (l :? Struct) - + let staticallyIllegalCoercionInterfaceToTuple(l:IBar) = (l :? (int * int)) - + let staticallyIllegalCoercionInterfaceToArray(l:IBar) = (l :? int[]) - + let staticallyIllegalCoercionInterfaceToFunction(l:IBar) = (l :? (int -> int)) - + end @@ -165,12 +165,12 @@ end module AmbiguousImplicitInstantiationWarning = begin - type IDuplex<'a> = - interface + type IDuplex<'a> = + interface end - type IServer<'a> = - interface + type IServer<'a> = + interface end let Delay(v: 'a when 'a :> IDuplex<'a> and 'a :> IServer<'a>) = () diff --git a/tests/fsharp/typecheck/sigs/neg05.fs b/tests/fsharp/typecheck/sigs/neg05.fs index 2787a46d053..906ddb0d8f8 100644 --- a/tests/fsharp/typecheck/sigs/neg05.fs +++ b/tests/fsharp/typecheck/sigs/neg05.fs @@ -1,41 +1,41 @@ module Test -type Foo = - interface - new() = 1 +type Foo = + interface + new() = 1 end [] -type N3 = +type N3 = abstract M : int [] -type N4 = +type N4 = interface end [] -type N5 = +type N5 = interface end [] -type N6 = +type N6 = class end [] -type N7 = +type N7 = class end [] -type N8 = +type N8 = struct end [] -type N9 = +type N9 = struct end diff --git a/tests/fsharp/typecheck/sigs/neg06.fs b/tests/fsharp/typecheck/sigs/neg06.fs index ee9ddce60dc..14477a0b9f6 100644 --- a/tests/fsharp/typecheck/sigs/neg06.fs +++ b/tests/fsharp/typecheck/sigs/neg06.fs @@ -1,88 +1,88 @@ (* SHOULD GIVE A NICE ERROR INCLUDING THE NAME "Ascii": *) module Test -let testError b = System.Text.Encoding.Ascii.GetString b +let testError b = System.Text.Encoding.Ascii.GetString b [] -type SealedType() = +type SealedType() = class member x.P = 1 end - + [] -type UnnecessarilySealedStruct = +type UnnecessarilySealedStruct = struct member x.P = 1 end - + [] -type BadSealedInterface = +type BadSealedInterface = interface abstract P : int end - + [] -type BadSealedAbbreviatedType = System.Object +type BadSealedAbbreviatedType = System.Object [] type UnnecessarilySealedDelegate = delegate of int -> int - -type BadExtensionOfSealedType() = + +type BadExtensionOfSealedType() = class inherit SealedType() member x.P = 1 end -//Moved to FSHARPQA suite +//Moved to FSHARPQA suite //let WarningOnHashOfSealedType (x: #SealedType) = x -type BadImmediateInheritance() = +type BadImmediateInheritance() = class inherit BadImmediateInheritance() end -type BadImmediateInheritance1() = +type BadImmediateInheritance1() = class inherit BadImmediateInheritance2() end -and BadImmediateInheritance2() = - class +and BadImmediateInheritance2() = + class inherit BadImmediateInheritance1() end - - + + module BadStructTest1 = begin - type BadStruct = + type BadStruct = struct val x : BadStruct - end + end end module BadStructTest2 = begin - type BadStruct1 = + type BadStruct1 = struct val x : BadStruct2 - end + end and BadStruct2 = struct val x : BadStruct1 - end + end end module BadStructTest3 = begin - type One<'a> = + type One<'a> = struct val x : 'a - end + end type BadStruct = struct val x : One - end + end type BadAbbreviation = One type GoodStruct = struct val x : One - end + end end @@ -91,21 +91,21 @@ module NegativeTest1 = begin end module NegativeTest2 = begin - type X = A + type X = A and A<'a> = A of int end module NegativeTest3 = begin - type X = A + type X = A and A<'a> = int end module Neg4 = begin - type Y = Y * Y + type Y = Y * Y end module Neg5 = begin - type Y = Y -> Y + type Y = Y -> Y end module Neg6 = begin @@ -146,14 +146,14 @@ module BadRecursiveTypeDefinitionSingleRecursion = begin end let _ = BadType1() - + type BadType2<'a> = struct [] static val mutable private X : BadType2 val Y : int end - + let _ = BadType2() type BadType3<'a> = @@ -162,10 +162,10 @@ module BadRecursiveTypeDefinitionSingleRecursion = begin val mutable X : BadType3 val Y : int end - + let _ = BadType3() - + type GoodType1<'a> = struct @@ -173,19 +173,19 @@ module BadRecursiveTypeDefinitionSingleRecursion = begin static val mutable private X : GoodType1<'a> val Y : int end - + let _ = GoodType1() - + type GoodType2 = struct [] val mutable X : GoodBox2 end - and GoodBox2<'T> = + and GoodBox2<'T> = class val v : 'T end - + let _ = GoodType2() end @@ -201,7 +201,7 @@ module BadRecursiveTypeDefinitionsWithAbbrev = begin and Naught1<'a> = 'a let _ = BadType1() - + type BadType2<'a> = struct [] @@ -209,7 +209,7 @@ module BadRecursiveTypeDefinitionsWithAbbrev = begin val Y : int end and Naught2<'a> = 'a - + let _ = BadType2() type BadType3<'a> = @@ -219,10 +219,10 @@ module BadRecursiveTypeDefinitionsWithAbbrev = begin val Y : int end and Naught3<'a> = 'a - + let _ = BadType3() - + type GoodType1<'a> = struct [] @@ -230,19 +230,19 @@ module BadRecursiveTypeDefinitionsWithAbbrev = begin val Y : int end and Naught5<'a> = 'a - + let _ = GoodType1() - + type GoodType2 = struct [] val mutable X : GoodBox2 end - and GoodBox2<'T> = + and GoodBox2<'T> = class val v : 'T end - + let _ = GoodType2() end @@ -286,28 +286,28 @@ end -module PositiveTests = +module PositiveTests = [] type X3 = { r : int } [] [] - type X2 = + type X2 = abstract M : unit -> 'a [] type X1 = { r : int } -module NegativeTests = +module NegativeTests = [] - type X1 = + type X1 = abstract M : unit -> 'a [] [] - type X2() = + type X2() = abstract M : unit -> 'a [] @@ -317,7 +317,7 @@ module NegativeTests = type X5 = R1 = 1 | R2 = 2 [] - type X6 = delegate of int -> int + type X6 = delegate of int -> int module Regression_3417a = @@ -328,21 +328,21 @@ module Regression_3417a = [] val mutable X : BadBox4 end - and BadBox4<'T> = + and BadBox4<'T> = struct val v : 'T end let _ = BadType4() module Regression_3417b = - // This type should be rejected due to a struct cycle (pre-fix, observed loop in fsi) + // This type should be rejected due to a struct cycle (pre-fix, observed loop in fsi) // Prefix: it looped type BadType4 = struct [] val mutable X : Naught4> end - and BadBox4<'T> = + and BadBox4<'T> = struct val v : 'T end @@ -373,35 +373,35 @@ module NonMonotonicByrefParameter = let f (x:byref) = () let g x = f x - -module AmbiguousOverload = - type C = + +module AmbiguousOverload = + type C = static member M1 (x: int) = 1 static member M1 (x: string) = 2 - let f x = C.M1 x - + let f x = C.M1 x + module CheckErrorForNonUniformGeneric = type Foo<'a>(bar : Bar<'a>) = - member this.Blah() = bar.Foo() + member this.Blah() = bar.Foo() and Bar<'a>() = member this.Foo() = () // expect NO error here module CheckNoErrorForNonUniformGenericWithExplicitSignature = type Foo<'a>(bar : Bar<'a>) = - member this.Blah() = bar.Foo() + member this.Blah() = bar.Foo() and Bar<'a>() = - member this.Foo() : unit = () // expect NO error here + member this.Foo() : unit = () // expect NO error here -module CHeckWarningForIncompletePatternMatchInForLoop = - let f () = +module CHeckWarningForIncompletePatternMatchInForLoop = + let f () = for 1 in [1;2;3] do () -module CHeckErrorForNamedArgumentToDatatype = - type C = +module CHeckErrorForNamedArgumentToDatatype = + type C = | C1 of bool * bool | C2 of bool - + let x = 1 let c1 = C1 (x=1, x = 1) // error no longer expected here let c2 = C2 (x=1) // no error expected diff --git a/tests/fsharp/typecheck/sigs/neg06_a.fs b/tests/fsharp/typecheck/sigs/neg06_a.fs index 6de61b7b031..6287d8cc651 100644 --- a/tests/fsharp/typecheck/sigs/neg06_a.fs +++ b/tests/fsharp/typecheck/sigs/neg06_a.fs @@ -8,7 +8,7 @@ module NameClashesWithDefaultAugmentation = member x.IsC(a) = match a with | C(_,_) -> true | D(_) -> false - + // Expect error here: static member IsD(b) = match b with | C(_,_) -> true @@ -18,7 +18,7 @@ module NameClashesWithDefaultAugmentation = member x.GetC1(a) = match a with | C(_,_) -> true | D(_) -> false - + // Expect no error here: static member GetC2(b) = match b with | C(_,_) -> true @@ -33,7 +33,7 @@ module NameClashesWithDefaultAugmentation = member x.GetC(a) = match a with | C(_,_) -> true | D(_) -> false - + // Expect NO NO NO error here: static member getD(b) = match b with | C(_,_) -> true diff --git a/tests/fsharp/typecheck/sigs/neg06_b.fs b/tests/fsharp/typecheck/sigs/neg06_b.fs index 9a312ff9181..0a5d561c60b 100644 --- a/tests/fsharp/typecheck/sigs/neg06_b.fs +++ b/tests/fsharp/typecheck/sigs/neg06_b.fs @@ -7,7 +7,7 @@ module Regression_4688 = static member Empty: BMap<'v> = empty end - // This type is OK, note 'v instance of BMap + // This type is OK, note 'v instance of BMap type CMap<'v> (bmap: BMap<'v>) = struct member x.bmap = bmap @@ -18,4 +18,4 @@ module Regression_4688 = type DMap<'v> (bmap: BMap<'v option>) = struct member x.bmap = bmap - end + end diff --git a/tests/fsharp/typecheck/sigs/neg07.fs b/tests/fsharp/typecheck/sigs/neg07.fs index 44d11a66cf8..632a6bf3de7 100644 --- a/tests/fsharp/typecheck/sigs/neg07.fs +++ b/tests/fsharp/typecheck/sigs/neg07.fs @@ -6,39 +6,39 @@ let test() = failwith "message" with UndeclaredException -> System.Console.WriteLine "UndeclaredException" - + do test() module TestRequiredQualifiedAccess = begin [] - type X = - | UnionCase1 + type X = + | UnionCase1 | UnionCase2 - with + with member x.M() = match x with UnionCase1 -> 1 | UnionCase2 -> 2 // expect ok, since inside the member of the type member x.N() = (UnionCase1, UnionCase2) // expect ok, since inside the member of the type end let _ = UnionCase1 // expect not ok - let f x = - match x with + let f x = + match x with | UnionCase1 -> 1 // expect not ok with warnings about uppercase variable names | UnionCase2 -> 2 // expect not ok with warnings about uppercase variable names let x = X.UnionCase1 // expect ok let x2 : X = UnionCase1 // expect not ok - let g (x:X) = + let g (x:X) = match x with | UnionCase1 -> () // expect not ok with warnings about uppercase variable names | UnionCase2 -> () // expect not ok with warnings about uppercase variable names [] - type R = + type R = { RecordLabel1 : int; RecordLabel2 : int } - with + with member x.M() = { RecordLabel1 = 1; RecordLabel2 = 2 } // expect ok, since inside the member of the type member x.N() = (fun y -> y.RecordLabel1) // expect ok, since inside the member of the type end @@ -54,7 +54,7 @@ end module TestUsNullAttribute = begin // expect error [] - type MyUnion = + type MyUnion = | A1 | A | B of string @@ -63,11 +63,11 @@ module TestUsNullAttribute = begin [] type MyUnion2 = | A1 - | A + | A // expect error [] - type MyUnion3 = + type MyUnion3 = | A1 // expect error @@ -76,21 +76,21 @@ module TestUsNullAttribute = begin // expect error [] - type MyClass4() = + type MyClass4() = class member x.P = 1 end // expect error [] - type MyInterface5 = - interface + type MyInterface5 = + interface abstract P : int end // expect error [] - type MyStruct6(x : int) = + type MyStruct6(x : int) = struct member __.X = x end diff --git a/tests/fsharp/typecheck/sigs/neg08.fs b/tests/fsharp/typecheck/sigs/neg08.fs index 1410925c9cc..8a61ad1e032 100644 --- a/tests/fsharp/typecheck/sigs/neg08.fs +++ b/tests/fsharp/typecheck/sigs/neg08.fs @@ -5,7 +5,7 @@ exception StackEmpty let push a x = l:=x:: !l let topEnvTable1 = new System.Collections.Generic.List() - + let topEnvTable2 = new System.Collections.Generic.List() @@ -13,9 +13,9 @@ let topEnvTable2 = new System.Collections.Generic.List() // Check non-generalization of escaping implicit ctor tyvars let x2 = ref [] -type C<'b>() = +type C<'b>() = member a.Z() : 'b list = !x2 - + member a.Z2() = a.Z() exception A = System.Object @@ -27,12 +27,12 @@ end let t : Test = {test = 0} -let q = { } +let q = { } module TestMissingAndExtraOverrides = begin type B = class new () = { } - + abstract A : int abstract M : unit -> int end @@ -43,7 +43,7 @@ module TestMissingAndExtraOverrides = begin override x.A with get() = 3 // Check we can't also provide a setter when the abstract only has a getter - and set(v : int) = (invalidArg "v" "C.A.set" : unit) + and set(v : int) = (invalidArg "v" "C.A.set" : unit) override x.N() = 2 override x.M() = 3 @@ -55,7 +55,7 @@ module FSharp1_0_Bug1221 = begin { new Foo with member x.Invoke (x,y) = x + y } end - + module FSharp1_0_Bug992= begin type Type = | P = 1 let _ = Type.P.value__ @@ -74,7 +74,7 @@ module FSharp1_0_Bug1423 = begin inherit Variable() static member Random(y:Variable<'a>) = new Variable<'a>() end - + let x : Variable = failwith "" Variable.Random (x, Name = "m_") end diff --git a/tests/fsharp/typecheck/sigs/neg09.fs b/tests/fsharp/typecheck/sigs/neg09.fs index d8c76c364dc..87a3de8de5f 100644 --- a/tests/fsharp/typecheck/sigs/neg09.fs +++ b/tests/fsharp/typecheck/sigs/neg09.fs @@ -5,12 +5,12 @@ let x = 1 let f x = x + x - + type C = class end module Bug1433 = begin - type IFoo = + type IFoo = interface abstract NamedMeth1 : arg1:int * arg2:int * arg3:int * arg4:int-> float end @@ -23,7 +23,7 @@ module Bug1433 = begin end let y = new Foo() :> IFoo - do y.NamedMeth1(1, arg4=1, arg2=2) + do y.NamedMeth1(1, arg4=1, arg2=2) end module Bug1462 = begin @@ -34,7 +34,7 @@ module Bug1462 = begin let rec expand_power (n,x) = if n = 0 - then 1 + then 1 else (x) * (failwith "" : Expr) end diff --git a/tests/fsharp/typecheck/sigs/neg10.fs b/tests/fsharp/typecheck/sigs/neg10.fs index f3e2e408c6c..58f2acae2f5 100644 --- a/tests/fsharp/typecheck/sigs/neg10.fs +++ b/tests/fsharp/typecheck/sigs/neg10.fs @@ -25,10 +25,10 @@ module M = begin let i5 = new System.Nullable< System.Nullable >() end -type I = +type I = interface - abstract X : int - abstract Y : x:int -> int + abstract X : int + abstract Y : x:int -> int end module KeikoNakataBug = begin @@ -50,23 +50,23 @@ module CheckNoImplementationsInAugmentations = begin type X = class abstract M : int end - type X with + type X with default a.M = 3 - end + end end - + module CheckNoInterfacesInAugmentations = begin type IX = interface abstract M : int end type X = class - interface IX + interface IX end - type X with - interface IX with + type X with + interface IX with member a.M = 3 end - end + end end module CheckNoMembersOnEnumerations = begin @@ -87,8 +87,8 @@ module CheckNoMembersOnEnumerations = begin // Check you can't have instance members in enumerations (see bug 1418, FSharp 1.0 database) *) type Season3 = Spring=0 | Summer=1 | Autumn=2 | Winter=3 with - interface System.IComparable with - member x.CompareTo(yobj) = 0 + interface System.IComparable with + member x.CompareTo(yobj) = 0 end end @@ -119,8 +119,8 @@ module CheckNoMembersOnAbbreviations = begin // Check you can't have members in type abbreviation type Season3 = int with - interface System.IComparable with - member x.CompareTo(yobj) = 0 + interface System.IComparable with + member x.CompareTo(yobj) = 0 end end @@ -133,22 +133,22 @@ module CheckNoMembersOnAbbreviations = begin end module CheckMissingMethod_FSharp_1_0_bug_1625 = begin - type IA = + type IA = interface - abstract M : int -> int + abstract M : int -> int end - type IB = + type IB = interface inherit IA - abstract M : int -> int + abstract M : int -> int end - type C() = - //interface IA with + type C() = + //interface IA with // member x.M(y) = y+3 class - interface IB with + interface IB with member x.M(y) = y+3 end end @@ -156,12 +156,12 @@ end module EnumOfString_FSharp_1_0_bug_1743 = begin type IA<'a> = - interface + interface abstract X : unit -> 'a end type IB<'a,'b> = - interface + interface inherit IA<'a> inherit IA<'b> end @@ -230,7 +230,7 @@ module CheckUnderConstrainedExplicitTyparDeclarationsGiveErrors = begin type C() = class member x.P = 1 end - + type C4 = class static member M<'a>(x:'a,y:C) = Four end @@ -260,10 +260,10 @@ module CheckMisusedConstraints = begin end -module CheckMisusedProperties = begin +module CheckMisusedProperties = begin module Test1 = begin - type T() = + type T() = class member this.X1 = 1 @@ -287,11 +287,11 @@ module CheckMisusedProperties = begin //member this.S5 with set (idx1 : int) (idx2 : int) v = 4 // should be rejected by parsing - + end let tobj = T() - + let _ = tobj.X1 let _ = tobj.X2 let _ = tobj.X3 // should be rejected @@ -304,7 +304,7 @@ module CheckMisusedProperties = begin let _ = T.SS3 // should be rejected let _ = T.SS4 // should be rejected end - + module Test2 = begin type T() = class @@ -312,7 +312,7 @@ module CheckMisusedProperties = begin with set (a:int, b:int) = () end - let _ = (new T()).X <- (1,2) // should be ok + let _ = (new T()).X <- (1,2) // should be ok let _ = (new T()).X(1) <- 2 // should be rejected type T2() = @@ -351,7 +351,7 @@ module MissingStaticOperatorsTests = begin static member op_Explicit(c: C) : int = 1 static member op_Explicit(c: C) : double = 2.0 static member op_Explicit(c: C) : char = 'a' - static member op_Explicit(c: C) : byte = byte 1 + static member op_Explicit(c: C) : byte = byte 1 end let c = C() @@ -377,7 +377,7 @@ module MissingStaticOperatorsTests = begin static member op_Explicit(c: C) : int = 1 static member op_Explicit(c: C) : double = 2.0 static member op_Implicit(c: C) : char = 'a' - static member op_Implicit(c: C) : byte = byte 1 + static member op_Implicit(c: C) : byte = byte 1 end let c = C() @@ -393,7 +393,7 @@ module MissingStaticOperatorsTests = begin let xQ = uint64 c // expect fail with decent error message let xW = int64 c // expect fail with decent error message let xE = decimal c // expect fail with decent error message - + let y1 : float = C.op_Explicit c // expect ok let y2 : char = C.op_Implicit c // expect ok let yA : char = C.op_Explicit c // expect error - no special treatment for direct calls @@ -457,6 +457,6 @@ module MissingStaticOperatorsTests = begin let xE = decimal c // expect fail with decent error message end - + end diff --git a/tests/fsharp/typecheck/sigs/neg10.fsi b/tests/fsharp/typecheck/sigs/neg10.fsi index 04c9865924c..334529826a3 100644 --- a/tests/fsharp/typecheck/sigs/neg10.fsi +++ b/tests/fsharp/typecheck/sigs/neg10.fsi @@ -9,6 +9,6 @@ namespace N type x = A | B -type I = +type I = interface end diff --git a/tests/fsharp/typecheck/sigs/neg100.fs b/tests/fsharp/typecheck/sigs/neg100.fs index b27ad77bf49..827ce66969e 100644 --- a/tests/fsharp/typecheck/sigs/neg100.fs +++ b/tests/fsharp/typecheck/sigs/neg100.fs @@ -8,7 +8,7 @@ let gggg2 (qqqq : int) = qqqq + 3 let gggg3 (qqqq : int) = qqqq + 3 let gggg4 (qqqq : int) = qqqq + 3 -type C( qqqq2: int) = +type C( qqqq2: int) = member __.M1 (qqqq3: int) = qqqq2 + qqqq3 |> ignore member __.M2 (qqqq3: int) = qqqq2 + qqqq3 |> ignore member __.M3 (qqqq3: int) = qqqq2 + qqqq3 |> ignore diff --git a/tests/fsharp/typecheck/sigs/neg100.fsi b/tests/fsharp/typecheck/sigs/neg100.fsi index 343bc7f1cd3..e69f2a92a08 100644 --- a/tests/fsharp/typecheck/sigs/neg100.fsi +++ b/tests/fsharp/typecheck/sigs/neg100.fsi @@ -8,7 +8,7 @@ val gggg2 : xx: int -> int val gggg3 : xxx: int -> int val gggg4 : xxxx: int -> int -type C = +type C = new : aaa : int -> C member M1 : x:int -> unit member M2 : xx:int -> unit diff --git a/tests/fsharp/typecheck/sigs/neg101.fs b/tests/fsharp/typecheck/sigs/neg101.fs index 46e642d20a9..86631b283b4 100644 --- a/tests/fsharp/typecheck/sigs/neg101.fs +++ b/tests/fsharp/typecheck/sigs/neg101.fs @@ -4,14 +4,14 @@ open System type MyRec = { Foo: string } let x: int = 1 -let y = x.Foo +let y = x.Foo let f1 z = z.Foo let f2 (z: MyRec) = z.Foo // all give a warning -let x1 = - [ (1,2).Item1 +let x1 = + [ (1,2).Item1 (1,2).Item2 (1,2,3).Item1 (1,2,3).Item2 @@ -56,7 +56,7 @@ open System.Runtime.CompilerServices type TupleEx() = [] static member inline Do((x,y): (int*string)) = () - + let x = 1, "2" x.Do() // no warning diff --git a/tests/fsharp/typecheck/sigs/neg102.fs b/tests/fsharp/typecheck/sigs/neg102.fs index 3f55c38fbcf..ec0fe3f0f2a 100644 --- a/tests/fsharp/typecheck/sigs/neg102.fs +++ b/tests/fsharp/typecheck/sigs/neg102.fs @@ -14,7 +14,7 @@ module FS0025 = let f3 = function | EnumABC.A -> "A" - + let f4 = function | EnumABC.A -> "A" | EnumABC.B -> "B" diff --git a/tests/fsharp/typecheck/sigs/neg104.fs b/tests/fsharp/typecheck/sigs/neg104.fs index 98c09fb1056..7e810d00d18 100644 --- a/tests/fsharp/typecheck/sigs/neg104.fs +++ b/tests/fsharp/typecheck/sigs/neg104.fs @@ -7,7 +7,7 @@ module A = let a (x: AT) = match! x with _ -> () let b (x: int) = - match! x with _ -> () + match! x with _ -> () module B = let a (x: AT) = async { diff --git a/tests/fsharp/typecheck/sigs/neg106.fs b/tests/fsharp/typecheck/sigs/neg106.fs index f843f0a6156..e323aba67f1 100644 --- a/tests/fsharp/typecheck/sigs/neg106.fs +++ b/tests/fsharp/typecheck/sigs/neg106.fs @@ -3,65 +3,65 @@ module M //#r @"..\..\..\..\packages\System.Memory.4.5.0-rc1\lib\netstandard2.0\System.Memory.dll" //#r @"..\..\..\..\packages\NETStandard.Library.NETFramework\2.0.0-preview2-25405-01\build\net461\ref\netstandard.dll" -module CompareExchangeTests_Negative1 = +module CompareExchangeTests_Negative1 = let x = 3 let v = System.Threading.Interlocked.CompareExchange(&x, 3, 4) // No overloads match for method 'CompareExchange'. 'inref' is not compatible with type 'byref' -module CompareExchangeTests_Negative1b = - let Test() = +module CompareExchangeTests_Negative1b = + let Test() = let x = 3 let v = System.Threading.Interlocked.CompareExchange(&x, 3, 4) // No overloads match for method 'CompareExchange'. 'inref' is not compatible with type 'byref' () -module CompareExchangeTests_Negative2 = +module CompareExchangeTests_Negative2 = let v = System.Threading.Interlocked.CompareExchange(&3, 3, 4) // 'inref' is not compatible with type 'byref' -module TryGetValueTests_Negative1 = - let Test() = +module TryGetValueTests_Negative1 = + let Test() = let d = dict [ (3,4) ] let res = 9 let v = d.TryGetValue(3, &res) // 'inref' is not compatible with type 'byref' () -module FSharpDeclaredOutParamTest_Negative1 = - type C() = +module FSharpDeclaredOutParamTest_Negative1 = + type C() = static member M([] x: byref) = () - let Test() = + let Test() = let res = 9 let v = C.M(&res) //'inref' is not compatible with type 'byref' () -module FSharpDeclaredOverloadedOutParamTest_Negative1 = - type C() = +module FSharpDeclaredOverloadedOutParamTest_Negative1 = + type C() = static member M(a: int, [] x: byref) = x <- 7 static member M(a: string, [] x: byref) = x <- 8 - let Test() = + let Test() = let res = 9 let v = C.M("a", &res) //'inref' is not compatible with type 'byref' let v2 = C.M(3, &res) //'inref' is not compatible with type 'byref' () -module FSharpDeclaredOutParamTest_Negative1b = - type C() = +module FSharpDeclaredOutParamTest_Negative1b = + type C() = static member M([] x: byref) = () - let Test() = + let Test() = let res = 9 let v = C.M(&res) // 'inref' is not compatible with type 'byref' () module TestOneArgumentInRefThenMutate_Negative1 = - type C() = + type C() = static member M (x:inref) = &x - let test() = + let test() = let mutable r1 = 1 let addr = &C.M (&r1) // Expecting a 'byref' but given a 'inref'. The type 'ByRefKinds.Out' does not match the type 'ByRefKinds.In' addr <- addr + 1 // "The byref pointer is readonly, so this write is not permitted" module EvilStruct_Negative1 = [] - type EvilStruct(s: int) = + type EvilStruct(s: int) = member x.Replace(y:EvilStruct) = x <- y module MutateInRef1 = @@ -73,76 +73,76 @@ module MutateInRef1 = let testIn (m: inref) = m.x <- 1 -module MatrixOfTests = +module MatrixOfTests = [] - type S = + type S = [] val mutable X : int - module WriteToInRef = + module WriteToInRef = let f1 (x: inref) = x <- 1 // not allowed - module WriteToInRefStructInner = + module WriteToInRefStructInner = let f1 (x: inref) = x.X <- 1 //not allowed - module InRefToByRef = + module InRefToByRef = let f1 (x: byref<'T>) = 1 - let f2 (x: inref<'T>) = f1 &x // not allowed + let f2 (x: inref<'T>) = f1 &x // not allowed - module InRefToByRefStructInner = + module InRefToByRefStructInner = let f1 (x: byref<'T>) = 1 - let f2 (x: inref) = f1 &x.X // not allowed + let f2 (x: inref) = f1 &x.X // not allowed - module InRefToOutRef = + module InRefToOutRef = let f1 (x: outref<'T>) = 1 - let f2 (x: inref<'T>) = f1 &x // not allowed + let f2 (x: inref<'T>) = f1 &x // not allowed - module InRefToOutRefStructInner = + module InRefToOutRefStructInner = let f1 (x: outref<'T>) = 1 - let f2 (x: inref<'T>) = f1 &x.X // not allowed + let f2 (x: inref<'T>) = f1 &x.X // not allowed - module InRefToByRefClassMethod = - type C() = + module InRefToByRefClassMethod = + type C() = static member f1 (x: byref<'T>) = 1 - let f2 (x: inref<'T>) = C.f1 &x // not allowed + let f2 (x: inref<'T>) = C.f1 &x // not allowed - module InRefToByRefClassMethodStructInner = - type C() = + module InRefToByRefClassMethodStructInner = + type C() = static member f1 (x: byref<'T>) = 1 - let f2 (x: inref<'T>) = C.f1 &x.X // not allowed + let f2 (x: inref<'T>) = C.f1 &x.X // not allowed module InRefToOutRefClassMethod = - type C() = + type C() = static member f1 (x: outref<'T>) = 1 // not allowed - let f2 (x: inref<'T>) = C.f1 &x + let f2 (x: inref<'T>) = C.f1 &x module InRefToOutRefClassMethodStructInner = - type C() = + type C() = static member f1 (x: outref<'T>) = 1 // not allowed - let f2 (x: inref<'T>) = C.f1 &x.X + let f2 (x: inref<'T>) = C.f1 &x.X - module InRefToByRefClassMethod2 = - type C() = + module InRefToByRefClassMethod2 = + type C() = static member f1 (x: byref<'T>) = 1 - let f2 (x: inref<'T>) = C.f1(&x) // not allowed + let f2 (x: inref<'T>) = C.f1(&x) // not allowed - module InRefToByRefClassMethod2StructInner = - type C() = + module InRefToByRefClassMethod2StructInner = + type C() = static member f1 (x: byref<'T>) = 1 - let f2 (x: inref<'T>) = C.f1(&x.X) // not allowed + let f2 (x: inref<'T>) = C.f1(&x.X) // not allowed module InRefToOutRefClassMethod2 = - type C() = + type C() = static member f1 (x: outref<'T>) = 1 // not allowed - let f2 (x: inref<'T>) = C.f1(&x) + let f2 (x: inref<'T>) = C.f1(&x) module InRefToOutRefClassMethod2StructInner = - type C() = + type C() = static member f1 (x: outref<'T>) = 1 // not allowed - let f2 (x: inref<'T>) = C.f1(&x.X) + let f2 (x: inref<'T>) = C.f1(&x.X) module UseOfLibraryOnly = - type C() = + type C() = static member f1 (x: byref<'T, 'U>) = 1 // not allowed - library only static member f2 (x: ByRefKinds.In) = 1 // not allowed - library only static member f2 (x: ByRefKinds.InOut) = 1 // not allowed - library only diff --git a/tests/fsharp/typecheck/sigs/neg11.fs b/tests/fsharp/typecheck/sigs/neg11.fs index 72d32a12133..933657f4e48 100644 --- a/tests/fsharp/typecheck/sigs/neg11.fs +++ b/tests/fsharp/typecheck/sigs/neg11.fs @@ -1,7 +1,7 @@ module Neg11 // check that a decent error is given when a constructor is too polymorphic type Gaussian1D = - class + class val p : float; new (precisionMean:'a) = { p = 0.0 } end diff --git a/tests/fsharp/typecheck/sigs/neg111.fs b/tests/fsharp/typecheck/sigs/neg111.fs index 02ad748a1dc..a418b2c3025 100644 --- a/tests/fsharp/typecheck/sigs/neg111.fs +++ b/tests/fsharp/typecheck/sigs/neg111.fs @@ -1,5 +1,5 @@ module Neg111 type TestDU = | A1 of string | A2 of string | A3 of string | A4 of string | A5 of string | A6 of string | A7 of string | A8 of string | A9 of string | A10 of string | A11 of string | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 | A20 | A21 | A22 | A23 | A24 | A25 | A26 | A27 | A28 | A29 | A30 | A31 | A32 | A33 | A34 | A35 | A36 | A37 | A38 | A39 | A40 | A41 | A42 | A43 | A44 | A45 | A46 | A47 | A48 | A49 | A50 | A51 | A52 | A53 | A54 | A55 | A56 | A57 | A58 | A59 | A60 | A61 | A62 | A63 | A64 | A65 | A66 | A67AAAAAAAAAAAAAAAAAAAAAAAA of string fail1 type TestRec = { Naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmeeeeeeeeeeee : string; Name2 : string } member x.P = fail2 -module SomeRidiculouslyLongNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmeeeeeeeeeeee = +module SomeRidiculouslyLongNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmeeeeeeeeeeee = let testFunctionNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmeeeeeeeeeeee () = () fail4 diff --git a/tests/fsharp/typecheck/sigs/neg112.fs b/tests/fsharp/typecheck/sigs/neg112.fs index 9fe032348cd..32d0f332fb3 100644 --- a/tests/fsharp/typecheck/sigs/neg112.fs +++ b/tests/fsharp/typecheck/sigs/neg112.fs @@ -3,17 +3,17 @@ type Tuple = static member inline TupleMap ((a, b), _ : Tuple) = fun f -> (f a, f b) static member inline TupleMap ((a, b, c), _ : Tuple) = fun f -> (f a, f b, f c) static member inline TupleMap ((a, b, c, d), _ : Tuple) = fun f -> (f a, f b, f c, f d) - + static member inline Map f (x: 'Tin) : 'Tout = let inline call_2 (a: ^a, b : ^b) = ((^a or ^b) : (static member TupleMap : ^b * _ -> ^t) (b, a)) call_2 (Unchecked.defaultof, x) f type IOption<'T> = abstract member Value : 'T - + let inline tupleMap f x = Tuple.Map f x -let inline addOptionValues<^value, ^options, ^values, 'item when +let inline addOptionValues<^value, ^options, ^values, 'item when 'item :> IOption<^value>> (addUp : ^values -> ^value, sourceOptions : ^options) = let getValue (i : 'item) = i.Value diff --git a/tests/fsharp/typecheck/sigs/neg113.fs b/tests/fsharp/typecheck/sigs/neg113.fs index 4979cea70bd..7095179c7de 100644 --- a/tests/fsharp/typecheck/sigs/neg113.fs +++ b/tests/fsharp/typecheck/sigs/neg113.fs @@ -2,7 +2,7 @@ module M // Check we get compile-time errors - let negTypeTest1() = ({| a = 1+1; b = 2 |} = {| a = 2 |}) + let negTypeTest1() = ({| a = 1+1; b = 2 |} = {| a = 2 |}) let negTypeTest2() = ({| b = 2 |} = {| a = 2 |} ) diff --git a/tests/fsharp/typecheck/sigs/neg115.fs b/tests/fsharp/typecheck/sigs/neg115.fs index 58025572c71..9b6d1c626a0 100644 --- a/tests/fsharp/typecheck/sigs/neg115.fs +++ b/tests/fsharp/typecheck/sigs/neg115.fs @@ -3,6 +3,5 @@ module M let foo x = x - for i foo 12 = 1 to 20 do + for i foo 12 = 1 to 20 do printfn "%d" i - \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg118.fs b/tests/fsharp/typecheck/sigs/neg118.fs index fb951db31c4..e8b35e81276 100644 --- a/tests/fsharp/typecheck/sigs/neg118.fs +++ b/tests/fsharp/typecheck/sigs/neg118.fs @@ -14,7 +14,7 @@ type FoldArgs<'t> with static member ($) (FoldArgs f, _:'t ) = f let test1() = - let x:int = foldArgs (+) 2 3 + let x:int = foldArgs (+) 2 3 let y:int = foldArgs (+) 2 3 4 let z:int = foldArgs (+) 2 3 4 5 let d:decimal = foldArgs (+) 2M 3M 4M diff --git a/tests/fsharp/typecheck/sigs/neg119a.fs b/tests/fsharp/typecheck/sigs/neg119a.fs index 46d64d49395..5d092466cfc 100644 --- a/tests/fsharp/typecheck/sigs/neg119a.fs +++ b/tests/fsharp/typecheck/sigs/neg119a.fs @@ -11,7 +11,7 @@ module Applicatives = type Ap = Ap with static member inline Invoke (x:'T) : '``Applicative<'T>`` = let inline call (mthd : ^M, output : ^R) = ((^M or ^R) : (static member Return: _*_ -> _) output, mthd) - call (Ap, Unchecked.defaultof<'``Applicative<'T>``>) x + call (Ap, Unchecked.defaultof<'``Applicative<'T>``>) x static member inline InvokeOnInstance (x:'T) = (^``Applicative<'T>`` : (static member Return: ^T -> ^``Applicative<'T>``) x) static member inline Return (r:'R , _:obj) = Ap.InvokeOnInstance :_ -> 'R static member Return (_:seq<'a> , Ap ) = fun x -> Seq.singleton x : seq<'a> @@ -20,7 +20,7 @@ module Applicatives = let inline result (x:'T) = Ap.Invoke x - let inline (<*>) (f:'``Applicative<'T->'U>``) (x:'``Applicative<'T>``) : '``Applicative<'U>`` = + let inline (<*>) (f:'``Applicative<'T->'U>``) (x:'``Applicative<'T>``) : '``Applicative<'U>`` = (( ^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>): _*_ -> _) f, x) let inline (+) (a:'Num) (b:'Num) :'Num = a + b diff --git a/tests/fsharp/typecheck/sigs/neg119b.fs b/tests/fsharp/typecheck/sigs/neg119b.fs index 46d64d49395..5d092466cfc 100644 --- a/tests/fsharp/typecheck/sigs/neg119b.fs +++ b/tests/fsharp/typecheck/sigs/neg119b.fs @@ -11,7 +11,7 @@ module Applicatives = type Ap = Ap with static member inline Invoke (x:'T) : '``Applicative<'T>`` = let inline call (mthd : ^M, output : ^R) = ((^M or ^R) : (static member Return: _*_ -> _) output, mthd) - call (Ap, Unchecked.defaultof<'``Applicative<'T>``>) x + call (Ap, Unchecked.defaultof<'``Applicative<'T>``>) x static member inline InvokeOnInstance (x:'T) = (^``Applicative<'T>`` : (static member Return: ^T -> ^``Applicative<'T>``) x) static member inline Return (r:'R , _:obj) = Ap.InvokeOnInstance :_ -> 'R static member Return (_:seq<'a> , Ap ) = fun x -> Seq.singleton x : seq<'a> @@ -20,7 +20,7 @@ module Applicatives = let inline result (x:'T) = Ap.Invoke x - let inline (<*>) (f:'``Applicative<'T->'U>``) (x:'``Applicative<'T>``) : '``Applicative<'U>`` = + let inline (<*>) (f:'``Applicative<'T->'U>``) (x:'``Applicative<'T>``) : '``Applicative<'U>`` = (( ^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>): _*_ -> _) f, x) let inline (+) (a:'Num) (b:'Num) :'Num = a + b diff --git a/tests/fsharp/typecheck/sigs/neg12.fs b/tests/fsharp/typecheck/sigs/neg12.fs index 261fdd121b1..17b8bec4d2a 100644 --- a/tests/fsharp/typecheck/sigs/neg12.fs +++ b/tests/fsharp/typecheck/sigs/neg12.fs @@ -2,7 +2,7 @@ module Test type Gaussian1D = - class + class member x.Foot with get() = failwith "" end @@ -18,8 +18,8 @@ module AccessingProtectedMembersFromUnderLambdas = begin let h = new System.EventHandler(fun _ _ -> (a.GetSchemaSerializable() |> ignore)) in // should give error // check that protected members from the surrounding context can be used // in the arguments to an object constructor. - let obj = { new System.Collections.ArrayList( (a.GetSchemaSerializable() |> ignore; 3)) with - member x.ToString() = "" + let obj = { new System.Collections.ArrayList( (a.GetSchemaSerializable() |> ignore; 3)) with + member x.ToString() = "" end } in () end @@ -31,7 +31,7 @@ type C(x) = member y.Z = x module ImplicitClassCOnstructionMayNotUseExplicitCOnstruction_Bug_1341_FSharp_1_0 = begin - type s = class + type s = class new () = {} end diff --git a/tests/fsharp/typecheck/sigs/neg120.fs b/tests/fsharp/typecheck/sigs/neg120.fs index 48ab1db0a0c..808df8bb6ac 100644 --- a/tests/fsharp/typecheck/sigs/neg120.fs +++ b/tests/fsharp/typecheck/sigs/neg120.fs @@ -18,7 +18,7 @@ type Bind = static member (>>=) (source: Lazy<'T> , f: 'T -> Lazy<'U> ) = lazy (f source.Value).Value : Lazy<'U> static member (>>=) (source: Task<'T> , f: 'T -> Task<'U> ) = source.ContinueWith(fun (x: Task<_>) -> f x.Result).Unwrap () : Task<'U> static member (>>=) (source , f: 'T -> _ ) = Option.bind f source : option<'U> - static member (>>=) (source , f: 'T -> _ ) = async.Bind (source, f) + static member (>>=) (source , f: 'T -> _ ) = async.Bind (source, f) static member (>>=) (source : Id<_> , f: 'T -> _ ) = f source.getValue : Id<'U> static member inline Invoke (source: '``Monad<'T>``) (binder: 'T -> '``Monad<'U>``) : '``Monad<'U>`` = @@ -69,7 +69,7 @@ let inline bind f (source: TypeT<'mt>) : TypeT<'mu> = | A -> result <| (A : Node<'mu,'u>) : 'miu | B (h:'t, t: TypeT<'mt>) -> let res = concat (f h: TypeT<'mu>) (loop f t) - unwrap res : 'miu) + unwrap res : 'miu) loop f source : TypeT<'mu> diff --git a/tests/fsharp/typecheck/sigs/neg121.fs b/tests/fsharp/typecheck/sigs/neg121.fs index 598820f4c9d..310aadd83f8 100644 --- a/tests/fsharp/typecheck/sigs/neg121.fs +++ b/tests/fsharp/typecheck/sigs/neg121.fs @@ -10,10 +10,10 @@ type System.Int32 with static member inline ParseApply (path:string) (fn: int type System.Double with static member inline ParseApply (path:string) (fn: float -> ^b) : ^b = fn 0. type System.Boolean with static member inline ParseApply (path:string) (fn: bool -> ^b) : ^b = fn true -let inline parser (fmt:PrintfFormat< ^a -> ^b,_,_,^b>) (fn:^a -> ^b) (v:string) : ^b +let inline parser (fmt:PrintfFormat< ^a -> ^b,_,_,^b>) (fn:^a -> ^b) (v:string) : ^b when ^a : (static member ParseApply: string -> (^a -> ^b) -> ^b) = (^a : (static member ParseApply: string -> (^a -> ^b) -> ^b)(v,fn)) let inline patternTest (fmt:PrintfFormat< ^a -> Action< ^T>,_,_,Action< ^T>>) (fn:^a -> Action< ^T>) v : Action< ^T> = parser fmt fn v -let parseFn1 = patternTest "adfadf%i" (fun v -> printfn "%i" v; Unchecked.defaultof> ) +let parseFn1 = patternTest "adfadf%i" (fun v -> printfn "%i" v; Unchecked.defaultof> ) diff --git a/tests/fsharp/typecheck/sigs/neg122.fs b/tests/fsharp/typecheck/sigs/neg122.fs index 981460feb12..f46f2a9dafa 100644 --- a/tests/fsharp/typecheck/sigs/neg122.fs +++ b/tests/fsharp/typecheck/sigs/neg122.fs @@ -10,10 +10,10 @@ type System.Int32 with static member inline ParseApply (path:string) (fn: int type System.Double with static member inline ParseApply (path:string) (fn: float -> ^b) : ^b = fn 0. type System.Boolean with static member inline ParseApply (path:string) (fn: bool -> ^b) : ^b = fn true -let inline parser (fmt:PrintfFormat< ^a -> ^b,_,_,^b>) (fn:^a -> ^b) (v:string) : ^b +let inline parser (fmt:PrintfFormat< ^a -> ^b,_,_,^b>) (fn:^a -> ^b) (v:string) : ^b when ^a : (static member ParseApply: string -> (^a -> ^b) -> ^b) = (^a : (static member ParseApply: string -> (^a -> ^b) -> ^b)(v,fn)) let inline patternTest (fmt:PrintfFormat< ^a -> Action< ^T>,_,_,Action< ^T>>) (fn:^a -> Action< ^T>) v : Action< ^T> = parser fmt fn v -let parseFn2 = patternTest "adf%s245" (fun v -> printfn "%s" v; Unchecked.defaultof> ) +let parseFn2 = patternTest "adf%s245" (fun v -> printfn "%s" v; Unchecked.defaultof> ) diff --git a/tests/fsharp/typecheck/sigs/neg124.fs b/tests/fsharp/typecheck/sigs/neg124.fs index d8a7c937dd4..e91dda438aa 100644 --- a/tests/fsharp/typecheck/sigs/neg124.fs +++ b/tests/fsharp/typecheck/sigs/neg124.fs @@ -2,7 +2,7 @@ module Neg124 // Variation on test case mentioned in https://github.com/dotnet/fsharp/pull/6805#issuecomment-580368303 module Negative_SelectOverloadedWitnessBasedOnInputAndReturnTypeWithoutOutputTypeSelector = - type witnesses = + type witnesses = static member inline unsigned_witness (x : sbyte) = uint8 x static member inline unsigned_witness (x : byte) = x static member inline unsigned_witness (x : int16) = uint16 x @@ -37,4 +37,3 @@ module Negative_SelectOverloadedWitnessBasedOnInputAndReturnTypeWithoutOutputTyp // Negative case - not enough information here let h1 : _ -> uint8 = unsigned - \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg125.fs b/tests/fsharp/typecheck/sigs/neg125.fs index cde0ebb4ac5..f6ce9bfcfe8 100644 --- a/tests/fsharp/typecheck/sigs/neg125.fs +++ b/tests/fsharp/typecheck/sigs/neg125.fs @@ -3,19 +3,19 @@ module Neg125 // Variation on test case mentioned in https://github.com/dotnet/fsharp/pull/6805#issuecomment-580368303 // // See also pos35.fs -// +// // This removes ^output as a type selector for the witness, and no longer passes a dummy ^output // // This means that when both ^witnesses and ^input are known, the overload determining the ^output still can't be determined, // and overload resolution failures are reported -module Negative_SelectOverloadedWitnessBasedOnReturnTypeWithoutOutputTypeSelectAndWithoutPassingDummyArgument = +module Negative_SelectOverloadedWitnessBasedOnReturnTypeWithoutOutputTypeSelectAndWithoutPassingDummyArgument = open System open System.Numerics let _uint8max = bigint (uint32 Byte.MaxValue) let _uint16max = bigint (uint32 UInt16.MaxValue) let _uint32max = bigint UInt32.MaxValue let _uint64max = bigint UInt64.MaxValue - type witnesses = + type witnesses = static member inline convert_witness (x : bigint) = int (uint32 (x &&& _uint32max)) static member inline convert_witness (x : bigint) = int64 (uint64 (x &&& _uint64max)) static member inline convert_witness (x : bigint) = x diff --git a/tests/fsharp/typecheck/sigs/neg126.fs b/tests/fsharp/typecheck/sigs/neg126.fs index 232a35bb9c1..2d36a220bdc 100644 --- a/tests/fsharp/typecheck/sigs/neg126.fs +++ b/tests/fsharp/typecheck/sigs/neg126.fs @@ -6,21 +6,21 @@ module Neg126 // // However, only one witness is present. // -// Due to the problem described in https://github.com/dotnet/fsharp/pull/6805#issuecomment-580396911, +// Due to the problem described in https://github.com/dotnet/fsharp/pull/6805#issuecomment-580396911, // "generic inline code we apply weak resolution to constraints that could otherwise be generalised", -// this generates a warning because overload resolution is invoked and the input type of "foo" becomes "sbyte" +// this generates a warning because overload resolution is invoked and the input type of "foo" becomes "sbyte" // // The inferred type should ideally be // foo: ^a -> ^b -// but is actually +// but is actually // foo: sbyte -> byte // // That is, the code is not generic at all, because the F# compiler thinks that it commit to the one and only witness. // // This test exists to pin down that we get a warning produced saying ^a has been instantiated to "sbyte" -module Negative_SelectOverloadedWitnessBasedOnInputTypeOneWitness = - type witnesses = +module Negative_SelectOverloadedWitnessBasedOnInputTypeOneWitness = + type witnesses = static member inline foo_witness (x : sbyte) : byte = byte x // Note, this doesn't try to use the output to select diff --git a/tests/fsharp/typecheck/sigs/neg127.fs b/tests/fsharp/typecheck/sigs/neg127.fs index ba44a1ae772..94b242b82bb 100644 --- a/tests/fsharp/typecheck/sigs/neg127.fs +++ b/tests/fsharp/typecheck/sigs/neg127.fs @@ -3,27 +3,27 @@ module Neg127 // Variation on test case mentioned in https://github.com/dotnet/fsharp/pull/6805#issuecomment-580368303 // // See also pos35.fs, neg125.fs -// +// // This no longer passes a dummy ^output but keeps ^output as a witness selector // // When both ^witnesses and ^input are known, the overload determining the ^output still can't be determined. // However overload resolution is **not** delayed because the language rule is that overload resolution // goes ahead once the support in the **argument** types of the constraint have all been resolved. -// +// // This design decision for SRTP resolution was based on the (technically false but normally true) assumption that // overload resolution will not depend on return type. // // The workaround for this in SRTP generic code is to pass a dummy Unchecked.defaultof<_> argument of the type of the // return type. -module Negative_SelectOverloadedWitnessBasedOnReturnTypeWithoutPassingDummyArgument = +module Negative_SelectOverloadedWitnessBasedOnReturnTypeWithoutPassingDummyArgument = open System open System.Numerics let _uint8max = bigint (uint32 Byte.MaxValue) let _uint16max = bigint (uint32 UInt16.MaxValue) let _uint32max = bigint UInt32.MaxValue let _uint64max = bigint UInt64.MaxValue - type witnesses = + type witnesses = static member inline convert_witness (x : bigint) = int (uint32 (x &&& _uint32max)) static member inline convert_witness (x : bigint) = int64 (uint64 (x &&& _uint64max)) static member inline convert_witness (x : bigint) = x @@ -43,7 +43,7 @@ module Negative_SelectOverloadedWitnessBasedOnReturnTypeWithoutPassingDummyArgum let inline convert num = call_convert_witness (num) - // These all cause errors + // These all cause errors let v1 : int32 = convert 0I let v2 : int64 = convert 0I let v3 : bigint = convert 0I diff --git a/tests/fsharp/typecheck/sigs/neg128.fs b/tests/fsharp/typecheck/sigs/neg128.fs index b936ee254b6..ca2026dfda5 100644 --- a/tests/fsharp/typecheck/sigs/neg128.fs +++ b/tests/fsharp/typecheck/sigs/neg128.fs @@ -1,13 +1,13 @@ module Neg128 -module Negative_SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentGenericOutputSelector = +module Negative_SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentGenericOutputSelector = open System open System.Numerics let _uint8max = bigint (uint32 Byte.MaxValue) let _uint16max = bigint (uint32 UInt16.MaxValue) let _uint32max = bigint UInt32.MaxValue let _uint64max = bigint UInt64.MaxValue - type witnesses = + type witnesses = static member inline convert_witness (x : bigint, _output : int32) = int (uint32 (x &&& _uint32max)) static member inline convert_witness (x : bigint, _output : int64) = int64 (uint64 (x &&& _uint64max)) static member inline convert_witness (x : bigint, _output : bigint) = x diff --git a/tests/fsharp/typecheck/sigs/neg129.fs b/tests/fsharp/typecheck/sigs/neg129.fs index d65671900bd..3f0d82df402 100644 --- a/tests/fsharp/typecheck/sigs/neg129.fs +++ b/tests/fsharp/typecheck/sigs/neg129.fs @@ -5,14 +5,14 @@ module Neg129 // This removes ^output as a type selector for the witness, but continues to pass a dummy ^output // // This is sufficient to make nearly all resolutions go through except when we instantiate by input type alone -module Negative_SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentNoOutputSelector = +module Negative_SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentNoOutputSelector = open System open System.Numerics let _uint8max = bigint (uint32 Byte.MaxValue) let _uint16max = bigint (uint32 UInt16.MaxValue) let _uint32max = bigint UInt32.MaxValue let _uint64max = bigint UInt64.MaxValue - type witnesses = + type witnesses = static member inline convert_witness (x : bigint, _output : int32) = int (uint32 (x &&& _uint32max)) static member inline convert_witness (x : bigint, _output : int64) = int64 (uint64 (x &&& _uint64max)) static member inline convert_witness (x : bigint, _output : bigint) = x @@ -61,7 +61,7 @@ module Negative_SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentNo let f10 : _ -> uint64 = convert let f11 : _ -> float32 = convert let f12 : _ -> decimal = convert - let f13 : _ -> Complex = convert + let f13 : _ -> Complex = convert // This gives an error, because all selector types are known and overload resolution kicks in let inline inst (num: bigint) : ^output = convert num diff --git a/tests/fsharp/typecheck/sigs/neg13.fs b/tests/fsharp/typecheck/sigs/neg13.fs index 3393f5e2136..3efa813d4b3 100644 --- a/tests/fsharp/typecheck/sigs/neg13.fs +++ b/tests/fsharp/typecheck/sigs/neg13.fs @@ -1,7 +1,7 @@ module Neg13 // check that a decent error is given when a setter is too polymorphic type Gaussian1D = - class + class member x.Feet with set(v) = failwith "" end @@ -44,21 +44,21 @@ type Ry = A | B [] -type Ru = - | A +type Ru = + | A | B - with + with override x.Equals(y) = false end [] -type Rv = - | A +type Rv = + | A | B - with + with override x.Equals(y) = false - interface System.IComparable with + interface System.IComparable with member x.CompareTo(y) = 0 end end diff --git a/tests/fsharp/typecheck/sigs/neg130.fs b/tests/fsharp/typecheck/sigs/neg130.fs index 5bb47f6daf5..dc07a751d1d 100644 --- a/tests/fsharp/typecheck/sigs/neg130.fs +++ b/tests/fsharp/typecheck/sigs/neg130.fs @@ -7,21 +7,21 @@ let PlaceDefaultConstructorConstraint<'T when 'T : (new : unit -> 'T)> (x : 'T) module TestVariableTypesForTuples = // The case for type variables (declared) where struct/reference is not known - type T3b<'T>(x : struct (int * 'T)) = + type T3b<'T>(x : struct (int * 'T)) = do x |> PlaceDefaultConstructorConstraint |> ignore // The case for type variables (inferred) where struct/reference is not known - let f3b (x : struct (int * 'T)) = + let f3b (x : struct (int * 'T)) = x |> PlaceDefaultConstructorConstraint |> ignore module TestVariableTypesForAnonRecords = - // Struct anon record are always considered to satisfy ValueType constraint - // - type T3b<'T>(x : struct {| X : int; Y : 'T |}) = + // Struct anon record are always considered to satisfy ValueType constraint + // + type T3b<'T>(x : struct {| X : int; Y : 'T |}) = do x |> PlaceDefaultConstructorConstraint |> ignore // The case for type variables (inferred) where struct/reference is not known - let f3b (x : struct {| X : int; Y : 'T |}) = + let f3b (x : struct {| X : int; Y : 'T |}) = x |> PlaceDefaultConstructorConstraint |> ignore diff --git a/tests/fsharp/typecheck/sigs/neg131.fs b/tests/fsharp/typecheck/sigs/neg131.fs index e1db0ef2f82..a69136c6ec1 100644 --- a/tests/fsharp/typecheck/sigs/neg131.fs +++ b/tests/fsharp/typecheck/sigs/neg131.fs @@ -11,5 +11,5 @@ module TestOverloadsWithSrtpThatDontResolve1 = // 'x' doesn't contain any type information so the overload doesn't resolve. - let inline f x = - OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) + let inline f x = + OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) diff --git a/tests/fsharp/typecheck/sigs/neg132.fs b/tests/fsharp/typecheck/sigs/neg132.fs index 393130266f5..b80620a1b62 100644 --- a/tests/fsharp/typecheck/sigs/neg132.fs +++ b/tests/fsharp/typecheck/sigs/neg132.fs @@ -11,5 +11,5 @@ module TestOverloadsWithSrtpThatDontResolve1 = // this will give a "requires version 6.0 or greater" error - let inline f x = - OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) + let inline f x = + OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) diff --git a/tests/fsharp/typecheck/sigs/neg133.fs b/tests/fsharp/typecheck/sigs/neg133.fs index e17b3635348..27258347d63 100644 --- a/tests/fsharp/typecheck/sigs/neg133.fs +++ b/tests/fsharp/typecheck/sigs/neg133.fs @@ -25,19 +25,19 @@ type C2() = let TestOneColumnOfTypeTestsWithUnSealedClassTypes_Redundant1(x: obj) = match x with | :? A -> 1 - | :? B1 -> 2 // expect - never matched + | :? B1 -> 2 // expect - never matched | _ -> 3 let TestOneColumnOfTypeTestsWithUnSealedClassTypes_Redundant2(x: obj) = match x with | :? A -> 1 - | :? C1 -> 2 // expect - never matched + | :? C1 -> 2 // expect - never matched | _ -> 3 let TestOneColumnOfTypeTestsWithUnSealedClassTypes_Redundant3(x: obj) = match x with | :? B1 -> 1 - | :? C1 -> 2 // expect - never matched + | :? C1 -> 2 // expect - never matched | _ -> 3 let TestColumnOfTypeTestsWithNullTrueValue_Redundant(x: obj) = @@ -65,7 +65,7 @@ let Misc_Redundant4(x: obj) = let Misc_Redundant5(x: obj) = match x with - | :? IComparable -> 1 + | :? IComparable -> 1 | :? string -> 2 // expect - never matched | g -> 3 diff --git a/tests/fsharp/typecheck/sigs/neg14a.fs b/tests/fsharp/typecheck/sigs/neg14a.fs index 1ac70e0a952..48a38deeac3 100644 --- a/tests/fsharp/typecheck/sigs/neg14a.fs +++ b/tests/fsharp/typecheck/sigs/neg14a.fs @@ -1,14 +1,14 @@ module Lib -type okType = X | Y +type okType = X | Y type missingConstructorInSignature = A | B | C type missingFieldInSignature = { a: int; b: int } type 'a missingTypeVariableInSignature = { f1: int } type missingInterfaceInSignature<'t> = class - interface System.IComparable with + interface System.IComparable with member x.CompareTo(y) = 0 end end diff --git a/tests/fsharp/typecheck/sigs/neg15.fs b/tests/fsharp/typecheck/sigs/neg15.fs index 7410b4c83ae..f2d76dd133f 100644 --- a/tests/fsharp/typecheck/sigs/neg15.fs +++ b/tests/fsharp/typecheck/sigs/neg15.fs @@ -8,33 +8,33 @@ module M = let private privateValue = 1 let internal internalValue = 1 - - type private PrivateUnionType = + + type private PrivateUnionType = | DefaultTagOfPrivateType of int //| private PrivateTagOfPrivateType of int //| internal InternalTagOfPrivateType of int - type UnionTypeWithPrivateRepresentation = + type UnionTypeWithPrivateRepresentation = private | DefaultTagOfUnionTypeWithPrivateRepresentation of int - type private PrivateRecordType = + type private PrivateRecordType = { DefaultFieldOfPrivateType : int } - type RecordTypeWithPrivateRepresentation = + type RecordTypeWithPrivateRepresentation = private { DefaultFieldOfRecordTypeWithPrivateRepresentation : int } - type internal InternalUnionType = + type internal InternalUnionType = | DefaultTagOfInternalType of int //| private PrivateTagOfInternalType of int //| internal InternalTagOfInternalType of int - type internal InternalRecordType = + type internal InternalRecordType = { DefaultFieldOfInternalType : int } - type PublicRecordType = - { DefaultFieldOfPublicType : int; - //private PrivateFieldOfPublicType : int; - //internal InternalFieldOfPublicType : int; + type PublicRecordType = + { DefaultFieldOfPublicType : int; + //private PrivateFieldOfPublicType : int; + //internal InternalFieldOfPublicType : int; PublicFieldOfPublicType: int } let errorPublicValueLaterInferredToInvolvePrivateUnionType = ref [] // escape via type inference @@ -42,11 +42,11 @@ module M = let internal errorInternalValueLaterInferredToInvolvePrivateUnionType = ref [] // escape via type inference let internal noErrorInternalValueLaterInferredToInvolveInternalUnionType = ref [] // escape via type inference - + let private noErrorPrivateValueLaterInferredToInvolvePrivateUnionType = ref [] // escape via type inference let private noErrorPrivateValueLaterInferredToInvolveInternalUnionType = ref [] // escape via type inference - - type Type() = + + type Type() = member private x.PrivateProperty = 3 static member private PrivateStaticProperty = 3 member private x.PrivateMethod() = 3 @@ -60,13 +60,13 @@ module M = // Check we can access private things from this type member x.NoError1 = x.PrivateProperty member x.NoError2 = Type.PrivateStaticProperty - static member NoError3 = Type.PrivateStaticProperty - static member NoError4 = Type.PrivateStaticMethod() + static member NoError3 = Type.PrivateStaticProperty + static member NoError4 = Type.PrivateStaticMethod() member x.NoError1a = x.InternalProperty member x.NoError2a = Type.InternalStaticProperty - static member NoError3a = Type.InternalStaticProperty - static member NoError4a = Type.InternalStaticMethod() + static member NoError3a = Type.InternalStaticProperty + static member NoError4a = Type.InternalStaticMethod() member x.Error1 = { DefaultFieldOfPrivateType=3 } // returning a private type from a public method member x.Error2 = DefaultTagOfPrivateType(3) // returning a private type from a public method @@ -89,15 +89,15 @@ module M = static member Method34() = noErrorPrivateValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)] static member Method35() = noErrorPrivateValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)] - type Type with + type Type with // Check we can access private things from an in-file augmentation member x.NoError51 = x.PrivateProperty member x.NoError52 = Type.PrivateStaticProperty - static member NoError53 = Type.PrivateStaticProperty - static member NoError54 = Type.PrivateStaticMethod() + static member NoError53 = Type.PrivateStaticProperty + static member NoError54 = Type.PrivateStaticMethod() + - module N = let error1 = M.privateValue let error2a = M.DefaultTagOfPrivateType(3) @@ -113,7 +113,7 @@ module N = let error7a1 { M.DefaultFieldOfRecordTypeWithPrivateRepresentation = x } = x let error7a2 { M.DefaultFieldOfPrivateType = x } = x let error8 x = x.M.DefaultFieldOfPrivateType - let error8a x = x.M.DefaultFieldOfRecordTypeWithPrivateRepresentation + let error8a x = x.M.DefaultFieldOfRecordTypeWithPrivateRepresentation //let error9 x = x.M.PrivateFieldOfPublicType let internal noError41 = M.internalValue @@ -142,7 +142,7 @@ module N = //let private noError79 x = x.M.InternalFieldOfPublicType let noError10 (x:M.PublicRecordType) = () - let noError21 = M.internalValue + let noError21 = M.internalValue let error22 = M.DefaultTagOfInternalType(3) // returning internal type as public value let noError23 = M.Type().InternalProperty let noError24 = M.Type.InternalStaticProperty @@ -152,7 +152,7 @@ module N = let error28 x = x.M.DefaultFieldOfInternalType // accepting internal type as argument to public function //let error29 x = x.M.InternalFieldOfPublicType // returning internal type as argument to public function -type X() = +type X() = member private x.P = 1 member private x.M() = 1 static member private SP = 1 @@ -162,7 +162,7 @@ type X() = static member internal SIP = 1 static member internal SIM() = 1 -type X2 = +type X2 = new() = { f = 1; f2 = 1 } private new (dummy:int) = { f = 1; f2 = 1 } val private f : int @@ -178,7 +178,7 @@ type X2 = static member internal SIM() = 1 -let xx = X() +let xx = X() let xx2 = X2() xx.P // This now gives access error xx.M() // This now gives access error @@ -201,4 +201,4 @@ X2.SIP // no access error X2.SIM() // no access error -let xx3 = X2(2) // should give an access error +let xx3 = X2(2) // should give an access error diff --git a/tests/fsharp/typecheck/sigs/neg16.fs b/tests/fsharp/typecheck/sigs/neg16.fs index 2fa1df8fa03..ec293674963 100644 --- a/tests/fsharp/typecheck/sigs/neg16.fs +++ b/tests/fsharp/typecheck/sigs/neg16.fs @@ -4,25 +4,25 @@ namespace Test open System.Reflection type System.Reflection.MethodInfo with - member mi.Bug() = printf "%A" mi.IsGenericMethod - + member mi.Bug() = printf "%A" mi.IsGenericMethod + module AllowNullLiteralTest = begin //[] - type I = + type I = interface abstract P : int end //[] - type C() = + type C() = member x.P = 1 [] - type D() = + type D() = inherit C() - interface I with + interface I with member x.P = 2 member x.P = 1 @@ -33,26 +33,26 @@ module AllowNullLiteralTest = begin [] // expect an error here type S(c:int) = struct end - + [] // expect an error here - type R = { r : int } - + type R = { r : int } + [] // expect an error here type U = A | B of int - + [] // expect an error here type E = A = 1 | B = 2 - + [] // expect an error here type Del = delegate of int -> int - + [] // expect an error here let x = 1 - + [] // expect an error here let f x = 1 - - + + end module ActivePatternSanityCHeckTests1 = begin @@ -102,7 +102,7 @@ module VolatileFieldSanityChecks = begin [] let x2 = 1 - type C() = + type C() = [] static let sx2 = 1 // expect an error - not mutable diff --git a/tests/fsharp/typecheck/sigs/neg17.fs b/tests/fsharp/typecheck/sigs/neg17.fs index 36802399832..e10420c0872 100644 --- a/tests/fsharp/typecheck/sigs/neg17.fs +++ b/tests/fsharp/typecheck/sigs/neg17.fs @@ -8,38 +8,38 @@ module M = let private privateValue = 1 let internal internalValue = 1 - - type private PrivateUnionType = + + type private PrivateUnionType = | DefaultTagOfPrivateType of int //| private PrivateTagOfPrivateType of int //| internal InternalTagOfPrivateType of int - type UnionTypeWithPrivateRepresentation = + type UnionTypeWithPrivateRepresentation = private | DefaultTagOfUnionTypeWithPrivateRepresentation of int - type private PrivateRecordType = + type private PrivateRecordType = { DefaultFieldOfPrivateType : int } - type RecordTypeWithPrivateRepresentation = + type RecordTypeWithPrivateRepresentation = private { DefaultFieldOfRecordTypeWithPrivateRepresentation : int } - type internal InternalUnionType = + type internal InternalUnionType = | DefaultTagOfInternalType of int //| private PrivateTagOfInternalType of int //| internal InternalTagOfInternalType of int - type internal InternalRecordType = + type internal InternalRecordType = { DefaultFieldOfInternalType : int } let errorPublicValueLaterInferredToInvolvePrivateUnionType = ref [] // escape check: escape via type inference let errorPublicValueLaterInferredToInvolveInternalUnionType = ref [] // escape check: escape via type inference let internal noErrorInternalValueLaterInferredToInvolveInternalUnionType = ref [] // no escape check: escape via type inference - + let private noErrorPrivateValueLaterInferredToInvolvePrivateUnionType = ref [] // escape check: escape via type inference let private noErrorPrivateValueLaterInferredToInvolveInternalUnionType = ref [] // no escape check: escape via type inference - - type Type() = + + type Type() = member private x.PrivateProperty = 3 static member private PrivateStaticProperty = 3 member private x.PrivateMethod() = 3 @@ -53,13 +53,13 @@ module M = // Check we can access private things from this type member x.NoError1 = x.PrivateProperty member x.NoError2 = Type.PrivateStaticProperty - static member NoError3 = Type.PrivateStaticProperty - static member NoError4 = Type.PrivateStaticMethod() + static member NoError3 = Type.PrivateStaticProperty + static member NoError4 = Type.PrivateStaticMethod() member x.NoError1a = x.InternalProperty member x.NoError2a = Type.InternalStaticProperty - static member NoError3a = Type.InternalStaticProperty - static member NoError4a = Type.InternalStaticMethod() + static member NoError3a = Type.InternalStaticProperty + static member NoError4a = Type.InternalStaticMethod() static member Method30() = errorPublicValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)] static member Method31() = errorPublicValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)] @@ -67,51 +67,51 @@ module M = static member Method34() = noErrorPrivateValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)] static member Method35() = noErrorPrivateValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)] - type Type with + type Type with // Check we can access private things from an in-file augmentation member x.NoError51 = x.PrivateProperty member x.NoError52 = Type.PrivateStaticProperty - static member NoError53 = Type.PrivateStaticProperty - static member NoError54 = Type.PrivateStaticMethod() + static member NoError53 = Type.PrivateStaticProperty + static member NoError54 = Type.PrivateStaticMethod() + - module M2 = let private privateValue = 1 let internal internalValue = 1 - - type private PrivateUnionType = + + type private PrivateUnionType = | DefaultTagOfPrivateType of int //| private PrivateTagOfPrivateType of int //| internal InternalTagOfPrivateType of int (* - type private PrivateRecordType = + type private PrivateRecordType = { DefaultFieldOfPrivateType : int } - type internal InternalUnionType = + type internal InternalUnionType = | DefaultTagOfInternalType of int | private PrivateTagOfInternalType of int | internal InternalTagOfInternalType of int - type internal InternalRecordType = + type internal InternalRecordType = { DefaultFieldOfInternalType : int } - type RecordTypeWithPrivateField = - { DefaultFieldOfPublicType : int; - private PrivateFieldOfPublicType : int; - internal InternalFieldOfPublicType : int; + type RecordTypeWithPrivateField = + { DefaultFieldOfPublicType : int; + private PrivateFieldOfPublicType : int; + internal InternalFieldOfPublicType : int; public PublicFieldOfPublicType: int } let errorPublicValueLaterInferredToInvolvePrivateUnionType = ref [] // escape check: escape via type inference let errorPublicValueLaterInferredToInvolveInternalUnionType = ref [] // escape check: escape via type inference let internal noErrorInternalValueLaterInferredToInvolveInternalUnionType = ref [] // no escape check: escape via type inference - + let private noErrorPrivateValueLaterInferredToInvolvePrivateUnionType = ref [] // escape check: escape via type inference let private noErrorPrivateValueLaterInferredToInvolveInternalUnionType = ref [] // no escape check: escape via type inference - - type Type() = + + type Type() = member private x.PrivateProperty = 3 static member private PrivateStaticProperty = 3 member private x.PrivateMethod() = 3 @@ -125,19 +125,19 @@ module M2 = // Check we can access private things from this type member x.NoError1 = x.PrivateProperty member x.NoError2 = Type.PrivateStaticProperty - static member NoError3 = Type.PrivateStaticProperty - static member NoError4 = Type.PrivateStaticMethod() + static member NoError3 = Type.PrivateStaticProperty + static member NoError4 = Type.PrivateStaticMethod() member x.NoError1a = x.InternalProperty member x.NoError2a = Type.InternalStaticProperty - static member NoError3a = Type.InternalStaticProperty - static member NoError4a = Type.InternalStaticMethod() + static member NoError3a = Type.InternalStaticProperty + static member NoError4a = Type.InternalStaticMethod() static member Method30() = errorPublicValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)] static member Method31() = errorPublicValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)] static member Method33() = noErrorInternalValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)] static member Method34() = noErrorPrivateValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfPrivateType(3)] static member Method35() = noErrorPrivateValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)] - + *) - + diff --git a/tests/fsharp/typecheck/sigs/neg17.fsi b/tests/fsharp/typecheck/sigs/neg17.fsi index 2359078f341..a0701451a77 100644 --- a/tests/fsharp/typecheck/sigs/neg17.fsi +++ b/tests/fsharp/typecheck/sigs/neg17.fsi @@ -8,31 +8,31 @@ module M = val private privateValue : int val internal internalValue : int - - type private PrivateUnionType = + + type private PrivateUnionType = | DefaultTagOfPrivateType of int //| private PrivateTagOfPrivateType of int //| internal InternalTagOfPrivateType of int - type UnionTypeWithPrivateRepresentation + type UnionTypeWithPrivateRepresentation - type private PrivateRecordType = + type private PrivateRecordType = { DefaultFieldOfPrivateType : int } - type RecordTypeWithPrivateRepresentation + type RecordTypeWithPrivateRepresentation - type internal InternalUnionType = + type internal InternalUnionType = | DefaultTagOfInternalType of int //| private PrivateTagOfInternalType of int //| internal InternalTagOfInternalType of int - type internal InternalRecordType = + type internal InternalRecordType = { DefaultFieldOfInternalType : int } val internal noErrorInternalValueLaterInferredToInvolveInternalUnionType : InternalUnionType list ref - - - type Type = + + + type Type = new : unit -> Type member internal InternalProperty : int static member internal InternalStaticProperty : int @@ -40,8 +40,8 @@ module M = static member internal InternalStaticMethod: unit -> int module M2 = - val internal privateValue : int // error + val internal privateValue : int // error val private internalValue : int // error - + type internal PrivateUnionType = // error | DefaultTagOfPrivateType of int diff --git a/tests/fsharp/typecheck/sigs/neg17b.fs b/tests/fsharp/typecheck/sigs/neg17b.fs index 066f38cb01c..1dc9f8bb25f 100644 --- a/tests/fsharp/typecheck/sigs/neg17b.fs +++ b/tests/fsharp/typecheck/sigs/neg17b.fs @@ -2,7 +2,7 @@ module Test open Neg17 - + module N = let error1 = M.privateValue let error2a = M.DefaultTagOfPrivateType(3) @@ -44,7 +44,7 @@ module N = //let private noError79 x = x.M.InternalFieldOfPublicType let noError10 (x:M.RecordTypeWithPrivateField) = () - let noError21 = M.internalValue + let noError21 = M.internalValue let error22 = M.DefaultTagOfInternalType(3) // returning internal type as public value let noError23 = M.Type().InternalProperty let noError24 = M.Type.InternalStaticProperty @@ -55,4 +55,3 @@ module N = //let error29 x = x.M.InternalFieldOfPublicType // returning internal type as argument to public function - \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg18.fs b/tests/fsharp/typecheck/sigs/neg18.fs index 69582990fa1..abdf9c16423 100644 --- a/tests/fsharp/typecheck/sigs/neg18.fs +++ b/tests/fsharp/typecheck/sigs/neg18.fs @@ -1,34 +1,34 @@ module Test -module TestSquigglyLocation = +module TestSquigglyLocation = type R = { Sizes : int } let r = { Sizes = 1 } Seq.max r.Sizes module TestSquigglyExists = - let f () = - match box 1 with + let f () = + match box 1 with | :? list<_> -> 3 // this line should give a warning | _ -> 4 -module AmbiguousTypeNameTests = - module TwoAmbiguousGenericTypes = - module M = - type C<'a>() = +module AmbiguousTypeNameTests = + module TwoAmbiguousGenericTypes = + module M = + type C<'a>() = static member P = 1 - type C<'a,'b>() = + type C<'a,'b>() = static member P = 1 let _ = new M.C() // give error - let _ = new M.C() + let _ = new M.C() let _ = M.C() // give warning - let _ = M.C() - let _ = M.C() - let _ = M.C<_>() - let _ = M.C<_,_>() + let _ = M.C() + let _ = M.C() + let _ = M.C<_>() + let _ = M.C<_,_>() let _ = M.C.P // give warning let _ = M.C<_>.P @@ -37,90 +37,90 @@ module AmbiguousTypeNameTests = open M let _ = new C() // give error - let _ = new C() + let _ = new C() let _ = C() // give warning - let _ = C() - let _ = C() - let _ = C<_>() - let _ = C<_,_>() + let _ = C() + let _ = C() + let _ = C<_>() + let _ = C<_,_>() let _ = C.P // give warning let _ = C<_>.P let _ = C<_,_>.P - + // open again for good luck open M let _ = new C() // give error - let _ = new C() + let _ = new C() let _ = C() // give warning - let _ = C() - let _ = C() - let _ = C<_>() - let _ = C<_,_>() + let _ = C() + let _ = C() + let _ = C<_>() + let _ = C<_,_>() let _ = C.P // give warning let _ = C<_>.P let _ = C<_,_>.P - - module OneGenericTypeAndOneNonGenericType = - module M = - type C() = + + module OneGenericTypeAndOneNonGenericType = + module M = + type C() = static member P = 1 - type C<'a>() = + type C<'a>() = static member P = 1 - let _ = new M.C() - let _ = new M.C< >() - let _ = new M.C() - let _ = M.C() - let _ = M.C< >() - let _ = M.C() - let _ = M.C<_>() + let _ = new M.C() + let _ = new M.C< >() + let _ = new M.C() + let _ = M.C() + let _ = M.C< >() + let _ = M.C() + let _ = M.C<_>() - let _ = M.C.P - let _ = M.C< >.P + let _ = M.C.P + let _ = M.C< >.P let _ = M.C<_>.P open M - let _ = new C() - let _ = new C< >() - let _ = new C() - let _ = C() - let _ = C< >() - let _ = C() - let _ = C<_>() + let _ = new C() + let _ = new C< >() + let _ = new C() + let _ = C() + let _ = C< >() + let _ = C() + let _ = C<_>() - let _ = C.P - let _ = C< >.P + let _ = C.P + let _ = C< >.P let _ = C<_>.P - + // open again for good luck open M - let _ = new C() - let _ = new C< >() - let _ = new C() - let _ = C() - let _ = C< >() - let _ = C() - let _ = C<_>() + let _ = new C() + let _ = new C< >() + let _ = new C() + let _ = C() + let _ = C< >() + let _ = C() + let _ = C<_>() - let _ = C.P - let _ = C< >.P + let _ = C.P + let _ = C< >.P let _ = C<_>.P - - module OneNonAmbiguousGenericType = - module M3 = - type C<'a>() = + + module OneNonAmbiguousGenericType = + module M3 = + type C<'a>() = static member P = 1 let _ = new M3.C() // give error - let _ = M3.C() - let _ = M3.C() + let _ = M3.C() + let _ = M3.C() let _ = M3.C.P // give warning let _ = M3.C<_>.P @@ -128,23 +128,23 @@ module AmbiguousTypeNameTests = open M3 let _ = new C() // give error - let _ = C() - let _ = C() + let _ = C() + let _ = C() let _ = C.P // give warning let _ = C<_>.P - + // open again for good luck open M3 new C() // give error - let _ = C() - let _ = C() + let _ = C() + let _ = C() let _ = C.P // give warning let _ = C<_>.P - module ActualRepro1 = + module ActualRepro1 = type Foo<'a>() = member x.f() = () @@ -153,9 +153,9 @@ module AmbiguousTypeNameTests = let foo = Foo() // Foo<'a,b> !!! - module ActualRepro2 = + module ActualRepro2 = - type T<'a>() = + type T<'a>() = static member P = sizeof<'a> member x.M = T.P // expect deprecation warning @@ -164,29 +164,28 @@ module AmbiguousTypeNameTests = printfn "Expected: 8" printfn "Actual: %d" v -module FSharp_1_0_Bug_3183 = - type IIndexable<'T> = +module FSharp_1_0_Bug_3183 = + type IIndexable<'T> = abstract (.[]) : 'T with get, set // expect no warning here let (.[]) x = x // expect warning here -module FSharp_1_0_Bug_2949 = +module FSharp_1_0_Bug_2949 = [] - type T() = - abstract X : unit -> int + type T() = + abstract X : unit -> int abstract X : unit -> decimal // expect duplicate member error here abstract X : unit -> byte // expect duplicate member error here abstract X : unit -> char // expect duplicate member error here abstract X : unit -> float<_> // expect duplicate member error here -module TestWarningGivenOnLessGenericCode = +module TestWarningGivenOnLessGenericCode = let f (x:'a,y:'b) = [x;y] - -module TestWarningGivenOnRecursiveCodeWithDifferentTypeVariableNames = + +module TestWarningGivenOnRecursiveCodeWithDifferentTypeVariableNames = let rec f (x:'a) = g x and g (x:'b) = f x -module TestNoWarningGivenOnRecursiveCodeWithSameTypeVariableNames = +module TestNoWarningGivenOnRecursiveCodeWithSameTypeVariableNames = let rec f (x:'a) = g x and g (x:'a) = f x - - \ No newline at end of file + diff --git a/tests/fsharp/typecheck/sigs/neg19.fs b/tests/fsharp/typecheck/sigs/neg19.fs index ef52895f766..3158026e565 100644 --- a/tests/fsharp/typecheck/sigs/neg19.fs +++ b/tests/fsharp/typecheck/sigs/neg19.fs @@ -1,14 +1,14 @@ module Test // Literal tests -module DecimalLiteralTests = +module DecimalLiteralTests = let literalTooBig = 7.922816252e+28M let literalTooSmall = -7.922816252e+28M -module CheckMisDefinedProperties = begin +module CheckMisDefinedProperties = begin module Test1 = begin - type T() = + type T() = class member this.X5 with get (idx1 : int) (idx2 : int) = 4 // should be rejected by parsing member this.X6 with get (idx1 : int) (idx2 : int) (idx3 : int) = 4 // should be rejected by parsing @@ -16,7 +16,7 @@ module CheckMisDefinedProperties = begin static member SX5 with get (idx1 : int) (idx2 : int) = 4 // should be rejected by parsing static member SX6 with get (idx1 : int) (idx2 : int) (idx3 : int) = 4 // should be rejected by parsing static member SS5 with set (idx1 : int) (idx2 : int) v = 4 // should be rejected by parsing - + end end diff --git a/tests/fsharp/typecheck/sigs/neg20.fs b/tests/fsharp/typecheck/sigs/neg20.fs index 80f4812a7b6..36285d60c5c 100644 --- a/tests/fsharp/typecheck/sigs/neg20.fs +++ b/tests/fsharp/typecheck/sigs/neg20.fs @@ -1,27 +1,27 @@ module Test -type A() = +type A() = member x.P = 1 -type B() = +type B() = inherit A() member x.P = 1 -type B1() = +type B1() = inherit A() member x.P = 1 -type B2() = +type B2() = inherit A() member x.P = 1 - - -type C() = + + +type C() = inherit B() member x.P = 1 module BiGenericStaticMemberTests = - type StaticClass1() = + type StaticClass1() = static member M<'b>(c:'b, d:'b) = 1 let obj = new obj() @@ -31,8 +31,8 @@ module BiGenericStaticMemberTests = StaticClass1.M(str,obj) StaticClass1.M(obj,obj) - StaticClass1.M(obj,str) // obj :> 'b --> obj = 'b - StaticClass1.M(str,obj) // string :> 'b --> string = 'b + StaticClass1.M(obj,str) // obj :> 'b --> obj = 'b + StaticClass1.M(str,obj) // string :> 'b --> string = 'b module BiGenericFunctionTests = let M<'b>(c:'b, d:'b) = 1 @@ -44,19 +44,19 @@ module BiGenericFunctionTests = M(str,obj) M(obj,obj) - M(obj,str) // obj :> 'b --> obj = 'b - M(str,obj) // string :> 'b --> string = 'b + M(obj,str) // obj :> 'b --> obj = 'b + M(str,obj) // string :> 'b --> string = 'b -module NoSubsumptionOnApplication = +module NoSubsumptionOnApplication = (fun (x:A) -> 1) (new B()) // now permitted (fun (x:System.ValueType) -> 1) 1 // coercion on application! -module NoSubsumptionForLists = - type StaticClass2() = +module NoSubsumptionForLists = + type StaticClass2() = static member DisplayControls(controls: A list) = () - + let v21 = [ new B(); new A() ] let v22 = [ new B1(); new B2() ] let v2b = [ new C(); new B() ] @@ -91,17 +91,17 @@ module NoSubsumptionForLists = // Q. subsumption on 'let v = expr'? Allowed let x76 : A = new B() -module NoSubsumptionForLists2 = +module NoSubsumptionForLists2 = - let d1 = new B() :: new A() :: [] - let d2 = new A() :: new B() :: [] + let d1 = new B() :: new A() :: [] + let d2 = new A() :: new B() :: [] - let v2a = [ new B(); new A() ] // would not work! - // cf. let v2b = [ (new B() :> A); new A() ] + let v2a = [ new B(); new A() ] // would not work! + // cf. let v2b = [ (new B() :> A); new A() ] type Data = Data of A * A let data (x,y) = Data (x,y) - let pAA = (new A(),new A()) + let pAA = (new A(),new A()) let pBB = (new B(),new B()) let pAB = (new A(),new B()) let pBA = (new B(),new A()) @@ -112,14 +112,14 @@ module NoSubsumptionForLists2 = pAB |> data // permitted pBA |> data // permitted -module BiGenericMethodsInGenericClassTests = +module BiGenericMethodsInGenericClassTests = type C<'a>() = static member M(x:'a) = 1 static member M2<'b>(x:'b) = 1 static member M3<'b>(x:'b,y:'b) = 1 - + static member OM3<'b>(x:'b,y:'b) = 1 - + static member OM3<'b>(x:'b,y:int) = 1 let obj = new obj() @@ -133,16 +133,16 @@ module BiGenericMethodsInGenericClassTests = -module BadNumberOfGenericParameters = +module BadNumberOfGenericParameters = - type C<'a>() = + type C<'a>() = member x.P = 1 member x.M1() = 2 member x.M2(y:int) = 2 member x.M3(y:int,z:int) = 2 member x.M4<'b>(y:'a,z:'b) = 2 member x.M5<'b,'c>(y:'a,z:'b) = 2 - + static member SP = 1 static member SM1() = 2 static member SM2(y:int) = 2 @@ -166,15 +166,15 @@ module BadNumberOfGenericParameters = let _ = c.M4(y=3,z=4) // expect error here let _ = c.M5(y=3,z=4) // expect error here - module PositiveTests = + module PositiveTests = let _ = C.SM4(y=3,z=4) // expect NO NO NO NO NO error here let _ = C.SM4(y=3,z=4) // expect NO NO NO NO NO error here let _ = C.SM5(y=3,z=4) // expect NO NO NO NO NO error here let _ = c.M4(y=3,z=4) // expect NO NO NO NO NO error here let _ = c.M4(y=3,z=4) // expect NO NO NO NO NO error here let _ = c.M5(y=3,z=4) // expect NO NO NO NO NO error here - - + + module ParamArgs = begin type C2() = class static member M( fmt:string, [] args : int[]) = System.String.Format(fmt,args) @@ -243,13 +243,13 @@ module BadAttribute = begin [] type C4() = class end - - type C5 = - class - [] val x : int + + type C5 = + class + [] val x : int end - + type C6() = class end [] @@ -268,7 +268,7 @@ module BadAttribute = begin [] let T14 = 1 - [] + [] let T15 = 1 end @@ -284,7 +284,7 @@ module DuplicateArgNames = begin let f1 x x = () let f2 x _ x = () - type C() = + type C() = member x.M(x:int) = x + x end @@ -340,14 +340,14 @@ type ClassWithOneConstructor(x:int) = member x.P = 1 let ss3 = ClassWithOneConstructor -module OverloadedTypeNamesBothHaveConstructors = - type OverloadedClassName<'T>(x:int) = +module OverloadedTypeNamesBothHaveConstructors = + type OverloadedClassName<'T>(x:int) = new (y:string) = OverloadedClassName<'T>(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T1,'T2>(x:int) = + type OverloadedClassName<'T1,'T2>(x:int) = new (y:string) = OverloadedClassName<'T1,'T2>(1) member __.P = x static member S() = 3 @@ -356,14 +356,14 @@ module OverloadedTypeNamesBothHaveConstructors = let t3s = "3" |> OverloadedClassName // expected error - multiple types exist -module OverloadedTypeNamesSomeConstructors = - type OverloadedClassName<'T>(x:int) = +module OverloadedTypeNamesSomeConstructors = + type OverloadedClassName<'T>(x:int) = new (y:string) = OverloadedClassName<'T>(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T1,'T2> = + type OverloadedClassName<'T1,'T2> = member __.P = 1 static member S() = 3 @@ -372,11 +372,11 @@ module OverloadedTypeNamesSomeConstructors = let t2s = "3" |> OverloadedClassName // CHANGE IN ERROR MESSAGE IN F# 4.x: Was "Invalid use of a type name", now "No constructors are available for the type 'OverloadedClassName<'a,'b>'" let t3s = "3" |> OverloadedClassName // expected error - multiple types exist -module OverloadedTypeNamesNoConstructors = - type OverloadedClassName<'T> = +module OverloadedTypeNamesNoConstructors = + type OverloadedClassName<'T> = static member S(x:int) = 3 - type OverloadedClassName<'T1,'T2> = + type OverloadedClassName<'T1,'T2> = static member S(x:int) = 3 let t3 = 3 |> OverloadedClassName.S // expected error - multiple types exist @@ -387,20 +387,20 @@ module OverloadedTypeNamesNoConstructors = -module OverloadedTypeNamesIncludingNonGenericTypeBothHaveConstructors = +module OverloadedTypeNamesIncludingNonGenericTypeBothHaveConstructors = - type OverloadedClassName(x:int) = + type OverloadedClassName(x:int) = new (y:string) = OverloadedClassName(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T>(x:int) = + type OverloadedClassName<'T>(x:int) = new (y:string) = OverloadedClassName<'T>(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T1,'T2>(x:int) = + type OverloadedClassName<'T1,'T2>(x:int) = new (y:string) = OverloadedClassName<'T1,'T2>(1) member __.P = x static member S() = 3 @@ -409,19 +409,19 @@ module OverloadedTypeNamesIncludingNonGenericTypeBothHaveConstructors = let t3s = "3" |> OverloadedClassName // expected error - multiple types exist -module OverloadedTypeNamesIncludingNonGenericTypeSomeConstructors = - type OverloadedClassName(x:int) = +module OverloadedTypeNamesIncludingNonGenericTypeSomeConstructors = + type OverloadedClassName(x:int) = new (y:string) = OverloadedClassName(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T>(x:int) = + type OverloadedClassName<'T>(x:int) = new (y:string) = OverloadedClassName<'T>(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T1,'T2> = + type OverloadedClassName<'T1,'T2> = member __.P = 1 static member S() = 3 @@ -430,14 +430,14 @@ module OverloadedTypeNamesIncludingNonGenericTypeSomeConstructors = let t2s = "3" |> OverloadedClassName // CHANGE IN ERROR MESSAGE IN F# 4.x: Was "Invalid use of a type name", now "No constructors are available for the type 'OverloadedClassName<'a,'b>'" let t3s = "3" |> OverloadedClassName // expected error - multiple types exist -module OverloadedTypeNamesIncludingNonGenericTypeNoConstructors = - type OverloadedClassName = +module OverloadedTypeNamesIncludingNonGenericTypeNoConstructors = + type OverloadedClassName = static member S(x:int) = 3 - type OverloadedClassName<'T> = + type OverloadedClassName<'T> = static member S(x:int) = 3 - type OverloadedClassName<'T1,'T2> = + type OverloadedClassName<'T1,'T2> = static member S(x:int) = 3 let t3 = 3 |> OverloadedClassName.S // NO ERROR EXPECTED @@ -459,13 +459,13 @@ module InterfacesOfMeasureAnnotatedTypes = inherit IEquatable<'T> type Prim() = - interface IComparable with + interface IComparable with member x.CompareTo(y) = 0 - interface IDerivedComparable with + interface IDerivedComparable with member x.CompareTo(y) = 0 - interface IDerivedEquatable with + interface IDerivedEquatable with member x.Equals(y) = true - interface IRandomOtherInterface with + interface IRandomOtherInterface with member x.M(y) = y override x.Equals(y) = true override x.GetHashCode() = 0 diff --git a/tests/fsharp/typecheck/sigs/neg23.fs b/tests/fsharp/typecheck/sigs/neg23.fs index 1ec74e6163e..5f547e6d355 100644 --- a/tests/fsharp/typecheck/sigs/neg23.fs +++ b/tests/fsharp/typecheck/sigs/neg23.fs @@ -3,9 +3,9 @@ module Test module DuplicateOverloadUpToErasure1 = begin type SomeClass() = - + member this.Foo (x:int->int) = printfn "method 1" - + member this.Foo (x:FSharpFunc) = printfn "method 2" end @@ -13,78 +13,78 @@ end module DuplicateOverloadUpToErasure2 = begin type SomeClass() = - + member this.Foo (x:'a->int) = printfn "method 1" - + member this.Foo (x:FSharpFunc<'b,int>) = printfn "method 2" end module DuplicateOverloadUpToErasure3 = begin type SomeClass() = - + member this.Foo (x:int*int) = printfn "method 1" - + member this.Foo (x:System.Tuple) = printfn "method 2" end module DuplicateOverloadUpToErasure4 = begin type SomeClass() = - + member this.Foo (x:int*int*int*int*int*int*int*int*int) = printfn "method 1" - + member this.Foo (x:System.Tuple>>) = printfn "method 2" end - + module DuplicateOverloadUpToErasure5 = begin type SomeClass() = - + member this.Foo (x:int*int*int*int*int*int*int) = printfn "method 1" - + member this.Foo (x:System.Tuple>) = printfn "method 2" end - + module NotAnyMoreDuplicateOverloadUpToErasure6 = begin // This is not the same IL type, not a duplicate type SomeClass() = - + member this.Foo (x:nativeptr) = printfn "method 1" - + member this.Foo (x:nativeint) = printfn "method 2" end module NotAnyMoreDuplicateOverloadUpToErasure7 = begin // This is not the same IL type, not a duplicate type SomeClass() = - + member this.Foo (x:(int*int)*int*(int*nativeptr)*int*int) = printfn "method 1" - + member this.Foo (x:System.Tuple,int,System.Tuple,int,int>) = printfn "method 2" end -module TestPrivateInheritance1 = +module TestPrivateInheritance1 = type private IA = interface abstract M : int -> int end - type C() = - interface IA with + type C() = + interface IA with member obj.M(x) = x + 1 -module TestPrivateInheritance2 = +module TestPrivateInheritance2 = type private IA = interface abstract M : int -> int end - type IB = - inherit IA + type IB = + inherit IA -module TestCurriedMemberRestrictions = +module TestCurriedMemberRestrictions = [] - type C() = + type C() = member x.X0 () () = 1 member x.X0 (a1,a2) (a3:int) = 1 member x.X01 a b = 1 member x.X01 (a1,a2,a3) = 1 - + member x.X02 a ([] b) = 1 member x.X03 a ([] b) = 1 @@ -92,7 +92,7 @@ module TestCurriedMemberRestrictions = abstract X04 : int -> int -> int abstract X04 : int * int -> int -> int - + // positive test - no error expected here abstract X1 : int -> int -> int default x.X1 a b = a + b @@ -100,26 +100,26 @@ module TestCurriedMemberRestrictions = // positive test - no error expected here abstract X2 : int * int -> int default x.X2 (a1,a3) = 1//(fun b -> 1) - + // positive test - no error expected here abstract X4 : int -> int * int * int -> int default x.X4 a (b1,b2,b3) = 1 - type T1() = + type T1() = member this.F(a, b) = () member this.F a b = () - type T2() = + type T2() = member this.F a b = () member this.F(a, b) = () -module PositiveTests = - module CurriedMember = +module PositiveTests = + module CurriedMember = type C() = member x.P = 1 - member x.M1 a b = a + b + member x.M1 a b = a + b member x.M2 (a,b) c = a + b + c - + let c = C() // positive test - no error expected here @@ -132,13 +132,13 @@ module PositiveTests = let y2 : int -> int = c.M2 (3,4) let y3 : int * int -> int -> int = c.M2 - module CurriedExtensionMember = + module CurriedExtensionMember = type C() = member x.P = 1 - - module M = - type C with - member x.M1 a b = a + b + + module M = + type C with + member x.M1 a b = a + b member x.M2 (a,b) c = a + b + c open M @@ -148,22 +148,22 @@ module PositiveTests = // positive test - no error expected here let x1 : int = c.M1 3 4 let x2 : int -> int = c.M1 3 - let x3 : int -> int -> int = c.M1 - + let x3 : int -> int -> int = c.M1 + // positive test - no error expected here let y1 : int = c.M2 (3,4) 4 let y2 : int -> int = c.M2 (3,4) let y3 : int * int -> int -> int = c.M2 -type Frame = - class +type Frame = + class end module X = type Frame with member frame.GroupRowsBy(key) = () member frame.GroupRowsBy(key) = () - + // Up to erasure member this.Foo (x:int->int) = printfn "method 1" member this.Foo (x:FSharpFunc) = printfn "method 2" diff --git a/tests/fsharp/typecheck/sigs/neg24.fs b/tests/fsharp/typecheck/sigs/neg24.fs index 293f2f91430..0a0853d3ff1 100644 --- a/tests/fsharp/typecheck/sigs/neg24.fs +++ b/tests/fsharp/typecheck/sigs/neg24.fs @@ -7,9 +7,9 @@ let test2 (v : Expr<'a> -> Expr<'b>) = <@ fun (i: 'a) -> %v <@i@> @> let test (v : 'a -> Expr<'b>) = <@ fun (i: 'a) -> %(v i) @> -module OldNegative = +module OldNegative = let v1 = [ if true then 1 else 2 ] // no longer an error or warning - let v2 = [ if true then () else () ] // no longer an error or warning + let v2 = [ if true then () else () ] // no longer an error or warning let v6 = [ if true then () ] // no longer an error or warning let a1 = [| if true then 1 else 2 |] // no longer an error or warning let a2 = [| if true then () else () |] // no longer an error or warning @@ -17,31 +17,31 @@ module OldNegative = let s3 = seq { (if true then 1 else 2) } // no longer an error or warning // expect no warning -module Positive = - let v3 = [ (if true then 1 else 2) ] - let v4 = [ if true then yield 1 else yield 2 ] - let v5 = [ if true then yield 1 ] - let a3 = [| (if true then 1 else 2) |] - let a4 = [| if true then yield 1 else yield 2 |] - let a5 = [| if true then yield 1 |] - let s2 = seq { if true then () else () } - let s6 = seq { if true then () } +module Positive = + let v3 = [ (if true then 1 else 2) ] + let v4 = [ if true then yield 1 else yield 2 ] + let v5 = [ if true then yield 1 ] + let a3 = [| (if true then 1 else 2) |] + let a4 = [| if true then yield 1 else yield 2 |] + let a5 = [| if true then yield 1 |] + let s2 = seq { if true then () else () } + let s6 = seq { if true then () } let s4 = seq { if true then yield 1 else yield 2 } let s5 = seq { if true then yield 1 } -module BadCurriedExtensionMember = +module BadCurriedExtensionMember = type C() = member x.P = 1 - - module M1 = - type C with - member x.M1 a b = a + b + + module M1 = + type C with + member x.M1 a b = a + b member x.M2 (a,b) c = a + b + c - module M2 = - type C with - member x.M1 a b = a + b + module M2 = + type C with + member x.M1 a b = a + b member x.M2 (a,b) c = a + b + c open M1 @@ -54,8 +54,8 @@ module BadCurriedExtensionMember = // negative test - error expected here let x2 : int -> int = c.M1 3 // negative test - error expected here - let x3 : int -> int -> int = c.M1 - + let x3 : int -> int -> int = c.M1 + // negative test - error expected here let y1 : int = c.M2 (3,4) 4 // negative test - error expected here @@ -63,133 +63,133 @@ module BadCurriedExtensionMember = // negative test - error expected here let y3 : int * int -> int -> int = c.M2 -type C() = +type C() = member x.M(abc:int,def:string) = abc + def.Length // Check that the error for a named argument/setter that does not exist is located in a good place let _ = C().M(qez=3) -module ListPositive2 = +module ListPositive2 = // In this example, implicit yield is enabled because there is no explicit 'yield' let v3 = - [ if true then 1 else 2 ] + [ if true then 1 else 2 ] // In this example, implicit yield is enabled because there is no explicit 'yield'. // When using implicit yield, statements are detected via a type-directed rule which tries // checks the statement without an expected type and then checks if the type of the resulting // expression has type 'unit'. - let v3a = + let v3a = [ printfn "hello" if true then 1 else 2 // implicit yield enabled - ] + ] // In this example, implicit yield is enabled even though there is an explicit 'yield!' // This is because using 'yield!' is the only way to yield anything - let v3b = + let v3b = [ printfn "hello" - if true then 1 else 2 - yield! [] ] + if true then 1 else 2 + yield! [] ] // This example checks subsumption is permitted when using implicit yield - let v3c : obj list = + let v3c : obj list = [ printfn "hello" - if true then 1 else obj() ] + if true then 1 else obj() ] // Another check that implicit yield is enabled , even though there is a `yield!` - let v3d = - [ if true then 1 else 2 - yield! [] ] + let v3d = + [ if true then 1 else 2 + yield! [] ] // Another check that implicit yield is enabled , even though there is a `yield!` - let v3e = - [ yield! [] - if true then 1 else 2 - ] + let v3e = + [ yield! [] + if true then 1 else 2 + ] // Another check that implicit yield is enabled - let v3f = - [ if true then + let v3f = + [ if true then printfn "hello" 1 - else - 2 ] + else + 2 ] // Another check that implicit yield is enabled - let v3g = - [ if true then + let v3g = + [ if true then 1 else printfn "hello" - 2 ] + 2 ] // Another check that implicit yield is enabled - let v3h = - [ for i in 1 .. 10 do + let v3h = + [ for i in 1 .. 10 do 10 - printfn "hello" ] + printfn "hello" ] // Another check that implicit yield is enabled let v5 = - [ if true then 1 ] + [ if true then 1 ] // Another check that implicit yield is enabled - let v5a = + let v5a = [ printfn "hello"; - if true then 1 ] + if true then 1 ] // Another check that implicit yield is enabled let v5b = - [ if true then + [ if true then printfn "hello" - 1 - ] + 1 + ] -module ArrayPositive2 = - let a3 = - [| (if true then 1 else 2) |] // simple single element sequence +module ArrayPositive2 = + let a3 = + [| (if true then 1 else 2) |] // simple single element sequence - let a5 = - [| if true then 1 |] + let a5 = + [| if true then 1 |] - let l10 = + let l10 = [ printfn "hello"; yield 1; yield 2 ] // expect ok - the printfn has type unit and is not interpreted as a yield - + // simple case of explicit yield - let l12 : int list = + let l12 : int list = [ printfn "hello" - if true then yield 1 else yield 2 ] + if true then yield 1 else yield 2 ] // check subsumption is allowed when using explicit yield - let l13 : obj list = + let l13 : obj list = [ printfn "hello" - if true then yield 1 else yield 2 ] + if true then yield 1 else yield 2 ] // check subsumption is allowed when using explicit yield - let l14 : obj list = + let l14 : obj list = [ printfn "hello" - if true then yield 1 ] + if true then yield 1 ] + +module SeqPositive2 = + let s2 = + seq { if true then () else () } -module SeqPositive2 = - let s2 = - seq { if true then () else () } + let s6 = + seq { if true then () } - let s6 = - seq { if true then () } - - let s4 = + let s4 = seq { if true then 1 else 2 } - let s6 = + let s6 = seq { if true then 1 } - - let s7 = + + let s7 = seq { match 1 with 1 -> 4 | 2 -> 5 | 3 -> 6 | _ -> () } - -module BuilderPositive2 = + +module BuilderPositive2 = type L<'T> = { Make: (unit -> 'T list) } let L f = { Make = f } - type ListBuilder() = + type ListBuilder() = member __.Combine(x1: L<'T>, x2: L<'T>) = L(fun () -> x1.Make() @ x2.Make()) member __.Delay(f: unit -> L<'T>) = L(fun () -> f().Make()) member __.Zero() = L(fun () -> []) @@ -205,26 +205,26 @@ module BuilderPositive2 = let v3y = list { if true then yield 1 else yield 2 } // equivalent explicit yield - let v3a = + let v3a = list { printfn "hello" if true then 1 else 2 // implicit yield enabled } - let v3ay = + let v3ay = list { printfn "hello" - if true then yield 1 else yield 2 // equivalent explicit yield + if true then yield 1 else yield 2 // equivalent explicit yield } - let v3b = + let v3b = list { printfn "hello" if true then 1 else 2 // implicit yield, even though there is a `yield!` yield! empty } - let v3bc = + let v3bc = list { printfn "hello" if true then yield 1 else yield 2 // equivalent explicit yield @@ -243,80 +243,80 @@ module BuilderPositive2 = - let v3d = + let v3d = list { if true then 1 else 2 // implicit yield enabled , even though there is a `yield!` yield! empty } - let v3dy = + let v3dy = list { if true then yield 1 else yield 2 // equivalent explicit yield yield! empty } - let v3e = + let v3e = list { yield! empty if true then 1 else 2 // implicit yield enabled , even though there is a `yield!` } - let v3f = - list { - if true then + let v3f = + list { + if true then printfn "hello" 1 - else 2 + else 2 } - let v3g = + let v3g = list { - if true then + if true then 1 else printfn "hello" - 2 + 2 } let v5 = list { - if true then 1 + if true then 1 } - let v5a = + let v5a = list { printfn "hello"; - if true then 1 + if true then 1 } let v5b = list { - if true then + if true then printfn "hello" - 1 + 1 } -module ListNegative2 = +module ListNegative2 = let v4 = [ if true then 1 else yield 2 ] // expect warning about "1" being ignored. There is a 'yield' so statements are statements. let l11 = [ 4; yield 1; yield 2 ] // expect warning about "1" being ignored. There is a 'yield' so statements are statements. let l9 = [ printfn "hello"; 1; 2 ] // Note, this is interpreted as a "SimpleSemicolonSequence", so we get "All elements of a list must be implicitly convertible to the type of the first element, which here is 'unit'. This element..." - let v3a : unit list = + let v3a : unit list = [ printfn "hello" - if true then 1 else 2 ] + if true then 1 else 2 ] -module ArrayNegative2 = +module ArrayNegative2 = let a4 = [| if true then 1 else yield 2 |] // expect warning about "1" being ignored. There is a 'yield' so statements are statements. - let a4 = [| (if true then 1) |] + let a4 = [| (if true then 1) |] -module SeqNegative2 = +module SeqNegative2 = let s5 = seq { if true then 1 else yield 2 } // expect warning about "1" being ignored. There is a 'yield' so statements are statements. let s8 = seq { match 1 with 1 -> 4 | 2 -> 5 | 3 -> yield 6 | _ -> () } // expect warning about "4" being ignored. There is a 'yield' so statements are statements. -module BuilderNegative2 = +module BuilderNegative2 = type L<'T> = { Make: (unit -> 'T list) } let L f = { Make = f } - type ListBuilder() = + type ListBuilder() = member __.Combine(x1: L<'T>, x2: L<'T>) = L(fun () -> x1.Make() @ x2.Make()) member __.Delay(f: unit -> L<'T>) = L(fun () -> f().Make()) member __.Zero() = L(fun () -> []) @@ -325,15 +325,15 @@ module BuilderNegative2 = let list = ListBuilder() - let v3c : L = + let v3c : L = list { printfn "hello" - if true then 1 else obj() - } + if true then 1 else obj() + } - let v3c : L = + let v3c : L = list { printfn "hello" - if true then yield 1 else obj() - } + if true then yield 1 else obj() + } diff --git a/tests/fsharp/typecheck/sigs/neg25.fs b/tests/fsharp/typecheck/sigs/neg25.fs index 5cdb6308f2d..f91b27f4735 100644 --- a/tests/fsharp/typecheck/sigs/neg25.fs +++ b/tests/fsharp/typecheck/sigs/neg25.fs @@ -1,8 +1,8 @@ module Test -module NegativeTests = +module NegativeTests = - module Test1 = + module Test1 = type ITest = abstract member Meth1: string -> string @@ -12,14 +12,14 @@ module NegativeTests = [] type Partial() = // This should give an error - Meth1 is not implemented - interface ITestSub with + interface ITestSub with override this.Meth2 x = x + 1 - type ErroneousComplete () = + type ErroneousComplete () = inherit Partial() - module Test2 = + module Test2 = type ITest = abstract member Meth1: string -> string @@ -35,10 +35,10 @@ module NegativeTests = type ErroneousComplete () = inherit Partial() abstract Meth1 : string -> string - override x.Meth1(s) = s + override x.Meth1(s) = s -module NegativeTestsActualRepro1 = +module NegativeTestsActualRepro1 = open System [] @@ -76,7 +76,7 @@ module NegativeTestsActualRepro1 = let foo = TestVariableLevelEnumeratorFactory Seq.empty // Surely I can't do this at compile time? -module NegativeTestsActualRepro3 = +module NegativeTestsActualRepro3 = open System type IThing = @@ -88,9 +88,9 @@ module NegativeTestsActualRepro3 = member x.Action = [("bites", fun () -> printfn "ouch")] type MyDog() = // expect an error here - Name not implemented - inherit Dog() + inherit Dog() -module AnotherNegativeTest = +module AnotherNegativeTest = type ITest = abstract member Meth1: int -> int @@ -112,8 +112,8 @@ module AnotherNegativeTest = module Throwaway = let foo = OkComplete() -module MissingInterfaceMemberTests = - module Test0 = +module MissingInterfaceMemberTests = + module Test0 = type ITest = abstract member Meth1: string -> string @@ -123,7 +123,7 @@ module MissingInterfaceMemberTests = [] type Partial() = - interface ITestSub + interface ITestSub type OkComplete () = inherit Partial() @@ -134,7 +134,7 @@ module MissingInterfaceMemberTests = module Throwaway = let foo = OkComplete() - module Test1 = + module Test1 = type ITest = abstract member Meth1: string -> string @@ -158,7 +158,7 @@ module MissingInterfaceMemberTests = let foo = OkComplete() - module Test3 = + module Test3 = type ITest = abstract member Meth1: string -> string @@ -180,11 +180,11 @@ module MissingInterfaceMemberTests = - module NegativeTestsActualRepro2 = - type IEvent<'del,'a> = + module NegativeTestsActualRepro2 = + type IEvent<'del,'a> = abstract Add : ('a -> unit) -> unit abstract Add2 : ('a -> unit) -> unit - + [] type wire<'a>() = abstract Send : 'a -> unit @@ -194,13 +194,13 @@ module MissingInterfaceMemberTests = let createWire() = let listeners = ref [] in - {new wire<'a>() with - member obj.Send(x) = List.iter (fun f -> f x) !listeners + {new wire<'a>() with + member obj.Send(x) = List.iter (fun f -> f x) !listeners member obj.Listen(f) = listeners := f :: !listeners } - module NegativeTestsActualRepro4 = + module NegativeTestsActualRepro4 = open System type IThing = @@ -208,8 +208,8 @@ module MissingInterfaceMemberTests = abstract Action: List< string * (unit -> unit) > [] type Dog() = // Expect an error here - Name not implemented - interface IThing with + interface IThing with member x.Action = [("bites", fun () -> printfn "ouch")] - let MyDog() = { new Dog() with member x.ToString() = "2" } + let MyDog() = { new Dog() with member x.ToString() = "2" } diff --git a/tests/fsharp/typecheck/sigs/neg26.fs b/tests/fsharp/typecheck/sigs/neg26.fs index a9b8a21bfe0..2b40808529c 100644 --- a/tests/fsharp/typecheck/sigs/neg26.fs +++ b/tests/fsharp/typecheck/sigs/neg26.fs @@ -1,21 +1,21 @@ module Test -module ObjectExpressionNegativeTests = +module ObjectExpressionNegativeTests = - module Test1 = + module Test1 = type ITest = abstract member Meth1: string -> string type ITestSub = - inherit ITest + inherit ITest abstract member Meth2: int -> int - let ErroneousComplete () = + let ErroneousComplete () = { new ITestSub with member x.Meth2(y) = 2 } // This should give an error - Meth1 is not implemented - module Test2 = + module Test2 = type ITest = abstract member Meth1: string -> string @@ -24,10 +24,10 @@ module ObjectExpressionNegativeTests = abstract member Meth2: int -> int let ErroneousComplete () = - { new ITestSub with override x.Meth1(s:string) = s } // Expect an error here - - -module AnotherObjectExpressionTest = + { new ITestSub with override x.Meth1(s:string) = s } // Expect an error here + + +module AnotherObjectExpressionTest = type ITest = abstract member Meth1: int -> int @@ -36,11 +36,11 @@ module AnotherObjectExpressionTest = abstract member Meth1: int -> int let Partial() = - { new ITestSub with // Expect an error here + { new ITestSub with // Expect an error here override this.Meth1 (x:int) = x } - -module YetAnotherObjectExpressionTest = + +module YetAnotherObjectExpressionTest = type ITest = abstract member Meth1: int -> int diff --git a/tests/fsharp/typecheck/sigs/neg29.fs b/tests/fsharp/typecheck/sigs/neg29.fs index ba18f59327f..565633ed62a 100644 --- a/tests/fsharp/typecheck/sigs/neg29.fs +++ b/tests/fsharp/typecheck/sigs/neg29.fs @@ -1,6 +1,6 @@ module Test // Some syntax tests -module MultiLineTypeParameterNegativeTests = +module MultiLineTypeParameterNegativeTests = type C4err<'T 'U>() = // Expect syntax error if comma omitted diff --git a/tests/fsharp/typecheck/sigs/neg30.fs b/tests/fsharp/typecheck/sigs/neg30.fs index a427d47501c..3ea831ffbbe 100644 --- a/tests/fsharp/typecheck/sigs/neg30.fs +++ b/tests/fsharp/typecheck/sigs/neg30.fs @@ -33,7 +33,7 @@ type SGeneric<'T> = val s : int type FSharpUnion = -| XA +| XA | XB | XC @@ -64,14 +64,14 @@ let _ = new C() // Error let _ = new C>() // Error -type CompilerMessageTest() = - [] +type CompilerMessageTest() = + [] member x.P = 1 let test = CompilerMessageTest().P -type CompilerMessageTest2() = +type CompilerMessageTest2() = [] member x.P = 1 diff --git a/tests/fsharp/typecheck/sigs/neg31.fs b/tests/fsharp/typecheck/sigs/neg31.fs index 42d7de0bffb..08355f389ce 100644 --- a/tests/fsharp/typecheck/sigs/neg31.fs +++ b/tests/fsharp/typecheck/sigs/neg31.fs @@ -1,6 +1,6 @@ module Neg31 -module ValAttributesDifferent = +module ValAttributesDifferent = // expect no warning, and attribute to be in compiled code [] let x1 = 1 @@ -19,7 +19,7 @@ module ValAttributesDifferent = -module TyconAttributesDifferent = +module TyconAttributesDifferent = // expect no warning, and attribute to be in compiled code [] type C1 = A | B @@ -37,55 +37,55 @@ module TyconAttributesDifferent = type C4 = A | B -module ModuleAttributesDifferent = +module ModuleAttributesDifferent = // expect no warning, and attribute to be in compiled code [] - module M1 = + module M1 = let x = 1 // expect warning, and attribute from signature to be included [] - module M2 = + module M2 = let x = 1 // expect no warning, and attribute to be in compiled code [] - module M3 = + module M3 = let x = 1 // expect no warning, and attribute to be in compiled code //[] - module M4 = + module M4 = let x = 1 -module UnionCaseAttributesDifferent = +module UnionCaseAttributesDifferent = // expect no warning, and attribute to be in compiled code - type U1 = + type U1 = | [] A of int | B of string // expect warning, and attribute from signature to be included - type U2 = + type U2 = | [] A of int | B of string // expect no warning, and attribute to be in compiled code - type U3 = + type U3 = | [] A of int | B of string // expect no warning, and attribute to be in compiled code - type U4 = + type U4 = | //[] A of int | B of string -module ParamAttributesDifferent = - +module ParamAttributesDifferent = + // identical in signature and implementation let x1 ([] p : int) = p @@ -98,8 +98,8 @@ module ParamAttributesDifferent = // in signature but not implementation let x4 ((* [] *) p : int) = p -module TypeParamAttributesDifferent = - +module TypeParamAttributesDifferent = + // identical in signature and implementation let x1<[] 'T>(x:'T) = x @@ -113,4 +113,3 @@ module TypeParamAttributesDifferent = let x4<(* [] *) 'T>(x:'T) = x - \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg31.fsi b/tests/fsharp/typecheck/sigs/neg31.fsi index 8ed343b31e8..be519502195 100644 --- a/tests/fsharp/typecheck/sigs/neg31.fsi +++ b/tests/fsharp/typecheck/sigs/neg31.fsi @@ -1,6 +1,6 @@ module Neg31 -module ValAttributesDifferent = +module ValAttributesDifferent = [] val x1 : int @@ -13,7 +13,7 @@ module ValAttributesDifferent = [] val x4 : int -module TyconAttributesDifferent = +module TyconAttributesDifferent = [] type C1 = A | B @@ -26,50 +26,50 @@ module TyconAttributesDifferent = [] type C4 = A | B -module ModuleAttributesDifferent = +module ModuleAttributesDifferent = [] - module M1 = + module M1 = val x : int [] - module M2 = + module M2 = val x : int //[] - module M3 = + module M3 = val x : int [] - module M4 = + module M4 = val x : int -module UnionCaseAttributesDifferent = +module UnionCaseAttributesDifferent = // expect no warning, and attribute to be in compiled code - type U1 = + type U1 = | [] A of int | B of string // expect warning, and attribute from signature to be included - type U2 = + type U2 = | [] A of int | B of string // expect no warning, and attribute to be in compiled code - type U3 = + type U3 = // [] | A of int | B of string // expect no warning, and attribute to be in compiled code - type U4 = + type U4 = | [] A of int | B of string -module ParamAttributesDifferent = - +module ParamAttributesDifferent = + // identical in signature and implementation val x1 : [] p : int -> int @@ -82,8 +82,8 @@ module ParamAttributesDifferent = // in signature but not implementation val x4 : [] p : int -> int -module TypeParamAttributesDifferent = - +module TypeParamAttributesDifferent = + // identical in signature and implementation val x1< [] 'T> : 'T -> 'T diff --git a/tests/fsharp/typecheck/sigs/neg32.fs b/tests/fsharp/typecheck/sigs/neg32.fs index 915336d7eb5..6fd94730228 100644 --- a/tests/fsharp/typecheck/sigs/neg32.fs +++ b/tests/fsharp/typecheck/sigs/neg32.fs @@ -1,27 +1,27 @@ module Neg32 module IncorrectAttributeUsage = - type DontPressThisButtonAttribute = - class + type DontPressThisButtonAttribute = + class inherit System.Attribute - val v: string - val mutable someOtherField: string - member x.SomeOtherField - with get() = x.someOtherField + val v: string + val mutable someOtherField: string + member x.SomeOtherField + with get() = x.someOtherField and set(v:string) = x.someOtherField <- v member x.Message = x.v new(s:string) = { inherit System.Attribute(); v=s; someOtherField="" } end - type C = - class + type C = + class [] val mutable mf3 : int end -module Bug5680 = +module Bug5680 = let inline try_parse x = (^a: (static member TryParse: string -> bool * ^a) x) - let _, x = try_parse "4" - let z = x + 1 + let _, x = try_parse "4" + let z = x + 1 @@ -37,18 +37,18 @@ type PositiveClass<'A>() = abstract M3 : 'A with get, set abstract M4 : 'A with set abstract M5 : 'A with get - - + + type NegativeInterface = abstract v : 'T - abstract M<'T> : 'U + abstract M<'T> : 'U abstract M<'T> : 'U -> 'U abstract M : ('U -> 'U) [] type NegativeClass() = abstract v : 'T - abstract M<'T> : 'U + abstract M<'T> : 'U abstract M<'T> : 'U -> 'U abstract M : ('U -> 'U) abstract M2 : 'T with get, set @@ -64,7 +64,7 @@ type NegativeRecord = type NegativeUnion = Foo of 'T -type EventDeclarationWithSquiggleThatWasTooLong = +type EventDeclarationWithSquiggleThatWasTooLong = [] abstract member Event1 : IDelegateEvent>> diff --git a/tests/fsharp/typecheck/sigs/neg35.fs b/tests/fsharp/typecheck/sigs/neg35.fs index 7a73583fe62..f5c61e3fcfe 100644 --- a/tests/fsharp/typecheck/sigs/neg35.fs +++ b/tests/fsharp/typecheck/sigs/neg35.fs @@ -1,6 +1,6 @@ namespace global -module PrefixOperatorsNegative = +module PrefixOperatorsNegative = let (~<<) x = x // now rejected let (~++) x = x // now rejected let (~!) x = x // now rejected diff --git a/tests/fsharp/typecheck/sigs/neg36.fs b/tests/fsharp/typecheck/sigs/neg36.fs index 9ffd667b2da..8bd904879d7 100644 --- a/tests/fsharp/typecheck/sigs/neg36.fs +++ b/tests/fsharp/typecheck/sigs/neg36.fs @@ -1,17 +1,17 @@ module Neg36 -module TestAbstractOverrides_Bug4232_Case1 = +module TestAbstractOverrides_Bug4232_Case1 = [] - type D<'T,'U>() = + type D<'T,'U>() = abstract M : 'T -> int abstract M : 'U -> int - - type E() = + + type E() = inherit D() override x.M(a:string) = 1 -module TestAbstractOverrides_Bug4232_Case2 = - +module TestAbstractOverrides_Bug4232_Case2 = + [] type PA() = abstract M : int -> unit @@ -27,7 +27,7 @@ module TestAbstractOverrides_Bug4232_Case2 = // Here, PA.M amd PB.M have the same signature, so PA.M is unimplementable. // EXPECT: friendly error at this point? - type PD() = + type PD() = inherit PC() override this.M(x:int) = () diff --git a/tests/fsharp/typecheck/sigs/neg37.fs b/tests/fsharp/typecheck/sigs/neg37.fs index 7795fd78faa..f2b32c76ddc 100644 --- a/tests/fsharp/typecheck/sigs/neg37.fs +++ b/tests/fsharp/typecheck/sigs/neg37.fs @@ -2,42 +2,42 @@ module Neg37 // This test should indeed give an error: the type variable 'T escapes its scope into the type of Bar -type AAA() = +type AAA() = static member Bar = (fun x -> ()) static member Baz<'T> () = AAA.Bar (failwith "" : list<'T>) // This test should indeed give an error: the use of 'Bar' at a non-uniform instantiation before we know its // complete type w.r.t. 'T is not permitted // Moved to neg37a - since the error was masked by other errors -//type BBB<'T>() = +//type BBB<'T>() = // static member Bar = (fun x -> ()) // static member Baz = BBB.Bar (failwith "" : 'T) // This test should indeed give an error: the type variable 'T escapes its scope into the type of Bar -type CCC<'U>() = +type CCC<'U>() = static member Bar = (fun x -> ()) static member Baz<'T> () = CCC.Bar (failwith "" : list<'T>) -type Bad1<'T>(v) = - member x.M() = +type Bad1<'T>(v) = + member x.M() = (v :> IEvent<'T> |> ignore) - (v :> System.IComparable<'T> |> ignore); + (v :> System.IComparable<'T> |> ignore); -type Bad2<'T> = - member x.P - with get v = +type Bad2<'T> = + member x.P + with get v = (v :> IEvent<'T> |> ignore) - (v :> System.IComparable<'T> |> ignore); + (v :> System.IComparable<'T> |> ignore); -type Bad3<'T>() = - member x.P - with get v = +type Bad3<'T>() = + member x.P + with get v = (v :> IEvent<'T> |> ignore) - (v :> System.IComparable<'T> |> ignore); + (v :> System.IComparable<'T> |> ignore); -type Bad4<'T> = - new () = { } - new v = - (v :> IEvent<'T> |> ignore); +type Bad4<'T> = + new () = { } + new v = + (v :> IEvent<'T> |> ignore); (v :> System.IComparable<'T> |> ignore); // this should give an ambiguity error Bad4<'T>() diff --git a/tests/fsharp/typecheck/sigs/neg37_a.fs b/tests/fsharp/typecheck/sigs/neg37_a.fs index 0f4e2fc6d92..e10b84cbbc1 100644 --- a/tests/fsharp/typecheck/sigs/neg37_a.fs +++ b/tests/fsharp/typecheck/sigs/neg37_a.fs @@ -2,7 +2,7 @@ module Neg37a // This test should indeed give an error: the use of 'Bar' at a non-uniform instantiation before we know its // complete type w.r.t. 'T is not permitted -type BBB<'T>() = +type BBB<'T>() = static member Bar = (fun x -> ()) static member Baz = BBB.Bar (failwith "" : 'T) diff --git a/tests/fsharp/typecheck/sigs/neg39.fs b/tests/fsharp/typecheck/sigs/neg39.fs index 664b00e5e2c..705a9b8fe83 100644 --- a/tests/fsharp/typecheck/sigs/neg39.fs +++ b/tests/fsharp/typecheck/sigs/neg39.fs @@ -1,4 +1,4 @@ -namespace Neg39a +namespace Neg39a namespace Neg39b diff --git a/tests/fsharp/typecheck/sigs/neg40.fs b/tests/fsharp/typecheck/sigs/neg40.fs index 11cdba56d4d..cae14024303 100644 --- a/tests/fsharp/typecheck/sigs/neg40.fs +++ b/tests/fsharp/typecheck/sigs/neg40.fs @@ -1,4 +1,4 @@ -namespace Neg40a +namespace Neg40a type X = A | B namespace Neg40b diff --git a/tests/fsharp/typecheck/sigs/neg41.fs b/tests/fsharp/typecheck/sigs/neg41.fs index b3e95b3a645..abf63e0e203 100644 --- a/tests/fsharp/typecheck/sigs/neg41.fs +++ b/tests/fsharp/typecheck/sigs/neg41.fs @@ -1,3 +1,3 @@ -namespace Neg41 +namespace Neg41 module Neg41Module type X = A | B diff --git a/tests/fsharp/typecheck/sigs/neg42.fs b/tests/fsharp/typecheck/sigs/neg42.fs index 070ceddd22c..ab7c2d87eaa 100644 --- a/tests/fsharp/typecheck/sigs/neg42.fs +++ b/tests/fsharp/typecheck/sigs/neg42.fs @@ -1,3 +1,3 @@ -namespace Neg42 +namespace Neg42 module Neg42Module = - type X = A | B + type X = A | B diff --git a/tests/fsharp/typecheck/sigs/neg42.fsi b/tests/fsharp/typecheck/sigs/neg42.fsi index cdb658117a9..358cc0d66ed 100644 --- a/tests/fsharp/typecheck/sigs/neg42.fsi +++ b/tests/fsharp/typecheck/sigs/neg42.fsi @@ -1,3 +1,3 @@ -namespace Neg42 +namespace Neg42 module Neg42Module type X = A | B diff --git a/tests/fsharp/typecheck/sigs/neg43.fs b/tests/fsharp/typecheck/sigs/neg43.fs index 81a64cd5fae..2e6b6d37251 100644 --- a/tests/fsharp/typecheck/sigs/neg43.fs +++ b/tests/fsharp/typecheck/sigs/neg43.fs @@ -1,6 +1,6 @@ namespace Foo [] -type DU = +type DU = | A | B of string with @@ -8,7 +8,7 @@ type DU = namespace Foo2 [] -type DU = +type DU = | A | B of string with diff --git a/tests/fsharp/typecheck/sigs/neg44.fs b/tests/fsharp/typecheck/sigs/neg44.fs index 8a178127ea3..1fa155849f5 100644 --- a/tests/fsharp/typecheck/sigs/neg44.fs +++ b/tests/fsharp/typecheck/sigs/neg44.fs @@ -3,7 +3,7 @@ module Neg44 open System open System.Reflection -type MyType() = +type MyType() = inherit Type() override this.GUID : Guid= failwith "Not implemented" override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj = failwith "Not implemented" @@ -33,7 +33,7 @@ type MyType() = override this.IsPointerImpl() : bool= failwith "Not implemented" override this.IsPrimitiveImpl() : bool= failwith "Not implemented" override this.IsCOMObjectImpl() : bool= failwith "Not implemented" - override this.GetElementType() : Type= failwith "Not implemented" + override this.GetElementType() : Type= failwith "Not implemented" override this.HasElementTypeImpl() : bool= failwith "Not implemented" override this.UnderlyingSystemType : Type = failwith "Not implemented" override this.Name : string = failwith "Not implemented" diff --git a/tests/fsharp/typecheck/sigs/neg45.fs b/tests/fsharp/typecheck/sigs/neg45.fs index 06a0618e414..cde3f91aa6c 100644 --- a/tests/fsharp/typecheck/sigs/neg45.fs +++ b/tests/fsharp/typecheck/sigs/neg45.fs @@ -1,6 +1,6 @@ namespace global -module RequiresExplicitTypeArgumentsAttributeNotRespectedForMembers_FSharp_1_0_6163 = +module RequiresExplicitTypeArgumentsAttributeNotRespectedForMembers_FSharp_1_0_6163 = type G1() = [] @@ -19,53 +19,53 @@ module RequiresExplicitTypeArgumentsAttributeNotRespectedForMembers_FSharp_1_0_6 [] member x.Foo<'a>(y:'a, ?z:int) = printfn "second" - let g2 = new G2() + let g2 = new G2() g2.Foo(42) // second g2.Foo(42) // second g2.Foo(42, 0) // second g2.Foo(42, 0) // second -module CompilerStackOverflowOnOperatorOverloading_FSharp_1_0_6164 = +module CompilerStackOverflowOnOperatorOverloading_FSharp_1_0_6164 = type 'a D = static member inline (+)(_:^b D, _:^b) : ^b when ^b : (static member (+) : ^b * ^b -> ^b) = failwith "Not implemented" static member inline (+)(_:^b, _:^b D) : ^b when ^b : (static member (+) : ^b * ^b -> ^b) = failwith "Not implemented" - + let f (x:int D) = x + 1 -module ActivePatternsShouldNotBeAllowedOnMembers = +module ActivePatternsShouldNotBeAllowedOnMembers = // No error in this class, static works great - type FooBir() = + type FooBir() = static member (|Foo|Bir|) (x, y) = match x = y with | true -> Foo | false -> Bir - + member x.doSomething y = match x, y with | Foo -> () // compiles! How is 'Foo' in scope? | Bir -> () - + match 1,2 with | FooBir.Foo -> printfn "hi" // The field, constructor or member 'Foo' is not defined | _ -> () - - type FooBir2() = + + type FooBir2() = member x.(|Foo|Bir|) y = match x = y with | true -> Foo | false -> Bir - // compiler error on "Foo" + // compiler error on "Foo" member x.doSomething y = let r = x.``|Foo|Bir|`` y // compiles! match r with | Foo -> () // The type 'Choice' is not compatible with the type 'FooBir2' | Bir -> () -module CheckThatNoConstraintPropagationHappensForTypeParameters = +module CheckThatNoConstraintPropagationHappensForTypeParameters = type C<'T when 'T :> System.IComparable>() = member x.P = 1 @@ -81,41 +81,41 @@ module CheckThatNoConstraintPropagationHappensForTypeParameters = type Negative10<'T when 'T :> C<'T> > = member x.P = 1 // EXPECT ERROR -module CheckNoOverloadResolutionAgainstSignatureInformationGivenByTUpledAndRecordPatterns = - module Negative1 = +module CheckNoOverloadResolutionAgainstSignatureInformationGivenByTUpledAndRecordPatterns = + module Negative1 = type R1 = { f1 : int } type R2 = { f2 : int } - type D() = + type D() = member x.N = x.M { f1 = 3 } // EXPECT ERROR member x.M({ f1 = y }) = () member x.M({ f2 = y }) = () - module Negative2 = + module Negative2 = type R1 = { f1 : int } type R2 = { f2 : int } - type D() = + type D() = member x.N = x.M (({ f1 = 3 },{ f1 = 3 })) // EXPECT ERROR member x.M((y1: R1,y2: R1)) = () member x.M((y1: R2,y2: R1)) = () - - module Negative3 = + + module Negative3 = type R1 = { f1 : int } // EXPECT ERROR - type D() = + type D() = member x.N = x.M 3 member x.M(1) = () member x.M(()) = () -module CheckInitializationGraphInStaticMembers = +module CheckInitializationGraphInStaticMembers = - module Positive6 = - type C() = + module Positive6 = + type C() = static let rec x = (); (fun () -> ignore x; ()) // expect warning static member A = x - - -module CheckMemberConstraintNegativeCases = + + +module CheckMemberConstraintNegativeCases = let inline staticName< ^T when ^T : (static member Name : string) > () = (^T : (static member Name : string) ()) let inline staticAge< ^T when ^T : (static member Age : int)> () = (^T : (static member Age : int) ()) @@ -145,4 +145,3 @@ module CheckMemberConstraintNegativeCases = let _ = staticName let _ = staticName let f() = staticName - \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg46.fs b/tests/fsharp/typecheck/sigs/neg46.fs index bd38d1de60a..612cb3cf9f1 100644 --- a/tests/fsharp/typecheck/sigs/neg46.fs +++ b/tests/fsharp/typecheck/sigs/neg46.fs @@ -15,25 +15,25 @@ type System.Random with static member Factory() = 1 type System.Random with - static let rec f x = g x + static let rec f x = g x and g x = f x static member Factory() = 1 type System.Random with - static let rec f x = f x + static let rec f x = f x static member Factory() = 1 type System.Random with - let rec f x = f x + let rec f x = f x static member Factory() = 1 type System.Random with - let rec f x = g x + let rec f x = g x and g x = f x static member Factory() = 1 type System.Random with - let rec f x = g x + let rec f x = g x static member Factory() = 1 type System.Random with @@ -65,11 +65,11 @@ type System.Random with static member Factory() = 1 type System.Random with - interface System.IComparable with + interface System.IComparable with member x.A = 1 static member Factory() = 1 type System.Random with - interface System.IComparable + interface System.IComparable static member Factory() = 1 diff --git a/tests/fsharp/typecheck/sigs/neg47.fs b/tests/fsharp/typecheck/sigs/neg47.fs index 8d938b4b38b..0f7b62e5a8f 100644 --- a/tests/fsharp/typecheck/sigs/neg47.fs +++ b/tests/fsharp/typecheck/sigs/neg47.fs @@ -9,25 +9,25 @@ type Allowed2 with [] static member GetCaretBlinkTime() : int = failwith "" -type System.Object with +type System.Object with [] - static member Allowed3() = true + static member Allowed3() = true type NotAllowed() = [] let GetCaretBlinkTime() : int = failwith "" - do - printf "%d" (GetCaretBlinkTime()) + do + printf "%d" (GetCaretBlinkTime()) type NotAllowed2() = [] member x.GetCaretBlinkTime() : int = failwith "" let NotAllowed3() = - { new obj() with + { new obj() with [] member x.Equals(y) = true } -type System.Object with +type System.Object with [] - member x.NotAllowed4() = true + member x.NotAllowed4() = true diff --git a/tests/fsharp/typecheck/sigs/neg48.fs b/tests/fsharp/typecheck/sigs/neg48.fs index bf87f389619..27847194b68 100644 --- a/tests/fsharp/typecheck/sigs/neg48.fs +++ b/tests/fsharp/typecheck/sigs/neg48.fs @@ -1,13 +1,13 @@ -module Neg48 +module Neg48 // No errors expected in here -module PositiveTests = - type tree3 = +module PositiveTests = + type tree3 = | NodeA of int * int member x.Item0 = 1 // ok - type tree3static = + type tree3static = | NodeA of int * int static member Item0 = 1 // ok @@ -15,94 +15,94 @@ module PositiveTests = | NodeA of int * int member x.Item3 = 1 // ok - type tree4A = - | NodeA + type tree4A = + | NodeA member x.Item = 1 // ok - type tree5 = + type tree5 = | NodeA of int - module M = - type tree5 with + module M = + type tree5 with member x.Tag = 1 // ok - extrinsic extension - type tree5 with + type tree5 with member x.Tags = 1 // ok - extrinsic extension - type tree5 with + type tree5 with member x.Item = 1 // ok - extrinsic extension module NegativeTEsts = // more union type checks - type tree1A = + type tree1A = | NodeA of int * int member x.Item1 = 1 // not ok - type tree1Astatic = + type tree1Astatic = | NodeA of int * int static member Item1 = 1 // not ok - type tree1B = + type tree1B = | NodeA of int * int member x.Item2 = 1 // not ok - type tree1Bstatic = + type tree1Bstatic = | NodeA of int * int static member Item2 = 1 // not ok - type tree1C = + type tree1C = | NodeA of int * int member x.Tags = 1 // not ok - type tree1Cstatic = + type tree1Cstatic = | NodeA of int * int static member Tags = 1 // not ok - type tree1D = + type tree1D = | NodeA of int * int member x.Tag = 1 // not ok - type tree2A = - | NodeA of int + type tree2A = + | NodeA of int member x.Item = 1 // not ok - type tree2Astatic = - | NodeA of int + type tree2Astatic = + | NodeA of int static member Item = 1 // not ok - type tree2B = + type tree2B = | NodeA of int member x.Tags = 1 // not ok - type tree2Bstatic = + type tree2Bstatic = | NodeA of int static member Tags = 1 // not ok - type tree2C = - | NodeA of int + type tree2C = + | NodeA of int member x.Tag = 1 // not ok - type tree2Cstatic = - | NodeA of int + type tree2Cstatic = + | NodeA of int static member Tag = 1 // not ok - type tree4B = - | NodeA + type tree4B = + | NodeA member x.Tags = 1 // not ok - type tree4C = - | NodeA + type tree4C = + | NodeA member x.Tag = 1 // not ok - type tree5 = + type tree5 = | NodeA of int - type tree5 with + type tree5 with member x.Tag = 1 // not ok - intrinsic extension - type tree5 with + type tree5 with member x.Tags = 1 // not ok - intrinsic extension - type tree5 with + type tree5 with member x.Item = 1 // not ok - intrinsic extension diff --git a/tests/fsharp/typecheck/sigs/neg49.fs b/tests/fsharp/typecheck/sigs/neg49.fs index 50fd3ff7e65..b9b8cd8853e 100644 --- a/tests/fsharp/typecheck/sigs/neg49.fs +++ b/tests/fsharp/typecheck/sigs/neg49.fs @@ -1,7 +1,7 @@ module Neg49 -module Example1 = +module Example1 = let rec X = X // expect an error module Example2 = diff --git a/tests/fsharp/typecheck/sigs/neg50.fs b/tests/fsharp/typecheck/sigs/neg50.fs index 2616cb9b135..141c0b0efbb 100644 --- a/tests/fsharp/typecheck/sigs/neg50.fs +++ b/tests/fsharp/typecheck/sigs/neg50.fs @@ -1,7 +1,7 @@ module Neg50 -module EnumPatternWithFunkyTypes_Dev11_13904 = +module EnumPatternWithFunkyTypes_Dev11_13904 = [] type Struct = @@ -24,7 +24,7 @@ module EnumPatternWithFunkyTypes_Dev11_13904 = // This is not allowed - 'a (and the type of "a") are not known to be "bool" let v a = seq { for i in T a -> i } -module EnumPatternWithFunkyTypes2_Dev11_13904 = +module EnumPatternWithFunkyTypes2_Dev11_13904 = [] type Struct = @@ -42,7 +42,7 @@ module EnumPatternWithFunkyTypes2_Dev11_13904 = let t = seq { for i in T() -> i } -module EnumPatternWithFunkyTypes3_Dev11_13904 = +module EnumPatternWithFunkyTypes3_Dev11_13904 = [] type Struct = @@ -59,7 +59,7 @@ module EnumPatternWithFunkyTypes3_Dev11_13904 = // This is not allowed - Current has an arg let t = seq { for i in T() -> i } -module EnumPatternWithFunkyTypes4_Dev11_13904 = +module EnumPatternWithFunkyTypes4_Dev11_13904 = [] type Struct = diff --git a/tests/fsharp/typecheck/sigs/neg52.fs b/tests/fsharp/typecheck/sigs/neg52.fs index 62b07820b1f..2f1b8fb393a 100644 --- a/tests/fsharp/typecheck/sigs/neg52.fs +++ b/tests/fsharp/typecheck/sigs/neg52.fs @@ -6,7 +6,7 @@ module Neg52 open System.Collections.Generic -type C<[] 'u>() = +type C<[] 'u>() = member this.Meth() = () // Emit error if overloaded method signatures are not distinct wrt erasure diff --git a/tests/fsharp/typecheck/sigs/neg53.fs b/tests/fsharp/typecheck/sigs/neg53.fs index bfaac61fba9..7b16f362f22 100644 --- a/tests/fsharp/typecheck/sigs/neg53.fs +++ b/tests/fsharp/typecheck/sigs/neg53.fs @@ -1,6 +1,6 @@ module Neg53 -let r = +let r = async { use z = null let rec loop() = @@ -10,4 +10,4 @@ let r = } return! loop() } - + diff --git a/tests/fsharp/typecheck/sigs/neg54.fs b/tests/fsharp/typecheck/sigs/neg54.fs index 0214e409819..bc6f8e3f73d 100644 --- a/tests/fsharp/typecheck/sigs/neg54.fs +++ b/tests/fsharp/typecheck/sigs/neg54.fs @@ -1,6 +1,6 @@ module Neg53 -let r = +let r = async { let! z = failwith "" let rec loop() = @@ -10,4 +10,4 @@ let r = } return! loop() } - + diff --git a/tests/fsharp/typecheck/sigs/neg55.fs b/tests/fsharp/typecheck/sigs/neg55.fs index 3fe78113259..00943aeee8d 100644 --- a/tests/fsharp/typecheck/sigs/neg55.fs +++ b/tests/fsharp/typecheck/sigs/neg55.fs @@ -1,25 +1,25 @@ module Neg53 -module Test1 = - type D() = +module Test1 = + type D() = static let x = 1 - + D.``.cctor``() -module Test2 = - type D() = +module Test2 = + type D() = static let x = 1 D.``.ctor``() -module Test3 = - type D() = +module Test3 = + type D() = static member ``.ctor``() = 1 diff --git a/tests/fsharp/typecheck/sigs/neg56.fs b/tests/fsharp/typecheck/sigs/neg56.fs index 8245eb0dffb..3fc6510a63e 100644 --- a/tests/fsharp/typecheck/sigs/neg56.fs +++ b/tests/fsharp/typecheck/sigs/neg56.fs @@ -2,14 +2,14 @@ module Neg56 // This should not compile. A has been generalized too early. // In this example, envNonRec contains "?X", later instantiated to T -module InstanceMembersEarlyGeneralizationPotentiallyInvalidAndUltimatelyInconsistent = - type C<'T>() = +module InstanceMembersEarlyGeneralizationPotentiallyInvalidAndUltimatelyInconsistent = + type C<'T>() = let mutable x = Unchecked.defaultof<_> // this inference variable ?X ultimately becomes T member this.A() = x // We incorrectly generalize "A" here, to have type Forall T. C -> unit -> ?X - member this.B1(c:C) = c.A() + member this.B1(c:C) = c.A() // At this point during type inference, the return type of c.A() is ?X // After type inference, the return type of c.A() is 'string' by one measure and T be another - this is the inconsistency - member this.B2(c:C) = c.A() + member this.B2(c:C) = c.A() // At this point during type inference, the return type of c.A() is ?X // After type inference, the return type of c.A() is 'int' by one measure and T be another - this is the inconsistency member this.B3<'U>(c:C<'U>) = c.A() // the return type of c.A() is 'U', the return type of B1 is T @@ -19,8 +19,8 @@ module InstanceMembersEarlyGeneralizationPotentiallyInvalidAndUltimatelyInconsis // At this point during type inference the inference variable ?X is inferred to be T // This should not compile. A has been generalized too early. -module StaticMembersEarlyGeneralizationPotentiallyInvalidAndUltimatelyInconsistent = - type C<'T>() = +module StaticMembersEarlyGeneralizationPotentiallyInvalidAndUltimatelyInconsistent = + type C<'T>() = static let mutable x = Unchecked.defaultof<_> // this inference variable ultimately becomes T static member A() = x // We incorrectly generalize "A" here, to 'Forall T. unit -> ?X static member B1() = C.A() diff --git a/tests/fsharp/typecheck/sigs/neg56_a.fs b/tests/fsharp/typecheck/sigs/neg56_a.fs index f311fdf9749..e86f61e3ab8 100644 --- a/tests/fsharp/typecheck/sigs/neg56_a.fs +++ b/tests/fsharp/typecheck/sigs/neg56_a.fs @@ -1,20 +1,20 @@ module Neg56 -module Devdiv2_Bug_10649_repro3 = +module Devdiv2_Bug_10649_repro3 = open System.Collections - - type 'a list1 = - | One of 'a + + type 'a list1 = + | One of 'a | Many of 'a * 'a list1 static member private toList = function | One x -> [x] | Many(x, xs) -> x :: list1.toList xs - + interface IEnumerable with member this.GetEnumerator() = (list1<_>.toList this :> IEnumerable).GetEnumerator() - + interface Generic.IEnumerable<'a> with member this.GetEnumerator() = (list1<_>.toList this :> Generic.IEnumerable<_>).GetEnumerator() - + diff --git a/tests/fsharp/typecheck/sigs/neg56_b.fs b/tests/fsharp/typecheck/sigs/neg56_b.fs index 559d42bc244..eccc7067b13 100644 --- a/tests/fsharp/typecheck/sigs/neg56_b.fs +++ b/tests/fsharp/typecheck/sigs/neg56_b.fs @@ -2,19 +2,19 @@ module Neg56 // Similar repro to above, but involving a property -module Devdiv2_Bug_10649_case0 = - type Foo<'T>() = +module Devdiv2_Bug_10649_case0 = + type Foo<'T>() = static member Inf = ref Unchecked.defaultof<_> - member this.Bar() = Foo<_>.Inf.Value : 'T + member this.Bar() = Foo<_>.Inf.Value : 'T // Similar repro to above, but involving a static property - type Foo2<'T>() = + type Foo2<'T>() = static let x = (); Unchecked.defaultof<_> static member Inf = ref x - member this.Bar() = Foo2<_>.Inf.Value : 'T + member this.Bar() = Foo2<_>.Inf.Value : 'T -module Devdiv2_Bug_10649 = +module Devdiv2_Bug_10649 = type Foo<'T> = FooCase of 'T with //static member private Inf l = ignore l // ok @@ -24,9 +24,9 @@ module Devdiv2_Bug_10649 = member this.Bar() = let (FooCase(x)) = this Foo<_>.Inf [x; x] - -module Devdiv2_Bug_10649_repro2 = + +module Devdiv2_Bug_10649_repro2 = // compiles ok type Qux<'T>(x:'T) = static member private Foo = function @@ -34,4 +34,4 @@ module Devdiv2_Bug_10649_repro2 = | [] -> [] member this.Bar() = Qux<_>.Foo [x; x] - + diff --git a/tests/fsharp/typecheck/sigs/neg57.fs b/tests/fsharp/typecheck/sigs/neg57.fs index 67465f1b13b..8103b33f3d7 100644 --- a/tests/fsharp/typecheck/sigs/neg57.fs +++ b/tests/fsharp/typecheck/sigs/neg57.fs @@ -3,4 +3,4 @@ module M [] type Foo<'T> = val offset : int - new (x:'T) = { offset = 1 } + new (x:'T) = { offset = 1 } diff --git a/tests/fsharp/typecheck/sigs/neg58.fs b/tests/fsharp/typecheck/sigs/neg58.fs index 91ef3552ca1..805dba6080f 100644 --- a/tests/fsharp/typecheck/sigs/neg58.fs +++ b/tests/fsharp/typecheck/sigs/neg58.fs @@ -5,7 +5,7 @@ open System.Collections.Generic type Foo<'T> = val offset : int new (x:'T) = { offset = 1 } - interface IEnumerable<'T> with - member this.GetEnumerator() = null :> IEnumerator<'T> + interface IEnumerable<'T> with + member this.GetEnumerator() = null :> IEnumerator<'T> member this.GetEnumerator() = null :> IEnumerator diff --git a/tests/fsharp/typecheck/sigs/neg58.fsi b/tests/fsharp/typecheck/sigs/neg58.fsi index 415aa011018..eba93de6812 100644 --- a/tests/fsharp/typecheck/sigs/neg58.fsi +++ b/tests/fsharp/typecheck/sigs/neg58.fsi @@ -3,9 +3,9 @@ namespace FooBarSoftware open System.Collections.Generic [] //[] -type Foo<'T> = +type Foo<'T> = new : 'T -> 'T Foo - member public GetEnumerator: unit -> IEnumerator<'T> + member public GetEnumerator: unit -> IEnumerator<'T> interface IEnumerable<'T> diff --git a/tests/fsharp/typecheck/sigs/neg59.fs b/tests/fsharp/typecheck/sigs/neg59.fs index 4fc08ced2df..bffddbf0f20 100644 --- a/tests/fsharp/typecheck/sigs/neg59.fs +++ b/tests/fsharp/typecheck/sigs/neg59.fs @@ -3,128 +3,128 @@ module Neg59 let dbOne = [[1]] -let joinMustUseASimplePattern = - query { for i in dbOne do +let joinMustUseASimplePattern = + query { for i in dbOne do // Join must use a simple pattern join [i] in dbOne on (i = j) select (i, j) } |> Seq.toList -let groupJoinMustUseASimplePattern = - query { for i in dbOne do +let groupJoinMustUseASimplePattern = + query { for i in dbOne do // Join must use a simple pattern groupJoin [i] in dbOne on (i = j) into group select (i, group) } |> Seq.toList -let functionDefinitionInQuery = - query { for i in dbOne do - let f (x:int) (y:int) = x +let functionDefinitionInQuery = + query { for i in dbOne do + let f (x:int) (y:int) = x select i } -let recFunctionDefinitionInQueryWithCustomOperator = - query { for i in dbOne do +let recFunctionDefinitionInQueryWithCustomOperator = + query { for i in dbOne do let rec f (x:int) (y:int) = f y x select i } -let recValueInQueryWithCustomOperator = - query { for i in dbOne do +let recValueInQueryWithCustomOperator = + query { for i in dbOne do let rec x = ((); (fun () -> x() + 1)) select i } -let recFunctionDefinitionInQueryNoCustomOperator = - query { for i in dbOne do +let recFunctionDefinitionInQueryNoCustomOperator = + query { for i in dbOne do let rec f (x:int) (y:int) = f y x yield i } -let recValueInQueryNoCustomOperator = - query { for i in dbOne do +let recValueInQueryNoCustomOperator = + query { for i in dbOne do let rec x = ((); (fun () -> x() + 1)) yield i } -let ifThenElseInQueryWithCustomOperator = - query { for i in dbOne do +let ifThenElseInQueryWithCustomOperator = + query { for i in dbOne do if true then - select i - else + select i + else select (i+1) } -let ifThenElseInQueryNoCustomOperator = - query { for i in dbOne do +let ifThenElseInQueryNoCustomOperator = + query { for i in dbOne do if true then - yield i - else + yield i + else yield (i+1) } -let matchInQueryWithCustomOperator = - query { for i in dbOne do - match 1 with - | 1 -> select i +let matchInQueryWithCustomOperator = + query { for i in dbOne do + match 1 with + | 1 -> select i | _ -> select (i+1) } -let matchInQueryNoCustomOperator = - query { for i in dbOne do - match 1 with - | 1 -> yield i +let matchInQueryNoCustomOperator = + query { for i in dbOne do + match 1 with + | 1 -> yield i | _ -> yield (i+1) } -let tryWithInQueryWithCustomOperator = - query { for i in dbOne do - try - select i +let tryWithInQueryWithCustomOperator = + query { for i in dbOne do + try + select i with _ -> () } -let tryWithInQueryNoCustomOperator = - query { for i in dbOne do - try - yield i +let tryWithInQueryNoCustomOperator = + query { for i in dbOne do + try + yield i with _ -> () } -let tryFinallyInQueryWithCustomOperator = - query { for i in dbOne do - try - select i +let tryFinallyInQueryWithCustomOperator = + query { for i in dbOne do + try + select i finally () } -let tryFinallyInQueryNoCustomOperator = - query { for i in dbOne do - try - yield i +let tryFinallyInQueryNoCustomOperator = + query { for i in dbOne do + try + yield i finally () } -let useInQueryWithCustomOperator = - query { for i in dbOne do +let useInQueryWithCustomOperator = + query { for i in dbOne do use x = { new IDisposable with x.Dispose() = () } select i } -let useInQueryNoCustomOperator = - query { for i in dbOne do +let useInQueryNoCustomOperator = + query { for i in dbOne do use x = { new IDisposable with x.Dispose() = () } yield i } -let whileInQueryWithCustomOperator = - query { for i in dbOne do - while true do +let whileInQueryWithCustomOperator = + query { for i in dbOne do + while true do select i } -let whileInQueryNoCustomOperator = - query { for i in dbOne do - while true do +let whileInQueryNoCustomOperator = + query { for i in dbOne do + while true do yield i } -let returnInQuery1 = - query { for i in dbOne do +let returnInQuery1 = + query { for i in dbOne do return i } -let returnFromInQuery1 = - query { for i in dbOne do +let returnFromInQuery1 = + query { for i in dbOne do return! i } diff --git a/tests/fsharp/typecheck/sigs/neg60.fs b/tests/fsharp/typecheck/sigs/neg60.fs index 30e3052d5fa..202e01ecdc3 100644 --- a/tests/fsharp/typecheck/sigs/neg60.fs +++ b/tests/fsharp/typecheck/sigs/neg60.fs @@ -1,31 +1,31 @@ module Neg60 // Tests that we get an error when custom operations are overloaded -module QuerySyntaxForAnFSharpType = +module QuerySyntaxForAnFSharpType = open System open Microsoft.FSharp.Quotations - type EventBuilder() = + type EventBuilder() = member __.For(ev:IObservable<'T>, loop:('T -> #IObservable<'U>)) : IObservable<'U> = failwith "" member __.Yield(v:'T) : IObservable<'T> = failwith "" member __.Quote(v:Quotations.Expr<'T>) : Expr<'T> = v member __.Run(x:Expr<'T>) = Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation x :?> 'T - + [] member __.Where (x, [] f) = Observable.filter f x - + [] member __.NotValid1 (x, [] f) = Observable.filter f x - + [] member __.NotValid2 (x, [] f) = Observable.filter f x - + [] member __.NotValid3 (x, [] f) = Observable.filter f x - + [] member __.NotValid4 (x, [] f) = Observable.filter f x - + // Note: overloaded, this gives the error further below [] member __.Select (x, [] f) = Observable.map f x @@ -34,15 +34,15 @@ module QuerySyntaxForAnFSharpType = member __.Choose (x, [] f) = Observable.choose f x // intrinsic extension member - type EventBuilder with + type EventBuilder with [] member __.Action (source:IObservable<_>, [] f) = Observable.add f source; source // extrinsic extension member /// Check that a custom operator defined by an extension member works [] - module ExtensionMembers = - type EventBuilder with + module ExtensionMembers = + type EventBuilder with [] member inline __.ScanSumBy (source, [] f : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f b) LanguagePrimitives.GenericZero<'U> source @@ -52,41 +52,41 @@ module QuerySyntaxForAnFSharpType = //--------------------------------------------------------------- - type PretendForm() = - + type PretendForm() = + let event = new Event() member x.Tick = event.Trigger(10,10) member x.MouseClick = event.Publish //let f = new System.Windows.Forms.Form() let f = new PretendForm() - let e1 = - myquery { for x in f.MouseClick do + let e1 = + myquery { for x in f.MouseClick do where (fst x < 100) scanSumBy (snd x) } -module NullableOperators1 = +module NullableOperators1 = let x : System.Nullable = null -module NullableOperators2 = - +module NullableOperators2 = + let iq = System.Nullable(10) - let _ = iq ?>= iq - let _ = iq ?>= 10 - let _ = 1 + (1,2) - let _ = (2,3) + (1,2) + let _ = iq ?>= iq + let _ = iq ?>= 10 + let _ = 1 + (1,2) + let _ = (2,3) + (1,2) let _ = (2,3) + (fun () -> ()) -module NullableOperators3 = - +module NullableOperators3 = + let a = new System.Nullable(0) let b = new System.Nullable(1) if a ?=? b then printfn "Same" else printfn "Different" -module QuerySyntaxWithValidOverloading = +module QuerySyntaxWithValidOverloading = open System @@ -131,7 +131,7 @@ module QuerySyntaxWithValidOverloading = body "Description" "of" "content" } -module QuerySyntaxWithOptionalParamAndParamsArray = +module QuerySyntaxWithOptionalParamAndParamsArray = open System @@ -146,27 +146,27 @@ module QuerySyntaxWithOptionalParamAndParamsArray = type InputBuilder() = - member t.Yield(_) = + member t.Yield(_) = { Label = None Kind = Text None Validators = [||] } - + [] member this.Text(io,?placeholder) = { io with Kind = Text placeholder } - + [] member this.Password(io,?placeholder) = { io with Kind = Password placeholder } - + [] - member this.Label(io,label) = + member this.Label(io,label) = { io with Label = Some label } - + [] member this.Validators(io, [] validators) = { io with Validators = validators } - + let input = InputBuilder() //--------------------------------------------------------------- @@ -178,7 +178,7 @@ module QuerySyntaxWithOptionalParamAndParamsArray = with_validators (String.IsNullOrWhiteSpace >> not) } - + let email = input { label "Email" @@ -187,7 +187,7 @@ module QuerySyntaxWithOptionalParamAndParamsArray = (String.IsNullOrWhiteSpace >> not) (fun s -> s.Contains "@") } - + let password = input { label "Password" diff --git a/tests/fsharp/typecheck/sigs/neg61.fs b/tests/fsharp/typecheck/sigs/neg61.fs index d32af70e9c1..02a140bfe59 100644 --- a/tests/fsharp/typecheck/sigs/neg61.fs +++ b/tests/fsharp/typecheck/sigs/neg61.fs @@ -1,140 +1,140 @@ module Neg61 -let b2 = +let b2 = query { for x in [1] do - join y in [2] on (x = y) + join y in [2] on (x = y) select x } -let b3 = +let b3 = query { for x in [1] do groupJoin y in [2] on ( x < y) into g select x } -let b4 = +let b4 = query { for x in [1] do groupJoin y in [2] on ( x = y) select x } -let a0 = +let a0 = query { for x in [1] do groupJoin y in [2] on ( x = y) select x } -let a1 = +let a1 = query { for x in [1] do - zip [2] + zip [2] select x } -let a2 = +let a2 = query { for x in [1] do select } -let a3 = +let a3 = query { for x in [1] do zip } -let a4 = +let a4 = query { for x in [1] do groupJoin } -let x0 = +let x0 = query { for x in [1] do join } -let x1 = +let x1 = query { for x in [1] do id select } -let x2 = +let x2 = query { for x in [1] do id join } -let x3 = +let x3 = query { for x in [1] do id groupJoin } -let x4 = +let x4 = query { for x in [1] do id zip } -let x5 = +let x5 = query { for c in [1..10] do - truncate } + truncate } -let x6 = +let x6 = query { for c in [1..10] do printfn "hello" - yield 1 } + yield 1 } -let x7 = +let x7 = query { for c in [1..10] do - while true do - yield 1 } + while true do + yield 1 } -let x8 = +let x8 = query { for c in [1..10] do - for i = 1 to 100 do - yield 1 } + for i = 1 to 100 do + yield 1 } -let x9 = +let x9 = query { for c in [1..10] do - try + try yield 1 - with _ -> - yield 2 } + with _ -> + yield 2 } -let x10 = +let x10 = query { for c in [1..10] do - try + try yield 1 - finally () } + finally () } -let x11 = +let x11 = query { for c in [1..10] do use x = { new System.IDisposable with __.Dispose() = () } - yield 1 } + yield 1 } -let x12 = +let x12 = query { for c in [1..10] do let! x = failwith "" - yield 1 } + yield 1 } -let x13 = +let x13 = query { for c in [1..10] do do! failwith "" - yield 1 } + yield 1 } -let x14 = +let x14 = query { for c in [1..10] do - return 1 } + return 1 } -let x15 = +let x15 = query { for c in [1..10] do - return! [1] } -let x16 = + return! [1] } +let x16 = query { for c in [1..10] do - truncate 3 } + truncate 3 } -let x17ok = +let x17ok = query { for d in [1..10] do let f x = x + 1 // no error expected here select (f d) } -let x18ok = +let x18ok = query { for d in [1..10] do let f x = x + 1 // no error expected here select (f d) } -let x18rec = +let x18rec = query { for d in [1..10] do let rec f x = x + 1 // error expected here - no recursive functions select (f d) } -let x18rec2 = +let x18rec2 = query { for d in [1..10] do let rec f x = x + 1 // error expected here - no recursive functions @@ -142,7 +142,7 @@ let x18rec2 = select (f d) } -let x18inline = +let x18inline = query { for d in [1..10] do let inline f x = x + 1 // error expected here - no inline functions @@ -150,14 +150,14 @@ let x18inline = } -let x18mutable = +let x18mutable = query { for d in [1..10] do let mutable v = 1 // error expected here - no mutable values select (f d) } -let x19 = +let x19 = query { for d in [1..10] do let r = // error expected here - no generic functions in quotations @@ -166,38 +166,38 @@ let x19 = select (r [] d) } -let x20 = +let x20 = query { for c in [1..10] do - sumBy } + sumBy } -let x21 = - query { for c in 1 do +let x21 = + query { for c in 1 do sumBy c } // check misuse of binary operator in sequence position -let x23a = +let x23a = query { for x in ["1"] do where x.Length > x select x } // check misuse of binary operator in last position -let x23b = +let x23b = query { for x in ["1"] do where x.Length > x } // check misuse of binary operator in sequence position -let x24a = +let x24a = query { for x in ["1"] do groupBy x.Length + 1 select x } // check misuse of binary operator in last position -let x24b = +let x24b = query { for x in ["1"] do groupBy x.Length + 1 } // check misuse of tuple in select position -let x24c = +let x24c = query { for x in ["1"] do select x.Length, x } diff --git a/tests/fsharp/typecheck/sigs/neg62.fs b/tests/fsharp/typecheck/sigs/neg62.fs index 572cdddce47..ddf69bba00d 100644 --- a/tests/fsharp/typecheck/sigs/neg62.fs +++ b/tests/fsharp/typecheck/sigs/neg62.fs @@ -17,70 +17,70 @@ type LetAfterMember() = member x.P = 1 let x = 1 -type Bad1() = +type Bad1() = member val X = 1 + 1 let x = 1 member x.P = 1 -type Bad2() = - interface System.ICloneable with +type Bad2() = + interface System.ICloneable with member x.Clone() = obj() let X = 1 + 1 -type WasBadButIsNowGood = +type WasBadButIsNowGood = static member val X = 1 + 1 -type Bad3 = +type Bad3 = member val X = 1 + 1 -type Ok1() = +type Ok1() = let p = 1 member val X = 1 + 1 -type Ok2() = +type Ok2() = let p = 1 member val X = 1 + 1 [] -type S = - val mutable X : int +type S = + val mutable X : int [] -type StructWithValBinding() = +type StructWithValBinding() = member val S = 1 with get,set -type Bad5() = +type Bad5() = let p = 1 member val X = 1 + 1 with set // 'set' alone not allowed -type Ok3() = +type Ok3() = let p = 1 member val X = 1 + 1 with get,set // 'set' alone not allowed -module GeneralizationBug_220377 = - type F<'T> = +module GeneralizationBug_220377 = + type F<'T> = abstract Invoke<'S> : 'S -> 'T let foo (f:F<'T>) = f.Invoke(42), f.Invoke("hi") - let res() = + let res() = foo { new F<_> with member x.Invoke<'S>(s:'S) = s } // 'S should not generalize, error should be reported here let n : int * int = res() [] -type Bad10 = +type Bad10 = abstract inline X : int [] -type Bad11 = +type Bad11 = abstract inline X : int -> int -module LeafExpressionsInQueries = +module LeafExpressionsInQueries = let f1 (xs:seq) = query { for x in xs do select (fun x -> x + 1) } let f2 (xs:seq) = query { for x in xs do select ((); x) } diff --git a/tests/fsharp/typecheck/sigs/neg63.fs b/tests/fsharp/typecheck/sigs/neg63.fs index 8f22c5468e1..0dee68f3911 100644 --- a/tests/fsharp/typecheck/sigs/neg63.fs +++ b/tests/fsharp/typecheck/sigs/neg63.fs @@ -6,25 +6,25 @@ let negTest1() = <@ x <- 1 @> -let negTest2() = +let negTest2() = let mutable x = 0 <@ &x @> -let posTest1(x:byref) = +let posTest1(x:byref) = <@ x @> -let negTest3() = +let negTest3() = let mutable x = 0 &x -let posTest4(addr:byref) = +let posTest4(addr:byref) = &addr -let negTest5() = +let negTest5() = let mutable x = 0 let addr = &x &addr [] -type Struct(x:int) = +type Struct(x:int) = member __.AddrX = &x diff --git a/tests/fsharp/typecheck/sigs/neg88.fs b/tests/fsharp/typecheck/sigs/neg88.fs index 0cbf2fe9d0a..fc85b1805b5 100644 --- a/tests/fsharp/typecheck/sigs/neg88.fs +++ b/tests/fsharp/typecheck/sigs/neg88.fs @@ -3,13 +3,13 @@ namespace neg88 open System open System.Linq -type Cls<'t>() = +type Cls<'t>() = member this.M1<'a, 'b>(f : Func<'a, 'b>) : Cls<'b> = new Cls<'b>() member this.M2<'a, 'b>(f : System.Linq.Expressions.Expression>) : Cls<'b> = new Cls<'b>() member this.M3<'a>(a : byref<'a>) = () -module Test = +module Test = let inline map1 (data : ^a) (f: ^b -> ^c) : ^d = (^a : (member M1 : (^b -> ^c) -> ^d) (data,f)) let inline map2 (data : ^a) (f: ^b -> ^c) : ^d = (^a : (member M2 : (^b -> ^c) -> ^d) (data,f)) let inline map3 (data : ^a)(f: ^b ref) : ^d = (^a : (member M3 : ^b ref -> ^d) (data,f)) diff --git a/tests/fsharp/typecheck/sigs/neg90.fs b/tests/fsharp/typecheck/sigs/neg90.fs index 39cca4e4607..0344cb4cbec 100644 --- a/tests/fsharp/typecheck/sigs/neg90.fs +++ b/tests/fsharp/typecheck/sigs/neg90.fs @@ -9,7 +9,7 @@ type M2 = float // See https://github.com/Microsoft/visualfsharp/issues/95 -module First = +module First = [] type DU = Member of int diff --git a/tests/fsharp/typecheck/sigs/neg91.fs b/tests/fsharp/typecheck/sigs/neg91.fs index f9c392a65f6..44b29f0ae3f 100644 --- a/tests/fsharp/typecheck/sigs/neg91.fs +++ b/tests/fsharp/typecheck/sigs/neg91.fs @@ -1,103 +1,103 @@ module Test -module T1 = - type Enum1 = +module T1 = + type Enum1 = | E = 1 with member this.Foo() = 1 // not ok -module T2 = - type Enum2 = +module T2 = + type Enum2 = | E2 = 1 type Enum2 with member this.Foo() = 1 // not ok -module TestPrivateSet = +module TestPrivateSet = // See https://github.com/Microsoft/visualfsharp/issues/27 module A = let mutable private x = 0 - module B = + module B = let test () = // let _ = A.x // accessibility error on read, as expected A.x <- 1 // but write works! -module TestObsoleteSet = +module TestObsoleteSet = // See https://github.com/Microsoft/visualfsharp/issues/27 module A = [] let mutable x = 0 - module B = + module B = let test () = - A.x <- 1 + A.x <- 1 -module TestCompilerMessageSet = +module TestCompilerMessageSet = // See https://github.com/Microsoft/visualfsharp/issues/27 module A = [] let mutable x = 0 - module B = + module B = let test () = - A.x <- 1 + A.x <- 1 -module TestExperimentalSet = +module TestExperimentalSet = // See https://github.com/Microsoft/visualfsharp/issues/27 module A = [] let mutable x = 0 - module B = + module B = let test () = - A.x <- 1 + A.x <- 1 -module Bug528_Ex1 = +module Bug528_Ex1 = module Color = let [] Yellow = "Yellow" - let isRed inp = + let isRed inp = match inp with | Color.Yellow arg -> // should get an error here failwith "Don't know this color" | _ -> "" -module Bug528_Ex2 = +module Bug528_Ex2 = type Color = | Yellow = 1 | Red = 2 - let isRed inp = + let isRed inp = match inp with | Color.Yellow arg -> // should get an error here failwith "Don't know this color" - | _ -> "" + | _ -> "" -module Bug528_Ex3 = +module Bug528_Ex3 = - let isRed inp = + let isRed inp = match inp with | System.DayOfWeek.Monday arg -> // should get an error here failwith "Don't know this day" | _ -> "" -module TestExtrinsicExtensionConstructor = +module TestExtrinsicExtensionConstructor = // See https://github.com/Microsoft/visualfsharp/issues/659 type AugmentMe() = class end - module M = + module M = type AugmentMe with new(i) = AugmentMe() // don't expect an error here -module TestIntrinsicExtensionConstructor1 = +module TestIntrinsicExtensionConstructor1 = type AugmentMe = val _i : int type AugmentMe with member i.I = i._i type AugmentMe with new(i) = { _i = i } // don't expect an error here let v = AugmentMe(42).I // don't expect an error here -module TestIntrinsicExtensionConstructor2 = +module TestIntrinsicExtensionConstructor2 = type AugmentMe() = class end type AugmentMe with member i.I = 1 type AugmentMe with new(i) = AugmentMe() // don't expect an error here diff --git a/tests/fsharp/typecheck/sigs/neg92.fs b/tests/fsharp/typecheck/sigs/neg92.fs index 4e18b421f47..afcc6d9102f 100644 --- a/tests/fsharp/typecheck/sigs/neg92.fs +++ b/tests/fsharp/typecheck/sigs/neg92.fs @@ -1,7 +1,7 @@ module Test -module Test1 = +module Test1 = type SomeClass(x : 'T) = class end //member this.P = 1 //member this.X = x @@ -9,11 +9,11 @@ module Test1 = let SomeFunc<'U> (x : 'U) = SomeClass(x) -module Test2 = +module Test2 = open System type SomeClass(updater : #IComparable->unit) = - let onLoaded () = + let onLoaded () = let adorner : #IComparable = failwith "" updater adorner member this.OnLoaded = onLoaded diff --git a/tests/fsharp/typecheck/sigs/neg93.fs b/tests/fsharp/typecheck/sigs/neg93.fs index dcb4f82c461..310422c0903 100644 --- a/tests/fsharp/typecheck/sigs/neg93.fs +++ b/tests/fsharp/typecheck/sigs/neg93.fs @@ -1,7 +1,7 @@ namespace Neg93 // See https://github.com/Microsoft/visualfsharp/issues/32 -module Repro1 = +module Repro1 = type T1<'TError>(xx:'TError) = member x.Foo() = T2.Bar(xx) and T2 = @@ -10,13 +10,13 @@ module Repro1 = //let rec f1<'TError>(xx:'TError) = f2(xx) //and f2(arg) = 0 -module Repro2 = +module Repro2 = type T1<'TError>(thisActuallyHasToBeHere:'TError) = member x.Foo() = T2.Bar(failwith "!" : option<'TError>) and T2 = static member Bar(arg:option<_>) = 0 -module Repro3 = +module Repro3 = let rec foo< > c = bar c and bar c = 0 diff --git a/tests/fsharp/typecheck/sigs/neg94-pre.fs b/tests/fsharp/typecheck/sigs/neg94-pre.fs index e17cfa79a68..2a56f3438d8 100644 --- a/tests/fsharp/typecheck/sigs/neg94-pre.fs +++ b/tests/fsharp/typecheck/sigs/neg94-pre.fs @@ -6,9 +6,9 @@ type Class1() = static member inline ($) (r:'R, _) = fun (x:'T) -> ((^R) : (static member method2: ^T -> ^R) x) static member inline method1 x = Unchecked.defaultof<'r> $ Class1() -type IComm = +type IComm = [] - abstract CanExecuteChanged : IEvent + abstract CanExecuteChanged : IEvent type Interface2<'T> = inherit IComm diff --git a/tests/fsharp/typecheck/sigs/neg94.fs b/tests/fsharp/typecheck/sigs/neg94.fs index a95c8943ced..384e0f08a04 100644 --- a/tests/fsharp/typecheck/sigs/neg94.fs +++ b/tests/fsharp/typecheck/sigs/neg94.fs @@ -1,12 +1,12 @@ namespace Neg94 -module Repro1 = +module Repro1 = let v = Neg94Pre.Class1() - let v2 = undefined - // We're expecting the compile of this file to fail, but the point is that the + let v2 = undefined + // We're expecting the compile of this file to fail, but the point is that the // reference of neg94-pre.dll shouldn't give extra warnings about bad definitions. - // See + // See // https://github.com/Microsoft/visualfsharp/issues/631 // https://github.com/Microsoft/visualfsharp/issues/592 diff --git a/tests/fsharp/typecheck/sigs/neg95.fs b/tests/fsharp/typecheck/sigs/neg95.fs index a8268129826..d3d51f93424 100644 --- a/tests/fsharp/typecheck/sigs/neg95.fs +++ b/tests/fsharp/typecheck/sigs/neg95.fs @@ -1,16 +1,16 @@ namespace rec Neg95 - module rec RecImplied = + module rec RecImplied = let x = 1 namespace Neg95B - module rec ModuleAbbreviationsAfterOpen = + module rec ModuleAbbreviationsAfterOpen = module M = List open System - module rec ModuleAbbreviationsBeforeLet = + module rec ModuleAbbreviationsBeforeLet = open System @@ -19,20 +19,20 @@ namespace Neg95B module M = List - module rec OpenBeforeLet = + module rec OpenBeforeLet = let x = 1 open System - module rec OpenBeforeType = + module rec OpenBeforeType = type C() = class end open System - module rec OpenBeforeException = + module rec OpenBeforeException = exception E of string @@ -49,4 +49,4 @@ namespace Neg95B } [] - type StructUnion = StructUnion of float * StructUnion + type StructUnion = StructUnion of float * StructUnion diff --git a/tests/fsharp/typecheck/sigs/neg96.fs b/tests/fsharp/typecheck/sigs/neg96.fs index c7e019f5f17..f368e26866a 100644 --- a/tests/fsharp/typecheck/sigs/neg96.fs +++ b/tests/fsharp/typecheck/sigs/neg96.fs @@ -20,9 +20,9 @@ type T = X<__SOURCE_DIRECTORY__> open System.Collections.Generic -let f (x: List<'T>) = +let f (x: List<'T>) = use mutable d = x.GetEnumerator() // no warning expected here! - while (d.MoveNext() ) do + while (d.MoveNext() ) do () () diff --git a/tests/fsharp/typecheck/sigs/neg97.fs b/tests/fsharp/typecheck/sigs/neg97.fs index c035cdc958f..b47abc8ef2f 100644 --- a/tests/fsharp/typecheck/sigs/neg97.fs +++ b/tests/fsharp/typecheck/sigs/neg97.fs @@ -12,22 +12,22 @@ let x = { X = 1.; Y = 1. } x.Y <- 5. -let pinIntNotAllowed() = +let pinIntNotAllowed() = use p = fixed 3 () -let pinAnyNotAllowed(x: 'T) = +let pinAnyNotAllowed(x: 'T) = use p = fixed x () -module Example1 = +module Example1 = type X<'T> = Y of 'T type X<'T when 'T :> string> with static member X = 2 static member take (s: 'T) = s -module Example2 = +module Example2 = type X<'T> = Y of 'T type X<'U when 'T :> string> with static member X = 2 diff --git a/tests/fsharp/typecheck/sigs/neg99.fs b/tests/fsharp/typecheck/sigs/neg99.fs index 6c3007c74ab..287e85a2b9b 100644 --- a/tests/fsharp/typecheck/sigs/neg99.fs +++ b/tests/fsharp/typecheck/sigs/neg99.fs @@ -2,7 +2,7 @@ namespace CrashFSC open System -// debatable code, but it was the minimalist example I could come up +// debatable code, but it was the minimalist example I could come up // with after analysis in the original project module OhOh = @@ -11,14 +11,14 @@ module OhOh = static member inline op_Explicit (MyByte x): double = double x static member inline op_Explicit (x: int64): MyByte = MyByte (byte x) - static member inline op_Explicit (x: float): MyByte = MyByte (byte x) + static member inline op_Explicit (x: float): MyByte = MyByte (byte x) static member inline op_Explicit (MyByte x): 'a = failwith "cannot convert" - + /// testing testing let inline ( !>>> ) (a: ^a) min: ^b option = - if a < (^b : (static member op_Explicit: ^b -> ^a) min) + if a < (^b : (static member op_Explicit: ^b -> ^a) min) then None - else + else Some (^b : (static member op_Explicit: ^a -> ^b) a) let inline crashMe (a: ^a) min = diff --git a/tests/fsharp/typecheck/sigs/neg_anon_1.fs b/tests/fsharp/typecheck/sigs/neg_anon_1.fs index 660788f83e2..2598d4f19c8 100644 --- a/tests/fsharp/typecheck/sigs/neg_anon_1.fs +++ b/tests/fsharp/typecheck/sigs/neg_anon_1.fs @@ -2,7 +2,7 @@ module M // Check we get compile-time errors - let negTypeTest1() = ({| a = 1+1; b = 2 |} = {| a = 2 |}) + let negTypeTest1() = ({| a = 1+1; b = 2 |} = {| a = 2 |}) let negTypeTest2() = ({| b = 2 |} = {| a = 2 |} ) diff --git a/tests/fsharp/typecheck/sigs/neg_byref_0.fs b/tests/fsharp/typecheck/sigs/neg_byref_0.fs index 5eacbb8b6bf..d027df4c706 100644 --- a/tests/fsharp/typecheck/sigs/neg_byref_0.fs +++ b/tests/fsharp/typecheck/sigs/neg_byref_0.fs @@ -1,6 +1,6 @@ module Test -(* original error *) +(* original error *) open Microsoft.FSharp.Quotations.Typed let test a = () let mutable i = 5 in diff --git a/tests/fsharp/typecheck/sigs/neg_byref_4.fs b/tests/fsharp/typecheck/sigs/neg_byref_4.fs index f33a71c67db..02c53272c1e 100644 --- a/tests/fsharp/typecheck/sigs/neg_byref_4.fs +++ b/tests/fsharp/typecheck/sigs/neg_byref_4.fs @@ -1,5 +1,5 @@ module Test type ID<'T> = - static member id (x:'T) = x + static member id (x:'T) = x let vv = ID> .id (* trap: tinst of a generic type, then static method (TExpr_ilcall) *) let f() = ID> .id (* trap: tinst of a generic type, then static method (TExpr_ilcall) *) diff --git a/tests/fsharp/typecheck/sigs/pos03.fs b/tests/fsharp/typecheck/sigs/pos03.fs index f1c91f8cd40..fe2331b7c87 100644 --- a/tests/fsharp/typecheck/sigs/pos03.fs +++ b/tests/fsharp/typecheck/sigs/pos03.fs @@ -7,7 +7,7 @@ type MU2<[] 'ua, [] 'ub> = class end type MT<'a> = class end type MT2<'a,'b> = class end -type T = +type T = static member foo (l: #MT<'c>) = () static member star (l:'a when 'a :> MT<'b>) = () diff --git a/tests/fsharp/typecheck/sigs/pos03a.fs b/tests/fsharp/typecheck/sigs/pos03a.fs index f1c91f8cd40..fe2331b7c87 100644 --- a/tests/fsharp/typecheck/sigs/pos03a.fs +++ b/tests/fsharp/typecheck/sigs/pos03a.fs @@ -7,7 +7,7 @@ type MU2<[] 'ua, [] 'ub> = class end type MT<'a> = class end type MT2<'a,'b> = class end -type T = +type T = static member foo (l: #MT<'c>) = () static member star (l:'a when 'a :> MT<'b>) = () diff --git a/tests/fsharp/typecheck/sigs/pos05.fs b/tests/fsharp/typecheck/sigs/pos05.fs index 7bd99dbe45e..92ef6369e4e 100644 --- a/tests/fsharp/typecheck/sigs/pos05.fs +++ b/tests/fsharp/typecheck/sigs/pos05.fs @@ -1,6 +1,6 @@ namespace global -module PrefixOperatorsDefaultPositive = +module PrefixOperatorsDefaultPositive = let f1 (x:Quotations.Expr<'T>) = <@ id %x @> // now allowed let f2 (x:Quotations.Expr) = <@@ id %%x @@> // now allowed let g (x:byref) = x @@ -10,7 +10,7 @@ module PrefixOperatorsDefaultPositive = let f4 x = let mutable v = 1 in g2 &v &v // now allowed let f5 x = let mutable v = 1 in g3 &&v &&v // now allowed -module PrefixOperatorsPositive = +module PrefixOperatorsPositive = // special cases: let (~+) x = x // keep let (~-) x = x // keep @@ -59,6 +59,6 @@ type Gaussian(x:float,y:float) = static member ( ** ) (g: Gaussian, e: float) = g static member Pow (g: Gaussian, e: float) = g -module M = +module M = let c1 : Gaussian = Gaussian(0.,1.) ** 3. let c2 = Gaussian(0.,1.) ** 3. diff --git a/tests/fsharp/typecheck/sigs/pos06.fs b/tests/fsharp/typecheck/sigs/pos06.fs index d209d98aed2..38eb723b6c3 100644 --- a/tests/fsharp/typecheck/sigs/pos06.fs +++ b/tests/fsharp/typecheck/sigs/pos06.fs @@ -1,6 +1,6 @@ - namespace Neg41a + namespace Neg41a type X = A | B - + namespace Neg40b type X = A | B diff --git a/tests/fsharp/typecheck/sigs/pos07.fs b/tests/fsharp/typecheck/sigs/pos07.fs index 60673733095..cbbb7dd51e1 100644 --- a/tests/fsharp/typecheck/sigs/pos07.fs +++ b/tests/fsharp/typecheck/sigs/pos07.fs @@ -1,13 +1,13 @@ module Neg41Module -id (fun x -> x) id +id (fun x -> x) id () let x = 1 open System open System.Reflection -type MyType() = +type MyType() = inherit Type() override this.GUID : Guid= failwith "Not implemented" override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj = failwith "Not implemented" @@ -37,7 +37,7 @@ type MyType() = override this.IsPointerImpl() : bool= failwith "Not implemented" override this.IsPrimitiveImpl() : bool= failwith "Not implemented" override this.IsCOMObjectImpl() : bool= failwith "Not implemented" - override this.GetElementType() : Type= failwith "Not implemented" + override this.GetElementType() : Type= failwith "Not implemented" override this.HasElementTypeImpl() : bool= failwith "Not implemented" override this.UnderlyingSystemType : Type = failwith "Not implemented" override this.Name : string = failwith "Not implemented" diff --git a/tests/fsharp/typecheck/sigs/pos08.fs b/tests/fsharp/typecheck/sigs/pos08.fs index eefa2eb769f..a7205e2c2c7 100644 --- a/tests/fsharp/typecheck/sigs/pos08.fs +++ b/tests/fsharp/typecheck/sigs/pos08.fs @@ -1,248 +1,248 @@ module Pos08 -module Tests2 = - let f2 () = - lazy +module Tests2 = + let f2 () = + lazy (let x = 1 // expect no error x + x) - let f3 () = - assert + let f3 () = + assert (let x = 1 // expect no error (x + x = x + x)) 1+2 - let f21 () = - lazy + let f21 () = + lazy (match () with () -> 1) // expect no error - let f31 () = - assert + let f31 () = + assert (match () with () -> true) // expect no error 1+2 - let f22 () = - lazy + let f22 () = + lazy (while false do ()) // expect no error - let f32 () = - assert + let f32 () = + assert (while false do () // expect no error true) 1+2 - let f23 () = - lazy + let f23 () = + lazy (try 1 with _ -> 2) // expect no error - let f33 () = - assert + let f33 () = + assert (try true with _ -> false) // expect no error 1+2 - let f24 () = - lazy + let f24 () = + lazy (if true then 1 else 2) // expect no error - let f34 () = - assert + let f34 () = + assert (if true then true else false) // expect no error 1+2 - let f25 () = - lazy + let f25 () = + lazy (for i in 0 .. 0 do ()) // expect no error - let f35 () = - assert + let f35 () = + assert (for i in 0 .. 0 do ()// expect no error true) 1+2 - let f26 () = + let f26 () = lazy 1 // expect no error - let f36 () = + let f36 () = assert true // expect no error 1+2 - let f27 () = + let f27 () = lazy id 1 // expect no error - let f37 () = + let f37 () = assert id true // expect no error 1+2 -module Tests3 = - let f2 () = - lazy +module Tests3 = + let f2 () = + lazy let x = 1 // expect no error x + x - let f3 () = - assert + let f3 () = + assert let x = 1 // expect no error (x + x = x + x) 1+2 - let f21 () = - lazy + let f21 () = + lazy match () with () -> 1 // expect no error - let f31 () = - assert + let f31 () = + assert match () with () -> true // expect no error 1+2 - let f22 () = - lazy + let f22 () = + lazy while false do () // expect no error - let f32 () = - assert + let f32 () = + assert while false do () // expect no error - true + true 1+2 - let f23 () = - lazy + let f23 () = + lazy try 1 with _ -> 2 // expect no error - let f33 () = - assert + let f33 () = + assert try true with _ -> false // expect no error 1+2 - let f24 () = - lazy + let f24 () = + lazy if true then 1 else 2 // expect no error - let f34 () = - assert + let f34 () = + assert if true then true else false // expect no error 1+2 - let f25 () = - lazy + let f25 () = + lazy for i in 0 .. 0 do () // expect no error - let f35 () = - assert + let f35 () = + assert for i in 0 .. 0 do ()// expect no error - true + true 1+2 - let gf21 () = + let gf21 () = lazy match () with () -> 1 // expect no error - let gf31 () = + let gf31 () = assert match () with () -> true // expect no error 1+2 - let gf22 () = + let gf22 () = lazy while false do () // expect no error - let gf32 () = + let gf32 () = assert while false do () // expect no error - true + true 1+2 - let gf23 () = + let gf23 () = lazy try 1 with _ -> 2 // expect no error - let gf33 () = + let gf33 () = assert try true with _ -> false // expect no error 1+2 - let gf24 () = + let gf24 () = lazy if true then 1 else 2 // expect no error - let gf34 () = + let gf34 () = assert if true then true else false // expect no error 1+2 - let gf25 () = + let gf25 () = lazy for i in 0 .. 0 do () // expect no error - let gf35 () = + let gf35 () = assert for i in 0 .. 0 do ()// expect no error - true + true 1+2 - let gf26 () = + let gf26 () = lazy let x = 1 // expect no error x + x - let gf36 () = + let gf36 () = assert let x = 1 // expect no error - x = x + x = x 1+2 -module NonControlFlowTests = +module NonControlFlowTests = let (a: Lazy), (b: int) = lazy 1, 2 - + let (++) (a:Lazy) (b:Lazy) = a.Force() + b.Force() let (b2: int) = lazy 1 ++ lazy 2 - - let (a3: Lazy), (b3: int) = - lazy 1, + + let (a3: Lazy), (b3: int) = + lazy 1, 2 - -module CheckOverloadResolutionAgainstSignatureInformationGivenByPatterns = - module Positive1 = +module CheckOverloadResolutionAgainstSignatureInformationGivenByPatterns = + + module Positive1 = type R1 = { f1 : int } type R2 = { f2 : int } - type D() = + type D() = member x.N = x.M { f1 = 3 } // Expect no error member x.M(y: R1) = () member x.M(y: R2) = () - module Positive2 = + module Positive2 = type R1 = { f1 : int } type R2 = { f2 : int } - type D() = + type D() = member x.N = x.M { f1 = 3 } // Expect no error member x.M((y: R1)) = () member x.M((y: R2)) = () - - module Positive3 = + + module Positive3 = type R1 = { f1 : int } type R2 = { f2 : int } - type D() = + type D() = member x.N = x.M { f1 = 3 } // Expect no error member x.M(_ as p : R2) = () member x.M(_ as p : R1) = () - module Positive4 = + module Positive4 = type R1 = { f1 : int } type R2 = { f2 : int } let (|Fail|_|) (x : 'a) : 'a option= None - type D() = + type D() = member x.N = x.M { f1 = 3 } // Expect no error member x.M(Fail(_) as p : R2) = () member x.M(Fail(_) as p : R1) = () - module Positive5 = + module Positive5 = type R1 = { f1 : int } type R2 = { f2 : int } - type D() = + type D() = member x.N = x.M { f1 = 3 } // Expect no error member x.M((y: R1)) = () member x.M(()) = () - -module CheckInitializationGraphInStaticMembers = - module Positive6 = - type C() = +module CheckInitializationGraphInStaticMembers = + + module Positive6 = + type C() = static let rec x = (); (fun () -> ignore x; ()) // expect warning, no runtime error static member A = x - + C.A () // expect no runtime error \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos09.fs b/tests/fsharp/typecheck/sigs/pos09.fs index b0cbe1c56ff..3c5ba08102c 100644 --- a/tests/fsharp/typecheck/sigs/pos09.fs +++ b/tests/fsharp/typecheck/sigs/pos09.fs @@ -1,6 +1,6 @@ namespace pos09 -type A() = +type A() = member this.Set(v : obj) = () member this.Set_1(name : string, v : obj) = () static member Set2(v : obj) = () diff --git a/tests/fsharp/typecheck/sigs/pos1281.fs b/tests/fsharp/typecheck/sigs/pos1281.fs index f2a73c07c3d..6beaa6c9746 100644 --- a/tests/fsharp/typecheck/sigs/pos1281.fs +++ b/tests/fsharp/typecheck/sigs/pos1281.fs @@ -6,7 +6,7 @@ let (|SetV|) x _ = x let c = Cond.Foo match c with -| Baz -> +| Baz -> printfn "Baz" | Foo & SetV "and" kwd | Bar & SetV "or" kwd -> diff --git a/tests/fsharp/typecheck/sigs/pos15.fs b/tests/fsharp/typecheck/sigs/pos15.fs index 64d5095b19a..d2e46f8154f 100644 --- a/tests/fsharp/typecheck/sigs/pos15.fs +++ b/tests/fsharp/typecheck/sigs/pos15.fs @@ -2,8 +2,8 @@ type Enumerator = member this.MoveNext() = false member this.Current = 1 - -type Collection() = + +type Collection() = member this.GetEnumerator() = Enumerator() - + [for c in Collection() do yield c] \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos16.fs b/tests/fsharp/typecheck/sigs/pos16.fs index 0dd2108b339..41e4132ac49 100644 --- a/tests/fsharp/typecheck/sigs/pos16.fs +++ b/tests/fsharp/typecheck/sigs/pos16.fs @@ -8,7 +8,7 @@ let (``A B C``(k)) = 5 if k <> 10 then exit 1 // partial case -let (|``Alpha Beta `` |_|) (x:int) = +let (|``Alpha Beta `` |_|) (x:int) = if x = 0 then Some() else None match 0,1 with @@ -27,7 +27,7 @@ match 0,1,2 with | _ -> exit 1 -module UnitOfMeasurePrintfPositiveTests = +module UnitOfMeasurePrintfPositiveTests = open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames open Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols @@ -46,13 +46,13 @@ module UnitOfMeasurePrintfPositiveTests = let _ = sprintf "%g" 1.0M let _ = sprintf "%g" 1.0M let _ = sprintf "%g" 1.0M - + let _ = sprintf "%M" 1.0M let _ = sprintf "%M" 1.0M let _ = sprintf "%M" 1.0M let _ = sprintf "%M" 1.0M -module AllowNullLiteralWithArgumentTest = +module AllowNullLiteralWithArgumentTest = type A() = class end diff --git a/tests/fsharp/typecheck/sigs/pos17.fs b/tests/fsharp/typecheck/sigs/pos17.fs index 8e81dc9369b..5e57f398db1 100644 --- a/tests/fsharp/typecheck/sigs/pos17.fs +++ b/tests/fsharp/typecheck/sigs/pos17.fs @@ -5,22 +5,22 @@ module Pos17 open System open System.Collections.Generic -module BasicTests = +module BasicTests = let f1() = "a" |> System.Uri let f2() = "a" |> Uri let f3() = ["a"] |> Set let f4() = ["a", 4 ] |> Map -module CheckFunctionNameHasPriorityOverTypeName = +module CheckFunctionNameHasPriorityOverTypeName = let Uri (x:int) = 4 let f3() = 3 |> Uri -module TestResolutionOfNonGenericTypeNameAsOverloadedConstructor = +module TestResolutionOfNonGenericTypeNameAsOverloadedConstructor = let f4() = ('a',3) |> String -module TestResolutionOfGenericTypeNameWithTypeArgumentsAsOverloadedConstructor = +module TestResolutionOfGenericTypeNameWithTypeArgumentsAsOverloadedConstructor = let w1 = List() let w2 = () |> List let w3 = List(3) @@ -30,7 +30,7 @@ module TestResolutionOfGenericTypeNameWithTypeArgumentsAsOverloadedConstructor = let w7 = List(seq { yield 1; yield 3 } ) let w8 = seq { yield 1; yield 3 } |> List -module TestResolutionOfGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotation = +module TestResolutionOfGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotation = let x1 : List = List() let x2 : List = () |> List let x3 : List = List(3) @@ -40,17 +40,17 @@ module TestResolutionOfGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotati let x7 : List = List(seq { yield 1; yield 3 } ) let x8 : List = seq { yield 1; yield 3 } |> List -module TestUseAsLambdaOfGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotation = +module TestUseAsLambdaOfGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotation = let x1 : unit -> List = List let x4 : int -> List = List let x5 : seq -> List = List -module TestUseAsLambdaOfGenericTypeNameWithLongPathAsOverloadedConstructorWithoutTypeAnnotation = +module TestUseAsLambdaOfGenericTypeNameWithLongPathAsOverloadedConstructorWithoutTypeAnnotation = let x1 : unit -> List = System.Collections.Generic.List let x4 : int -> List = System.Collections.Generic.List let x5 : seq -> List = System.Collections.Generic.List -module TestUseAsLambda2 = +module TestUseAsLambda2 = let x1 : unit -> List<_> = List let x4 : int -> List<_> = List let x5 : seq -> List<_> = List @@ -60,7 +60,7 @@ module TestUseAsLambda2 = -module TestResolutionOfAbbreviatedGenericTypeNameWithTypeArgumentsAsOverloadedConstructor = +module TestResolutionOfAbbreviatedGenericTypeNameWithTypeArgumentsAsOverloadedConstructor = let w1 = ResizeArray() let w2 = () |> ResizeArray let w3 = ResizeArray(3) @@ -70,7 +70,7 @@ module TestResolutionOfAbbreviatedGenericTypeNameWithTypeArgumentsAsOverloadedCo let w7 = ResizeArray(seq { yield 1; yield 3 } ) let w8 = seq { yield 1; yield 3 } |> ResizeArray -module TestResolutionOfAbbreviatedGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotation = +module TestResolutionOfAbbreviatedGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotation = let x1 : ResizeArray = ResizeArray() let x2 : ResizeArray = () |> ResizeArray let x3 : ResizeArray = ResizeArray(3) @@ -80,12 +80,12 @@ module TestResolutionOfAbbreviatedGenericTypeNameAsOverloadedConstructorWithoutT let x7 : ResizeArray = ResizeArray(seq { yield 1; yield 3 } ) let x8 : ResizeArray = seq { yield 1; yield 3 } |> ResizeArray -module TestUseOfAbbreviatedGenericTypeNameAsLambdaForOverloadedConstructor = +module TestUseOfAbbreviatedGenericTypeNameAsLambdaForOverloadedConstructor = let x1 : unit -> ResizeArray = ResizeArray let x4 : int -> ResizeArray = ResizeArray let x5 : seq -> ResizeArray = ResizeArray -module TestUseOfAbbreviatedGenericTypeNameWithTypeArgumentsAsLambdaForOverloadedConstructor = +module TestUseOfAbbreviatedGenericTypeNameWithTypeArgumentsAsLambdaForOverloadedConstructor = let x1 : unit -> ResizeArray<_> = ResizeArray let x4 : int -> ResizeArray<_> = ResizeArray let x5 : seq -> ResizeArray<_> = ResizeArray @@ -93,7 +93,7 @@ module TestUseOfAbbreviatedGenericTypeNameWithTypeArgumentsAsLambdaForOverloaded type IntResizeArray = List -module TestResolutionOfAbbreviatedAndInstantiatedGenericTypeNameWithTypeArgumentsAsOverloadedConstructor = +module TestResolutionOfAbbreviatedAndInstantiatedGenericTypeNameWithTypeArgumentsAsOverloadedConstructor = let w1 = IntResizeArray() let w2 = () |> IntResizeArray let w3 = IntResizeArray(3) @@ -103,7 +103,7 @@ module TestResolutionOfAbbreviatedAndInstantiatedGenericTypeNameWithTypeArgument let w7 = IntResizeArray(seq { yield 1; yield 3 } ) let w8 = seq { yield 1; yield 3 } |> IntResizeArray -module TestResolutionOfAbbreviatedAndInstantiatedGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotation = +module TestResolutionOfAbbreviatedAndInstantiatedGenericTypeNameAsOverloadedConstructorWithoutTypeAnnotation = let x1 : IntResizeArray = IntResizeArray() let x2 : IntResizeArray = () |> IntResizeArray let x3 : IntResizeArray = IntResizeArray(3) @@ -113,26 +113,26 @@ module TestResolutionOfAbbreviatedAndInstantiatedGenericTypeNameAsOverloadedCons let x7 : IntResizeArray = IntResizeArray(seq { yield 1; yield 3 } ) let x8 : IntResizeArray = seq { yield 1; yield 3 } |> IntResizeArray -module TestUseOfAbbreviatedAndInstantiatedGenericTypeNameAsLambdaForOverloadedConstructor = +module TestUseOfAbbreviatedAndInstantiatedGenericTypeNameAsLambdaForOverloadedConstructor = let x1 : unit -> IntResizeArray = IntResizeArray let x4 : int -> IntResizeArray = IntResizeArray let x5 : seq -> IntResizeArray = IntResizeArray -module TestUseOfAbbreviatedAndInstantiatedGenericTypeNameWithTypeArgumentsAsLambdaForOverloadedConstructor = +module TestUseOfAbbreviatedAndInstantiatedGenericTypeNameWithTypeArgumentsAsLambdaForOverloadedConstructor = let x1 : unit -> IntResizeArray = IntResizeArray let x4 : int -> IntResizeArray = IntResizeArray let x5 : seq -> IntResizeArray = IntResizeArray -module OverloadedTypeNamesBothWithConstructors = - type OverloadedClassName<'T>(x:int) = +module OverloadedTypeNamesBothWithConstructors = + type OverloadedClassName<'T>(x:int) = new (y:string) = OverloadedClassName<'T>(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T1,'T2>(x:int) = + type OverloadedClassName<'T1,'T2>(x:int) = new (y:string) = OverloadedClassName<'T1,'T2>(1) member __.P = x static member S() = 3 @@ -145,14 +145,14 @@ module OverloadedTypeNamesBothWithConstructors = //let t3s = "3" |> OverloadedClassName // expected error (see neg20.fs) - multiple types exist -module OverloadedTypeNamesSomeConstructors = - type OverloadedClassName<'T>(x:int) = +module OverloadedTypeNamesSomeConstructors = + type OverloadedClassName<'T>(x:int) = new (y:string) = OverloadedClassName<'T>(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T1,'T2> = + type OverloadedClassName<'T1,'T2> = member __.P = 1 static member S() = 3 @@ -163,11 +163,11 @@ module OverloadedTypeNamesSomeConstructors = //let t2s = "3" |> OverloadedClassName // expected error (see neg20.fs) - "The value or constructor 'OverloadedClassName' is not defined" //let t3s = "3" |> OverloadedClassName // expected error (see neg20.fs) - - multiple types exist -module OverloadedTypeNamesNoConstructors = - type OverloadedClassName<'T> = +module OverloadedTypeNamesNoConstructors = + type OverloadedClassName<'T> = static member S(x:int) = 3 - type OverloadedClassName<'T1,'T2> = + type OverloadedClassName<'T1,'T2> = static member S(x:int) = 3 let t1 = 3 |> OverloadedClassName.S @@ -180,20 +180,20 @@ module OverloadedTypeNamesNoConstructors = -module OverloadedTypeNamesIncludingNonGenericTypeAllWithConstructors = +module OverloadedTypeNamesIncludingNonGenericTypeAllWithConstructors = - type OverloadedClassName(x:int) = + type OverloadedClassName(x:int) = new (y:string) = OverloadedClassName(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T>(x:int) = + type OverloadedClassName<'T>(x:int) = new (y:string) = OverloadedClassName<'T>(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T1,'T2>(x:int) = + type OverloadedClassName<'T1,'T2>(x:int) = new (y:string) = OverloadedClassName<'T1,'T2>(1) member __.P = x static member S() = 3 @@ -206,41 +206,41 @@ module OverloadedTypeNamesIncludingNonGenericTypeAllWithConstructors = let t3s = "3" |> OverloadedClassName -module OverloadedTypeNamesIncludingNonGenericTypeSomeConstructors = - type OverloadedClassName(x:int) = +module OverloadedTypeNamesIncludingNonGenericTypeSomeConstructors = + type OverloadedClassName(x:int) = new (y:string) = OverloadedClassName(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T>(x:int) = + type OverloadedClassName<'T>(x:int) = new (y:string) = OverloadedClassName<'T>(1) member __.P = x static member S() = 3 - type OverloadedClassName<'T1,'T2> = + type OverloadedClassName<'T1,'T2> = member __.P = 1 static member S() = 3 let t1 = 3 |> OverloadedClassName let t1s = "3" |> OverloadedClassName -module OverloadedTypeNamesIncludingNonGenericTypeNoConstructors = +module OverloadedTypeNamesIncludingNonGenericTypeNoConstructors = - type OverloadedClassName = + type OverloadedClassName = static member S(x:int) = 3 - type OverloadedClassName<'T> = + type OverloadedClassName<'T> = static member S(x:int) = 3 - type OverloadedClassName<'T1,'T2> = + type OverloadedClassName<'T1,'T2> = static member S(x:int) = 3 let t1 = 3 |> OverloadedClassName.S let t2 = 3 |> OverloadedClassName.S - let t3 = 3 |> OverloadedClassName.S - let t3b = 3 |> OverloadedClassName.S - let t3c = 3 |> OverloadedClassName.S + let t3 = 3 |> OverloadedClassName.S + let t3b = 3 |> OverloadedClassName.S + let t3c = 3 |> OverloadedClassName.S diff --git a/tests/fsharp/typecheck/sigs/pos18.fs b/tests/fsharp/typecheck/sigs/pos18.fs index 361b9c8862f..b5d297247d5 100644 --- a/tests/fsharp/typecheck/sigs/pos18.fs +++ b/tests/fsharp/typecheck/sigs/pos18.fs @@ -2,7 +2,7 @@ // // In this test, we check we can do basic operations like "open FSharp.Collections" without needing the "Microsoft" prefix -module Pos18 = +module Pos18 = // Check we can open 'FSharp.Collections' unqualified, without warning open FSharp.Collections @@ -14,12 +14,12 @@ module Pos18 = // Check we can access 'FSharp.Quotations' via full path let v2 = FSharp.Quotations.Expr.Value 3 - // Check we can access 'FSharp.Quotations' via 'global' + // Check we can access 'FSharp.Quotations' via 'global' let v3 = global.FSharp.Quotations.Expr.Value 3 -module Pos18b = +module Pos18b = open Microsoft // Adding "open Microsoft" shouldn't trigger additional warnings - + // Check we can open 'FSharp.Collections' unqualified, without warning open FSharp.Collections @@ -31,5 +31,5 @@ module Pos18b = // Check we can access 'FSharp.Quotations' via full path let v2 = FSharp.Quotations.Expr.Value 3 - // Check we can access 'FSharp.Quotations' via 'global' + // Check we can access 'FSharp.Quotations' via 'global' let v3 = global.FSharp.Quotations.Expr.Value 3 diff --git a/tests/fsharp/typecheck/sigs/pos19.fs b/tests/fsharp/typecheck/sigs/pos19.fs index 850c4061a87..0638c9f0eb2 100644 --- a/tests/fsharp/typecheck/sigs/pos19.fs +++ b/tests/fsharp/typecheck/sigs/pos19.fs @@ -12,68 +12,68 @@ namespace FSharp.Collections namespace Pos19 - module N = + module N = open FSharp.Collections // check "List" resolves to the FSharp.Collections.List defined above - let f (x: List) = - match x with - | A -> 1 + let f (x: List) = + match x with + | A -> 1 | B -> 2 - let y = f A + let y = f A namespace Test3 - module N = + module N = open FSharp.Collections // check "List" resolves to the FSharp.Collections.List defined above - let f1 (x: List) = - match x with - | A -> 1 + let f1 (x: List) = + match x with + | A -> 1 | B -> 2 - let y1 = f1 A + let y1 = f1 A // check "List" resolves to the FSharp.Collections.List defined above - let f2 (x: global.FSharp.Collections.List) = - match x with - | A -> 1 + let f2 (x: global.FSharp.Collections.List) = + match x with + | A -> 1 | B -> 2 - let y2 = f2 A + let y2 = f2 A // check "List" resolves to the FSharp.Collections.List defined above - let f3 (x: FSharp.Collections.List) = - match x with - | A -> 1 + let f3 (x: FSharp.Collections.List) = + match x with + | A -> 1 | B -> 2 - let y3 = f3 A + let y3 = f3 A // check "Map" resolves to the FSharp.Collections.List defined above - let g1 (x: Map) = - match x with - | C -> 1 + let g1 (x: Map) = + match x with + | C -> 1 | D -> 2 - let z1 = g1 C + let z1 = g1 C // check "List" resolves to the FSharp.Collections.List defined above - let g2 (x: global.FSharp.Collections.Map) = - match x with - | C -> 1 + let g2 (x: global.FSharp.Collections.Map) = + match x with + | C -> 1 | D -> 2 - let z2 = g2 C + let z2 = g2 C // check "List" resolves to the FSharp.Collections.List defined above - let g3 (x: FSharp.Collections.Map) = - match x with - | C -> 1 + let g3 (x: FSharp.Collections.Map) = + match x with + | C -> 1 | D -> 2 - let z3 = g3 C + let z3 = g3 C diff --git a/tests/fsharp/typecheck/sigs/pos20.fs b/tests/fsharp/typecheck/sigs/pos20.fs index 2c0c8ef098d..aa7d3ae6d23 100644 --- a/tests/fsharp/typecheck/sigs/pos20.fs +++ b/tests/fsharp/typecheck/sigs/pos20.fs @@ -1,6 +1,6 @@ // test covering https://github.com/Microsoft/visualfsharp/issues/276 -open FSharp.Data.UnitSystems.SI.UnitSymbols +open FSharp.Data.UnitSystems.SI.UnitSymbols [] type S1 = @@ -8,7 +8,7 @@ type S1 = [] type S2 = - val X: int + val X: int let f (x : 'T when 'T: unmanaged and 'T: struct) = printfn "%A" x diff --git a/tests/fsharp/typecheck/sigs/pos21.fs b/tests/fsharp/typecheck/sigs/pos21.fs index 77f2d2d1fb4..8250659022a 100644 --- a/tests/fsharp/typecheck/sigs/pos21.fs +++ b/tests/fsharp/typecheck/sigs/pos21.fs @@ -3,7 +3,7 @@ namespace Library2 open System open System.Data -module M = +module M = let dataset = new DataSet("test add reference") Console.WriteLine(dataset.DataSetName) Console.ReadKey(true) \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos23.fs b/tests/fsharp/typecheck/sigs/pos23.fs index 2f7b2b20d9a..a9b89a5f986 100644 --- a/tests/fsharp/typecheck/sigs/pos23.fs +++ b/tests/fsharp/typecheck/sigs/pos23.fs @@ -2,8 +2,8 @@ module PrintfDecimalUnitOfMeasureTests [] type usd -let f x = +let f x = let _ = sprintf "%M" x exit (match box x with :? decimal -> 0 | _ -> 1) - + f 1.m \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos24.fs b/tests/fsharp/typecheck/sigs/pos24.fs index d54b7415207..71de0a5b141 100644 --- a/tests/fsharp/typecheck/sigs/pos24.fs +++ b/tests/fsharp/typecheck/sigs/pos24.fs @@ -2,7 +2,7 @@ module Pos24 [] -let main argv = +let main argv = let fu = 0 1 |> ignore let fu = 0 diff --git a/tests/fsharp/typecheck/sigs/pos27.fs b/tests/fsharp/typecheck/sigs/pos27.fs index 554e8d8a956..53a8f17acf2 100644 --- a/tests/fsharp/typecheck/sigs/pos27.fs +++ b/tests/fsharp/typecheck/sigs/pos27.fs @@ -1,6 +1,6 @@ module Pos27 -module TUple = +module TUple = let x1: System.Tuple = System.Tuple.Create(1) let x2: System.Tuple = System.Tuple.Create(1,2) let x3: System.Tuple = System.Tuple.Create(1,2,3) @@ -10,7 +10,7 @@ module TUple = let x7: System.Tuple = System.Tuple.Create(1,2,3,4,5,6,7) let x9: System.Tuple> = System.Tuple.Create(1,2,3,4,5,6,7,8) -module ValueTuple = +module ValueTuple = let x1: System.ValueTuple = System.ValueTuple.Create(1) let x2: System.ValueTuple = System.ValueTuple.Create(1,2) let x3: System.ValueTuple = System.ValueTuple.Create(1,2,3) @@ -20,6 +20,6 @@ module ValueTuple = let x7: System.ValueTuple = System.ValueTuple.Create(1,2,3,4,5,6,7) let x9: System.ValueTuple> = System.ValueTuple.Create(1,2,3,4,5,6,7,8) -module FSharpFunc = +module FSharpFunc = let x1: FSharpFunc = (fun x -> x + 1) let x2: FSharpFunc> = (fun x y -> x + 1 + y) diff --git a/tests/fsharp/typecheck/sigs/pos28.fs b/tests/fsharp/typecheck/sigs/pos28.fs index ae383989f47..9d52919d3a1 100644 --- a/tests/fsharp/typecheck/sigs/pos28.fs +++ b/tests/fsharp/typecheck/sigs/pos28.fs @@ -2,19 +2,19 @@ module Pos28 open FSharp.NativeInterop -module Test1 = +module Test1 = [] type Point = val mutable X: int val mutable Y: int - new(x,y) = { X=x; Y=y; } + new(x,y) = { X=x; Y=y; } let fixPoint1() = let mutable point = Point(1,2) let p1 = &&point.X NativePtr.read p1 -module Test2 = +module Test2 = [] type Point = { mutable x : int; mutable y : int } @@ -24,4 +24,3 @@ module Test2 = NativePtr.read p1 - \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos29.fsi b/tests/fsharp/typecheck/sigs/pos29.fsi index 743173c41d8..910fd6accb1 100644 --- a/tests/fsharp/typecheck/sigs/pos29.fsi +++ b/tests/fsharp/typecheck/sigs/pos29.fsi @@ -1,4 +1,4 @@ module rec Pos29 -val x : A +val x : A type A = int diff --git a/tests/fsharp/typecheck/sigs/pos30.fs b/tests/fsharp/typecheck/sigs/pos30.fs index cbc3c4041da..1b93ea4427d 100644 --- a/tests/fsharp/typecheck/sigs/pos30.fs +++ b/tests/fsharp/typecheck/sigs/pos30.fs @@ -1,45 +1,45 @@ module Pos30 -module Test0 = +module Test0 = System.Console.WriteLine(format="{0}", arg = (Array.ofSeq <| seq { yield box "hello" })) -module Test0b = +module Test0b = System.Console.WriteLine(seq { - yield 1 + yield 1 }) -module Test1 = - System.Console.WriteLine(format="{0}", arg = [| +module Test1 = + System.Console.WriteLine(format="{0}", arg = [| "hello" |]) System.Console.WriteLine([| "hello" |]) -module Test2 = - System.Console.WriteLine(format="{0}", arg = Array.ofList [ +module Test2 = + System.Console.WriteLine(format="{0}", arg = Array.ofList [ "hello" ]) System.Console.WriteLine([ "hello" ]) -module Test3 = - System.Console.WriteLine(format="{0}", arg = [| +module Test3 = + System.Console.WriteLine(format="{0}", arg = [| |]) System.Console.WriteLine([| |]) -module Test4 = - System.Console.WriteLine(format="{0}", arg = Array.ofList [ +module Test4 = + System.Console.WriteLine(format="{0}", arg = Array.ofList [ ]) System.Console.WriteLine([ ]) -module Test5 = +module Test5 = System.Console.WriteLine(format="{0}", arg = [| yield box "hello" yield box "hello" @@ -47,8 +47,8 @@ module Test5 = yield box "hello" |]) -module Test6 = - System.Console.WriteLine(format="{0}", arg = Array.ofList [ +module Test6 = + System.Console.WriteLine(format="{0}", arg = Array.ofList [ yield box "hello" yield box "hello" yield box "hello" @@ -57,8 +57,8 @@ module Test6 = ]) -module Test7 = - System.Console.WriteLine [| +module Test7 = + System.Console.WriteLine [| yield "hello" yield "hello" yield "hello" @@ -67,4 +67,3 @@ module Test7 = |] - \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos31.fs b/tests/fsharp/typecheck/sigs/pos31.fs index cab65060062..84d14f4be44 100644 --- a/tests/fsharp/typecheck/sigs/pos31.fs +++ b/tests/fsharp/typecheck/sigs/pos31.fs @@ -7,16 +7,16 @@ let x4 : obj[] = [| yield "" |] let x5 : seq = seq { yield "" } let x6 : seq = seq { yield "" :> obj } -let g2 () : System.Reflection.MemberInfo[] = +let g2 () : System.Reflection.MemberInfo[] = [| yield (Unchecked.defaultof :> _) |] -let g3 () : System.Reflection.MemberInfo[] = +let g3 () : System.Reflection.MemberInfo[] = [| yield Unchecked.defaultof |] -let g4 () : System.Reflection.MemberInfo[] = +let g4 () : System.Reflection.MemberInfo[] = [| yield! g2() yield Unchecked.defaultof |] -let g5 xs : System.Reflection.MemberInfo[] = +let g5 xs : System.Reflection.MemberInfo[] = [| for x in xs do yield x |] - + diff --git a/tests/fsharp/typecheck/sigs/pos32.fs b/tests/fsharp/typecheck/sigs/pos32.fs index 2df8deebdab..c8d8e38385b 100644 --- a/tests/fsharp/typecheck/sigs/pos32.fs +++ b/tests/fsharp/typecheck/sigs/pos32.fs @@ -1,9 +1,9 @@ module Pos32 - let inline test (arg: ^T when ^T : struct) = + let inline test (arg: ^T when ^T : struct) = () let f () = let a = test struct (1, 2) () - + diff --git a/tests/fsharp/typecheck/sigs/pos33.fsi b/tests/fsharp/typecheck/sigs/pos33.fsi index 3ba98f32d9d..2079b9aac6c 100644 --- a/tests/fsharp/typecheck/sigs/pos33.fsi +++ b/tests/fsharp/typecheck/sigs/pos33.fsi @@ -8,5 +8,5 @@ val z : int val w : string = "w" val q : string [] -val u : string = +val u : string = "u" \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos34.fs b/tests/fsharp/typecheck/sigs/pos34.fs index 73cebb29505..f1748e6167d 100644 --- a/tests/fsharp/typecheck/sigs/pos34.fs +++ b/tests/fsharp/typecheck/sigs/pos34.fs @@ -23,7 +23,7 @@ type Bind = static member (>>=) (source: Lazy<'T> , f: 'T -> Lazy<'U> ) = lazy (f source.Value).Value : Lazy<'U> static member (>>=) (source: Task<'T> , f: 'T -> Task<'U> ) = source.ContinueWith(fun (x: Task<_>) -> f x.Result).Unwrap () : Task<'U> static member (>>=) (source , f: 'T -> _ ) = Option.bind f source : option<'U> - static member (>>=) (source , f: 'T -> _ ) = async.Bind (source, f) + static member (>>=) (source , f: 'T -> _ ) = async.Bind (source, f) static member (>>=) (source : Id<_> , f: 'T -> _ ) = f source.getValue : Id<'U> static member inline Invoke (source: '``Monad<'T>``) (binder: 'T -> '``Monad<'U>``) : '``Monad<'U>`` = @@ -74,7 +74,7 @@ let inline bind f (source: TypeT<'mt>) : TypeT<'mu> = | A -> result <| (A : Node<'mu,'u>) : 'miu | B (h:'t, t: TypeT<'mt>) -> let res = concat (f h: TypeT<'mu>) (loop f t) - unwrap res : 'miu) + unwrap res : 'miu) loop f source : TypeT<'mu> diff --git a/tests/fsharp/typecheck/sigs/pos35.fs b/tests/fsharp/typecheck/sigs/pos35.fs index ed7c76a5617..7dc23df2fb8 100644 --- a/tests/fsharp/typecheck/sigs/pos35.fs +++ b/tests/fsharp/typecheck/sigs/pos35.fs @@ -3,8 +3,8 @@ module Pos35 // Variation on test case mentioned in https://github.com/dotnet/fsharp/pull/6805#issuecomment-580368303 // // We are selecting an overloaded witness based on input type -module SelectOverloadedWitnessBasedOnInputType = - type witnesses = +module SelectOverloadedWitnessBasedOnInputType = + type witnesses = static member inline unsigned_witness (x : sbyte) = uint8 x static member inline unsigned_witness (x : byte) = x static member inline unsigned_witness (x : int16) = uint16 x @@ -45,8 +45,8 @@ module SelectOverloadedWitnessBasedOnInputType = // Variation on the previous test case // // Note, this adds output as a selector though that shouldn't make any difference -module SelectOverloadedWitnessBasedOnInputTypePlusNeedlessOutputTypeSelector = - type witnesses = +module SelectOverloadedWitnessBasedOnInputTypePlusNeedlessOutputTypeSelector = + type witnesses = static member inline unsigned_witness (x : sbyte) = uint8 x static member inline unsigned_witness (x : byte) = x static member inline unsigned_witness (x : int16) = uint16 x @@ -77,14 +77,14 @@ module SelectOverloadedWitnessBasedOnInputTypePlusNeedlessOutputTypeSelector = let g4 : int64 -> _ = unsigned // Variation on test case mentioned in https://github.com/dotnet/fsharp/pull/6805#issuecomment-580368303 -module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentAndUsingOutputSelector = +module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentAndUsingOutputSelector = open System open System.Numerics let _uint8max = bigint (uint32 Byte.MaxValue) let _uint16max = bigint (uint32 UInt16.MaxValue) let _uint32max = bigint UInt32.MaxValue let _uint64max = bigint UInt64.MaxValue - type witnesses = + type witnesses = static member inline convert_witness (x : bigint, _output : int32) = int (uint32 (x &&& _uint32max)) static member inline convert_witness (x : bigint, _output : int64) = int64 (uint64 (x &&& _uint64max)) static member inline convert_witness (x : bigint, _output : bigint) = x @@ -132,10 +132,10 @@ module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentAndUsingOut let f10 : _ -> uint64 = convert let f11 : _ -> float32 = convert let f12 : _ -> decimal = convert - let f13 : _ -> Complex = convert + let f13 : _ -> Complex = convert // This is permitted because the ^output type is still a selector - // + // // The resulting type is like this: // // val inline inst : num:bigint -> ^output when (witnesses or bigint or ^output) : (static member convert_witness : bigint * ^output -> ^output) @@ -158,14 +158,14 @@ module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentAndUsingOut // This removes ^output as a type selector for the witness, but continues to pass a dummy ^output // // This is sufficient to make the resolutions go through -module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentNoOutputSelector = +module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentNoOutputSelector = open System open System.Numerics let _uint8max = bigint (uint32 Byte.MaxValue) let _uint16max = bigint (uint32 UInt16.MaxValue) let _uint32max = bigint UInt32.MaxValue let _uint64max = bigint UInt64.MaxValue - type witnesses = + type witnesses = static member inline convert_witness (x : bigint, _output : int32) = int (uint32 (x &&& _uint32max)) static member inline convert_witness (x : bigint, _output : int64) = int64 (uint64 (x &&& _uint64max)) static member inline convert_witness (x : bigint, _output : bigint) = x @@ -213,25 +213,25 @@ module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentNoOutputSel let f10 : _ -> uint64 = convert let f11 : _ -> float32 = convert let f12 : _ -> decimal = convert - let f13 : _ -> Complex = convert + let f13 : _ -> Complex = convert // Adding this gives an error, see neg129.fs for the test for this // let inline inst (num: bigint) : ^output = convert num - + // Variation on test case mentioned in https://github.com/dotnet/fsharp/pull/6805#issuecomment-580368303 -// +// // Same as SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentNoOutputSelector but the output type // parameter is generic 'output rather than SRTP ^output // -module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentGenericOutputType = +module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentGenericOutputType = open System open System.Numerics let _uint8max = bigint (uint32 Byte.MaxValue) let _uint16max = bigint (uint32 UInt16.MaxValue) let _uint32max = bigint UInt32.MaxValue let _uint64max = bigint UInt64.MaxValue - type witnesses = + type witnesses = static member inline convert_witness (x : bigint, _output : int32) = int (uint32 (x &&& _uint32max)) static member inline convert_witness (x : bigint, _output : int64) = int64 (uint64 (x &&& _uint64max)) static member inline convert_witness (x : bigint, _output : bigint) = x @@ -279,14 +279,14 @@ module SelectOverloadedWitnessBasedOnReturnTypeByPassingDummyArgumentGenericOutp let f10 : _ -> uint64 = convert let f11 : _ -> float32 = convert let f12 : _ -> decimal = convert - let f13 : _ -> Complex = convert + let f13 : _ -> Complex = convert // Adding this gives an error, see neg128.fs for the test for this // let inline inst (num: bigint) : 'output = convert num // Reduced FSharpPlus tests case from https://github.com/dotnet/fsharp/pull/6805#issuecomment-580365649 -module PositiveTestCase3 = +module PositiveTestCase3 = [] module Extensions = @@ -302,14 +302,14 @@ module PositiveTestCase3 = type Witnesses = - static member inline QuackWitness (x: ^a, _output: ^Output, _impl: Witnesses) : ^Output = CallQuack x + static member inline QuackWitness (x: ^a, _output: ^Output, _impl: Witnesses) : ^Output = CallQuack x static member inline QuackWitness (x: ref<_>, _output: ^Output, _impl: Witnesses) : ^Output = Unchecked.defaultof<_> let inline CallQuackWitness (x: ^a, output: ^Output, witnesses: ^Witnesses) = ((^a or ^Output or ^Witnesses) : (static member QuackWitness : _*_*_ -> _) (x, output, witnesses)) - let inline call (x: seq< ^b > ) : ^Output = - CallQuackWitness (x, Unchecked.defaultof< ^Output >, Unchecked.defaultof) + let inline call (x: seq< ^b > ) : ^Output = + CallQuackWitness (x, Unchecked.defaultof< ^Output >, Unchecked.defaultof) diff --git a/tests/fsharp/typecheck/sigs/pos36-srtp-lib.fs b/tests/fsharp/typecheck/sigs/pos36-srtp-lib.fs index f8b24122724..b3ff38a0605 100644 --- a/tests/fsharp/typecheck/sigs/pos36-srtp-lib.fs +++ b/tests/fsharp/typecheck/sigs/pos36-srtp-lib.fs @@ -2,10 +2,10 @@ module Lib -let inline RequireM< ^Witnesses, ^T when (^Witnesses or ^T): (static member M : ^T -> string) > (x: ^T) : string = +let inline RequireM< ^Witnesses, ^T when (^Witnesses or ^T): (static member M : ^T -> string) > (x: ^T) : string = ((^Witnesses or ^T): (static member M : ^T -> string) x) -type C(p:int) = +type C(p:int) = member x.P = p type Witnesses() = diff --git a/tests/fsharp/typecheck/sigs/pos37.fs b/tests/fsharp/typecheck/sigs/pos37.fs index 71199d438e1..20c19d9bf2f 100644 --- a/tests/fsharp/typecheck/sigs/pos37.fs +++ b/tests/fsharp/typecheck/sigs/pos37.fs @@ -12,32 +12,32 @@ module TestVariableTypes = // Variable types are considered to satisfy ValueType constraint if they have that constraint // or it is inferred - // - type T1<'T when 'T :> ValueType>(x : 'T) = + // + type T1<'T when 'T :> ValueType>(x : 'T) = do x |> PlaceValueTypeConstraint |> ignore let f1 x = x |> PlaceValueTypeConstraint |> ignore // Variable types are considered to satisfy struct constraint if they have that constraint // or it is inferred - // - type T2<'T when 'T : struct>(x : 'T) = + // + type T2<'T when 'T : struct>(x : 'T) = do x |> PlaceStructConstraint |> ignore let f2 x = x |> PlaceStructConstraint |> ignore // Variable types are considered to satisfy default constructor constraint if they have that constraint // or it is inferred - // - type T3<'T when 'T : (new : unit -> 'T)>(x : 'T) = + // + type T3<'T when 'T : (new : unit -> 'T)>(x : 'T) = do x |> PlaceDefaultConstructorConstraint |> ignore let f3 x = x |> PlaceDefaultConstructorConstraint |> ignore module TestStructTuples = - // Struct tuples are always considered to satisfy ValueType constraint - // - type T1<'T when 'T :> ValueType>(x : struct ('T * 'T)) = + // Struct tuples are always considered to satisfy ValueType constraint + // + type T1<'T when 'T :> ValueType>(x : struct ('T * 'T)) = do x |> PlaceValueTypeConstraint |> ignore let f1 (x : struct ('T * 'T)) = @@ -48,8 +48,8 @@ module TestStructTuples = // Struct tuple types are considered to satisfy struct constraint if they have that constraint // or it is inferred - // - type T2<'T when 'T : struct>(x : struct ('T * 'T)) = + // + type T2<'T when 'T : struct>(x : struct ('T * 'T)) = do x |> PlaceStructConstraint |> ignore let f2 (x : struct ('T * 'T)) = @@ -62,7 +62,7 @@ module TestStructTuples = // type is known (without placing any constraints) to have a default value. If the element types // are variable types they must have been pre-determined through inference or explicit // declaration to be either struct or reference variable types. - type T3a(x : struct (int * string)) = + type T3a(x : struct (int * string)) = do x |> PlaceDefaultConstructorConstraint |> ignore let v3a = T3a (struct (1, "a")) @@ -74,13 +74,13 @@ module TestStructTuples = f3a (struct (1, "a")) // The case for struct type variables (declared) - type T3b<'T when 'T : struct and 'T : (new : unit -> 'T)>(x : struct (int * 'T)) = + type T3b<'T when 'T : struct and 'T : (new : unit -> 'T)>(x : struct (int * 'T)) = do x |> PlaceDefaultConstructorConstraint |> ignore let v3b = T3b (struct (1, System.DateTime.Now)) // The case for struct type variables (inferred) - let f3b (x : struct (int * 'T)) = + let f3b (x : struct (int * 'T)) = let (struct (a,b)) = x b |> PlaceStructConstraint |> ignore x |> PlaceDefaultConstructorConstraint |> ignore @@ -89,13 +89,13 @@ module TestStructTuples = f3b (struct (1, System.DateTime.Now)) // The case for reference type variables (declared) - type T3c<'T when 'T : not struct and 'T : null>(x : struct (int * 'T)) = + type T3c<'T when 'T : not struct and 'T : null>(x : struct (int * 'T)) = do x |> PlaceDefaultConstructorConstraint |> ignore let v3c = T3c (struct (1, "abc")) // The case for reference type variables (inferred) - let f3c (x : struct (int * 'T)) = + let f3c (x : struct (int * 'T)) = let (struct (a,b)) = x b |> PlaceReferenceConstraint |> ignore x |> PlaceDefaultConstructorConstraint |> ignore @@ -104,9 +104,9 @@ module TestStructTuples = f3c (struct (1, obj())) module TestStructAnonRecords = - // Struct anon record are always considered to satisfy ValueType constraint - // - type T1<'T when 'T :> ValueType>(x : struct {| X : 'T; Y : 'T |}) = + // Struct anon record are always considered to satisfy ValueType constraint + // + type T1<'T when 'T :> ValueType>(x : struct {| X : 'T; Y : 'T |}) = do x |> PlaceValueTypeConstraint |> ignore let f1 (x : struct {| X : 'T; Y : 'T |}) = @@ -117,8 +117,8 @@ module TestStructAnonRecords = // Struct tuple types are considered to satisfy struct constraint if they have that constraint // or it is inferred - // - type T2<'T when 'T : struct>(x : struct {| X : 'T; Y : 'T |}) = + // + type T2<'T when 'T : struct>(x : struct {| X : 'T; Y : 'T |}) = do x |> PlaceStructConstraint |> ignore let f2 (x : struct {| X : 'T; Y : 'T |}) = @@ -131,7 +131,7 @@ module TestStructAnonRecords = // type is known (without placing any constraints) to have a default value. If the element types // are variable types they must have been pre-determined through inference or explicit // declaration to be either struct or reference variable types. - type T3a(x : struct {| X : int; Y : string |}) = + type T3a(x : struct {| X : int; Y : string |}) = do x |> PlaceDefaultConstructorConstraint |> ignore // The case for struct and reference element types @@ -141,13 +141,13 @@ module TestStructAnonRecords = f3a {| X = 1; Y = "a" |} // The case for struct type variables (declared) - type T3b<'T when 'T : struct and 'T : (new : unit -> 'T)>(x : struct {| X : int; Y : 'T |}) = + type T3b<'T when 'T : struct and 'T : (new : unit -> 'T)>(x : struct {| X : int; Y : 'T |}) = do x |> PlaceDefaultConstructorConstraint |> ignore let v3b = T3b {| X = 1; Y = System.DateTime.Now |} // The case for struct type variables (inferred) - let f3b (x : struct {| X : int; Y : 'T |}) = + let f3b (x : struct {| X : int; Y : 'T |}) = x.Y |> PlaceStructConstraint |> ignore x |> PlaceDefaultConstructorConstraint |> ignore @@ -155,13 +155,13 @@ module TestStructAnonRecords = f3b {| X = 1; Y = System.DateTime.Now |} // The case for reference type variables (declared) - type T3c<'T when 'T : not struct and 'T : null>(x : struct {| X : int; Y : 'T |}) = + type T3c<'T when 'T : not struct and 'T : null>(x : struct {| X : int; Y : 'T |}) = do x |> PlaceDefaultConstructorConstraint |> ignore let v3c = T3c {| X = 1; Y = "abc" |} // The case for reference type variables (inferred) - let f3c (x : struct {| X : int; Y : 'T |}) = + let f3c (x : struct {| X : int; Y : 'T |}) = x.Y |> PlaceReferenceConstraint |> ignore x |> PlaceDefaultConstructorConstraint |> ignore @@ -178,7 +178,7 @@ module TestNullableStructTuples = let m2 (x: Nullable>) = () - type T<'T when 'T :> ValueType and 'T : struct and 'T : (new : unit -> 'T)>() = + type T<'T when 'T :> ValueType and 'T : struct and 'T : (new : unit -> 'T)>() = let m (x: Nullable) = () module TestNullableStructAnonRecds = @@ -190,14 +190,14 @@ module TestNullableStructAnonRecds = // this means knowing whether the variable type is a reference or value type let m1 (x: Nullable) = () - type Ta<'T when 'T :> ValueType and 'T : struct and 'T : (new : unit -> 'T)>() = + type Ta<'T when 'T :> ValueType and 'T : struct and 'T : (new : unit -> 'T)>() = let m (x: Nullable) = () - type Tb<'T when 'T : not struct and 'T : null>() = + type Tb<'T when 'T : not struct and 'T : null>() = let m (x: Nullable) = () -module TestAnotherStructRecord = - +module TestAnotherStructRecord = + let inline test<'t when 't: (new: unit -> 't) and 't: struct and 't:> ValueType> () = () [] @@ -209,17 +209,17 @@ module TestAnotherStructRecord = test< struct {| SkipX: byte; Control: sbyte |} > () test< struct (byte * sbyte) > () -module TestAnotherStructTuple = - +module TestAnotherStructTuple = + let x = System.Nullable(struct (0, 0)) // note, the type annotations are required -module TestAnotherStructTuple2 = - +module TestAnotherStructTuple2 = + let x = struct(0, 0) let y = System.Nullable(x) -module TestAnotherStructTuple3 = - +module TestAnotherStructTuple3 = + let x = struct(0, 0) let y = System.Nullable(struct (0, 0) |> unbox>) let z = System.Nullable(x |> unbox>) diff --git a/tests/fsharp/typecheck/sigs/pos38.fs b/tests/fsharp/typecheck/sigs/pos38.fs index bf9ad7ea8f9..0b5ca80807f 100644 --- a/tests/fsharp/typecheck/sigs/pos38.fs +++ b/tests/fsharp/typecheck/sigs/pos38.fs @@ -15,7 +15,7 @@ module Extensions = match this with | BinaryOp (_, e2) -> e2.Foobar2 - | EndOp -> + | EndOp -> count <- count + 1 () diff --git a/tests/fsharp/typecheck/sigs/pos39.fs b/tests/fsharp/typecheck/sigs/pos39.fs index aced03845e4..a382cb75eab 100644 --- a/tests/fsharp/typecheck/sigs/pos39.fs +++ b/tests/fsharp/typecheck/sigs/pos39.fs @@ -1,28 +1,28 @@ module Pos39 -module BigAnonRecords4 = +module BigAnonRecords4 = let v = Map [ {| A = ""; B = ""; C = ""; D = ""; |}, () ] v.TryFind {| A = ""; B = ""; C = ""; D = ""; |} |> sprintf "%A" |> fun s -> if s <> "Some ()" then failwith "unexpected" -module BigAnonRecords5 = +module BigAnonRecords5 = let v = Map [ {| A = ""; B = ""; C = ""; D = ""; E = "" ;|}, () ] v.TryFind {| A = ""; B = ""; C = ""; D = ""; E = "" |} |> sprintf "%A" |> fun s -> if s <> "Some ()" then failwith "unexpected" -module BigAnonRecords6 = +module BigAnonRecords6 = let v = Map [ {| A = ""; B = ""; C = ""; D = ""; E = "" ; F = ""|}, () ] v.TryFind {| A = ""; B = ""; C = ""; D = ""; E = ""; F = "" |} |> sprintf "%A" |> fun s -> if s <> "Some ()" then failwith "unexpected" -module BigAnonRecords7 = +module BigAnonRecords7 = let v = Map [ {| A = ""; B = ""; C = ""; D = ""; E = "" ; F = ""; G = "" |}, () ] v.TryFind {| A = ""; B = ""; C = ""; D = ""; E = ""; F = ""; G = "" |} |> sprintf "%A" |> fun s -> if s <> "Some ()" then failwith "unexpected" -module BigAnonRecords8 = +module BigAnonRecords8 = let v = Map [ {| A = ""; B = ""; C = ""; D = ""; E = "" ; F = ""; G = ""; H = 1 |}, () {| A = ""; B = ""; C = ""; D = ""; E = "" ; F = ""; G = ""; H = 2 |}, ()] v.TryFind {| A = ""; B = ""; C = ""; D = ""; E = ""; F = ""; G = ""; H = 2 |} |> sprintf "%A" |> fun s -> if s <> "Some ()" then failwith "unexpected" v.TryFind {| A = ""; B = ""; C = ""; D = ""; E = ""; F = ""; G = ""; H = 1 |} |> sprintf "%A" |> fun s -> if s <> "Some ()" then failwith "unexpected" -module BigAnonRecords9 = +module BigAnonRecords9 = let v = Map [ {| A = ""; B = ""; C = ""; D = ""; E = "" ; F = ""; G = ""; H = 1; I = 3.0M |}, 1 {| A = ""; B = ""; C = ""; D = ""; E = "" ; F = ""; G = ""; H = 2; I = 3.0M |}, 2] v.TryFind {| A = ""; B = ""; C = ""; D = ""; E = ""; F = ""; G = ""; H = 2; I = 3.0M |} |> sprintf "%A" |> fun s -> if s <> "Some 2" then failwith "unexpected" diff --git a/tests/fsharp/typecheck/sigs/pos40.fs b/tests/fsharp/typecheck/sigs/pos40.fs index 29cb9724ffe..02c2d766f22 100644 --- a/tests/fsharp/typecheck/sigs/pos40.fs +++ b/tests/fsharp/typecheck/sigs/pos40.fs @@ -14,18 +14,18 @@ module TestOverloadsWithSrtpThatDoResolve1 = // Here, 'x' doesn't contain any type information. However the presence of an SRTP-constrained // method causes the Foo constraint to be applied to the caller argument type and the // method is resolved to the first overload. - let inline f x = - OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) + let inline f x = + OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) type C() = member x.Foo = 3 - - let v = f (C()) // this should now resolve + + let v = f (C()) // this should now resolve // Here, 'x' contains enough type information to resolve the overload. // Lambda propagation applies and the lambda argument 'a' gets known type 'string'. - let f4 (x: string) = - OverloadsWithSrtp.SomeMethod (x, (fun a -> a.Length)) + let f4 (x: string) = + OverloadsWithSrtp.SomeMethod (x, (fun a -> a.Length)) module TestOverloadsWithSrtpThatDoResolve2 = @@ -38,15 +38,15 @@ module TestOverloadsWithSrtpThatDoResolve2 = // method does not causes the Foo constraint to be applied to the caller argument type because NoEagerConstraintApplication is present. // // Overload resolution proceeds. The second overload is not generic so is preferred according to standard overloading rules. - let f x = - OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) + let f x = + OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) let v = f "hello" // this should now resolve since 'x' was inferred to have type 'string' // Here, 'x' contains enough type information to resolve the overload. // Lambda propagation applies and the lambda argument 'a' gets known type 'string'. - let f4 (x: string) = - OverloadsWithSrtp.SomeMethod (x, (fun a -> a.Length)) + let f4 (x: string) = + OverloadsWithSrtp.SomeMethod (x, (fun a -> a.Length)) module TestOverloadsWithSrtpThatDoResolve3 = @@ -57,20 +57,20 @@ module TestOverloadsWithSrtpThatDoResolve3 = // Here, 'x' contains enough type information to resolve the overload. // The lambda argument 'a' gets constrained type - let inline f2< ^T when ^T : (member Length: int)> (x: ^T) = - OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) + let inline f2< ^T when ^T : (member Length: int)> (x: ^T) = + OverloadsWithSrtp.SomeMethod (x, (fun a -> 1)) let v1 = f2 [1] let v2 = f2 [| 1 |] // Here, 'x' contains enough type information to resolve the overload // The lambda argument 'a' gets constrained type - let inline f3< ^T when ^T : (member Length: int) and ^T : (member Length2: int)> (x: ^T) = - OverloadsWithSrtp.SomeMethod (x, (fun a -> 2)) + let inline f3< ^T when ^T : (member Length: int) and ^T : (member Length2: int)> (x: ^T) = + OverloadsWithSrtp.SomeMethod (x, (fun a -> 2)) // Here, 'x' contains enough type information to resolve the overload // The lambda argument 'a' gets type 'int' - let f4 (x: int list) = + let f4 (x: int list) = OverloadsWithSrtp.SomeMethod (x, (fun a -> a.Length)) let v4 = f4 [ 1 ] diff --git a/tests/projects/CompilerCompat/CompilerCompatApp/Program.fs b/tests/projects/CompilerCompat/CompilerCompatApp/Program.fs index 0824a213abf..a21e1093378 100644 --- a/tests/projects/CompilerCompat/CompilerCompatApp/Program.fs +++ b/tests/projects/CompilerCompat/CompilerCompatApp/Program.fs @@ -8,7 +8,7 @@ let main _argv = // Helper to get the actual compiler path (prefer dotnetFscCompilerPath when using local build) let getActualCompilerPath (dotnetPath: string) (fallbackPath: string) = if dotnetPath <> "N/A" && dotnetPath <> "" then dotnetPath else fallbackPath - + // Print detailed build information to verify which compiler was used printfn "=== BUILD VERIFICATION ===" printfn "Library Build Info:" @@ -20,28 +20,28 @@ let main _argv = printfn " F# Compiler Path: %s" (getActualCompilerPath AppBuildInfo.dotnetFscCompilerPath AppBuildInfo.fsharpCompilerPath) printfn " Is Local Build: %b" AppBuildInfo.isLocalBuild printfn "==========================" - + // Test basic anonymous record functionality let record = Library.getAnonymousRecord() printfn "Basic record: X=%d, Y=%s" record.X record.Y - + // Verify expected values if record.X <> 42 || record.Y <> "hello" then printfn "ERROR: Basic record values don't match expected" 1 else printfn "SUCCESS: Basic record test passed" - + // Test complex anonymous record functionality let complex = Library.getComplexAnonymousRecord() printfn "Complex record: Simple.A=%d, Simple.B=%s" complex.Simple.A complex.Simple.B printfn "Complex record: List has %d items" complex.List.Length printfn "Complex record: Tuple=(%d, Value=%f)" (fst complex.Tuple) (snd complex.Tuple).Value - + // Test function that takes anonymous record let processed = Library.processAnonymousRecord({| X = 123; Y = "test" |}) printfn "Processed result: %s" processed - + // Test well-known attribute types let sealedObj = CompilerCompatLib.Library.SealedType() printfn "Sealed: %d" sealedObj.Value @@ -141,7 +141,7 @@ let main _argv = Console.WriteLine $"RecordCtor: inline=({viaInline.A},{viaInline.B}) direct=({viaCtor.A},{viaCtor.B})" Console.WriteLine "SUCCESS: All compiler compatibility tests passed" 0 - + with ex -> printfn "ERROR: Exception occurred: %s" ex.Message 1 \ No newline at end of file diff --git a/tests/projects/CompilerCompat/CompilerCompatLib/Library.fs b/tests/projects/CompilerCompat/CompilerCompatLib/Library.fs index aee5730ec52..02c24c86ae4 100644 --- a/tests/projects/CompilerCompat/CompilerCompatLib/Library.fs +++ b/tests/projects/CompilerCompat/CompilerCompatLib/Library.fs @@ -3,15 +3,15 @@ namespace CompilerCompatLib module Library = /// Returns an anonymous record to test compiler compatibility let getAnonymousRecord () = {| X = 42; Y = "hello" |} - + /// Returns a more complex anonymous record with nested structure - let getComplexAnonymousRecord () = - {| + let getComplexAnonymousRecord () = + {| Simple = {| A = 1; B = "test" |}; List = [ {| Id = 1; Name = "first" |}; {| Id = 2; Name = "second" |} ]; Tuple = (42, {| Value = 3.14; Label = "pi" |}) |} - + /// Function that takes an anonymous record as parameter let processAnonymousRecord (record: {| X: int; Y: string |}) = sprintf "Processed: X=%d, Y=%s" record.X record.Y diff --git a/tests/scripts/array-perf/array-perf.fs b/tests/scripts/array-perf/array-perf.fs index 58f476d3a56..126859853da 100644 --- a/tests/scripts/array-perf/array-perf.fs +++ b/tests/scripts/array-perf/array-perf.fs @@ -2,7 +2,7 @@ /// Docs/GitHub: https://github.com/PerfDotNet/BenchmarkDotNet#getting-started /// /// This benchmarking suite will perform JIT warmups, collect system environment data -/// run multiple trials, and produce convenient reports. +/// run multiple trials, and produce convenient reports. /// You will find csv, markdown, and html versions of the reports in .\BenchmarkDotNet.Artifacts\results /// after running the tests. /// @@ -26,22 +26,22 @@ open BenchmarkDotNet.Jobs #else open BenchmarkDotNet.Diagnostics.Windows #endif - + /// When pulling functions out of the complete fsharp solution to test /// Some things are not easily available, such as Array.zeroCreateUnchecked /// We mock these here using their checked variations module Array = - let inline zeroCreateUnchecked (count:int) = + let inline zeroCreateUnchecked (count:int) = Array.zeroCreate count let inline subUnchecked startIndex count (array : 'T[]) = Array.sub array startIndex count -// Almost every array function calls this, so mock it with +// Almost every array function calls this, so mock it with // the exact same code -let inline checkNonNull argName arg = - match box arg with - | null -> nullArg argName +let inline checkNonNull argName arg = + match box arg with + | null -> nullArg argName | _ -> () @@ -56,14 +56,14 @@ let partition predicate (array : 'T[]) = let lastInputIndex = inputLength - 1 let isTrue = Array.zeroCreateUnchecked inputLength - Parallel.For(0, inputLength, + Parallel.For(0, inputLength, fun i -> isTrue.[i] <- predicate array.[i] ) |> ignore - + let mutable trueLength = 0 for i in 0 .. lastInputIndex do if isTrue.[i] then trueLength <- trueLength + 1 - + let trueResult = Array.zeroCreateUnchecked trueLength let falseResult = Array.zeroCreateUnchecked (inputLength - trueLength) let mutable iTrue = 0 @@ -80,23 +80,23 @@ let partition predicate (array : 'T[]) = // New variation let partitionNew predicate (array : 'T[]) = - + checkNonNull "array" array - let inputLength = array.Length - let isTrue = Array.zeroCreateUnchecked inputLength + let inputLength = array.Length + let isTrue = Array.zeroCreateUnchecked inputLength let mutable trueLength = 0 - - Parallel.For(0, - inputLength, + + Parallel.For(0, + inputLength, (fun () -> 0), - (fun i _ trueCount -> + (fun i _ trueCount -> if predicate array.[i] then isTrue.[i] <- true trueCount + 1 else - trueCount), + trueCount), Action (fun x -> System.Threading.Interlocked.Add(&trueLength,x) |> ignore) ) |> ignore - + let res1 = Array.zeroCreateUnchecked trueLength let res2 = Array.zeroCreateUnchecked (inputLength - trueLength) let mutable iTrue = 0 @@ -117,7 +117,7 @@ let partitionNew predicate (array : 'T[]) = /// Configuration for a given benchmark type ArrayPerfConfig () = inherit ManualConfig() - do + do base.Add Job.RyuJitX64 //base.Add Job.LegacyJitX86 // If you want to also test 32bit. It will run tests on both if both of these are here. #if MONO @@ -126,62 +126,62 @@ type ArrayPerfConfig () = #endif [)>] -type ArrayBenchmark () = +type ArrayBenchmark () = let r = Random() let mutable array = [||] let mutable array2 = [||] let mutable array3 = [||] - + //When the test runs, it will run once per each param. //This is used to run the test on arrays of size 10, 100, etc //You can create a 2nd Params section and the test will run over all permutations - [] + [] member val public Length = 0 with get, set //This is run before each iteration of a test [] - member self.SetupData () = - + member self.SetupData () = + // Initialize whatever arrays or other data you want to test on here. - // Random is often handy but some algorithms you may want to test on + // Random is often handy but some algorithms you may want to test on // Sorted or other structured data. Ints/doubles/objects etc - // Create however many you need. Setup time is not included in - // runtime statistics, however allocations may be, due to a bug + // Create however many you need. Setup time is not included in + // runtime statistics, however allocations may be, due to a bug // as of this comment. array <- Array.init self.Length (fun i -> int(r.NextDouble()*1000.0)) //array2 <- Array.create self.Length 5 - - - - - // If you set a benchmark as baseline, the results output will add a + + + + + // If you set a benchmark as baseline, the results output will add a // column showing runtime of all other benchmarks as a percentage of the baseline // care must be taken here to be sure your benchmark is not JITTed into nothingness - // because it is identified as dead code. + // because it is identified as dead code. [] member self.Original () = - array |> partition (fun x -> x % 2 = 0) + array |> partition (fun x -> x % 2 = 0) [] member self.New () = array |> partitionNew (fun x -> x % 2 = 0) - - //Create any number of benchmarks - - - + //Create any number of benchmarks + + + + [] -let main argv = - - // Run the executable with the argument "ArrayPerfBenchmark" - - let switch = +let main argv = + + // Run the executable with the argument "ArrayPerfBenchmark" + + let switch = BenchmarkSwitcher [| typeof |] diff --git a/tests/service/data/SyntaxTree/Binding/ConditionalDirectiveAroundInlineKeyword.fs b/tests/service/data/SyntaxTree/Binding/ConditionalDirectiveAroundInlineKeyword.fs index 082d522fe2b..baef32334cf 100644 --- a/tests/service/data/SyntaxTree/Binding/ConditionalDirectiveAroundInlineKeyword.fs +++ b/tests/service/data/SyntaxTree/Binding/ConditionalDirectiveAroundInlineKeyword.fs @@ -1,5 +1,5 @@ -let +let #if !FOO inline #endif diff --git a/tests/service/data/SyntaxTree/Expression/AnonRecd - Quotation 02.fs b/tests/service/data/SyntaxTree/Expression/AnonRecd - Quotation 02.fs index 995c19c6de2..8ecc8100651 100644 --- a/tests/service/data/SyntaxTree/Expression/AnonRecd - Quotation 02.fs +++ b/tests/service/data/SyntaxTree/Expression/AnonRecd - Quotation 02.fs @@ -1,4 +1,4 @@ -module Module +module Module {| A = <@@ 1 + 1 @@>|} diff --git a/tests/service/data/SyntaxTree/Expression/InheritRecord - Field 1.fs b/tests/service/data/SyntaxTree/Expression/InheritRecord - Field 1.fs index 4530232acf8..09ca56af1e1 100644 --- a/tests/service/data/SyntaxTree/Expression/InheritRecord - Field 1.fs +++ b/tests/service/data/SyntaxTree/Expression/InheritRecord - Field 1.fs @@ -1,7 +1,7 @@ module Foo { inherit Exception( - "This is a " + + "This is a " + "multiline " + "message" ) diff --git a/tests/service/data/SyntaxTree/Expression/Return 07.fs b/tests/service/data/SyntaxTree/Expression/Return 07.fs index 19e68b27e5c..56b0f9554e4 100644 --- a/tests/service/data/SyntaxTree/Expression/Return 07.fs +++ b/tests/service/data/SyntaxTree/Expression/Return 07.fs @@ -1,6 +1,6 @@ module Module let _ = - async { + async { return new MyType() : } diff --git a/tests/service/data/SyntaxTree/Expression/SynExprAnonRecdWithStructKeyword.fs b/tests/service/data/SyntaxTree/Expression/SynExprAnonRecdWithStructKeyword.fs index d1983af8f59..e37119fddec 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprAnonRecdWithStructKeyword.fs +++ b/tests/service/data/SyntaxTree/Expression/SynExprAnonRecdWithStructKeyword.fs @@ -1,5 +1,5 @@ -struct +struct {| Foo = // meh someValue |} diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseDoesNotContainTheRangeOfInKeyword.fs b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseDoesNotContainTheRangeOfInKeyword.fs index 1f0765a5c7e..1fe97107a77 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseDoesNotContainTheRangeOfInKeyword.fs +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseDoesNotContainTheRangeOfInKeyword.fs @@ -1,4 +1,4 @@ do -let x = 1 +let x = 1 () diff --git a/tests/service/data/SyntaxTree/Expression/Try - Finally 02.fs b/tests/service/data/SyntaxTree/Expression/Try - Finally 02.fs index 8c364c295db..f55b05342c8 100644 --- a/tests/service/data/SyntaxTree/Expression/Try - Finally 02.fs +++ b/tests/service/data/SyntaxTree/Expression/Try - Finally 02.fs @@ -1,7 +1,7 @@ module Module let _ = - try 1 + try 1 finally 2 diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs index 196aa44511e..00baa939fd7 100644 --- a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs @@ -1,4 +1,4 @@ module Module -try +try with _ -> diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs index fbf5dd7a340..f056423064d 100644 --- a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs @@ -1,3 +1,3 @@ module Module -try +try diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs index 88b8986701c..67756064cc9 100644 --- a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs @@ -1,5 +1,5 @@ module Module -try +try let _ = () diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs index c2a4f5ccf09..59af8ea7a98 100644 --- a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs @@ -1,6 +1,6 @@ module Module -try +try module Nested = () diff --git a/tests/service/data/SyntaxTree/Expression/Try with 01.fs b/tests/service/data/SyntaxTree/Expression/Try with 01.fs index cc5cc7c9638..08462bc9634 100644 --- a/tests/service/data/SyntaxTree/Expression/Try with 01.fs +++ b/tests/service/data/SyntaxTree/Expression/Try with 01.fs @@ -1,4 +1,4 @@ module Module -try () +try () with _ -> () diff --git a/tests/service/data/SyntaxTree/Expression/Unfinished escaped ident 01.fs b/tests/service/data/SyntaxTree/Expression/Unfinished escaped ident 01.fs index 199330b5379..9d62914961b 100644 --- a/tests/service/data/SyntaxTree/Expression/Unfinished escaped ident 01.fs +++ b/tests/service/data/SyntaxTree/Expression/Unfinished escaped ident 01.fs @@ -1,43 +1,43 @@ module Module do - ` + ` do - `` + `` do - ``` + ``` do - ```` + ```` do - `` `` + `` `` do - ` `` ` + ` `` ` do - ` `` `` + ` `` `` do - ```````` + ```````` do - ``````` + ``````` do - `````` + `````` do - ````` + ````` do - ``` `` + ``` `` do - ``` ``` + ``` ``` do ````.P diff --git a/tests/service/data/SyntaxTree/Expression/Yield 06.fs b/tests/service/data/SyntaxTree/Expression/Yield 06.fs index bb699f40621..573d3b81cdc 100644 --- a/tests/service/data/SyntaxTree/Expression/Yield 06.fs +++ b/tests/service/data/SyntaxTree/Expression/Yield 06.fs @@ -1,6 +1,6 @@ module Module seq { - yield [ 1 .. 10 ] : + yield [ 1 .. 10 ] : } diff --git a/tests/service/data/SyntaxTree/Lambda/ComplexArgumentsLambdaHasArrowRange.fs b/tests/service/data/SyntaxTree/Lambda/ComplexArgumentsLambdaHasArrowRange.fs index 84b90a40a2c..be34015d3fb 100644 --- a/tests/service/data/SyntaxTree/Lambda/ComplexArgumentsLambdaHasArrowRange.fs +++ b/tests/service/data/SyntaxTree/Lambda/ComplexArgumentsLambdaHasArrowRange.fs @@ -1,6 +1,6 @@ -fun (x, _) - ({ Y = h::_ }) - (SomePattern(z)) - -> +fun (x, _) + ({ Y = h::_ }) + (SomePattern(z)) + -> x * y + z diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs b/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs index b054165672b..60ee1b2c79d 100644 --- a/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs @@ -1,4 +1,4 @@ module Module match () with -| +| diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing pat 01.fs b/tests/service/data/SyntaxTree/MatchClause/Missing pat 01.fs index a50b5fd5fef..d4b76298ed9 100644 --- a/tests/service/data/SyntaxTree/MatchClause/Missing pat 01.fs +++ b/tests/service/data/SyntaxTree/MatchClause/Missing pat 01.fs @@ -2,5 +2,5 @@ module Module match () with | _ -> () -| +| | _ -> () diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing pat 02.fs b/tests/service/data/SyntaxTree/MatchClause/Missing pat 02.fs index d9950136b8d..5746b06762c 100644 --- a/tests/service/data/SyntaxTree/MatchClause/Missing pat 02.fs +++ b/tests/service/data/SyntaxTree/MatchClause/Missing pat 02.fs @@ -1,5 +1,5 @@ module Module match () with -| +| | _ -> () diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing pat 03.fs b/tests/service/data/SyntaxTree/MatchClause/Missing pat 03.fs index 6cf1b037a51..1e415fd6cef 100644 --- a/tests/service/data/SyntaxTree/MatchClause/Missing pat 03.fs +++ b/tests/service/data/SyntaxTree/MatchClause/Missing pat 03.fs @@ -1,5 +1,5 @@ module Module match () with -| +| | _ as _ -> () diff --git a/tests/service/data/SyntaxTree/Measure/Constant - 07.fs b/tests/service/data/SyntaxTree/Measure/Constant - 07.fs index 1c83b91385f..5147cb11d28 100644 --- a/tests/service/data/SyntaxTree/Measure/Constant - 07.fs +++ b/tests/service/data/SyntaxTree/Measure/Constant - 07.fs @@ -1,3 +1,3 @@ module M - + 23 diff --git a/tests/service/data/SyntaxTree/Measure/Constant - 08.fs b/tests/service/data/SyntaxTree/Measure/Constant - 08.fs index 7e02ecb1436..12c0e6266de 100644 --- a/tests/service/data/SyntaxTree/Measure/Constant - 08.fs +++ b/tests/service/data/SyntaxTree/Measure/Constant - 08.fs @@ -1,3 +1,3 @@ module M - + 23 diff --git a/tests/service/data/SyntaxTree/Measure/Constant - 09.fs b/tests/service/data/SyntaxTree/Measure/Constant - 09.fs index 048a0a46305..974aeb57381 100644 --- a/tests/service/data/SyntaxTree/Measure/Constant - 09.fs +++ b/tests/service/data/SyntaxTree/Measure/Constant - 09.fs @@ -1,3 +1,3 @@ module M - + 23 diff --git a/tests/service/data/SyntaxTree/Measure/Constant - 10.fs b/tests/service/data/SyntaxTree/Measure/Constant - 10.fs index 5be24e325f0..f212841e3bd 100644 --- a/tests/service/data/SyntaxTree/Measure/Constant - 10.fs +++ b/tests/service/data/SyntaxTree/Measure/Constant - 10.fs @@ -1,3 +1,3 @@ module M - + 23 diff --git a/tests/service/data/SyntaxTree/Member/GetSetMemberWithInlineKeyword.fs b/tests/service/data/SyntaxTree/Member/GetSetMemberWithInlineKeyword.fs index deacb2fc635..3a72c107583 100644 --- a/tests/service/data/SyntaxTree/Member/GetSetMemberWithInlineKeyword.fs +++ b/tests/service/data/SyntaxTree/Member/GetSetMemberWithInlineKeyword.fs @@ -1,5 +1,5 @@ type X = - member inline x.Y + member inline x.Y with inline get () = 4 and inline set y = () diff --git a/tests/service/data/SyntaxTree/Member/SynTypeDefnWithStaticMemberWithGetset.fs b/tests/service/data/SyntaxTree/Member/SynTypeDefnWithStaticMemberWithGetset.fs index 02b35e27497..bdf4c03ea35 100644 --- a/tests/service/data/SyntaxTree/Member/SynTypeDefnWithStaticMemberWithGetset.fs +++ b/tests/service/data/SyntaxTree/Member/SynTypeDefnWithStaticMemberWithGetset.fs @@ -1,5 +1,5 @@ type Foo = - static member ReadWrite2 + static member ReadWrite2 with set x = lastUsed <- ("ReadWrite2", x) and get () = lastUsed <- ("ReadWrite2", 0); 4 diff --git a/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi b/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi index 99280315c6f..f9ebf4afefe 100644 --- a/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi +++ b/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi @@ -51,7 +51,7 @@ module Operators = [] member Length1 : int /// Get the length of the array in the second dimension - [] + [] member Length2 : int /// Get the lower bound of the array in the first dimension [] diff --git a/tests/service/data/SyntaxTree/Nullness/RegressionAnnotatedInlinePatternMatch.fs b/tests/service/data/SyntaxTree/Nullness/RegressionAnnotatedInlinePatternMatch.fs index e608c5198c9..836ddc425bd 100644 --- a/tests/service/data/SyntaxTree/Nullness/RegressionAnnotatedInlinePatternMatch.fs +++ b/tests/service/data/SyntaxTree/Nullness/RegressionAnnotatedInlinePatternMatch.fs @@ -1,2 +1,2 @@ -match x with +match x with | "123" -> "": string | null -> "456" \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Nullness/RegressionChoiceType.fs b/tests/service/data/SyntaxTree/Nullness/RegressionChoiceType.fs index dde76747ac4..c1ccc321583 100644 --- a/tests/service/data/SyntaxTree/Nullness/RegressionChoiceType.fs +++ b/tests/service/data/SyntaxTree/Nullness/RegressionChoiceType.fs @@ -1,7 +1,7 @@ -type MyChoice<'T1,'T2> = +type MyChoice<'T1,'T2> = /// Choice 1 of 2 choices - | MyChoice of 'T1 + | MyChoice of 'T1 /// Choice 2 of 2 choices | MyChoice of 'T2 diff --git a/tests/service/data/SyntaxTree/Nullness/RegressionListType.fs b/tests/service/data/SyntaxTree/Nullness/RegressionListType.fs index fca67d8f23e..99be3fbc154 100644 --- a/tests/service/data/SyntaxTree/Nullness/RegressionListType.fs +++ b/tests/service/data/SyntaxTree/Nullness/RegressionListType.fs @@ -1,3 +1,3 @@ -type List<'T> = - | ([]) +type List<'T> = + | ([]) | ( :: ) of Head: 'T * Tail: 'T list \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Nullness/RegressionOptionType.fs b/tests/service/data/SyntaxTree/Nullness/RegressionOptionType.fs index 8b1018d513f..06b39a9e541 100644 --- a/tests/service/data/SyntaxTree/Nullness/RegressionOptionType.fs +++ b/tests/service/data/SyntaxTree/Nullness/RegressionOptionType.fs @@ -1,3 +1,3 @@ type Option<'T> = | None: 'T option - | Some: Value:'T -> 'T option \ No newline at end of file + | Some: Value:'T -> 'T option \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Nullness/RegressionResultType.fs b/tests/service/data/SyntaxTree/Nullness/RegressionResultType.fs index b2974154002..093e768c512 100644 --- a/tests/service/data/SyntaxTree/Nullness/RegressionResultType.fs +++ b/tests/service/data/SyntaxTree/Nullness/RegressionResultType.fs @@ -1,7 +1,7 @@ - type MyResult<'T,'TError> = + type MyResult<'T,'TError> = /// Represents an OK or a Successful result. The code succeeded with a value of 'T. - | Ok of ResultValue:'T + | Ok of ResultValue:'T /// Represents an Error or a Failure. The code failed with a value of 'TError representing what went wrong. | Error of ErrorValue:'TError \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi b/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi index e1ab714e844..ca9fb3510e5 100644 --- a/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi +++ b/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi @@ -6,7 +6,7 @@ /// The value to negate. /// /// The result of the operation. - /// + /// /// - /// + /// val inline (~-): n: ^T -> ^T when ^T: (static member ( ~- ): ^T -> ^T) and default ^T: int diff --git a/tests/service/data/SyntaxTree/Pattern/And 01.fs b/tests/service/data/SyntaxTree/Pattern/And 01.fs index eae6846ea1f..6b4d2344e41 100644 --- a/tests/service/data/SyntaxTree/Pattern/And 01.fs +++ b/tests/service/data/SyntaxTree/Pattern/And 01.fs @@ -1,6 +1,6 @@ module Module -let f x = +let f x = match x with | Error (_: exn & :? System.NullReferenceException) -> () | _ -> () diff --git a/tests/service/data/SyntaxTree/Pattern/And 02.fs b/tests/service/data/SyntaxTree/Pattern/And 02.fs index 18ec41f62c6..5d77e441127 100644 --- a/tests/service/data/SyntaxTree/Pattern/And 02.fs +++ b/tests/service/data/SyntaxTree/Pattern/And 02.fs @@ -1,6 +1,6 @@ module Module -let f x = +let f x = match x with | Error (_: exn & (:? System.NullReferenceException)) -> () | _ -> () diff --git a/tests/service/data/SyntaxTree/Pattern/And 03.fs b/tests/service/data/SyntaxTree/Pattern/And 03.fs index 0f73ae03d95..657b86ad037 100644 --- a/tests/service/data/SyntaxTree/Pattern/And 03.fs +++ b/tests/service/data/SyntaxTree/Pattern/And 03.fs @@ -1,6 +1,6 @@ module Module -let f x = +let f x = match x with | Error ((_: exn) & :? System.NullReferenceException) -> () | _ -> () diff --git a/tests/service/data/SyntaxTree/Pattern/And 04.fs b/tests/service/data/SyntaxTree/Pattern/And 04.fs index 7a1d9f5e361..1d2186e286e 100644 --- a/tests/service/data/SyntaxTree/Pattern/And 04.fs +++ b/tests/service/data/SyntaxTree/Pattern/And 04.fs @@ -1,6 +1,6 @@ module Module -let f x = +let f x = match x with | Error ((_: exn) & (:? System.NullReferenceException)) -> () | _ -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Tuple - Recover 01.fs b/tests/service/data/SyntaxTree/Pattern/Tuple - Recover 01.fs index 65f306b74ff..6484e3f77e6 100644 --- a/tests/service/data/SyntaxTree/Pattern/Tuple - Recover 01.fs +++ b/tests/service/data/SyntaxTree/Pattern/Tuple - Recover 01.fs @@ -1,4 +1,4 @@ module Tuple let a - , + , diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 06.fs b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 06.fs index 73a608a3ee5..87bdbc3f1d1 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 06.fs +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 06.fs @@ -2,5 +2,5 @@ module Module do let i: = 1 - + () diff --git a/tests/service/data/SyntaxTree/SignatureType/SynTypeDefnSigWithUnionContainsTheRangeOfTheEqualsSign.fsi b/tests/service/data/SyntaxTree/SignatureType/SynTypeDefnSigWithUnionContainsTheRangeOfTheEqualsSign.fsi index f353be212ad..ff2b8760200 100644 --- a/tests/service/data/SyntaxTree/SignatureType/SynTypeDefnSigWithUnionContainsTheRangeOfTheEqualsSign.fsi +++ b/tests/service/data/SyntaxTree/SignatureType/SynTypeDefnSigWithUnionContainsTheRangeOfTheEqualsSign.fsi @@ -2,5 +2,5 @@ namespace SomeNamespace type Shape = -| Square of int +| Square of int | Rectangle of int * int diff --git a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs index efd95432f88..956a91dd1a0 100644 --- a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs +++ b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs @@ -1,3 +1,3 @@ -let inline f_StaticMethod<'T1, 'T2 when ('T1 or 'T2) : (static member StaticMethod: int -> int) >() : int = +let inline f_StaticMethod<'T1, 'T2 when ('T1 or 'T2) : (static member StaticMethod: int -> int) >() : int = () diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs index 5cbe57f4dbe..3ae0b3d3f78 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs @@ -1,7 +1,7 @@ module Module async { let! ({ Name = name }: Person) = asyncPerson() - + return name - + } \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs index 941456b8732..a367ce4c623 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs @@ -2,5 +2,5 @@ module Module async { let! { Name = name }: Person = asyncPerson() return name - + } \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 09.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 09.fs index ffae5310fb2..6bd0a12080c 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 09.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 09.fs @@ -1,5 +1,5 @@ module Module async { let! (Union value) = asyncOption() - return value + return value } diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 11.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 11.fs index 48e18bbe04f..6f6ebd7f7a8 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 11.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 11.fs @@ -1,5 +1,5 @@ module Module async { let! (Union value): int option = asyncOption() - return value + return value } diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 12.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 12.fs index 4fb0e0b1a5e..c3cfae2b250 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 12.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 12.fs @@ -1,5 +1,5 @@ module Module async { let! Union value: int option = asyncOption() - return value + return value } diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 13.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 13.fs index 19c127c107f..314afc35966 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 13.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 13.fs @@ -1,5 +1,5 @@ module Module async { let! x: int, y: int = asyncInt() - return () + return () } diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 15.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 15.fs index 92646da071f..e39cdca438d 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 15.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 15.fs @@ -3,5 +3,5 @@ module Module async { let! (x, y): int * int = asyncInt() and! x: int, y: int = asyncInt() - return () + return () } diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 16.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 16.fs index b01631488a2..d3ba74c5661 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 16.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 16.fs @@ -3,5 +3,5 @@ module Module async { let! (x, y): int * int = asyncInt() and! (x: int, y: int) = asyncInt() - return () + return () } diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 17.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 17.fs index 3918e729716..9360e4d5c51 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 17.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 17.fs @@ -3,5 +3,5 @@ module Module async { let! (x, y): int * int = asyncInt() and! (x, y): int * int = asyncInt() - return () + return () } diff --git a/tests/service/data/SyntaxTree/Type/Exception Inside Type 01.fs b/tests/service/data/SyntaxTree/Type/Exception Inside Type 01.fs index 3f47a6778b8..c310fe2aaf7 100644 --- a/tests/service/data/SyntaxTree/Type/Exception Inside Type 01.fs +++ b/tests/service/data/SyntaxTree/Type/Exception Inside Type 01.fs @@ -1,5 +1,5 @@ // Testing: Exception inside type module Module -type A = +type A = exception MyException diff --git a/tests/service/data/SyntaxTree/Type/Inline IL With Type 01.fs b/tests/service/data/SyntaxTree/Type/Inline IL With Type 01.fs index cd597bd124a..113cf3c212c 100644 --- a/tests/service/data/SyntaxTree/Type/Inline IL With Type 01.fs +++ b/tests/service/data/SyntaxTree/Type/Inline IL With Type 01.fs @@ -1,4 +1,4 @@ // Expected: No warning - parentheses context skips validation module Module -let inline unbox (x: obj) : 'T = +let inline unbox (x: obj) : 'T = (# "unbox.any !0" type ('T) x : 'T #) diff --git a/tests/service/data/SyntaxTree/Type/Module After Do Binding 01.fs b/tests/service/data/SyntaxTree/Type/Module After Do Binding 01.fs index e524972fe92..53e7ee8ade3 100644 --- a/tests/service/data/SyntaxTree/Type/Module After Do Binding 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module After Do Binding 01.fs @@ -3,5 +3,5 @@ module Module type MyClass() = do printfn "Initializing" - module M = + module M = let helper = 42 diff --git a/tests/service/data/SyntaxTree/Type/Module After Inherit 01.fs b/tests/service/data/SyntaxTree/Type/Module After Inherit 01.fs index ff4bd5c0561..2573550c14a 100644 --- a/tests/service/data/SyntaxTree/Type/Module After Inherit 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module After Inherit 01.fs @@ -5,6 +5,6 @@ type Base() = class end type Derived() = inherit Base() - - module InvalidModule = + + module InvalidModule = let x = 2 diff --git a/tests/service/data/SyntaxTree/Type/Module After Members 01.fs b/tests/service/data/SyntaxTree/Type/Module After Members 01.fs index 9998e34cdb8..0711f4d3fdc 100644 --- a/tests/service/data/SyntaxTree/Type/Module After Members 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module After Members 01.fs @@ -4,6 +4,6 @@ module Module type ClassWithMembers() = member _.Method1() = 1 member _.Method2() = 2 - - module InvalidModule = + + module InvalidModule = let helper = 10 diff --git a/tests/service/data/SyntaxTree/Type/Module After Static Members 01.fs b/tests/service/data/SyntaxTree/Type/Module After Static Members 01.fs index a990fa898db..c07104a4391 100644 --- a/tests/service/data/SyntaxTree/Type/Module After Static Members 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module After Static Members 01.fs @@ -3,6 +3,6 @@ module Module type MyType = static member StaticMethod() = 42 - - module InvalidModule = + + module InvalidModule = let x = 1 diff --git a/tests/service/data/SyntaxTree/Type/Module And Exception Interleaved With Members 01.fs b/tests/service/data/SyntaxTree/Type/Module And Exception Interleaved With Members 01.fs index 13c274c3da3..2e30daf1685 100644 --- a/tests/service/data/SyntaxTree/Type/Module And Exception Interleaved With Members 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module And Exception Interleaved With Members 01.fs @@ -3,7 +3,7 @@ module Module type Interleaved = member _.X = 1 - module M1 = + module M1 = let y = 2 member _.Y = 2 exception E1 diff --git a/tests/service/data/SyntaxTree/Type/Module And Type After Do Binding 01.fs b/tests/service/data/SyntaxTree/Type/Module And Type After Do Binding 01.fs index bc6ed0b60a0..20fb9446ab2 100644 --- a/tests/service/data/SyntaxTree/Type/Module And Type After Do Binding 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module And Type After Do Binding 01.fs @@ -2,12 +2,12 @@ module Module type ClassWithDo() = - do + do printfn "init" - + type InternalType = int - - module InternalModule = + + module InternalModule = let x = 1 - + open System.Collections diff --git a/tests/service/data/SyntaxTree/Type/Module And Type Inside Type 01.fs b/tests/service/data/SyntaxTree/Type/Module And Type Inside Type 01.fs index 0ecbc807474..56df3b67290 100644 --- a/tests/service/data/SyntaxTree/Type/Module And Type Inside Type 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module And Type Inside Type 01.fs @@ -2,7 +2,7 @@ module Module type MyType = - module InvalidModule = + module InvalidModule = let helper = 10 - + type InvalidType = string diff --git a/tests/service/data/SyntaxTree/Type/Module At Module Level 01.fs b/tests/service/data/SyntaxTree/Type/Module At Module Level 01.fs index 67fbec5f1d3..a30fc03d0a3 100644 --- a/tests/service/data/SyntaxTree/Type/Module At Module Level 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module At Module Level 01.fs @@ -1,8 +1,8 @@ // Expected: No warning - module at correct indentation level module Module -type SimpleType = +type SimpleType = | A of int | B of string -module ValidModule = +module ValidModule = let x = 42 diff --git a/tests/service/data/SyntaxTree/Type/Module At Type Column 01.fs b/tests/service/data/SyntaxTree/Type/Module At Type Column 01.fs index b49d1ca2516..f5ec5c7b53e 100644 --- a/tests/service/data/SyntaxTree/Type/Module At Type Column 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module At Type Column 01.fs @@ -1,7 +1,7 @@ // Expected: No warning - same indentation level module Module -type A = +type A = | A of int type B = B module C = diff --git a/tests/service/data/SyntaxTree/Type/Module Between Constructors 01.fs b/tests/service/data/SyntaxTree/Type/Module Between Constructors 01.fs index 4b6afa24953..1adf69c5d45 100644 --- a/tests/service/data/SyntaxTree/Type/Module Between Constructors 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module Between Constructors 01.fs @@ -3,8 +3,8 @@ module Module type MyClass(x: int) = new() = MyClass(0) - - module InvalidModule = + + module InvalidModule = let x = 1 - + new(s: string) = MyClass(1) diff --git a/tests/service/data/SyntaxTree/Type/Module Inside Nested Type 01.fs b/tests/service/data/SyntaxTree/Type/Module Inside Nested Type 01.fs index 8f808473055..fdf0af95198 100644 --- a/tests/service/data/SyntaxTree/Type/Module Inside Nested Type 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module Inside Nested Type 01.fs @@ -5,5 +5,5 @@ module Level2 = module Level3 = type MyType = | A - module InvalidModule = + module InvalidModule = let x = 1 diff --git a/tests/service/data/SyntaxTree/Type/Module Inside Struct 01.fs b/tests/service/data/SyntaxTree/Type/Module Inside Struct 01.fs index 0eff7380d47..cbd4108ef33 100644 --- a/tests/service/data/SyntaxTree/Type/Module Inside Struct 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module Inside Struct 01.fs @@ -3,6 +3,6 @@ module Module type MyStruct = struct - module InvalidModule = + module InvalidModule = let helper = 10 end diff --git a/tests/service/data/SyntaxTree/Type/Module Inside Type With Augmentation 01.fs b/tests/service/data/SyntaxTree/Type/Module Inside Type With Augmentation 01.fs index 313317e35b6..6b81952194e 100644 --- a/tests/service/data/SyntaxTree/Type/Module Inside Type With Augmentation 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module Inside Type With Augmentation 01.fs @@ -1,7 +1,7 @@ // Expected: Warning for module in type augmentation module Module -type A = +type A = | A with module M = begin end diff --git a/tests/service/data/SyntaxTree/Type/Module Less Indented 01.fs b/tests/service/data/SyntaxTree/Type/Module Less Indented 01.fs index 84a6612add3..ff5eb1e272a 100644 --- a/tests/service/data/SyntaxTree/Type/Module Less Indented 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module Less Indented 01.fs @@ -1,8 +1,8 @@ // Expected: No warning - module at valid position module Module -type A = +type A = | CaseA of int | CaseB of string -module ValidModule = +module ValidModule = let x = 1 diff --git a/tests/service/data/SyntaxTree/Type/Module Same Indentation 01.fs b/tests/service/data/SyntaxTree/Type/Module Same Indentation 01.fs index 7ff2c635103..a9bc7df9eef 100644 --- a/tests/service/data/SyntaxTree/Type/Module Same Indentation 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module Same Indentation 01.fs @@ -1,12 +1,12 @@ // Expected: No warning - module not nested module Module -type A = +type A = | CaseA of int | CaseB of string - -module B = + +module B = let x = 42 - -type C = + +type C = { Field: int } diff --git a/tests/service/data/SyntaxTree/Type/Module With Semicolon Delimiter 01.fs b/tests/service/data/SyntaxTree/Type/Module With Semicolon Delimiter 01.fs index fa8640c4fa0..0a1c8c77a48 100644 --- a/tests/service/data/SyntaxTree/Type/Module With Semicolon Delimiter 01.fs +++ b/tests/service/data/SyntaxTree/Type/Module With Semicolon Delimiter 01.fs @@ -1,7 +1,7 @@ // Expected: Depends on verbose syntax rules module Module -type TypeA = +type TypeA = | A;; - module ModuleAfterDelimiter = + module ModuleAfterDelimiter = let x = 1 diff --git a/tests/service/data/SyntaxTree/Type/Nested Module Hierarchy 01.fs b/tests/service/data/SyntaxTree/Type/Nested Module Hierarchy 01.fs index f9ad5ba9673..68c5992c11d 100644 --- a/tests/service/data/SyntaxTree/Type/Nested Module Hierarchy 01.fs +++ b/tests/service/data/SyntaxTree/Type/Nested Module Hierarchy 01.fs @@ -5,5 +5,5 @@ module Level1 = module Level2 = module Level3 = type TypeWithInvalidModule = - module InvalidModule = + module InvalidModule = let x = 1 diff --git a/tests/service/data/SyntaxTree/Type/Open Inside Type 01.fs b/tests/service/data/SyntaxTree/Type/Open Inside Type 01.fs index 60c5a5618f7..9c4db98f8d1 100644 --- a/tests/service/data/SyntaxTree/Type/Open Inside Type 01.fs +++ b/tests/service/data/SyntaxTree/Type/Open Inside Type 01.fs @@ -1,6 +1,6 @@ // Expected: Warning for open inside type module Module -type A = +type A = | A open System diff --git a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithUnionContainsTheRangeOfTheEqualsSign.fs b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithUnionContainsTheRangeOfTheEqualsSign.fs index 91a02ddff40..51d73c0d599 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithUnionContainsTheRangeOfTheEqualsSign.fs +++ b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithUnionContainsTheRangeOfTheEqualsSign.fs @@ -1,4 +1,4 @@ type Shape = - | Square of int + | Square of int | Rectangle of int * int diff --git a/tests/service/data/SyntaxTree/Type/SynTypeFunHasRangeOfArrow.fs b/tests/service/data/SyntaxTree/Type/SynTypeFunHasRangeOfArrow.fs index 92b6fe0f85b..86c915013d8 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeFunHasRangeOfArrow.fs +++ b/tests/service/data/SyntaxTree/Type/SynTypeFunHasRangeOfArrow.fs @@ -1,3 +1,3 @@ -type X = string -> // after a tuple, mixed needs an indent +type X = string -> // after a tuple, mixed needs an indent int diff --git a/tests/service/data/SyntaxTree/Type/Type 10.fs b/tests/service/data/SyntaxTree/Type/Type 10.fs index c79ce3754f1..b83f6516813 100644 --- a/tests/service/data/SyntaxTree/Type/Type 10.fs +++ b/tests/service/data/SyntaxTree/Type/Type 10.fs @@ -3,7 +3,7 @@ namespace N -module M = +module M = type � = class static member M() = 11 end diff --git a/tests/service/data/SyntaxTree/Type/Type Inside Type 01.fs b/tests/service/data/SyntaxTree/Type/Type Inside Type 01.fs index bdfc1d67396..ee80c49f076 100644 --- a/tests/service/data/SyntaxTree/Type/Type Inside Type 01.fs +++ b/tests/service/data/SyntaxTree/Type/Type Inside Type 01.fs @@ -1,7 +1,7 @@ // Expected: Warning for type inside type module Module -type A = +type A = | A - type NestedType = + type NestedType = | B of int diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs index 189f8ad7ebb..59d3782d523 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs @@ -2,5 +2,5 @@ module Module type U = | A - | internal of + | internal of | C diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs index bab3df45ca4..3c4037199b0 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs @@ -2,6 +2,6 @@ module Module type U = | A - | of + | of | C | D diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs index 76738ee661e..e369076e9e1 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs @@ -3,4 +3,4 @@ module Module type U = A of -type A = int +type A = int diff --git a/tests/service/data/TestProject/AssemblyInfo.fs b/tests/service/data/TestProject/AssemblyInfo.fs index 5c62ae5770c..e43b50a569f 100644 --- a/tests/service/data/TestProject/AssemblyInfo.fs +++ b/tests/service/data/TestProject/AssemblyInfo.fs @@ -4,7 +4,7 @@ open System.Reflection open System.Runtime.CompilerServices open System.Runtime.InteropServices -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [] @@ -16,8 +16,8 @@ open System.Runtime.InteropServices [] [] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [] @@ -25,13 +25,13 @@ open System.Runtime.InteropServices [] // Version information for an assembly consists of the following four values: -// +// // Major Version -// Minor Version +// Minor Version // Build Number // Revision -// -// You can specify all the values or you can default the Build and Revision Numbers +// +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [] [] diff --git a/tests/service/data/TestProject/TestProject.fs b/tests/service/data/TestProject/TestProject.fs index ebf81723cb0..b0d49be9d39 100644 --- a/tests/service/data/TestProject/TestProject.fs +++ b/tests/service/data/TestProject/TestProject.fs @@ -2,7 +2,7 @@ type T = ErasedWithConstructor.Provided.MyType -type Class1() = +type Class1() = member this.X1 = T().DoNothing() member this.X2 = T().DoNothingGeneric() member this.X3 = T().DoNothingOneArg() @@ -47,5 +47,5 @@ type Class1() = type T2 = GeneratedWithConstructor.Provided.GenerativeProvider<3> -type Class2() = +type Class2() = member this.X1 = T2() diff --git a/tests/service/data/TestProject2/AssemblyInfo.fs b/tests/service/data/TestProject2/AssemblyInfo.fs index 5c62ae5770c..e43b50a569f 100644 --- a/tests/service/data/TestProject2/AssemblyInfo.fs +++ b/tests/service/data/TestProject2/AssemblyInfo.fs @@ -4,7 +4,7 @@ open System.Reflection open System.Runtime.CompilerServices open System.Runtime.InteropServices -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [] @@ -16,8 +16,8 @@ open System.Runtime.InteropServices [] [] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [] @@ -25,13 +25,13 @@ open System.Runtime.InteropServices [] // Version information for an assembly consists of the following four values: -// +// // Major Version -// Minor Version +// Minor Version // Build Number // Revision -// -// You can specify all the values or you can default the Build and Revision Numbers +// +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [] [] diff --git a/tests/service/data/TestProject2/TestProject2.fs b/tests/service/data/TestProject2/TestProject2.fs index b1e2fb49a91..121c2f8e1e1 100644 --- a/tests/service/data/TestProject2/TestProject2.fs +++ b/tests/service/data/TestProject2/TestProject2.fs @@ -2,6 +2,6 @@ // This is code in one project making use of another project that uses a generative type provider -type Class1() = +type Class1() = member this.X1 = TestProject.T() member this.X2 = TestProject.T2() diff --git a/tests/service/data/TestTP/ProvidedTypes.fs b/tests/service/data/TestTP/ProvidedTypes.fs index 218c9738f1a..6980f7814a3 100644 --- a/tests/service/data/TestTP/ProvidedTypes.fs +++ b/tests/service/data/TestTP/ProvidedTypes.fs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation, Tomas Petricek, Gustavo Guerra, and other contributors -// +// // Licensed under the MIT License see LICENSE.md in this project namespace ProviderImplementation.ProvidedTypes @@ -22,13 +22,13 @@ open Microsoft.FSharp.Quotations.Patterns open Microsoft.FSharp.Core.CompilerServices [] -module Utils = +module Utils = let K x = (fun () -> x) let inline isNull x = match x with null -> true | _ -> false let inline isNil x = match x with [] -> true | _ -> false let inline isEmpty x = match x with [| |] -> true | _ -> false - module Option = + module Option = let toObj x = match x with None -> null | Some x -> x let ofObj x = match x with null -> None | _ -> Some x @@ -45,7 +45,7 @@ module Utils = let USome v = uoption<'T>(true, v) let (|UNone|USome|) (x:uoption<'T>) = if x.HasValue then USome x.Value else UNone - module StructOption = + module StructOption = let toObj x = match x with UNone -> null | USome x -> x let ofObj x = match x with null -> UNone | x -> USome x @@ -56,7 +56,7 @@ module Utils = if idx < 0 then failwith "splitNameAt: idx < 0"; let last = nm.Length - 1 if idx > last then failwith "splitNameAt: idx > last"; - (nm.Substring(0, idx)), + (nm.Substring(0, idx)), (if idx < last then nm.Substring (idx+1, last - idx) else "") let splitILTypeName (nm:string) = @@ -93,22 +93,22 @@ module Utils = let isAssignableFrom (ty: Type) (otherTy: Type) = eqTypes ty otherTy || (match otherTy.BaseType with null -> false | bt -> ty.IsAssignableFrom(bt)) - /// General implementation of .IsSubclassOf logic for System.Type, regardless of specific implementation, with + /// General implementation of .IsSubclassOf logic for System.Type, regardless of specific implementation, with /// an added hack to make the types usable with the FSharp.Core quotations implementation let isSubclassOf (this: Type) (otherTy: Type) = (this.IsClass && otherTy.IsClass && this.IsAssignableFrom(otherTy) && not (eqTypes this otherTy)) // The FSharp.Core implementation of FSharp.Quotations uses - // let isDelegateType (typ:Type) = + // let isDelegateType (typ:Type) = // if typ.IsSubclassOf(typeof) then ... // This means even target type definitions must process the case where ``otherTy`` is typeof rather than // the System.Delegate type for the target assemblies. - || (match this.BaseType with - | null -> false + || (match this.BaseType with + | null -> false | bt -> bt.FullName = "System.MulticastDelegate" && (let fn = otherTy.FullName in fn = "System.Delegate" || fn = "System.MulticastDelegate" )) - /// General implementation of .GetAttributeFlags logic for System.Type over symbol types - let getAttributeFlagsImpl (ty: Type) = + /// General implementation of .GetAttributeFlags logic for System.Type over symbol types + let getAttributeFlagsImpl (ty: Type) = if ty.IsGenericType then ty.GetGenericTypeDefinition().Attributes elif ty.IsArray then typeof.Attributes elif ty.IsPointer then typeof.MakePointerType().Attributes @@ -120,7 +120,7 @@ module Utils = let bindSome isStatic = BindingFlags.DeclaredOnly ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| (if isStatic then BindingFlags.Static else BindingFlags.Instance) let inline hasFlag e flag = (e &&& flag) <> enum 0 - let memberBinds isType (bindingFlags: BindingFlags) isStatic isPublic = + let memberBinds isType (bindingFlags: BindingFlags) isStatic isPublic = (isType || hasFlag bindingFlags (if isStatic then BindingFlags.Static else BindingFlags.Instance)) && ((hasFlag bindingFlags BindingFlags.Public && isPublic) || (hasFlag bindingFlags BindingFlags.NonPublic && not isPublic)) @@ -163,16 +163,16 @@ module Utils = else ty - let mutable token = 0 + let mutable token = 0 let genToken() = token <- token + 1; token /// Internal code of .NET expects the obj[] returned by GetCustomAttributes to be an Attribute[] even in the case of empty arrays let emptyAttributes = (([| |]: Attribute[]) |> box |> unbox) - - type Attributes<'T when 'T :> Attribute>() = + + type Attributes<'T when 'T :> Attribute>() = static let empty = ([| |] : 'T []) |> box |> unbox static member Empty() = empty - - type Attributes = + + type Attributes = static member CreateEmpty (typ : Type) = let gtype = typedefof>.MakeGenericType([| typ |]) // the Empty member is private due to the presence of the fsi file @@ -183,7 +183,7 @@ module Utils = let nonNull str x = if isNull x then failwithf "Null in '%s', stacktrace = '%s'" str Environment.StackTrace else x let nonNone str x = match x with None -> failwithf "No value has been specified for '%s', stacktrace = '%s'" str Environment.StackTrace | Some v -> v - let patchOption v f = match v with None -> f() | Some _ -> failwithf "Already patched, stacktrace = '%s'" Environment.StackTrace + let patchOption v f = match v with None -> f() | Some _ -> failwithf "Already patched, stacktrace = '%s'" Environment.StackTrace let notRequired this opname item = let msg = sprintf "The operation '%s' on item '%s' should not be called on provided type, member or parameter of type '%O'. Stack trace:\n%s" opname item (this.GetType()) Environment.StackTrace @@ -207,24 +207,24 @@ module Utils = type ConstructorInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetConstructors(bindAll) + gdty.GetConstructors(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic constructor definition via metadata token, stacktrace = '%s'" m.DeclaringType m.Name Environment.StackTrace else m type PropertyInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetProperties(bindAll) + gdty.GetProperties(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic property definition via metadata token" m.DeclaringType m.Name else @@ -234,12 +234,12 @@ module Utils = member p.IsPublic = p.CanRead && p.GetGetMethod(true).IsPublic || p.CanWrite && p.GetSetMethod(true).IsPublic type EventInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetEvents(bindAll) + gdty.GetEvents(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic event definition via metadata token" m.DeclaringType m.Name else @@ -249,33 +249,33 @@ module Utils = member p.IsPublic = p.GetAddMethod().IsPublic || p.GetRemoveMethod().IsPublic type FieldInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetFields(bindAll) + gdty.GetFields(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic event definition via metadata token" m.DeclaringType m.Name else m type MethodInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType if (m.IsGenericMethod && not dty.IsGenericType) then m.GetGenericMethodDefinition() - elif (m.IsGenericMethod && (not m.IsGenericMethodDefinition || not dty.IsGenericTypeDefinition)) || - (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + elif (m.IsGenericMethod && (not m.IsGenericMethodDefinition || not dty.IsGenericTypeDefinition)) || + (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through ALL the methods on the original type definition looking for the one // with a matching metadata token let gdty = if dty.IsGenericType then dty.GetGenericTypeDefinition() else dty - gdty.GetMethods(bindSome m.IsStatic) + gdty.GetMethods(bindSome m.IsStatic) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind generic instantiation of %O::%s back to generic method definition via metadata token" m.DeclaringType m.Name else - m + m let canBindConstructor (bindingFlags: BindingFlags) (c: ConstructorInfo) = hasFlag bindingFlags BindingFlags.Public && c.IsPublic || hasFlag bindingFlags BindingFlags.NonPublic && not c.IsPublic @@ -297,10 +297,10 @@ module Utils = // We only want to return source types "typeof" values as _target_ types in one very specific location due to a limitation in the // F# compiler code for multi-targeting. - let ImportProvidedMethodBaseAsILMethodRef_OnStack_HACK() = - let rec loop i = - if i > 9 then - false + let ImportProvidedMethodBaseAsILMethodRef_OnStack_HACK() = + let rec loop i = + if i > 9 then + false else let frame = StackFrame(i, true) match frame.GetMethod() with @@ -336,7 +336,7 @@ module UncheckedQuotations = let pTy = typeof.Assembly.GetType("Microsoft.FSharp.Quotations.PatternsModule") assert (not (isNull pTy)) - // These are handles to the internal functions that create quotation nodes of different sizes. Although internal, + // These are handles to the internal functions that create quotation nodes of different sizes. Although internal, // these function names have been stable since F# 2.0. let mkFE0 = pTy.GetMethod("mkFE0", bindAll) assert (not (isNull mkFE0)) @@ -353,7 +353,7 @@ module UncheckedQuotations = let mkFEN = pTy.GetMethod("mkFEN", bindAll) assert (mkFEN |> isNull |> not) - // These are handles to the internal tags attached to quotation nodes of different sizes. Although internal, + // These are handles to the internal tags attached to quotation nodes of different sizes. Although internal, // these function names have been stable since F# 2.0. let newDelegateOp = qTy.GetMethod("NewNewDelegateOp", bindAll) assert (newDelegateOp |> isNull |> not) @@ -489,20 +489,20 @@ module UncheckedQuotations = let op = letOp.Invoke(null, [| |]) mkFE2.Invoke(null, [| box op; box e; box lam |]) :?> Expr - static member ForIntegerRangeLoopUnchecked (loopVariable, startExpr:Expr, endExpr:Expr, body:Expr) = + static member ForIntegerRangeLoopUnchecked (loopVariable, startExpr:Expr, endExpr:Expr, body:Expr) = let lam = Expr.Lambda(loopVariable, body) let op = forIntegerRangeLoopOp.Invoke(null, [| |]) mkFE3.Invoke(null, [| box op; box startExpr; box endExpr; box lam |] ) :?> Expr - static member WhileLoopUnchecked (guard:Expr, body:Expr) = + static member WhileLoopUnchecked (guard:Expr, body:Expr) = let op = whileLoopOp.Invoke(null, [| |]) mkFE2.Invoke(null, [| box op; box guard; box body |] ):?> Expr - static member IfThenElseUnchecked (e:Expr, t:Expr, f:Expr) = + static member IfThenElseUnchecked (e:Expr, t:Expr, f:Expr) = let op = ifThenElseOp.Invoke(null, [| |]) mkFE3.Invoke(null, [| box op; box e; box t; box f |] ):?> Expr - static member NewUnionCaseUnchecked (uci:Reflection.UnionCaseInfo, args:Expr list) = + static member NewUnionCaseUnchecked (uci:Reflection.UnionCaseInfo, args:Expr list) = let op = newUnionCaseOp.Invoke(null, [| box uci |]) mkFEN.Invoke(null, [| box op; box args |]) :?> Expr @@ -605,7 +605,7 @@ type ProvidedTypeSymbol(kind: ProvidedTypeSymbolKind, typeArgs: Type list, typeB | ProvidedTypeSymbolKind.Generic gty -> gty.DeclaringType | ProvidedTypeSymbolKind.FSharpTypeAbbreviation _ -> null - override __.Name = + override __.Name = match kind, typeArgs with | ProvidedTypeSymbolKind.SDArray, [| arg |] -> arg.Name + "[]" | ProvidedTypeSymbolKind.Array _, [| arg |] -> arg.Name + "[*]" @@ -613,7 +613,7 @@ type ProvidedTypeSymbol(kind: ProvidedTypeSymbolKind, typeArgs: Type list, typeB | ProvidedTypeSymbolKind.ByRef, [| arg |] -> arg.Name + "&" | ProvidedTypeSymbolKind.Generic gty, _typeArgs -> gty.Name | ProvidedTypeSymbolKind.FSharpTypeAbbreviation (_, _, path), _ -> path[path.Length-1] - | c -> failwithf "unreachable %O" c + | c -> failwithf "unreachable %O" c override __.BaseType = match kind with @@ -669,7 +669,7 @@ type ProvidedTypeSymbol(kind: ProvidedTypeSymbolKind, typeArgs: Type list, typeB | ProvidedTypeSymbolKind.ByRef, [| arg |] -> 43904 + hash arg | ProvidedTypeSymbolKind.Generic gty, _ -> 9797 + hash gty + Array.sumBy hash typeArgs | ProvidedTypeSymbolKind.FSharpTypeAbbreviation _, _ -> 3092 - | c -> failwithf "unreachable %O" c + | c -> failwithf "unreachable %O" c override this.Equals(other: obj) = eqTypeObj this other @@ -765,7 +765,7 @@ type ProvidedTypeSymbol(kind: ProvidedTypeSymbolKind, typeArgs: Type list, typeB | _ -> false #endif - override __.MetadataToken = + override __.MetadataToken = match kind with | ProvidedTypeSymbolKind.SDArray -> typeof.MetadataToken | ProvidedTypeSymbolKind.Array _ -> typeof.MetadataToken @@ -905,7 +905,7 @@ module Misc = match obsoleteMessage with None -> () | Some s -> customAttributes.Add(mkObsoleteAttributeCustomAttributeData s) if hasParamArray then yield mkParamArrayCustomAttributeData() if hasReflectedDefinition then yield mkReflectedDefinitionCustomAttributeData() - yield! customAttributes + yield! customAttributes yield! customAttributesData() |] @@ -921,14 +921,14 @@ module Misc = member __.AddCustomAttribute(attribute) = customAttributes.Add(attribute) member __.GetCustomAttributesData() = let attrs = customAttributesOnce.Force() - let attrsWithDocHack = - match xmlDocAlwaysRecomputed with - | None -> + let attrsWithDocHack = + match xmlDocAlwaysRecomputed with + | None -> attrs - | Some f -> + | Some f -> // Recomputed XML doc is evaluated on every call to GetCustomAttributesData() when in the IDE [| for ca in attrs -> - if ca.Constructor.DeclaringType.Name = typeof.Name then + if ca.Constructor.DeclaringType.Name = typeof.Name then { new CustomAttributeData() with member __.Constructor = ca.Constructor member __.ConstructorArguments = upcast [| CustomAttributeTypedArgument(typeof, f()) |] @@ -942,14 +942,14 @@ type ProvidedStaticParameter(isTgt: bool, parameterName:string, parameterType:Ty let customAttributesImpl = CustomAttributesImpl(isTgt, customAttributesData) - new (parameterName:string, parameterType:Type, ?parameterDefaultValue:obj) = + new (parameterName:string, parameterType:Type, ?parameterDefaultValue:obj) = ProvidedStaticParameter(false, parameterName, parameterType, parameterDefaultValue, (K [| |])) member __.AddXmlDocDelayed xmlDocFunction = customAttributesImpl.AddXmlDocDelayed xmlDocFunction member __.AddXmlDocComputed xmlDocFunction = customAttributesImpl.AddXmlDocComputed xmlDocFunction member __.AddXmlDoc xmlDoc = customAttributesImpl.AddXmlDoc xmlDoc - member __.ParameterDefaultValue = parameterDefaultValue + member __.ParameterDefaultValue = parameterDefaultValue member __.BelongsToTargetModel = isTgt override __.RawDefaultValue = defaultArg parameterDefaultValue null @@ -962,15 +962,15 @@ type ProvidedStaticParameter(isTgt: bool, parameterName:string, parameterType:Ty override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() type ProvidedParameter(isTgt: bool, parameterName:string, attrs, parameterType:Type, optionalValue:obj option, customAttributesData) = - + inherit ParameterInfo() let customAttributesImpl = CustomAttributesImpl(isTgt, customAttributesData) - new (parameterName:string, parameterType:Type, ?isOut:bool, ?optionalValue:obj) = + new (parameterName:string, parameterType:Type, ?isOut:bool, ?optionalValue:obj) = ProvidedParameter(false, parameterName, parameterType, isOut, optionalValue) - new (_isTgt, parameterName:string, parameterType:Type, isOut:bool option, optionalValue:obj option) = + new (_isTgt, parameterName:string, parameterType:Type, isOut:bool option, optionalValue:obj option) = let isOut = defaultArg isOut false let attrs = (if isOut then ParameterAttributes.Out else enum 0) ||| (match optionalValue with None -> enum 0 | Some _ -> ParameterAttributes.Optional ||| ParameterAttributes.HasDefault) @@ -978,7 +978,7 @@ type ProvidedParameter(isTgt: bool, parameterName:string, attrs, parameterType:T member __.IsParamArray with set(v) = customAttributesImpl.HasParamArray <- v member __.IsReflectedDefinition with set(v) = customAttributesImpl.HasReflectedDefinition <- v - member __.OptionalValue = optionalValue + member __.OptionalValue = optionalValue member __.HasDefaultParameterValue = Option.isSome optionalValue member __.BelongsToTargetModel = isTgt member __.AddCustomAttribute(attribute) = customAttributesImpl.AddCustomAttribute(attribute) @@ -990,11 +990,11 @@ type ProvidedParameter(isTgt: bool, parameterName:string, attrs, parameterType:T override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() and ProvidedConstructor(isTgt: bool, attrs: MethodAttributes, parameters: ProvidedParameter[], invokeCode: (Expr list -> Expr), baseCall, isImplicitCtor, customAttributesData) = - + inherit ConstructorInfo() let parameterInfos = parameters |> Array.map (fun p -> p :> ParameterInfo) let mutable baseCall = baseCall - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let mutable isImplicitCtor = isImplicitCtor let mutable attrs = attrs let isStatic() = hasFlag attrs MethodAttributes.Static @@ -1051,7 +1051,7 @@ and ProvidedMethod(isTgt: bool, methodName: string, attrs: MethodAttributes, par inherit MethodInfo() let parameterInfos = parameters |> Array.map (fun p -> p :> ParameterInfo) - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let mutable attrs = attrs let mutable staticParams = staticParams let mutable staticParamsApply = staticParamsApply @@ -1103,11 +1103,11 @@ and ProvidedMethod(isTgt: bool, methodName: string, attrs: MethodAttributes, par member this.IsErased = (nonNone "DeclaringType" this.DeclaringProvidedType).IsErased // Implement overloads - override __.GetParameters() = parameterInfos + override __.GetParameters() = parameterInfos - override this.Attributes = + override this.Attributes = match invokeCode, this.DeclaringProvidedType with - | None, Some pt when pt.IsInterface || pt.IsAbstract -> + | None, Some pt when pt.IsInterface || pt.IsAbstract -> attrs ||| MethodAttributes.Abstract ||| MethodAttributes.Virtual ||| MethodAttributes.HideBySig ||| MethodAttributes.NewSlot | _ -> attrs @@ -1125,17 +1125,17 @@ and ProvidedMethod(isTgt: bool, methodName: string, attrs: MethodAttributes, par let cc = if not x.IsStatic then cc ||| CallingConventions.HasThis else cc cc - override __.ReturnType = - if isTgt then - match returnTypeFixCache with + override __.ReturnType = + if isTgt then + match returnTypeFixCache with | Some returnTypeFix -> returnTypeFix - | None -> - let returnTypeFix = - match returnType.Namespace, returnType.Name with - | "System", "Void"-> - if ImportProvidedMethodBaseAsILMethodRef_OnStack_HACK() then + | None -> + let returnTypeFix = + match returnType.Namespace, returnType.Name with + | "System", "Void"-> + if ImportProvidedMethodBaseAsILMethodRef_OnStack_HACK() then typeof - else + else returnType | _ -> returnType returnTypeFixCache <- Some returnTypeFix @@ -1166,7 +1166,7 @@ and ProvidedMethod(isTgt: bool, methodName: string, attrs: MethodAttributes, par and ProvidedProperty(isTgt: bool, propertyName: string, attrs: PropertyAttributes, propertyType: Type, isStatic: bool, getter: (unit -> MethodInfo) option, setter: (unit -> MethodInfo) option, indexParameters: ProvidedParameter[], customAttributesData) = inherit PropertyInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(isTgt, customAttributesData) @@ -1188,11 +1188,11 @@ and ProvidedProperty(isTgt: bool, propertyName: string, attrs: PropertyAttribute override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() member __.PatchDeclaringType x = - if not isTgt then + if not isTgt then match getter with Some f -> (match f() with (:? ProvidedMethod as g) -> g.PatchDeclaringType x | _ -> ()) | _ -> () match setter with Some f -> (match f() with (:? ProvidedMethod as s) -> s.PatchDeclaringType x | _ -> ()) | _ -> () patchOption declaringType (fun () -> declaringType <- Some x) - + member __.IsStatic = isStatic member __.IndexParameters = indexParameters member __.BelongsToTargetModel = isTgt @@ -1203,7 +1203,7 @@ and ProvidedProperty(isTgt: bool, propertyName: string, attrs: PropertyAttribute override this.SetValue(_obj, _value, _invokeAttr, _binder, _index, _culture) = notRequired this "SetValue" propertyName override this.GetAccessors _nonPublic = notRequired this "nonPublic" propertyName override __.GetGetMethod _nonPublic = match getter with None -> null | Some g -> g() - override __.GetSetMethod _nonPublic = match setter with None -> null | Some s -> s() + override __.GetSetMethod _nonPublic = match setter with None -> null | Some s -> s() override __.GetIndexParameters() = [| for p in indexParameters -> upcast p |] override __.Attributes = attrs override __.CanRead = getter.IsSome @@ -1221,11 +1221,11 @@ and ProvidedProperty(isTgt: bool, propertyName: string, attrs: PropertyAttribute and ProvidedEvent(isTgt: bool, eventName:string, attrs: EventAttributes, eventHandlerType:Type, isStatic: bool, adder: (unit -> MethodInfo), remover: (unit -> MethodInfo), customAttributesData) = inherit EventInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(isTgt, customAttributesData) - new (eventName, eventHandlerType, adderCode, removerCode, ?isStatic) = + new (eventName, eventHandlerType, adderCode, removerCode, ?isStatic) = let isStatic = defaultArg isStatic false let pattrs = (if isStatic then MethodAttributes.Static else enum(0)) ||| MethodAttributes.Public ||| MethodAttributes.SpecialName let adder = ProvidedMethod(false, "add_" + eventName, pattrs, [| ProvidedParameter(false, "handler", eventHandlerType, isOut=Some false, optionalValue=None) |], typeof, Some adderCode, [], None, K [| |]) :> MethodInfo @@ -1238,7 +1238,7 @@ and ProvidedEvent(isTgt: bool, eventName:string, attrs: EventAttributes, eventHa member __.AddDefinitionLocation(line, column, filePath) = customAttributesImpl.AddDefinitionLocation(line, column, filePath) member __.PatchDeclaringType x = - if not isTgt then + if not isTgt then match adder() with :? ProvidedMethod as a -> a.PatchDeclaringType x | _ -> () match remover() with :? ProvidedMethod as r -> r.PatchDeclaringType x | _ -> () patchOption declaringType (fun () -> declaringType <- Some x) @@ -1249,7 +1249,7 @@ and ProvidedEvent(isTgt: bool, eventName:string, attrs: EventAttributes, eventHa member __.BelongsToTargetModel = isTgt override __.EventHandlerType = eventHandlerType - override __.GetAddMethod _nonPublic = adder() + override __.GetAddMethod _nonPublic = adder() override __.GetRemoveMethod _nonPublic = remover() override __.Attributes = attrs override __.Name = eventName @@ -1266,7 +1266,7 @@ and ProvidedEvent(isTgt: bool, eventName:string, attrs: EventAttributes, eventHa and ProvidedField(isTgt: bool, fieldName:string, attrs, fieldType:Type, rawConstantValue: obj, customAttributesData) = inherit FieldInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(isTgt, customAttributesData) let mutable attrs = attrs @@ -1303,10 +1303,10 @@ and ProvidedField(isTgt: bool, fieldName:string, attrs, fieldType:Type, rawConst override this.GetValue(_obj): obj = notRequired this "GetValue" fieldName override this.FieldHandle = notRequired this "FieldHandle" fieldName - static member Literal(fieldName:string, fieldType:Type, literalValue: obj) = + static member Literal(fieldName:string, fieldType:Type, literalValue: obj) = ProvidedField(false, fieldName, (FieldAttributes.Static ||| FieldAttributes.Literal ||| FieldAttributes.Public), fieldType, literalValue, K [| |]) - + and ProvidedMeasureBuilder() = // TODO: this shouldn't be hardcoded, but without creating a dependency on FSharp.Compiler.Service @@ -1325,7 +1325,7 @@ and ProvidedMeasureBuilder() = "m"; "kg"; "s"; "A"; "K"; "mol"; "cd"; "Hz"; "N"; "Pa"; "J"; "W"; "C" "V"; "F"; "S"; "ohm"; "Wb"; "T"; "lm"; "lx"; "Bq"; "Gy"; "Sv"; "kat"; "H" ] - |> Set.ofList + |> Set.ofList static member One = typeof static member Product (measure1, measure2) = typedefof>.MakeGenericType [| measure1;measure2 |] @@ -1353,14 +1353,14 @@ and ProvidedMeasureBuilder() = static member AnnotateType (basic, argument) = ProvidedTypeSymbol(Generic basic, argument, defaultTypeBuilder) :> Type -and - [] +and + [] TypeContainer = | Namespace of (unit -> Assembly) * string // namespace | Type of ProvidedTypeDefinition | TypeToBeDecided -/// backingDataSource is a set of functions to fetch backing data for the ProvidedTypeDefinition, +/// backingDataSource is a set of functions to fetch backing data for the ProvidedTypeDefinition, /// and allows us to reuse this type for both target and source models, even when the /// source model is being incrementally updates by further .AddMember calls and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: string, getBaseType: (unit -> Type option), attrs: TypeAttributes, getEnumUnderlyingType, staticParams, staticParamsApply, backingDataSource, customAttributesData, nonNullable, hideObjectMethods, typeBuilder: ITypeBuilder) as this = @@ -1371,7 +1371,7 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri | _ -> () static let defaultAttributes (isErased, isSealed, isInterface, isAbstract) = - TypeAttributes.Public ||| + TypeAttributes.Public ||| (if isInterface then TypeAttributes.Interface ||| TypeAttributes.Abstract elif isAbstract then TypeAttributes.Abstract else TypeAttributes.Class) ||| @@ -1382,7 +1382,7 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri let mutable attrs = attrs let mutable enumUnderlyingType = lazy getEnumUnderlyingType() let mutable baseType = lazy getBaseType() - + /// Represents the evaluated members so far let members = ResizeArray() @@ -1398,26 +1398,26 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri let methodOverrides = ResizeArray() let methodOverridesQueue = ResizeArray (ProvidedMethod * MethodInfo)[]>() - do match backingDataSource with - | None -> () + do match backingDataSource with + | None -> () | Some (_, getFreshMembers, getFreshInterfaces, getFreshMethodOverrides) -> membersQueue.Add getFreshMembers interfacesQueue.Add getFreshInterfaces methodOverridesQueue.Add getFreshMethodOverrides let checkFreshMembers() = - match backingDataSource with + match backingDataSource with | None -> false | Some (checkFreshMembers, _getFreshMembers, _getFreshInterfaces, _getFreshMethodOverrides) -> checkFreshMembers() let moreMembers() = - membersQueue.Count > 0 || checkFreshMembers() + membersQueue.Count > 0 || checkFreshMembers() let evalMembers() = if moreMembers() then // re-add the getFreshMembers call from the backingDataSource to make sure we fetch the latest translated members from the source model - match backingDataSource with - | None -> () + match backingDataSource with + | None -> () | Some (_, getFreshMembers, _getFreshInterfaces, _getFreshMethodOverrides) -> membersQueue.Add getFreshMembers @@ -1426,19 +1426,19 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri for f in elems do for m in f() do members.Add m - + // Implicitly add the property and event methods (only for the source model where they are not explicitly declared) match m with | :? ProvidedProperty as p -> - if not p.BelongsToTargetModel then + if not p.BelongsToTargetModel then if p.CanRead then members.Add (p.GetGetMethod true) if p.CanWrite then members.Add (p.GetSetMethod true) | :? ProvidedEvent as e -> - if not e.BelongsToTargetModel then + if not e.BelongsToTargetModel then members.Add (e.GetAddMethod true) members.Add (e.GetRemoveMethod true) | _ -> () - + let getMembers() = evalMembers() members.ToArray() @@ -1446,13 +1446,13 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri // Save some common lookups for provided types with lots of members let mutable bindings : Dictionary = null - let save (key: BindingFlags) f : 'T = + let save (key: BindingFlags) f : 'T = let key = int key - if isNull bindings then + if isNull bindings then bindings <- Dictionary<_, _>(HashIdentity.Structural) - if not (moreMembers()) && bindings.ContainsKey(key) then + if not (moreMembers()) && bindings.ContainsKey(key) then bindings[key] :?> 'T else let res = f () // this will refresh the members @@ -1466,8 +1466,8 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri for f in elems do for i in f() do interfaceImpls.Add i - match backingDataSource with - | None -> () + match backingDataSource with + | None -> () | Some (_, _getFreshMembers, getInterfaces, _getFreshMethodOverrides) -> interfacesQueue.Add getInterfaces @@ -1482,8 +1482,8 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri for f in elems do for i in f() do methodOverrides.Add i - match backingDataSource with - | None -> () + match backingDataSource with + | None -> () | Some (_, _getFreshMembers, _getFreshInterfaces, getFreshMethodOverrides) -> methodOverridesQueue.Add getFreshMethodOverrides @@ -1499,7 +1499,7 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() - new (assembly:Assembly, namespaceName, className, baseType, ?hideObjectMethods, ?nonNullable, ?isErased, ?isSealed, ?isInterface, ?isAbstract) = + new (assembly:Assembly, namespaceName, className, baseType, ?hideObjectMethods, ?nonNullable, ?isErased, ?isSealed, ?isInterface, ?isAbstract) = let isErased = defaultArg isErased true let isSealed = defaultArg isSealed true let isInterface = defaultArg isInterface false @@ -1510,7 +1510,7 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri //if not isErased && assembly.GetType().Name <> "ProvidedAssembly" then failwithf "a non-erased (i.e. generative) ProvidedTypeDefinition '%s.%s' was placed in an assembly '%s' that is not a ProvidedAssembly" namespaceName className (assembly.GetName().Name) ProvidedTypeDefinition(false, TypeContainer.Namespace (K assembly, namespaceName), className, K baseType, attrs, K None, [], None, None, K [| |], nonNullable, hideObjectMethods, defaultTypeBuilder) - new (className:string, baseType, ?hideObjectMethods, ?nonNullable, ?isErased, ?isSealed, ?isInterface, ?isAbstract) = + new (className:string, baseType, ?hideObjectMethods, ?nonNullable, ?isErased, ?isSealed, ?isInterface, ?isAbstract) = let isErased = defaultArg isErased true let isSealed = defaultArg isSealed true let isInterface = defaultArg isInterface false @@ -1525,13 +1525,13 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri override __.UnderlyingSystemType = typeof // Implement overloads - override __.Assembly = + override __.Assembly = match container with | TypeContainer.Namespace (theAssembly, _) -> theAssembly() | TypeContainer.Type t -> t.Assembly | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not yet added as a member to a declaring type, stacktrace = %s" className Environment.StackTrace - override __.FullName = + override __.FullName = match container with | TypeContainer.Type declaringType -> declaringType.FullName + "+" + className | TypeContainer.Namespace (_, namespaceName) -> @@ -1541,7 +1541,7 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri | _ -> namespaceName + "." + className | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not added as a member to a declaring type" className - override __.Namespace = + override __.Namespace = match container with | TypeContainer.Namespace (_, nsp) -> nsp | TypeContainer.Type t -> t.Namespace @@ -1550,72 +1550,72 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri override __.BaseType = match baseType.Value with Some ty -> ty | None -> null override __.GetConstructors bindingFlags = - (//save ("ctor", bindingFlags, None) (fun () -> - getMembers() + (//save ("ctor", bindingFlags, None) (fun () -> + getMembers() |> Array.choose (function :? ConstructorInfo as c when memberBinds false bindingFlags c.IsStatic c.IsPublic -> Some c | _ -> None)) override this.GetMethods bindingFlags = - (//save ("methods", bindingFlags, None) (fun () -> - getMembers() + (//save ("methods", bindingFlags, None) (fun () -> + getMembers() |> Array.choose (function :? MethodInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if hasFlag bindingFlags BindingFlags.DeclaredOnly || isNull this.BaseType then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetMethods(bindingFlags))))) override this.GetFields bindingFlags = - (//save ("fields", bindingFlags, None) (fun () -> - getMembers() + (//save ("fields", bindingFlags, None) (fun () -> + getMembers() |> Array.choose (function :? FieldInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if hasFlag bindingFlags BindingFlags.DeclaredOnly || isNull this.BaseType then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetFields(bindingFlags))))) override this.GetProperties bindingFlags = - (//save ("props", bindingFlags, None) (fun () -> + (//save ("props", bindingFlags, None) (fun () -> let staticOrPublic = - getMembers() + getMembers() |> Array.choose (function :? PropertyInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) - staticOrPublic + staticOrPublic |> (if hasFlag bindingFlags BindingFlags.DeclaredOnly || isNull this.BaseType then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetProperties(bindingFlags))))) override this.GetEvents bindingFlags = - (//save ("events", bindingFlags, None) (fun () -> - getMembers() + (//save ("events", bindingFlags, None) (fun () -> + getMembers() |> Array.choose (function :? EventInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if hasFlag bindingFlags BindingFlags.DeclaredOnly || isNull this.BaseType then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetEvents(bindingFlags))))) override __.GetNestedTypes bindingFlags = - (//save ("nested", bindingFlags, None) (fun () -> - getMembers() + (//save ("nested", bindingFlags, None) (fun () -> + getMembers() |> Array.choose (function :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> Some m | _ -> None) |> (if hasFlag bindingFlags BindingFlags.DeclaredOnly || isNull this.BaseType then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetNestedTypes(bindingFlags))))) - override this.GetConstructorImpl(bindingFlags, _binder, _callConventions, _types, _modifiers) = + override this.GetConstructorImpl(bindingFlags, _binder, _callConventions, _types, _modifiers) = let xs = this.GetConstructors bindingFlags |> Array.filter (fun m -> m.Name = ".ctor") if xs.Length > 1 then failwith "GetConstructorImpl. not support overloads" if xs.Length > 0 then xs[0] else null override __.GetMethodImpl(name, bindingFlags, _binderBinder, _callConvention, _types, _modifiers): MethodInfo = - (//save ("methimpl", bindingFlags, Some name) (fun () -> + (//save ("methimpl", bindingFlags, Some name) (fun () -> // This is performance critical for large spaces of provided methods and properties // Save a table of the methods grouped by name - let table = - save (bindingFlags ||| BindingFlags.InvokeMethod) (fun () -> + let table = + save (bindingFlags ||| BindingFlags.InvokeMethod) (fun () -> let methods = this.GetMethods bindingFlags methods |> Seq.groupBy (fun m -> m.Name) |> Seq.map (fun (k, v) -> k, Seq.toArray v) |> dict) - + let xs = match table.TryGetValue name with | true, tn -> tn | false, _ -> [| |] //let xs = this.GetMethods bindingFlags |> Array.filter (fun m -> m.Name = name) if xs.Length > 1 then failwithf "GetMethodImpl. not support overloads, name = '%s', methods - '%A', callstack = '%A'" name xs Environment.StackTrace if xs.Length > 0 then xs[0] else null) override this.GetField(name, bindingFlags) = - (//save ("field1", bindingFlags, Some name) (fun () -> + (//save ("field1", bindingFlags, Some name) (fun () -> let xs = this.GetFields bindingFlags |> Array.filter (fun m -> m.Name = name) if xs.Length > 0 then xs[0] else null) override __.GetPropertyImpl(name, bindingFlags, _binder, _returnType, _types, _modifiers) = - (//save ("prop1", bindingFlags, Some name) (fun () -> - let table = - save (bindingFlags ||| BindingFlags.GetProperty) (fun () -> + (//save ("prop1", bindingFlags, Some name) (fun () -> + let table = + save (bindingFlags ||| BindingFlags.GetProperty) (fun () -> let methods = this.GetProperties bindingFlags methods |> Seq.groupBy (fun m -> m.Name) |> Seq.map (fun (k, v) -> k, Seq.toArray v) |> dict) let xs = match table.TryGetValue name with | true, tn -> tn | false, _ -> [| |] @@ -1623,18 +1623,18 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri if xs.Length > 0 then xs[0] else null) override __.GetEvent(name, bindingFlags) = - (//save ("event1", bindingFlags, Some name) (fun () -> + (//save ("event1", bindingFlags, Some name) (fun () -> let xs = this.GetEvents bindingFlags |> Array.filter (fun m -> m.Name = name) if xs.Length > 0 then xs[0] else null) override __.GetNestedType(name, bindingFlags) = - (//save ("nested1", bindingFlags, Some name) (fun () -> + (//save ("nested1", bindingFlags, Some name) (fun () -> let xs = this.GetNestedTypes bindingFlags |> Array.filter (fun m -> m.Name = name) if xs.Length > 0 then xs[0] else null) override __.GetInterface(_name, _ignoreCase) = notRequired this "GetInterface" this.Name - override __.GetInterfaces() = getInterfaces() + override __.GetInterfaces() = getInterfaces() override __.MakeArrayType() = ProvidedTypeSymbol(ProvidedTypeSymbolKind.SDArray, [this], typeBuilder) :> Type @@ -1649,13 +1649,13 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri // However, it's possible for the framework to generate other sets of flags in some corner cases (e.g. via use of `enum` with a provided type as the target) override __.GetMembers bindingFlags = [| for m in getMembers() do - match m with + match m with | :? ConstructorInfo as c when memberBinds false bindingFlags c.IsStatic c.IsPublic -> yield (c :> MemberInfo) | :? MethodInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? FieldInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? PropertyInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? EventInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) - | :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> yield (m :> _) + | :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> yield (m :> _) | _ -> () |] override this.GetMember(name, mt, _bindingFlags) = @@ -1663,15 +1663,15 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri this.GetMembers() |> Array.filter (fun m -> 0 <> int(m.MemberType &&& mt) && m.Name = name) // Attributes, etc.. - override __.GetAttributeFlagsImpl() = adjustTypeAttributes this.IsNested attrs + override __.GetAttributeFlagsImpl() = adjustTypeAttributes this.IsNested attrs - override this.IsValueTypeImpl() = - match this.BaseType with - | null -> false - | bt -> bt.FullName = "System.Enum" || bt.FullName = "System.ValueType" || bt.IsValueType + override this.IsValueTypeImpl() = + match this.BaseType with + | null -> false + | bt -> bt.FullName = "System.Enum" || bt.FullName = "System.ValueType" || bt.IsValueType - override __.IsEnum = - match this.BaseType with + override __.IsEnum = + match this.BaseType with | null -> false | bt -> bt.FullName = "System.Enum" || bt.IsEnum @@ -1690,7 +1690,7 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri override __.HasElementTypeImpl() = false override __.Name = className - override __.DeclaringType = + override __.DeclaringType = match container with | TypeContainer.Namespace _ -> null | TypeContainer.Type enclosingTyp -> (enclosingTyp :> Type) @@ -1736,12 +1736,12 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri member __.BaseTypeRaw() = baseType.Force() member __.StaticParams = staticParams member __.StaticParamsApply = staticParamsApply - - // Count the members declared since the indicated position in the members list. This allows the target model to observe + + // Count the members declared since the indicated position in the members list. This allows the target model to observe // incremental additions made to the source model member __.CountMembersFromCursor(idx: int) = evalMembers(); members.Count - idx - // Fetch the members declared since the indicated position in the members list. This allows the target model to observe + // Fetch the members declared since the indicated position in the members list. This allows the target model to observe // incremental additions made to the source model member __.GetMembersFromCursor(idx: int) = evalMembers(); members.GetRange(idx, members.Count - idx).ToArray(), members.Count @@ -1751,7 +1751,7 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri // Fetch the method overrides declared since the indicated position in the list member __.GetMethodOverridesFromCursor(idx: int) = evalMethodOverrides(); methodOverrides.GetRange(idx, methodOverrides.Count - idx).ToArray(), methodOverrides.Count - // Fetch the method overrides + // Fetch the method overrides member __.GetMethodOverrides() = getFreshMethodOverrides() member this.ErasedBaseType : Type = ProvidedTypeDefinition.EraseType(this.BaseType) @@ -1766,16 +1766,16 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri member __.AddCustomAttribute attribute = customAttributesImpl.AddCustomAttribute attribute member __.SetEnumUnderlyingType(ty) = enumUnderlyingType <- lazy Some ty - member __.SetBaseType t = + member __.SetBaseType t = if baseType.IsValueCreated then failwithf "The base type has already been evaluated for this type. Please call SetBaseType before any operations which traverse the type hierarchy. stacktrace = %A" Environment.StackTrace baseType <- lazy Some t - member __.SetBaseTypeDelayed baseTypeFunction = + member __.SetBaseTypeDelayed baseTypeFunction = if baseType.IsValueCreated then failwithf "The base type has already been evaluated for this type. Please call SetBaseType before any operations which traverse the type hierarchy. stacktrace = %A" Environment.StackTrace baseType <- lazy (Some (baseTypeFunction())) member __.AddAttributes x = attrs <- attrs ||| x member __.SetAttributes x = attrs <- x - member this.AddMembers(memberInfos:list<#MemberInfo>) = + member this.AddMembers(memberInfos:list<#MemberInfo>) = memberInfos |> List.iter this.PatchDeclaringTypeOfMember membersQueue.Add (fun () -> memberInfos |> List.toArray |> Array.map (fun x -> x :> MemberInfo )) @@ -1832,7 +1832,7 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri staticParams <- parameters staticParamsApply <- Some instantiationFunction - /// Get ParameterInfo[] for the parametric type parameters + /// Get ParameterInfo[] for the parametric type parameters member __.GetStaticParametersInternal() = [| for p in staticParams -> p :> ParameterInfo |] /// Instantiate parametric type @@ -1864,8 +1864,8 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri member __.AddInterfaceImplementationsDelayed interfacesFunction = interfacesQueue.Add (interfacesFunction >> Array.ofList) - member __.SetAssemblyInternal (assembly: unit -> Assembly) = - match container with + member __.SetAssemblyInternal (assembly: unit -> Assembly) = + match container with | TypeContainer.Namespace (_, ns) -> container <- TypeContainer.Namespace (assembly, ns) | TypeContainer.Type _ -> failwithf "can't set assembly of nested type '%s'" className | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not added as a member to a declaring type" className @@ -1897,10 +1897,10 @@ and ProvidedTypeDefinition(isTgt: bool, container:TypeContainer, className: stri member this.PatchDeclaringTypeOfMember (m:MemberInfo) = match m with - | :? ProvidedConstructor as c -> c.PatchDeclaringType this - | :? ProvidedMethod as m -> m.PatchDeclaringType this - | :? ProvidedProperty as p -> p.PatchDeclaringType this - | :? ProvidedEvent as e -> e.PatchDeclaringType this + | :? ProvidedConstructor as c -> c.PatchDeclaringType this + | :? ProvidedMethod as m -> m.PatchDeclaringType this + | :? ProvidedProperty as p -> p.PatchDeclaringType this + | :? ProvidedEvent as e -> e.PatchDeclaringType this | :? ProvidedTypeDefinition as t -> t.PatchDeclaringType this | :? ProvidedField as l -> l.PatchDeclaringType this | _ -> () @@ -1936,13 +1936,13 @@ module internal AssemblyReader = // the public key. //--------------------------------------------------------------------- - // Little-endian encoding of int32 + // Little-endian encoding of int32 let b0 n = byte (n &&& 0xFF) let b1 n = byte ((n >>> 8) &&& 0xFF) let b2 n = byte ((n >>> 16) &&& 0xFF) let b3 n = byte ((n >>> 24) &&& 0xFF) - // Little-endian encoding of int64 + // Little-endian encoding of int64 let dw7 n = byte ((n >>> 56) &&& 0xFFL) let dw6 n = byte ((n >>> 48) &&& 0xFFL) let dw5 n = byte ((n >>> 40) &&& 0xFFL) @@ -2081,10 +2081,10 @@ module internal AssemblyReader = member x.ToAssemblyName() = let asmName = AssemblyName(Name=x.Name) - match x.PublicKey with + match x.PublicKey with | USome bytes -> asmName.SetPublicKeyToken(bytes.ToToken()) | UNone -> () - match x.Version with + match x.Version with | USome v -> asmName.Version <- v | UNone -> () asmName.CultureName <- System.Globalization.CultureInfo.InvariantCulture.Name @@ -2152,7 +2152,7 @@ module internal AssemblyReader = override x.ToString() = x.QualifiedName override __.GetHashCode() = - + name.GetHashCode() + 137 * (hash.GetHashCode() + 137 * (publicKey.GetHashCode() + @@ -2164,8 +2164,8 @@ module internal AssemblyReader = match obj with | :? ILAssemblyRef as y -> name = y.Name - && hash = y.Hash - && publicKey = y.PublicKey + && hash = y.Hash + && publicKey = y.PublicKey && retargetable = y.Retargetable && version = y.Version && locale = y.Locale @@ -2341,7 +2341,7 @@ module internal AssemblyReader = | :? ILTypeSpec as y -> typeRef = y.TypeRef && inst = y.GenericArgs - | _ -> false + | _ -> false and [] ILType = @@ -2462,8 +2462,8 @@ module internal AssemblyReader = type ILCodeLabel = int // -------------------------------------------------------------------- - // Instruction set. - // -------------------------------------------------------------------- + // Instruction set. + // -------------------------------------------------------------------- type ILBasicType = | DT_R @@ -2482,52 +2482,52 @@ module internal AssemblyReader = | DT_REF [] - type ILToken = - | ILType of ILType - | ILMethod of ILMethodSpec + type ILToken = + | ILType of ILType + | ILMethod of ILMethodSpec | ILField of ILFieldSpec [] - type ILConst = + type ILConst = | I4 of int32 | I8 of int64 | R4 of single | R8 of double - type ILTailcall = + type ILTailcall = | Tailcall | Normalcall - type ILAlignment = + type ILAlignment = | Aligned | Unaligned1 | Unaligned2 | Unaligned4 - type ILVolatility = + type ILVolatility = | Volatile | Nonvolatile - type ILReadonly = + type ILReadonly = | ReadonlyAddress | NormalAddress type ILVarArgs = ILTypes option [] - type ILComparisonInstr = - | I_beq - | I_bge - | I_bge_un - | I_bgt - | I_bgt_un - | I_ble - | I_ble_un - | I_blt - | I_blt_un - | I_bne_un - | I_brfalse - | I_brtrue + type ILComparisonInstr = + | I_beq + | I_bge + | I_bge_un + | I_bgt + | I_bgt_un + | I_ble + | I_ble_un + | I_blt + | I_blt_un + | I_bne_un + | I_brfalse + | I_brtrue #if DEBUG_INFO @@ -2552,42 +2552,42 @@ module internal AssemblyReader = #endif [] - type ILInstr = - | I_add + type ILInstr = + | I_add | I_add_ovf | I_add_ovf_un - | I_and - | I_div + | I_and + | I_div | I_div_un - | I_ceq - | I_cgt - | I_cgt_un - | I_clt - | I_clt_un + | I_ceq + | I_cgt + | I_cgt_un + | I_clt + | I_clt_un | I_conv of ILBasicType | I_conv_ovf of ILBasicType | I_conv_ovf_un of ILBasicType - | I_mul - | I_mul_ovf + | I_mul + | I_mul_ovf | I_mul_ovf_un - | I_rem - | I_rem_un - | I_shl - | I_shr + | I_rem + | I_rem_un + | I_shl + | I_shr | I_shr_un - | I_sub - | I_sub_ovf - | I_sub_ovf_un - | I_xor - | I_or - | I_neg - | I_not - | I_ldnull - | I_dup + | I_sub + | I_sub_ovf + | I_sub_ovf_un + | I_xor + | I_or + | I_neg + | I_not + | I_ldnull + | I_dup | I_pop - | I_ckfinite + | I_ckfinite | I_nop - | I_ldc of ILBasicType * ILConst + | I_ldc of ILBasicType * ILConst | I_ldarg of int | I_ldarga of int | I_ldind of ILAlignment * ILVolatility * ILBasicType @@ -2599,9 +2599,9 @@ module internal AssemblyReader = | I_br of ILCodeLabel | I_jmp of ILMethodSpec - | I_brcmp of ILComparisonInstr * ILCodeLabel - | I_switch of ILCodeLabel list - | I_ret + | I_brcmp of ILComparisonInstr * ILCodeLabel + | I_switch of ILCodeLabel list + | I_ret | I_call of ILTailcall * ILMethodSpec * ILVarArgs | I_callvirt of ILTailcall * ILMethodSpec * ILVarArgs @@ -2609,7 +2609,7 @@ module internal AssemblyReader = | I_calli of ILTailcall * ILCallingSignature * ILVarArgs | I_ldftn of ILMethodSpec | I_newobj of ILMethodSpec * ILVarArgs - + | I_throw | I_endfinally | I_endfilter @@ -2619,7 +2619,7 @@ module internal AssemblyReader = | I_ldsfld of ILVolatility * ILFieldSpec | I_ldfld of ILAlignment * ILVolatility * ILFieldSpec | I_ldsflda of ILFieldSpec - | I_ldflda of ILFieldSpec + | I_ldflda of ILFieldSpec | I_stsfld of ILVolatility * ILFieldSpec | I_stfld of ILAlignment * ILVolatility * ILFieldSpec | I_ldstr of string @@ -2642,70 +2642,70 @@ module internal AssemblyReader = | I_ldelema of ILReadonly * ILArrayShape * ILType | I_ldelem_any of ILArrayShape * ILType | I_stelem_any of ILArrayShape * ILType - | I_newarr of ILArrayShape * ILType + | I_newarr of ILArrayShape * ILType | I_ldlen | I_mkrefany of ILType - | I_refanytype + | I_refanytype | I_refanyval of ILType - | I_break + | I_break #if EMIT_DEBUG_INFO | I_seqpoint of ILDebugPoint #endif - | I_arglist + | I_arglist | I_localloc | I_cpblk of ILAlignment * ILVolatility | I_initblk of ILAlignment * ILVolatility - (* FOR EXTENSIONS, e.g. MS-ILX *) + (* FOR EXTENSIONS, e.g. MS-ILX *) | EI_ilzero of ILType | EI_ldlen_multi of int32 * int32 [] - type ILExceptionClause = + type ILExceptionClause = | Finally of (ILCodeLabel * ILCodeLabel) | Fault of (ILCodeLabel * ILCodeLabel) | FilterCatch of (ILCodeLabel * ILCodeLabel) * (ILCodeLabel * ILCodeLabel) | TypeCatch of ILType * (ILCodeLabel * ILCodeLabel) [] - type ILExceptionSpec = + type ILExceptionSpec = { Range: (ILCodeLabel * ILCodeLabel); Clause: ILExceptionClause } - /// Indicates that a particular local variable has a particular source - /// language name within a given set of ranges. This does not effect local - /// variable numbering, which is global over the whole method. + /// Indicates that a particular local variable has a particular source + /// language name within a given set of ranges. This does not effect local + /// variable numbering, which is global over the whole method. [] type ILLocalDebugMapping = { LocalIndex: int; LocalName: string; } [] - type ILLocalDebugInfo = + type ILLocalDebugInfo = { Range: (ILCodeLabel * ILCodeLabel); DebugMappings: ILLocalDebugMapping[] } [] - type ILCode = - { Labels: Dictionary - Instrs:ILInstr[] + type ILCode = + { Labels: Dictionary + Instrs:ILInstr[] Exceptions: ILExceptionSpec[] Locals: ILLocalDebugInfo[] } [] - type ILLocal = + type ILLocal = { Type: ILType; IsPinned: bool; DebugInfo: (string * int * int) option } - + type ILLocals = ILLocal[] [] - type ILMethodBody = + type ILMethodBody = { IsZeroInit: bool MaxStack: int32 Locals: ILLocals @@ -2722,9 +2722,9 @@ module internal AssemblyReader = type ILCustomAttrNamedArg = ILCustomAttrNamedArg of (string * ILType * obj) - type ILCustomAttribute = + type ILCustomAttribute = { Method: ILMethodSpec - Data: byte[] + Data: byte[] Elements: obj list} type ILCustomAttrs = @@ -2789,7 +2789,7 @@ module internal AssemblyReader = { Name: string Constraints: ILTypes Attributes: GenericParameterAttributes - CustomAttrs: ILCustomAttrs + CustomAttrs: ILCustomAttrs Token: int } member x.HasReferenceTypeConstraint= (x.Attributes &&& GenericParameterAttributes.ReferenceTypeConstraint) <> enum 0 @@ -2818,7 +2818,7 @@ module internal AssemblyReader = CustomAttrs: ILCustomAttrs } member x.ParameterTypes = x.Parameters |> Array.map (fun p -> p.ParameterType) static member ComputeIsStatic attrs = attrs &&& MethodAttributes.Static <> enum 0 - member x.IsStatic = ILMethodDef.ComputeIsStatic x.Attributes + member x.IsStatic = ILMethodDef.ComputeIsStatic x.Attributes member x.IsAbstract = x.Attributes &&& MethodAttributes.Abstract <> enum 0 member x.IsVirtual = x.Attributes &&& MethodAttributes.Virtual <> enum 0 member x.IsCheckAccessOnOverride = x.Attributes &&& MethodAttributes.CheckAccessOnOverride <> enum 0 @@ -2855,13 +2855,13 @@ module internal AssemblyReader = lmap member __.Entries = larr.Force() - member __.FindByName nm = + member __.FindByName nm = let scc, ys = getmap().TryGetValue(nm) if scc then ys else Array.empty member x.FindByNameAndArity (nm, arity) = x.FindByName nm |> Array.filter (fun x -> x.Parameters.Length = arity) - member x.TryFindUniqueByName name = + member x.TryFindUniqueByName name = match x.FindByName(name) with - | [| md |] -> Some md + | [| md |] -> Some md | [| |] -> None | _ -> failwithf "multiple methods exist with name %s" name @@ -2898,7 +2898,7 @@ module internal AssemblyReader = CustomAttrs: ILCustomAttrs Token: int } member x.IsStatic = (match x.CallingConv with ILThisConvention.Static -> true | _ -> false) - member x.IndexParameters = + member x.IndexParameters = x.IndexParameterTypes |> Array.mapi (fun i ty -> { Name = USome("arg"+string i) ParameterType = ty @@ -2969,13 +2969,13 @@ module internal AssemblyReader = and ILTypeDefLayoutInfo = { Size: int32 option - Pack: uint16 option } + Pack: uint16 option } type ILTypeDefAccess = | Public | Private | Nested of ILMemberAccess - static member OfFlags flags = + static member OfFlags flags = let f = (flags &&& 0x00000007) if f = 0x00000001 then ILTypeDefAccess.Public elif f = 0x00000002 then ILTypeDefAccess.Nested ILMemberAccess.Public @@ -3011,7 +3011,7 @@ module internal AssemblyReader = Properties: ILPropertyDefs CustomAttrs: ILCustomAttrs Token: int } - static member ComputeKind flags (super: ILType option) (nsp: string uoption) (nm: string) = + static member ComputeKind flags (super: ILType option) (nsp: string uoption) (nm: string) = if (flags &&& 0x00000020) <> 0x0 then ILTypeDefKind.Interface else let isEnum = (match super with None -> false | Some ty -> ty.TypeSpec.Namespace = USome "System" && ty.TypeSpec.Name = "Enum") let isDelegate = (match super with None -> false | Some ty -> ty.TypeSpec.Namespace = USome "System" && ty.TypeSpec.Name = "Delegate") @@ -3036,7 +3036,7 @@ module internal AssemblyReader = member x.Access = ILTypeDefAccess.OfFlags (int x.Attributes) member x.IsNested = - match x.Access with + match x.Access with | ILTypeDefAccess.Nested _ -> true | _ -> false @@ -3045,13 +3045,13 @@ module internal AssemblyReader = | ILTypeDefKind.ValueType | ILTypeDefKind.Enum -> true | _ -> false - member x.Encoding = + member x.Encoding = let f = (int x.Attributes &&& 0x00030000) if f = 0x00020000 then ILDefaultPInvokeEncoding.Auto elif f = 0x00010000 then ILDefaultPInvokeEncoding.Unicode else ILDefaultPInvokeEncoding.Ansi - member x.InitSemantics = + member x.InitSemantics = if x.Kind = ILTypeDefKind.Interface then ILTypeInit.OnAny elif (int x.Attributes &&& 0x00100000) <> 0x0 then ILTypeInit.BeforeField else ILTypeInit.OnAny @@ -3076,7 +3076,7 @@ module internal AssemblyReader = let tdefs = getmap() let key = (nsp, nm) match tdefs.TryGetValue key with - | true, tdefFal -> + | true, tdefFal -> Some (tdefFal.Force()) | false, _ -> None @@ -3098,10 +3098,10 @@ module internal AssemblyReader = { ScopeRef: ILScopeRef Namespace: string uoption Name: string - IsForwarder: bool - Access: ILTypeDefAccess; + IsForwarder: bool + Access: ILTypeDefAccess; Nested: ILNestedExportedTypesAndForwarders; - CustomAttrs: ILCustomAttrs } + CustomAttrs: ILCustomAttrs } override x.ToString() = "fwd " + x.Name and ILExportedTypesAndForwarders(larr:Lazy) = @@ -3154,10 +3154,10 @@ module internal AssemblyReader = member x.GetName() = let asmName = AssemblyName(Name=x.Name) - match x.PublicKey with + match x.PublicKey with | USome bytes -> asmName.SetPublicKey(bytes) | UNone -> () - match x.Version with + match x.Version with | USome v -> asmName.Version <- v | UNone -> () asmName.CultureName <- System.Globalization.CultureInfo.InvariantCulture.Name @@ -3176,7 +3176,7 @@ module internal AssemblyReader = SubSystemFlags: int32 IsDLL: bool IsILOnly: bool - Platform: ILPlatform option + Platform: ILPlatform option StackReserveSize: int32 option Is32Bit: bool Is32BitPreferred: bool @@ -3275,14 +3275,14 @@ module internal AssemblyReader = let GenericParamConstraint = ILTableName 44 let UserStrings = ILTableName 0x70 (* Special encoding of embedded UserString tokens - See 1.9 Partition III *) - /// Which tables are sorted and by which column. + /// Which tables are sorted and by which column. // - // Sorted bit-vector as stored by CLR V1: 00fa 0133 0002 0000 - // But what does this mean? The ECMA spec does not say! - // Metainfo -schema reports sorting as shown below. - // But some sorting, e.g. EventMap does not seem to show - let sortedTableInfo = - [ (InterfaceImpl, 0) + // Sorted bit-vector as stored by CLR V1: 00fa 0133 0002 0000 + // But what does this mean? The ECMA spec does not say! + // Metainfo -schema reports sorting as shown below. + // But some sorting, e.g. EventMap does not seem to show + let sortedTableInfo = + [ (InterfaceImpl, 0) (Constant, 1) (CustomAttribute, 0) (FieldMarshal, 0) @@ -3294,7 +3294,7 @@ module internal AssemblyReader = (ImplMap, 1) (FieldRVA, 1) (Nested, 0) - (GenericParam, 2) + (GenericParam, 2) (GenericParamConstraint, 0) ] [] @@ -3455,7 +3455,7 @@ module internal AssemblyReader = type VarArgMethodData = VarArgMethodData of ILType * ILCallingConv * string * ILTypes * ILVarArgs * ILType * ILTypes [] - module Constants = + module Constants = let et_END = 0x00uy let et_VOID = 0x01uy let et_BOOLEAN = 0x02uy @@ -3548,221 +3548,221 @@ module internal AssemblyReader = let idx = tok >>>& nbits TaggedIndex(f tag, idx) - let i_nop = 0x00 - let i_break = 0x01 - let i_ldarg_0 = 0x02 - let i_ldarg_1 = 0x03 - let i_ldarg_2 = 0x04 - let i_ldarg_3 = 0x05 - let i_ldloc_0 = 0x06 - let i_ldloc_1 = 0x07 - let i_ldloc_2 = 0x08 - let i_ldloc_3 = 0x09 - let i_stloc_0 = 0x0a - let i_stloc_1 = 0x0b - let i_stloc_2 = 0x0c - let i_stloc_3 = 0x0d - let i_ldarg_s = 0x0e - let i_ldarga_s = 0x0f - let i_starg_s = 0x10 - let i_ldloc_s = 0x11 - let i_ldloca_s = 0x12 - let i_stloc_s = 0x13 - let i_ldnull = 0x14 - let i_ldc_i4_m1 = 0x15 - let i_ldc_i4_0 = 0x16 - let i_ldc_i4_1 = 0x17 - let i_ldc_i4_2 = 0x18 - let i_ldc_i4_3 = 0x19 - let i_ldc_i4_4 = 0x1a - let i_ldc_i4_5 = 0x1b - let i_ldc_i4_6 = 0x1c - let i_ldc_i4_7 = 0x1d - let i_ldc_i4_8 = 0x1e - let i_ldc_i4_s = 0x1f - let i_ldc_i4 = 0x20 - let i_ldc_i8 = 0x21 - let i_ldc_r4 = 0x22 - let i_ldc_r8 = 0x23 - let i_dup = 0x25 - let i_pop = 0x26 - let i_jmp = 0x27 - let i_call = 0x28 - let i_calli = 0x29 - let i_ret = 0x2a - let i_br_s = 0x2b - let i_brfalse_s = 0x2c - let i_brtrue_s = 0x2d - let i_beq_s = 0x2e - let i_bge_s = 0x2f - let i_bgt_s = 0x30 - let i_ble_s = 0x31 - let i_blt_s = 0x32 - let i_bne_un_s = 0x33 - let i_bge_un_s = 0x34 - let i_bgt_un_s = 0x35 - let i_ble_un_s = 0x36 - let i_blt_un_s = 0x37 - let i_br = 0x38 - let i_brfalse = 0x39 - let i_brtrue = 0x3a - let i_beq = 0x3b - let i_bge = 0x3c - let i_bgt = 0x3d - let i_ble = 0x3e - let i_blt = 0x3f - let i_bne_un = 0x40 - let i_bge_un = 0x41 - let i_bgt_un = 0x42 - let i_ble_un = 0x43 - let i_blt_un = 0x44 - let i_switch = 0x45 - let i_ldind_i1 = 0x46 - let i_ldind_u1 = 0x47 - let i_ldind_i2 = 0x48 - let i_ldind_u2 = 0x49 - let i_ldind_i4 = 0x4a - let i_ldind_u4 = 0x4b - let i_ldind_i8 = 0x4c - let i_ldind_i = 0x4d - let i_ldind_r4 = 0x4e - let i_ldind_r8 = 0x4f - let i_ldind_ref = 0x50 - let i_stind_ref = 0x51 - let i_stind_i1 = 0x52 - let i_stind_i2 = 0x53 - let i_stind_i4 = 0x54 - let i_stind_i8 = 0x55 - let i_stind_r4 = 0x56 - let i_stind_r8 = 0x57 - let i_add = 0x58 - let i_sub = 0x59 - let i_mul = 0x5a - let i_div = 0x5b - let i_div_un = 0x5c - let i_rem = 0x5d - let i_rem_un = 0x5e - let i_and = 0x5f - let i_or = 0x60 - let i_xor = 0x61 - let i_shl = 0x62 - let i_shr = 0x63 - let i_shr_un = 0x64 - let i_neg = 0x65 - let i_not = 0x66 - let i_conv_i1 = 0x67 - let i_conv_i2 = 0x68 - let i_conv_i4 = 0x69 - let i_conv_i8 = 0x6a - let i_conv_r4 = 0x6b - let i_conv_r8 = 0x6c - let i_conv_u4 = 0x6d - let i_conv_u8 = 0x6e - let i_callvirt = 0x6f - let i_cpobj = 0x70 - let i_ldobj = 0x71 - let i_ldstr = 0x72 - let i_newobj = 0x73 - let i_castclass = 0x74 - let i_isinst = 0x75 - let i_conv_r_un = 0x76 - let i_unbox = 0x79 - let i_throw = 0x7a - let i_ldfld = 0x7b - let i_ldflda = 0x7c - let i_stfld = 0x7d - let i_ldsfld = 0x7e - let i_ldsflda = 0x7f - let i_stsfld = 0x80 - let i_stobj = 0x81 - let i_conv_ovf_i1_un= 0x82 - let i_conv_ovf_i2_un= 0x83 - let i_conv_ovf_i4_un= 0x84 - let i_conv_ovf_i8_un= 0x85 - let i_conv_ovf_u1_un= 0x86 - let i_conv_ovf_u2_un= 0x87 - let i_conv_ovf_u4_un= 0x88 - let i_conv_ovf_u8_un= 0x89 - let i_conv_ovf_i_un = 0x8a - let i_conv_ovf_u_un = 0x8b - let i_box = 0x8c - let i_newarr = 0x8d - let i_ldlen = 0x8e - let i_ldelema = 0x8f - let i_ldelem_i1 = 0x90 - let i_ldelem_u1 = 0x91 - let i_ldelem_i2 = 0x92 - let i_ldelem_u2 = 0x93 - let i_ldelem_i4 = 0x94 - let i_ldelem_u4 = 0x95 - let i_ldelem_i8 = 0x96 - let i_ldelem_i = 0x97 - let i_ldelem_r4 = 0x98 - let i_ldelem_r8 = 0x99 - let i_ldelem_ref = 0x9a - let i_stelem_i = 0x9b - let i_stelem_i1 = 0x9c - let i_stelem_i2 = 0x9d - let i_stelem_i4 = 0x9e - let i_stelem_i8 = 0x9f - let i_stelem_r4 = 0xa0 - let i_stelem_r8 = 0xa1 - let i_stelem_ref = 0xa2 - let i_conv_ovf_i1 = 0xb3 - let i_conv_ovf_u1 = 0xb4 - let i_conv_ovf_i2 = 0xb5 - let i_conv_ovf_u2 = 0xb6 - let i_conv_ovf_i4 = 0xb7 - let i_conv_ovf_u4 = 0xb8 - let i_conv_ovf_i8 = 0xb9 - let i_conv_ovf_u8 = 0xba - let i_refanyval = 0xc2 - let i_ckfinite = 0xc3 - let i_mkrefany = 0xc6 - let i_ldtoken = 0xd0 - let i_conv_u2 = 0xd1 - let i_conv_u1 = 0xd2 - let i_conv_i = 0xd3 - let i_conv_ovf_i = 0xd4 - let i_conv_ovf_u = 0xd5 - let i_add_ovf = 0xd6 - let i_add_ovf_un = 0xd7 - let i_mul_ovf = 0xd8 - let i_mul_ovf_un = 0xd9 - let i_sub_ovf = 0xda - let i_sub_ovf_un = 0xdb - let i_endfinally = 0xdc - let i_leave = 0xdd - let i_leave_s = 0xde - let i_stind_i = 0xdf - let i_conv_u = 0xe0 + let i_nop = 0x00 + let i_break = 0x01 + let i_ldarg_0 = 0x02 + let i_ldarg_1 = 0x03 + let i_ldarg_2 = 0x04 + let i_ldarg_3 = 0x05 + let i_ldloc_0 = 0x06 + let i_ldloc_1 = 0x07 + let i_ldloc_2 = 0x08 + let i_ldloc_3 = 0x09 + let i_stloc_0 = 0x0a + let i_stloc_1 = 0x0b + let i_stloc_2 = 0x0c + let i_stloc_3 = 0x0d + let i_ldarg_s = 0x0e + let i_ldarga_s = 0x0f + let i_starg_s = 0x10 + let i_ldloc_s = 0x11 + let i_ldloca_s = 0x12 + let i_stloc_s = 0x13 + let i_ldnull = 0x14 + let i_ldc_i4_m1 = 0x15 + let i_ldc_i4_0 = 0x16 + let i_ldc_i4_1 = 0x17 + let i_ldc_i4_2 = 0x18 + let i_ldc_i4_3 = 0x19 + let i_ldc_i4_4 = 0x1a + let i_ldc_i4_5 = 0x1b + let i_ldc_i4_6 = 0x1c + let i_ldc_i4_7 = 0x1d + let i_ldc_i4_8 = 0x1e + let i_ldc_i4_s = 0x1f + let i_ldc_i4 = 0x20 + let i_ldc_i8 = 0x21 + let i_ldc_r4 = 0x22 + let i_ldc_r8 = 0x23 + let i_dup = 0x25 + let i_pop = 0x26 + let i_jmp = 0x27 + let i_call = 0x28 + let i_calli = 0x29 + let i_ret = 0x2a + let i_br_s = 0x2b + let i_brfalse_s = 0x2c + let i_brtrue_s = 0x2d + let i_beq_s = 0x2e + let i_bge_s = 0x2f + let i_bgt_s = 0x30 + let i_ble_s = 0x31 + let i_blt_s = 0x32 + let i_bne_un_s = 0x33 + let i_bge_un_s = 0x34 + let i_bgt_un_s = 0x35 + let i_ble_un_s = 0x36 + let i_blt_un_s = 0x37 + let i_br = 0x38 + let i_brfalse = 0x39 + let i_brtrue = 0x3a + let i_beq = 0x3b + let i_bge = 0x3c + let i_bgt = 0x3d + let i_ble = 0x3e + let i_blt = 0x3f + let i_bne_un = 0x40 + let i_bge_un = 0x41 + let i_bgt_un = 0x42 + let i_ble_un = 0x43 + let i_blt_un = 0x44 + let i_switch = 0x45 + let i_ldind_i1 = 0x46 + let i_ldind_u1 = 0x47 + let i_ldind_i2 = 0x48 + let i_ldind_u2 = 0x49 + let i_ldind_i4 = 0x4a + let i_ldind_u4 = 0x4b + let i_ldind_i8 = 0x4c + let i_ldind_i = 0x4d + let i_ldind_r4 = 0x4e + let i_ldind_r8 = 0x4f + let i_ldind_ref = 0x50 + let i_stind_ref = 0x51 + let i_stind_i1 = 0x52 + let i_stind_i2 = 0x53 + let i_stind_i4 = 0x54 + let i_stind_i8 = 0x55 + let i_stind_r4 = 0x56 + let i_stind_r8 = 0x57 + let i_add = 0x58 + let i_sub = 0x59 + let i_mul = 0x5a + let i_div = 0x5b + let i_div_un = 0x5c + let i_rem = 0x5d + let i_rem_un = 0x5e + let i_and = 0x5f + let i_or = 0x60 + let i_xor = 0x61 + let i_shl = 0x62 + let i_shr = 0x63 + let i_shr_un = 0x64 + let i_neg = 0x65 + let i_not = 0x66 + let i_conv_i1 = 0x67 + let i_conv_i2 = 0x68 + let i_conv_i4 = 0x69 + let i_conv_i8 = 0x6a + let i_conv_r4 = 0x6b + let i_conv_r8 = 0x6c + let i_conv_u4 = 0x6d + let i_conv_u8 = 0x6e + let i_callvirt = 0x6f + let i_cpobj = 0x70 + let i_ldobj = 0x71 + let i_ldstr = 0x72 + let i_newobj = 0x73 + let i_castclass = 0x74 + let i_isinst = 0x75 + let i_conv_r_un = 0x76 + let i_unbox = 0x79 + let i_throw = 0x7a + let i_ldfld = 0x7b + let i_ldflda = 0x7c + let i_stfld = 0x7d + let i_ldsfld = 0x7e + let i_ldsflda = 0x7f + let i_stsfld = 0x80 + let i_stobj = 0x81 + let i_conv_ovf_i1_un= 0x82 + let i_conv_ovf_i2_un= 0x83 + let i_conv_ovf_i4_un= 0x84 + let i_conv_ovf_i8_un= 0x85 + let i_conv_ovf_u1_un= 0x86 + let i_conv_ovf_u2_un= 0x87 + let i_conv_ovf_u4_un= 0x88 + let i_conv_ovf_u8_un= 0x89 + let i_conv_ovf_i_un = 0x8a + let i_conv_ovf_u_un = 0x8b + let i_box = 0x8c + let i_newarr = 0x8d + let i_ldlen = 0x8e + let i_ldelema = 0x8f + let i_ldelem_i1 = 0x90 + let i_ldelem_u1 = 0x91 + let i_ldelem_i2 = 0x92 + let i_ldelem_u2 = 0x93 + let i_ldelem_i4 = 0x94 + let i_ldelem_u4 = 0x95 + let i_ldelem_i8 = 0x96 + let i_ldelem_i = 0x97 + let i_ldelem_r4 = 0x98 + let i_ldelem_r8 = 0x99 + let i_ldelem_ref = 0x9a + let i_stelem_i = 0x9b + let i_stelem_i1 = 0x9c + let i_stelem_i2 = 0x9d + let i_stelem_i4 = 0x9e + let i_stelem_i8 = 0x9f + let i_stelem_r4 = 0xa0 + let i_stelem_r8 = 0xa1 + let i_stelem_ref = 0xa2 + let i_conv_ovf_i1 = 0xb3 + let i_conv_ovf_u1 = 0xb4 + let i_conv_ovf_i2 = 0xb5 + let i_conv_ovf_u2 = 0xb6 + let i_conv_ovf_i4 = 0xb7 + let i_conv_ovf_u4 = 0xb8 + let i_conv_ovf_i8 = 0xb9 + let i_conv_ovf_u8 = 0xba + let i_refanyval = 0xc2 + let i_ckfinite = 0xc3 + let i_mkrefany = 0xc6 + let i_ldtoken = 0xd0 + let i_conv_u2 = 0xd1 + let i_conv_u1 = 0xd2 + let i_conv_i = 0xd3 + let i_conv_ovf_i = 0xd4 + let i_conv_ovf_u = 0xd5 + let i_add_ovf = 0xd6 + let i_add_ovf_un = 0xd7 + let i_mul_ovf = 0xd8 + let i_mul_ovf_un = 0xd9 + let i_sub_ovf = 0xda + let i_sub_ovf_un = 0xdb + let i_endfinally = 0xdc + let i_leave = 0xdd + let i_leave_s = 0xde + let i_stind_i = 0xdf + let i_conv_u = 0xe0 let i_arglist = 0xfe00 let i_ceq = 0xfe01 let i_cgt = 0xfe02 let i_cgt_un = 0xfe03 let i_clt = 0xfe04 let i_clt_un = 0xfe05 - let i_ldftn = 0xfe06 - let i_ldvirtftn = 0xfe07 - let i_ldarg = 0xfe09 - let i_ldarga = 0xfe0a - let i_starg = 0xfe0b - let i_ldloc = 0xfe0c - let i_ldloca = 0xfe0d - let i_stloc = 0xfe0e - let i_localloc = 0xfe0f - let i_endfilter = 0xfe11 - let i_unaligned = 0xfe12 - let i_volatile = 0xfe13 + let i_ldftn = 0xfe06 + let i_ldvirtftn = 0xfe07 + let i_ldarg = 0xfe09 + let i_ldarga = 0xfe0a + let i_starg = 0xfe0b + let i_ldloc = 0xfe0c + let i_ldloca = 0xfe0d + let i_stloc = 0xfe0e + let i_localloc = 0xfe0f + let i_endfilter = 0xfe11 + let i_unaligned = 0xfe12 + let i_volatile = 0xfe13 let i_constrained = 0xfe16 let i_readonly = 0xfe1e - let i_tail = 0xfe14 - let i_initobj = 0xfe15 - let i_cpblk = 0xfe17 - let i_initblk = 0xfe18 - let i_rethrow = 0xfe1a - let i_sizeof = 0xfe1c - let i_refanytype = 0xfe1d + let i_tail = 0xfe14 + let i_initobj = 0xfe15 + let i_cpblk = 0xfe17 + let i_initblk = 0xfe18 + let i_rethrow = 0xfe1a + let i_sizeof = 0xfe1c + let i_refanytype = 0xfe1d let i_ldelem_any = 0xa3 let i_stelem_any = 0xa4 @@ -3775,7 +3775,7 @@ module internal AssemblyReader = Array.init n (fun i -> ILType.Var (numtypars + i)) - let noArgInstrs = + let noArgInstrs = lazy [ i_ldc_i4_0, mk_ldc 0 i_ldc_i4_1, mk_ldc 1 i_ldc_i4_2, mk_ldc 2 @@ -3811,63 +3811,63 @@ module internal AssemblyReader = 0xfe04, I_clt 0xfe05, I_clt_un 0x67, I_conv DT_I1 - 0x68, I_conv DT_I2 + 0x68, I_conv DT_I2 0x69, I_conv DT_I4 - 0x6a, I_conv DT_I8 - 0xd3, I_conv DT_I - 0x6b, I_conv DT_R4 - 0x6c, I_conv DT_R8 - 0xd2, I_conv DT_U1 - 0xd1, I_conv DT_U2 - 0x6d, I_conv DT_U4 - 0x6e, I_conv DT_U8 - 0xe0, I_conv DT_U - 0x76, I_conv DT_R - 0xb3, I_conv_ovf DT_I1 - 0xb5, I_conv_ovf DT_I2 - 0xb7, I_conv_ovf DT_I4 - 0xb9, I_conv_ovf DT_I8 - 0xd4, I_conv_ovf DT_I - 0xb4, I_conv_ovf DT_U1 - 0xb6, I_conv_ovf DT_U2 - 0xb8, I_conv_ovf DT_U4 - 0xba, I_conv_ovf DT_U8 - 0xd5, I_conv_ovf DT_U - 0x82, I_conv_ovf_un DT_I1 - 0x83, I_conv_ovf_un DT_I2 - 0x84, I_conv_ovf_un DT_I4 - 0x85, I_conv_ovf_un DT_I8 - 0x8a, I_conv_ovf_un DT_I - 0x86, I_conv_ovf_un DT_U1 - 0x87, I_conv_ovf_un DT_U2 - 0x88, I_conv_ovf_un DT_U4 - 0x89, I_conv_ovf_un DT_U8 - 0x8b, I_conv_ovf_un DT_U - 0x9c, I_stelem DT_I1 + 0x6a, I_conv DT_I8 + 0xd3, I_conv DT_I + 0x6b, I_conv DT_R4 + 0x6c, I_conv DT_R8 + 0xd2, I_conv DT_U1 + 0xd1, I_conv DT_U2 + 0x6d, I_conv DT_U4 + 0x6e, I_conv DT_U8 + 0xe0, I_conv DT_U + 0x76, I_conv DT_R + 0xb3, I_conv_ovf DT_I1 + 0xb5, I_conv_ovf DT_I2 + 0xb7, I_conv_ovf DT_I4 + 0xb9, I_conv_ovf DT_I8 + 0xd4, I_conv_ovf DT_I + 0xb4, I_conv_ovf DT_U1 + 0xb6, I_conv_ovf DT_U2 + 0xb8, I_conv_ovf DT_U4 + 0xba, I_conv_ovf DT_U8 + 0xd5, I_conv_ovf DT_U + 0x82, I_conv_ovf_un DT_I1 + 0x83, I_conv_ovf_un DT_I2 + 0x84, I_conv_ovf_un DT_I4 + 0x85, I_conv_ovf_un DT_I8 + 0x8a, I_conv_ovf_un DT_I + 0x86, I_conv_ovf_un DT_U1 + 0x87, I_conv_ovf_un DT_U2 + 0x88, I_conv_ovf_un DT_U4 + 0x89, I_conv_ovf_un DT_U8 + 0x8b, I_conv_ovf_un DT_U + 0x9c, I_stelem DT_I1 0x9d, I_stelem DT_I2 - 0x9e, I_stelem DT_I4 - 0x9f, I_stelem DT_I8 - 0xa0, I_stelem DT_R4 - 0xa1, I_stelem DT_R8 - 0x9b, I_stelem DT_I - 0xa2, I_stelem DT_REF + 0x9e, I_stelem DT_I4 + 0x9f, I_stelem DT_I8 + 0xa0, I_stelem DT_R4 + 0xa1, I_stelem DT_R8 + 0x9b, I_stelem DT_I + 0xa2, I_stelem DT_REF 0x90, I_ldelem DT_I1 - 0x92, I_ldelem DT_I2 - 0x94, I_ldelem DT_I4 - 0x96, I_ldelem DT_I8 - 0x91, I_ldelem DT_U1 - 0x93, I_ldelem DT_U2 - 0x95, I_ldelem DT_U4 - 0x98, I_ldelem DT_R4 - 0x99, I_ldelem DT_R8 - 0x97, I_ldelem DT_I - 0x9a, I_ldelem DT_REF + 0x92, I_ldelem DT_I2 + 0x94, I_ldelem DT_I4 + 0x96, I_ldelem DT_I8 + 0x91, I_ldelem DT_U1 + 0x93, I_ldelem DT_U2 + 0x95, I_ldelem DT_U4 + 0x98, I_ldelem DT_R4 + 0x99, I_ldelem DT_R8 + 0x97, I_ldelem DT_I + 0x9a, I_ldelem DT_REF 0x5a, I_mul 0xd8, I_mul_ovf 0xd9, I_mul_ovf_un 0x5d, I_rem 0x5e, I_rem_un - 0x62, I_shl + 0x62, I_shl 0x63, I_shr 0x64, I_shr_un 0x59, I_sub @@ -3892,91 +3892,91 @@ module internal AssemblyReader = i_ldlen, I_ldlen i_rethrow, I_rethrow ] - let isNoArgInstr i = - match i with + let isNoArgInstr i = + match i with | I_ldc (DT_I4, ILConst.I4 n) when -1 <= n && n <= 8 -> true | I_stloc n | I_ldloc n | I_ldarg n when n <= 3 -> true | I_ret | I_add | I_add_ovf | I_add_ovf_un - | I_and - | I_div + | I_and + | I_div | I_div_un - | I_ceq - | I_cgt + | I_ceq + | I_cgt | I_cgt_un | I_clt | I_clt_un - | I_conv DT_I1 - | I_conv DT_I2 - | I_conv DT_I4 - | I_conv DT_I8 - | I_conv DT_I - | I_conv DT_R4 - | I_conv DT_R8 - | I_conv DT_U1 - | I_conv DT_U2 - | I_conv DT_U4 - | I_conv DT_U8 - | I_conv DT_U - | I_conv DT_R - | I_conv_ovf DT_I1 - | I_conv_ovf DT_I2 - | I_conv_ovf DT_I4 - | I_conv_ovf DT_I8 - | I_conv_ovf DT_I - | I_conv_ovf DT_U1 - | I_conv_ovf DT_U2 - | I_conv_ovf DT_U4 - | I_conv_ovf DT_U8 - | I_conv_ovf DT_U - | I_conv_ovf_un DT_I1 - | I_conv_ovf_un DT_I2 - | I_conv_ovf_un DT_I4 - | I_conv_ovf_un DT_I8 - | I_conv_ovf_un DT_I - | I_conv_ovf_un DT_U1 - | I_conv_ovf_un DT_U2 - | I_conv_ovf_un DT_U4 - | I_conv_ovf_un DT_U8 - | I_conv_ovf_un DT_U - | I_stelem DT_I1 - | I_stelem DT_I2 - | I_stelem DT_I4 - | I_stelem DT_I8 - | I_stelem DT_R4 - | I_stelem DT_R8 - | I_stelem DT_I - | I_stelem DT_REF - | I_ldelem DT_I1 - | I_ldelem DT_I2 - | I_ldelem DT_I4 - | I_ldelem DT_I8 - | I_ldelem DT_U1 - | I_ldelem DT_U2 - | I_ldelem DT_U4 - | I_ldelem DT_R4 - | I_ldelem DT_R8 - | I_ldelem DT_I - | I_ldelem DT_REF - | I_mul + | I_conv DT_I1 + | I_conv DT_I2 + | I_conv DT_I4 + | I_conv DT_I8 + | I_conv DT_I + | I_conv DT_R4 + | I_conv DT_R8 + | I_conv DT_U1 + | I_conv DT_U2 + | I_conv DT_U4 + | I_conv DT_U8 + | I_conv DT_U + | I_conv DT_R + | I_conv_ovf DT_I1 + | I_conv_ovf DT_I2 + | I_conv_ovf DT_I4 + | I_conv_ovf DT_I8 + | I_conv_ovf DT_I + | I_conv_ovf DT_U1 + | I_conv_ovf DT_U2 + | I_conv_ovf DT_U4 + | I_conv_ovf DT_U8 + | I_conv_ovf DT_U + | I_conv_ovf_un DT_I1 + | I_conv_ovf_un DT_I2 + | I_conv_ovf_un DT_I4 + | I_conv_ovf_un DT_I8 + | I_conv_ovf_un DT_I + | I_conv_ovf_un DT_U1 + | I_conv_ovf_un DT_U2 + | I_conv_ovf_un DT_U4 + | I_conv_ovf_un DT_U8 + | I_conv_ovf_un DT_U + | I_stelem DT_I1 + | I_stelem DT_I2 + | I_stelem DT_I4 + | I_stelem DT_I8 + | I_stelem DT_R4 + | I_stelem DT_R8 + | I_stelem DT_I + | I_stelem DT_REF + | I_ldelem DT_I1 + | I_ldelem DT_I2 + | I_ldelem DT_I4 + | I_ldelem DT_I8 + | I_ldelem DT_U1 + | I_ldelem DT_U2 + | I_ldelem DT_U4 + | I_ldelem DT_R4 + | I_ldelem DT_R8 + | I_ldelem DT_I + | I_ldelem DT_REF + | I_mul | I_mul_ovf | I_mul_ovf_un - | I_rem - | I_rem_un - | I_shl - | I_shr + | I_rem + | I_rem_un + | I_shl + | I_shr | I_shr_un - | I_sub + | I_sub | I_sub_ovf - | I_sub_ovf_un - | I_xor - | I_or - | I_neg - | I_not - | I_ldnull - | I_dup + | I_sub_ovf_un + | I_xor + | I_or + | I_neg + | I_not + | I_ldnull + | I_dup | I_pop | I_ckfinite | I_nop @@ -3991,7 +3991,7 @@ module internal AssemblyReader = | I_rethrow -> true | _ -> false - let ILCmpInstrMap = + let ILCmpInstrMap = lazy ( let dict = Dictionary 12 dict.Add (I_beq , i_beq ) @@ -4009,7 +4009,7 @@ module internal AssemblyReader = dict ) - let ILCmpInstrRevMap = + let ILCmpInstrRevMap = lazy ( let dict = Dictionary 12 dict.Add ( I_beq , i_beq_s ) @@ -4027,7 +4027,7 @@ module internal AssemblyReader = dict ) - // From corhdr.h + // From corhdr.h let nt_VOID = 0x1uy let nt_BOOLEAN = 0x2uy @@ -4121,7 +4121,7 @@ module internal AssemblyReader = let vt_ARRAY = 0x2000 let vt_BYREF = 0x4000 - + let e_CorILMethod_TinyFormat = 0x02uy let e_CorILMethod_FatFormat = 0x03uy @@ -4140,136 +4140,136 @@ module internal AssemblyReader = let e_COR_ILEXCEPTION_CLAUSE_FAULT = 0x4 - module Bytes = + module Bytes = let dWw1 n = int32 ((n >>> 32) &&& 0xFFFFFFFFL) let dWw0 n = int32 (n &&& 0xFFFFFFFFL) - let get (b:byte[]) n = int32 (Array.get b n) - let zeroCreate n: byte[] = Array.zeroCreate n + let get (b:byte[]) n = int32 (Array.get b n) + let zeroCreate n: byte[] = Array.zeroCreate n - let sub ( b:byte[]) s l = Array.sub b s l - let blit (a:byte[]) b c d e = Array.blit a b c d e + let sub ( b:byte[]) s l = Array.sub b s l + let blit (a:byte[]) b c d e = Array.blit a b c d e - let ofInt32Array (arr:int[]) = Array.init arr.Length (fun i -> byte arr[i]) + let ofInt32Array (arr:int[]) = Array.init arr.Length (fun i -> byte arr[i]) - let stringAsUtf8NullTerminated (s:string) = - Array.append (Encoding.UTF8.GetBytes s) (ofInt32Array [| 0x0 |]) + let stringAsUtf8NullTerminated (s:string) = + Array.append (Encoding.UTF8.GetBytes s) (ofInt32Array [| 0x0 |]) - let stringAsUnicodeNullTerminated (s:string) = - Array.append (Encoding.Unicode.GetBytes s) (ofInt32Array [| 0x0;0x0 |]) + let stringAsUnicodeNullTerminated (s:string) = + Array.append (Encoding.Unicode.GetBytes s) (ofInt32Array [| 0x0;0x0 |]) - type ByteStream = - { bytes: byte[] - mutable pos: int + type ByteStream = + { bytes: byte[] + mutable pos: int max: int } - member b.ReadByte() = + member b.ReadByte() = if b.pos >= b.max then failwith "end of stream" let res = b.bytes[b.pos] b.pos <- b.pos + 1 - res - member b.ReadUtf8String n = - let res = Encoding.UTF8.GetString(b.bytes, b.pos, n) - b.pos <- b.pos + n; res - - static member FromBytes (b:byte[], n, len) = + res + member b.ReadUtf8String n = + let res = Encoding.UTF8.GetString(b.bytes, b.pos, n) + b.pos <- b.pos + n; res + + static member FromBytes (b:byte[], n, len) = if n < 0 || (n+len) > b.Length then failwith "FromBytes" { bytes = b; pos = n; max = n+len } - member b.ReadBytes n = + member b.ReadBytes n = if b.pos + n > b.max then failwith "ReadBytes: end of stream" let res = Bytes.sub b.bytes b.pos n b.pos <- b.pos + n - res + res - member b.Position = b.pos + member b.Position = b.pos - type ByteBuffer = - { mutable bbArray: byte[] + type ByteBuffer = + { mutable bbArray: byte[] mutable bbCurrent: int } - member buf.Ensure newSize = - let oldBufSize = buf.bbArray.Length - if newSize > oldBufSize then - let old = buf.bbArray + member buf.Ensure newSize = + let oldBufSize = buf.bbArray.Length + if newSize > oldBufSize then + let old = buf.bbArray buf.bbArray <- Bytes.zeroCreate (max newSize (oldBufSize * 2)) Bytes.blit old 0 buf.bbArray 0 buf.bbCurrent member buf.Close () = Bytes.sub buf.bbArray 0 buf.bbCurrent - member buf.EmitIntAsByte (i:int) = - let newSize = buf.bbCurrent + 1 + member buf.EmitIntAsByte (i:int) = + let newSize = buf.bbCurrent + 1 buf.Ensure newSize buf.bbArray[buf.bbCurrent] <- byte i - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize member buf.EmitByte (b:byte) = buf.EmitIntAsByte (int b) - member buf.EmitIntsAsBytes (arr:int[]) = + member buf.EmitIntsAsBytes (arr:int[]) = let n = arr.Length - let newSize = buf.bbCurrent + n + let newSize = buf.bbCurrent + n buf.Ensure newSize let bbarr = buf.bbArray let bbbase = buf.bbCurrent - for i = 0 to n - 1 do - bbarr[bbbase + i] <- byte arr[i] - buf.bbCurrent <- newSize + for i = 0 to n - 1 do + bbarr[bbbase + i] <- byte arr[i] + buf.bbCurrent <- newSize - member bb.FixupInt32 pos n = + member bb.FixupInt32 pos n = bb.bbArray[pos] <- (b0 n |> byte) bb.bbArray[pos + 1] <- (b1 n |> byte) bb.bbArray[pos + 2] <- (b2 n |> byte) bb.bbArray[pos + 3] <- (b3 n |> byte) - member buf.EmitInt32 n = - let newSize = buf.bbCurrent + 4 + member buf.EmitInt32 n = + let newSize = buf.bbCurrent + 4 buf.Ensure newSize buf.FixupInt32 buf.bbCurrent n - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize - member buf.EmitBytes (i:byte[]) = - let n = i.Length - let newSize = buf.bbCurrent + n + member buf.EmitBytes (i:byte[]) = + let n = i.Length + let newSize = buf.bbCurrent + n buf.Ensure newSize Bytes.blit i 0 buf.bbArray buf.bbCurrent n - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize - member buf.EmitInt32AsUInt16 n = - let newSize = buf.bbCurrent + 2 + member buf.EmitInt32AsUInt16 n = + let newSize = buf.bbCurrent + 2 buf.Ensure newSize buf.bbArray[buf.bbCurrent] <- (b0 n |> byte) buf.bbArray[buf.bbCurrent + 1] <- (b1 n |> byte) - buf.bbCurrent <- newSize - + buf.bbCurrent <- newSize + member buf.EmitBoolAsByte (b:bool) = buf.EmitIntAsByte (if b then 1 else 0) member buf.EmitUInt16 (x:uint16) = buf.EmitInt32AsUInt16 (int32 x) - member buf.EmitInt64 x = + member buf.EmitInt64 x = buf.EmitInt32 (Bytes.dWw0 x) buf.EmitInt32 (Bytes.dWw1 x) member buf.Position = buf.bbCurrent - static member Create sz = - { bbArray=Bytes.zeroCreate sz + static member Create sz = + { bbArray=Bytes.zeroCreate sz bbCurrent = 0 } - /// Z32 = compressed unsigned integer - static member Z32Size n = + /// Z32 = compressed unsigned integer + static member Z32Size n = if n <= 0x7F then 1 elif n <= 0x3FFF then 2 else 4 /// Emit int32 as compressed unsigned integer - member buf.EmitZ32 n = - if n >= 0 && n <= 0x7F then - buf.EmitIntAsByte n - elif n >= 0x80 && n <= 0x3FFF then + member buf.EmitZ32 n = + if n >= 0 && n <= 0x7F then + buf.EmitIntAsByte n + elif n >= 0x80 && n <= 0x3FFF then buf.EmitIntAsByte (0x80 ||| (n >>> 8)) - buf.EmitIntAsByte (n &&& 0xFF) - else + buf.EmitIntAsByte (n &&& 0xFF) + else buf.EmitIntAsByte (0xc0l ||| ((n >>> 24) &&& 0xFF)) buf.EmitIntAsByte ( (n >>> 16) &&& 0xFF) buf.EmitIntAsByte ( (n >>> 8) &&& 0xFF) @@ -4277,12 +4277,12 @@ module internal AssemblyReader = static member Z32 n = let bb = ByteBuffer.Create (ByteBuffer.Z32Size n) in bb.EmitZ32 n; bb.Close() - member buf.EmitPadding n = + member buf.EmitPadding n = for i = 0 to n-1 do buf.EmitByte 0x0uy // Emit compressed untagged integer - member buf.EmitZUntaggedIndex big idx = + member buf.EmitZUntaggedIndex big idx = if big then buf.EmitInt32 idx elif idx > 0xffff then failwith "EmitZUntaggedIndex: too big for small address or simple index" else buf.EmitInt32AsUInt16 idx @@ -4798,7 +4798,7 @@ module internal AssemblyReader = member __.MetadataPhysLoc = metadataPhysLoc member __.MetadataSize = metadataSize member __.ResourcePhysLoc offset = resourcePhysLoc offset - + type ILModuleReader(fileName: string, is: ByteFile, ilg: ILGlobals, lowMem: bool) = let metadataPhysLoc = 0 @@ -5213,26 +5213,26 @@ module internal AssemblyReader = let valIdx = seekReadBlobIdx &addr (parentIdx, typeIdx, valIdx) - //let seekReadFieldMarshalRow idx = + //let seekReadFieldMarshalRow idx = // let mutable addr = rowAddr TableNames.FieldMarshal idx // let parentIdx = seekReadHasFieldMarshalIdx &addr // let typeIdx = seekReadBlobIdx &addr // (parentIdx, typeIdx) - /// Read Table ClassLayout. + /// Read Table ClassLayout. let seekReadClassLayoutRow idx = let mutable addr = rowAddr ILTableNames.ClassLayout idx let pack = seekReadUInt16Adv &addr let size = seekReadInt32Adv &addr let tidx = seekReadUntaggedIdx ILTableNames.TypeDef &addr - (pack, size, tidx) + (pack, size, tidx) - /// Read Table FieldLayout. + /// Read Table FieldLayout. let seekReadFieldLayoutRow idx = let mutable addr = rowAddr ILTableNames.FieldLayout idx let offset = seekReadInt32Adv &addr let fidx = seekReadUntaggedIdx ILTableNames.Field &addr - (offset, fidx) + (offset, fidx) /// Read Table EventMap let seekReadEventMapRow idx = @@ -5277,7 +5277,7 @@ module internal AssemblyReader = let tidx = seekReadUntaggedIdx ILTableNames.TypeDef &addr let mbodyIdx = seekReadMethodDefOrRefIdx &addr let mdeclIdx = seekReadMethodDefOrRefIdx &addr - (tidx, mbodyIdx, mdeclIdx) + (tidx, mbodyIdx, mdeclIdx) /// Read Table ILModuleRef let seekReadModuleRefRow idx = @@ -5453,7 +5453,7 @@ module internal AssemblyReader = Retargetable = 0 <> (flags &&& 0x100); DisableJitOptimizations = 0 <> (flags &&& 0x4000); JitTracking = 0 <> (flags &&& 0x8000) - IgnoreSymbolStoreSequencePoints = 0 <> (flags &&& 0x2000) + IgnoreSymbolStoreSequencePoints = 0 <> (flags &&& 0x2000) } and seekReadAssemblyRef idx = cacheAssemblyRef seekReadAssemblyRefUncached idx @@ -5466,11 +5466,11 @@ module internal AssemblyReader = | USome blob -> USome (if (flags &&& 0x0001) <> 0x0 then PublicKey blob else PublicKeyToken blob) ILAssemblyRef - (name=nm, - hash=readBlobHeapOption hashValueIdx, - publicKey=publicKey, - retargetable=((flags &&& 0x0100) <> 0x0), - version=USome(Version(int v1, int v2, int v3, int v4)), + (name=nm, + hash=readBlobHeapOption hashValueIdx, + publicKey=publicKey, + retargetable=((flags &&& 0x0100) <> 0x0), + version=USome(Version(int v1, int v2, int v3, int v4)), locale=readStringHeapOption localeIdx;) and seekReadModuleRef idx = @@ -5479,8 +5479,8 @@ module internal AssemblyReader = and seekReadFile idx = let (flags, nameIdx, hashValueIdx) = seekReadFileRow idx - ILModuleRef(name = readStringHeap nameIdx, - hasMetadata= ((flags &&& 0x0001) = 0x0), + ILModuleRef(name = readStringHeap nameIdx, + hasMetadata= ((flags &&& 0x0001) = 0x0), hash= readBlobHeapOption hashValueIdx) and seekReadClassLayout idx = @@ -5510,7 +5510,7 @@ module internal AssemblyReader = and seekReadTypeDefRowExtents _info (idx:int) = if idx >= getNumRows ILTableNames.TypeDef then - getNumRows ILTableNames.Field + 1, + getNumRows ILTableNames.Field + 1, getNumRows ILTableNames.Method + 1 else let (_, _, _, _, fieldsIdx, methodsIdx) = seekReadTypeDefRow (idx + 1) @@ -5589,10 +5589,10 @@ module internal AssemblyReader = and seekReadGenericParams numtypars (a, b): ILGenericParameterDefs = let pars = seekReadIndexedRows - (getNumRows ILTableNames.GenericParam, seekReadGenericParamRow, - (fun (_, _, _, tomd, _) -> tomd), - tomdCompare (TaggedIndex(a, b)), - isSorted ILTableNames.GenericParam, + (getNumRows ILTableNames.GenericParam, seekReadGenericParamRow, + (fun (_, _, _, tomd, _) -> tomd), + tomdCompare (TaggedIndex(a, b)), + isSorted ILTableNames.GenericParam, (fun (gpidx, seq, flags, _, nameIdx) -> let constraints = seekReadGenericParamConstraintsUncached numtypars gpidx let cas = seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.GenericParam, gpidx)) @@ -5605,11 +5605,11 @@ module internal AssemblyReader = and seekReadGenericParamConstraintsUncached numtypars gpidx = seekReadIndexedRows - (getNumRows ILTableNames.GenericParamConstraint, - seekReadGenericParamConstraintRow, - fst, - simpleIndexCompare gpidx, - isSorted ILTableNames.GenericParamConstraint, + (getNumRows ILTableNames.GenericParamConstraint, + seekReadGenericParamConstraintRow, + fst, + simpleIndexCompare gpidx, + isSorted ILTableNames.GenericParamConstraint, (snd >> seekReadTypeDefOrRef numtypars AsObject (*ok*) [| |])) and seekReadTypeDefAsType boxity (ginst:ILTypes) idx = cacheTypeDefAsType seekReadTypeDefAsTypeUncached (TypeDefAsTypIdx (boxity, ginst, idx)) @@ -5666,16 +5666,16 @@ module internal AssemblyReader = and seekReadMethodDefOrRef numtypars (TaggedIndex(tag, idx)) = - match tag with - | tag when tag = MethodDefOrRefTag.MethodDef -> + match tag with + | tag when tag = MethodDefOrRefTag.MethodDef -> let (MethodData(enclTyp, cc, nm, argtys, retty, minst)) = seekReadMethodDefAsMethodData idx VarArgMethodData(enclTyp, cc, nm, argtys, None, retty, minst) - | tag when tag = MethodDefOrRefTag.MemberRef -> + | tag when tag = MethodDefOrRefTag.MemberRef -> seekReadMemberRefAsMethodData numtypars idx | _ -> failwith "seekReadMethodDefOrRef ctxt" and seekReadMethodDefOrRefNoVarargs numtypars x = - let (VarArgMethodData(enclTyp, cc, nm, argtys, varargs, retty, minst)) = seekReadMethodDefOrRef numtypars x + let (VarArgMethodData(enclTyp, cc, nm, argtys, varargs, retty, minst)) = seekReadMethodDefOrRef numtypars x MethodData(enclTyp, cc, nm, argtys, retty, minst) and seekReadCustomAttrType (TaggedIndex(tag, idx) ) = @@ -5718,22 +5718,22 @@ module internal AssemblyReader = LiteralValue = if (flags &&& 0x8000) = 0 then None else Some (seekReadConstant (TaggedIndex(HasConstantTag.FieldDef, idx))) //Marshal = // if (flags &&& 0x1000) = 0 then None else - // Some (seekReadIndexedRow (getNumRows ILTableNames.FieldMarshal, seekReadFieldMarshalRow, - // fst, hfmCompare (TaggedIndex(hfm_FieldDef, idx)), - // isSorted ILTableNames.FieldMarshal, + // Some (seekReadIndexedRow (getNumRows ILTableNames.FieldMarshal, seekReadFieldMarshalRow, + // fst, hfmCompare (TaggedIndex(hfm_FieldDef, idx)), + // isSorted ILTableNames.FieldMarshal, // (snd >> readBlobHeapAsNativeType ctxt))) //Data = // if (flags &&& 0x0100) = 0 then None // else - // let rva = seekReadIndexedRow (getNumRows ILTableNames.FieldRVA, seekReadFieldRVARow, + // let rva = seekReadIndexedRow (getNumRows ILTableNames.FieldRVA, seekReadFieldRVARow, // snd, simpleIndexCompare idx, isSorted ILTableNames.FieldRVA, fst) // Some (rvaToData "field" rva) Attributes = enum(flags) Offset = if hasLayout && not isStatic then - Some (seekReadIndexedRow (getNumRows ILTableNames.FieldLayout, seekReadFieldLayoutRow, + Some (seekReadIndexedRow (getNumRows ILTableNames.FieldLayout, seekReadFieldLayoutRow, snd, simpleIndexCompare idx, isSorted ILTableNames.FieldLayout, fst)) else None - CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.FieldDef, idx)) + CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.FieldDef, idx)) Token = idx } and seekReadFields (numtypars, hasLayout) fidx1 fidx2 = @@ -5778,7 +5778,7 @@ module internal AssemblyReader = let tdorIdx, sigptr = sigptrGetTypeDefOrRefOrSpecIdx bytes sigptr let n, sigptr = sigptrGetZInt32 bytes sigptr let argtys, sigptr = sigptrFold (sigptrGetTy numtypars) n bytes sigptr - seekReadTypeDefOrRef numtypars (if b0 = et_CLASS then AsObject else AsValue) argtys tdorIdx, + seekReadTypeDefOrRef numtypars (if b0 = et_CLASS then AsObject else AsValue) argtys tdorIdx, sigptr elif b0 = et_CLASS then @@ -5811,7 +5811,7 @@ module internal AssemblyReader = let lobounds, sigptr = sigptrFold sigptrGetZInt32 numLoBounded bytes sigptr let shape = let dim i = - (if i < numLoBounded then USome lobounds[i] else UNone), + (if i < numLoBounded then USome lobounds[i] else UNone), (if i < numSized then USome sizes[i] else UNone) ILArrayShape (Array.init rank dim) ILType.Array (shape, typ), sigptr @@ -5933,14 +5933,14 @@ module internal AssemblyReader = let nm = readStringHeap nameIdx // Look for the method def parent. let tidx = - seekReadIndexedRow (getNumRows ILTableNames.TypeDef, - (fun i -> i, seekReadTypeDefRowWithExtents i), - id, - (fun (_, ((_, _, _, _, _, methodsIdx), + seekReadIndexedRow (getNumRows ILTableNames.TypeDef, + (fun i -> i, seekReadTypeDefRowWithExtents i), + id, + (fun (_, ((_, _, _, _, _, methodsIdx), (_, endMethodsIdx))) -> if endMethodsIdx <= idx then 1 elif methodsIdx <= idx && idx < endMethodsIdx then 0 - else -1), + else -1), true, fst) let _generic, _genarity, cc, retty, argtys, _varargs = readBlobHeapAsMethodSig 0 typeIdx let ctps = seekReadGenericParams 0 (TypeOrMethodDefTag.TypeDef, tidx) @@ -6031,11 +6031,11 @@ module internal AssemblyReader = and seekReadMultipleMethodSemantics (flags, id) = seekReadIndexedRows - (getNumRows ILTableNames.MethodSemantics , - seekReadMethodSemanticsRow, - (fun (_flags, _, c) -> c), - hsCompare id, - isSorted ILTableNames.MethodSemantics, + (getNumRows ILTableNames.MethodSemantics , + seekReadMethodSemanticsRow, + (fun (_flags, _, c) -> c), + hsCompare id, + isSorted ILTableNames.MethodSemantics, (fun (a, b, _c) -> let (MethodData(enclTyp, cc, nm, argtys, retty, minst)) = seekReadMethodDefAsMethodData b a, (mkILMethSpecInTyRaw (enclTyp, cc, nm, argtys, retty, minst)).MethodRef)) @@ -6062,7 +6062,7 @@ module internal AssemblyReader = RemoveMethod=seekReadMethodSemantics (0x0010, TaggedIndex(HasSemanticsTag.Event, idx)) //FireMethod=seekReadOptionalMethodSemantics (0x0020, TaggedIndex(HasSemanticsTag.Event, idx)) //OtherMethods = seekReadMultipleMethodSemantics (0x0004, TaggedIndex(HasSemanticsTag.Event, idx)) - CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.Event, idx)) + CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.Event, idx)) Token = idx} and seekReadEvents numtypars tidx = @@ -6123,17 +6123,17 @@ module internal AssemblyReader = and seekReadCustomAttrs idx = { new ILCustomAttrs with member __.Entries = - seekReadIndexedRows (getNumRows ILTableNames.CustomAttribute, - seekReadCustomAttributeRow, (fun (a, _, _) -> a), - hcaCompare idx, - isSorted ILTableNames.CustomAttribute, + seekReadIndexedRows (getNumRows ILTableNames.CustomAttribute, + seekReadCustomAttributeRow, (fun (a, _, _) -> a), + hcaCompare idx, + isSorted ILTableNames.CustomAttribute, (fun (_, b, c) -> seekReadCustomAttr (b, c))) } and seekReadCustomAttr (catIdx, valIdx) = let data = match readBlobHeapOption valIdx with | USome bytes -> bytes - | UNone -> [| |] + | UNone -> [| |] { Method=seekReadCustomAttrType catIdx; Data= data Elements = [] } @@ -6142,26 +6142,26 @@ module internal AssemblyReader = and seekReadSecurityDecls idx = mkILLazySecurityDecls (lazy - seekReadIndexedRows (getNumRows ILTableNames.Permission, - seekReadPermissionRow, - (fun (_, par, _) -> par), - hdsCompare idx, - isSorted ILTableNames.Permission, + seekReadIndexedRows (getNumRows ILTableNames.Permission, + seekReadPermissionRow, + (fun (_, par, _) -> par), + hdsCompare idx, + isSorted ILTableNames.Permission, (fun (act, _, ty) -> seekReadSecurityDecl (act, ty)))) and seekReadSecurityDecl (a, b) = ctxt.seekReadSecurityDecl (SecurityDeclIdx (a, b)) and seekReadSecurityDeclUncached ctxtH (SecurityDeclIdx (act, ty)) = - PermissionSet ((if List.memAssoc (int act) (Lazy.force ILSecurityActionRevMap) then List.assoc (int act) (Lazy.force ILSecurityActionRevMap) else failwith "unknown security action"), + PermissionSet ((if List.memAssoc (int act) (Lazy.force ILSecurityActionRevMap) then List.assoc (int act) (Lazy.force ILSecurityActionRevMap) else failwith "unknown security action"), readBlobHeap ty) *) and seekReadConstant idx = - let kind, vidx = seekReadIndexedRow (getNumRows ILTableNames.Constant, - seekReadConstantRow, - (fun (_, key, _) -> key), + let kind, vidx = seekReadIndexedRow (getNumRows ILTableNames.Constant, + seekReadConstantRow, + (fun (_, key, _) -> key), hcCompare idx, isSorted ILTableNames.Constant, (fun (kind, _, v) -> kind, v)) match kind with | x when x = uint16 et_STRING -> @@ -6304,7 +6304,7 @@ module internal AssemblyReader = let b6, sigptr = sigptr_get_byte bytes sigptr let b7, sigptr = sigptr_get_byte bytes sigptr int64 b0 ||| (int64 b1 <<< 8) ||| (int64 b2 <<< 16) ||| (int64 b3 <<< 24) ||| - (int64 b4 <<< 32) ||| (int64 b5 <<< 40) ||| (int64 b6 <<< 48) ||| (int64 b7 <<< 56), + (int64 b4 <<< 32) ||| (int64 b5 <<< 40) ||| (int64 b6 <<< 48) ||| (int64 b7 <<< 56), sigptr let sigptr_get_u64 bytes sigptr = @@ -6340,17 +6340,17 @@ module internal AssemblyReader = let (|ElementType|_|) (ty: ILType) = - match ty with - | ILType.Boxed tspec -> - match tspec.Namespace, tspec.Name with + match ty with + | ILType.Boxed tspec -> + match tspec.Namespace, tspec.Name with | USome "System", "String"-> Some et_STRING | USome "System", "Object"-> Some et_OBJECT | _ -> None - | ILType.Value tspec -> + | ILType.Value tspec -> match tspec.Namespace, tspec.Name with | USome "System", "Int32" -> Some et_I4 | USome "System", "SByte" -> Some et_I1 - | USome "System", "Int16"-> Some et_I2 + | USome "System", "Int16"-> Some et_I2 | USome "System", "Int64" -> Some et_I8 | USome "System", "IntPtr" -> Some et_I | USome "System", "Byte" -> Some et_U1 @@ -6366,22 +6366,22 @@ module internal AssemblyReader = | _ -> None | _ -> None - let encodeCustomAttrString (s: string) = + let encodeCustomAttrString (s: string) = let arr = Encoding.UTF8.GetBytes s - Array.concat [ ByteBuffer.Z32 arr.Length; arr ] + Array.concat [ ByteBuffer.Z32 arr.Length; arr ] - let rec encodeCustomAttrElemType x = + let rec encodeCustomAttrElemType x = match x with - | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| 0x51uy |] + | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| 0x51uy |] | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Type" -> [| 0x50uy |] | ElementType et -> [| et |] | ILType.Value tspec -> Array.append [| 0x55uy |] (encodeCustomAttrString tspec.TypeRef.QualifiedName) - | ILType.Array (shape, elemType) when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, elemType) when shape = ILArrayShape.SingleDimensional -> Array.append [| et_SZARRAY |] (encodeCustomAttrElemType elemType) | _ -> failwith "encodeCustomAttrElemType: unrecognized custom element type" /// Given a custom attribute element, work out the type of the .NET argument for that element. - let rec encodeCustomAttrElemTypeForObject (x: obj) = + let rec encodeCustomAttrElemTypeForObject (x: obj) = match x with | :? string -> [| et_STRING |] | :? bool -> [| et_BOOLEAN |] @@ -6400,11 +6400,11 @@ module internal AssemblyReader = | :? single -> [| et_R4 |] | :? double -> [| et_R8 |] | :? (obj[]) -> failwith "TODO: can't yet emit arrays in attrs" // [| yield et_SZARRAY; yield! encodeCustomAttrElemType elemTy |] - | _ -> failwith "unexpected value in custom attribute" + | _ -> failwith "unexpected value in custom attribute" /// Given a custom attribute element, encode it to a binary representation according to the rules in Ecma 335 Partition II. - let rec encodeCustomAttrPrimValue (c: obj) = - match c with + let rec encodeCustomAttrPrimValue (c: obj) = + match c with | :? bool as b -> [| (if b then 0x01uy else 0x00uy) |] | null -> [| 0xFFuy |] | :? string as s -> encodeCustomAttrString s @@ -6419,40 +6419,40 @@ module internal AssemblyReader = | :? UInt64 as x -> u64AsBytes x | :? Single as x -> ieee32AsBytes x | :? Double as x -> ieee64AsBytes x - | :? ILType as ty -> encodeCustomAttrString ty.QualifiedName - | :? Type as ty -> encodeCustomAttrString ty.FullName - | :? (obj[]) as elems -> + | :? ILType as ty -> encodeCustomAttrString ty.QualifiedName + | :? Type as ty -> encodeCustomAttrString ty.FullName + | :? (obj[]) as elems -> [| yield! i32AsBytes elems.Length; for elem in elems do yield! encodeCustomAttrPrimValue elem |] | c -> failwithf "unexpected value in custom attribute (%O)" c - and encodeCustomAttrValue ty (c: obj) = - match ty, c with - | ILType.Boxed tspec, _ when tspec.Namespace = USome "System" && tspec.Name = "Object" -> + and encodeCustomAttrValue ty (c: obj) = + match ty, c with + | ILType.Boxed tspec, _ when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| yield! encodeCustomAttrElemTypeForObject c; yield! encodeCustomAttrPrimValue c |] - | ILType.Array (shape, _), null when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, _), null when shape = ILArrayShape.SingleDimensional -> [| yield! i32AsBytes 0xFFFFFFFF |] - | ILType.Array (shape, elemType), (:? (obj[]) as elems) when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, elemType), (:? (obj[]) as elems) when shape = ILArrayShape.SingleDimensional -> [| yield! i32AsBytes elems.Length; for elem in elems do yield! encodeCustomAttrValue elemType elem |] - | _ -> + | _ -> encodeCustomAttrPrimValue c - let encodeCustomAttrNamedArg prop (ILCustomAttrNamedArg (nm, ty, elem)) = - [| yield (if prop then 0x54uy else 0x53uy) + let encodeCustomAttrNamedArg prop (ILCustomAttrNamedArg (nm, ty, elem)) = + [| yield (if prop then 0x54uy else 0x53uy) yield! encodeCustomAttrElemType ty yield! encodeCustomAttrString nm yield! encodeCustomAttrValue ty elem |] - let mkILCustomAttribMethRef (mspec:ILMethodSpec, fixedArgs: obj list, propArgs: ILCustomAttrNamedArg list, fieldArgs: ILCustomAttrNamedArg list) = + let mkILCustomAttribMethRef (mspec:ILMethodSpec, fixedArgs: obj list, propArgs: ILCustomAttrNamedArg list, fieldArgs: ILCustomAttrNamedArg list) = let argtys = mspec.MethodRef.ArgTypes let nnamed = propArgs.Length + fieldArgs.Length - let data = + let data = [| yield! [| 0x01uy; 0x00uy; |] for (argty, fixedArg) in Seq.zip argtys fixedArgs do yield! encodeCustomAttrValue argty fixedArg yield! u16AsBytes (uint16 nnamed ) - for arg in propArgs do + for arg in propArgs do yield! encodeCustomAttrNamedArg true arg - for arg in fieldArgs do + for arg in fieldArgs do yield! encodeCustomAttrNamedArg false arg |] //printfn "mkILCustomAttribMethRef, nnamed = %d, data.Length = %d, data = %A" nnamed data.Length data { Method = mspec; @@ -6509,12 +6509,12 @@ module internal AssemblyReader = s // The format we accept is - // "{`[, +]}{}{}" E.g., + // "{`[, +]}{}{}" E.g., // // System.Collections.Generic.Dictionary // `2[ - // [System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089], - // dev.virtualearth.net.webservices.v1.search.CategorySpecificPropertySet], + // [System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089], + // dev.virtualearth.net.webservices.v1.search.CategorySpecificPropertySet], // mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" // // Note that @@ -6722,7 +6722,7 @@ module internal AssemblyReader = if n = 0 then List.rev acc, sigptr else let v, sigptr = parseVal elemTy sigptr parseElems (v ::acc) (n-1) sigptr - let elems, sigptr = parseElems [] n sigptr + let elems, sigptr = parseElems [] n sigptr let elems = elems |> List.map snd |> List.toArray (argty, box elems), sigptr | ILType.Value _ -> (* assume it is an enumeration *) @@ -6775,22 +6775,22 @@ module internal AssemblyReader = let named = parseNamed [] (int nnamed) sigptr fixedArgs, named - with err -> + with err -> failwithf "FAILED decodeILCustomAttribData, data.Length = %d, data = %A, meth = %A, argtypes = %A, fixedArgs=%A, nnamed = %A, sigptr before named = %A, innerError = %A" bytes.Length bytes ca.Method.EnclosingType ca.Method.FormalArgTypes fixedArgs nnamed sigptr (err.ToString()) - // Share DLLs within a provider by weak-caching them. + // Share DLLs within a provider by weak-caching them. let readerWeakCache = ConcurrentDictionary<(string * string), DateTime * WeakReference>(HashIdentity.Structural) // Share DLLs across providers by strong-caching them, but flushing regularly let readerStrongCache = ConcurrentDictionary<(string * string), DateTime * int * ILModuleReader>(HashIdentity.Structural) - type File with - static member ReadBinaryChunk (fileName: string, start, len) = + type File with + static member ReadBinaryChunk (fileName: string, start, len) = use stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) stream.Seek(int64 start, SeekOrigin.Begin) |> ignore - let buffer = Array.zeroCreate len + let buffer = Array.zeroCreate len let mutable n = 0 - while n < len do + while n < len do n <- n + stream.Read(buffer, n, len-n) buffer @@ -6814,8 +6814,8 @@ module internal AssemblyReader = let lastAccessLock = obj() let mutable lastAccess = DateTime.Now - let StartClearReaderCache() = - if enableAutoClear then + let StartClearReaderCache() = + if enableAutoClear then async { while true do do! Async.Sleep clearSpan @@ -6827,25 +6827,25 @@ module internal AssemblyReader = do StartClearReaderCache() - let (|WeakReference|_|) (x: WeakReference<'T>) = - match x.TryGetTarget() with + let (|WeakReference|_|) (x: WeakReference<'T>) = + match x.TryGetTarget() with | true, v -> Some v | _ -> None let ILModuleReaderAfterReadingAllBytes (file:string, ilGlobals: ILGlobals) = let key = (file, ilGlobals.systemRuntimeScopeRef.QualifiedName) lock lastAccessLock (fun () -> lastAccess <- DateTime.Now) - + // Check the weak cache, to enable sharing within a provider, even if the strong cache is flushed. - match readerWeakCache.TryGetValue(key) with - | true, (currentLastWriteTime, WeakReference(reader)) when + match readerWeakCache.TryGetValue(key) with + | true, (currentLastWriteTime, WeakReference(reader)) when let lastWriteTime = File.GetLastWriteTime(file) currentLastWriteTime = lastWriteTime -> reader - | _ -> - let add _ = + | _ -> + let add _ = let lastWriteTime = File.GetLastWriteTime(file) let reader = createReader ilGlobals file // record in the weak cache, to enable sharing within a provider, even if the strong cache is flushed. @@ -6869,7 +6869,7 @@ module internal AssemblyReader = let EcmaMscorlibScopeRef = ILScopeRef.Assembly (ILAssemblyRef("mscorlib", UNone, USome EcmaPublicKey, true, UNone, UNone)) //==================================================================================================== -// TargetAssembly +// TargetAssembly // // An implementation of reflection objects over on-disk assemblies, sufficient to give // System.Type, System.MethodInfo, System.ConstructorInfo etc. objects @@ -7077,7 +7077,7 @@ namespace ProviderImplementation.ProvidedTypes | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes dty that.DeclaringType && lengthsEqAndForall2 (gmd.GetGenericArguments()) (that.GetGenericArguments()) (=) | _ -> false - + override this.MethodHandle = notRequired this "MethodHandle" this.Name override this.ReturnParameter = notRequired this "ReturnParameter" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name @@ -7096,7 +7096,7 @@ namespace ProviderImplementation.ProvidedTypes /// Represents a constructor in an instantiated type type ConstructorSymbol (declTy: Type, inp: ConstructorInfo, typeBuilder: ITypeBuilder) = - inherit ConstructorInfo() + inherit ConstructorInfo() let gps = ((if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]), [| |]) override __.Name = inp.Name @@ -7123,12 +7123,12 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(inherited) = inp.GetCustomAttributes(inherited) override this.GetCustomAttributes(attributeType, inherited) = inp.GetCustomAttributes(attributeType, inherited) - override __.ToString() = sprintf "tgt constructor(...) in type %s" declTy.FullName + override __.ToString() = sprintf "tgt constructor(...) in type %s" declTy.FullName static member Make (typeBuilder: ITypeBuilder) (declTy: Type) md = ConstructorSymbol (declTy, md, typeBuilder) :> ConstructorInfo /// Represents a method in an instantiated type type MethodSymbol (declTy: Type, inp: MethodInfo, typeBuilder: ITypeBuilder) = - inherit MethodInfo() + inherit MethodInfo() let gps1 = (if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]) let gps2 = inp.GetGenericArguments() let gps = (gps1, gps2) @@ -7148,7 +7148,7 @@ namespace ProviderImplementation.ProvidedTypes override __.GetHashCode() = inp.GetHashCode() override this.Equals(that:obj) = match that with - | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType + | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType | _ -> false override this.MakeGenericMethod(args) = MethodSymbol2(this, args, typeBuilder) :> MethodInfo @@ -7166,13 +7166,13 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(inherited) = inp.GetCustomAttributes(inherited) override this.GetCustomAttributes(attributeType, inherited) = inp.GetCustomAttributes(attributeType, inherited) - override __.ToString() = sprintf "tgt method %s(...) in type %s" inp.Name declTy.FullName + override __.ToString() = sprintf "tgt method %s(...) in type %s" inp.Name declTy.FullName static member Make (typeBuilder: ITypeBuilder) (declTy: Type) md = MethodSymbol (declTy, md, typeBuilder) :> MethodInfo /// Represents a property in an instantiated type type PropertySymbol (declTy: Type, inp: PropertyInfo, typeBuilder: ITypeBuilder) = - inherit PropertyInfo() + inherit PropertyInfo() let gps = ((if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]), [| |]) override __.Name = inp.Name @@ -7203,7 +7203,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name - override __.ToString() = sprintf "tgt property %s(...) in type %s" inp.Name declTy.Name + override __.ToString() = sprintf "tgt property %s(...) in type %s" inp.Name declTy.Name static member Make (typeBuilder: ITypeBuilder) (declTy: Type) md = PropertySymbol (declTy, md, typeBuilder) :> PropertyInfo @@ -7235,13 +7235,13 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name - override __.ToString() = sprintf "tgt event %s(...) in type %s" inp.Name declTy.FullName + override __.ToString() = sprintf "tgt event %s(...) in type %s" inp.Name declTy.FullName static member Make (typeBuilder: ITypeBuilder) (declTy: Type) md = EventSymbol (declTy, md, typeBuilder) :> EventInfo /// Represents a field in an instantiated type type FieldSymbol (declTy: Type, inp: FieldInfo, typeBuilder: ITypeBuilder) = - inherit FieldInfo() + inherit FieldInfo() let gps = if declTy.IsGenericType then declTy.GetGenericArguments() else [| |] override __.Name = inp.Name @@ -7268,7 +7268,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetValue(_obj) = notRequired this "GetValue" this.Name override this.FieldHandle = notRequired this "FieldHandle" this.Name - override __.ToString() = sprintf "tgt literal field %s(...) in type %s" inp.Name declTy.FullName + override __.ToString() = sprintf "tgt literal field %s(...) in type %s" inp.Name declTy.FullName static member Make (typeBuilder: ITypeBuilder) (declTy: Type) md = FieldSymbol (declTy, md, typeBuilder) :> FieldInfo @@ -7365,71 +7365,71 @@ namespace ProviderImplementation.ProvidedTypes member __.Kind = kind member __.Args = typeArgs - override this.GetConstructors bindingFlags = + override this.GetConstructors bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Methods.Entries - |> Array.filter (fun md -> md.Name = ".ctor" || md.Name = ".cctor") - |> Array.map (gtd.MakeConstructorInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Methods.Entries + |> Array.filter (fun md -> md.Name = ".ctor" || md.Name = ".cctor") + |> Array.map (gtd.MakeConstructorInfo this) |> Array.filter (canBindConstructor bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetConstructors(bindingFlags) - |> Array.map (ConstructorSymbol.Make typeBuilder this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetConstructors(bindingFlags) + |> Array.map (ConstructorSymbol.Make typeBuilder this) | _ -> notRequired this "GetConstructors" this.Name - override this.GetMethods bindingFlags = + override this.GetMethods bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Methods.Entries - |> Array.filter (fun md -> md.Name <> ".ctor" && md.Name <> ".cctor") - |> Array.map (gtd.MakeMethodInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Methods.Entries + |> Array.filter (fun md -> md.Name <> ".ctor" && md.Name <> ".cctor") + |> Array.map (gtd.MakeMethodInfo this) |> Array.filter (canBindMethod bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetMethods(bindingFlags) - |> Array.map (MethodSymbol.Make typeBuilder this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetMethods(bindingFlags) + |> Array.map (MethodSymbol.Make typeBuilder this) | _ -> notRequired this "GetMethods" this.Name - override this.GetFields bindingFlags = + override this.GetFields bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Fields.Entries - |> Array.map (gtd.MakeFieldInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Fields.Entries + |> Array.map (gtd.MakeFieldInfo this) |> Array.filter (canBindField bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetFields(bindingFlags) - |> Array.map (FieldSymbol.Make typeBuilder this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetFields(bindingFlags) + |> Array.map (FieldSymbol.Make typeBuilder this) | _ -> notRequired this "GetFields" this.Name - override this.GetProperties bindingFlags = + override this.GetProperties bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Properties.Entries - |> Array.map (gtd.MakePropertyInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Properties.Entries + |> Array.map (gtd.MakePropertyInfo this) |> Array.filter (canBindProperty bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetProperties(bindingFlags) - |> Array.map (PropertySymbol.Make typeBuilder this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetProperties(bindingFlags) + |> Array.map (PropertySymbol.Make typeBuilder this) | _ -> notRequired this "GetProperties" this.Name - override this.GetEvents bindingFlags = + override this.GetEvents bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Events.Entries - |> Array.map (gtd.MakeEventInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Events.Entries + |> Array.map (gtd.MakeEventInfo this) |> Array.filter (canBindEvent bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetEvents(bindingFlags) - |> Array.map (EventSymbol.Make typeBuilder this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetEvents(bindingFlags) + |> Array.map (EventSymbol.Make typeBuilder this) | _ -> notRequired this "GetEvents" this.Name - override this.GetNestedTypes bindingFlags = + override this.GetNestedTypes bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.NestedTypes.Entries - |> Array.map (gtd.MakeNestedTypeInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.NestedTypes.Entries + |> Array.map (gtd.MakeNestedTypeInfo this) |> Array.filter (canBindNestedType bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetNestedTypes(bindingFlags) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetNestedTypes(bindingFlags) | _ -> notRequired this "GetNestedTypes" this.Name override this.GetConstructorImpl(bindingFlags, _binderBinder, _callConvention, types, _modifiers) = @@ -7437,68 +7437,68 @@ namespace ProviderImplementation.ProvidedTypes match ctors with | [| |] -> null | [| ci |] -> ci - | _ -> failwithf "multiple constructors exist" + | _ -> failwithf "multiple constructors exist" override this.GetMethodImpl(name, bindingFlags, _binderBinder, _callConvention, types, _modifiers) = match kind with | TypeSymbolKind.TargetGeneric gtd -> let md = match types with - | null -> gtd.Metadata.Methods.TryFindUniqueByName(name) + | null -> gtd.Metadata.Methods.TryFindUniqueByName(name) | _ -> - let mds = gtd.Metadata.Methods.FindByNameAndArity(name, types.Length) + let mds = gtd.Metadata.Methods.FindByNameAndArity(name, types.Length) match mds |> Array.filter (fun md -> eqTypesAndILTypesWithInst typeArgs types md.ParameterTypes) with | [| |] -> None | [| md |] -> Some md | _ -> failwithf "multiple methods exist with name %s" name md |> Option.map (gtd.MakeMethodInfo this) |> Option.toObj - | TypeSymbolKind.OtherGeneric _ -> + | TypeSymbolKind.OtherGeneric _ -> match this.GetMethods(bindingFlags) |> Array.filter (fun c -> name = c.Name && match types with null -> true | t -> c.GetParameters().Length = t.Length) with | [| |] -> null | [| mi |] -> mi | _ -> failwithf "multiple methods exist with name %s" name | _ -> notRequired this "GetMethodImpl" this.Name - override this.GetField(name, bindingFlags) = + override this.GetField(name, bindingFlags) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Fields.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakeFieldInfo this) + |> Option.map (gtd.MakeFieldInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetFields(bindingFlags) + gtd.GetFields(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (FieldSymbol.Make typeBuilder this) + |> Option.map (FieldSymbol.Make typeBuilder this) |> Option.toObj | _ -> notRequired this "GetField" this.Name - override this.GetPropertyImpl(name, bindingFlags, _binder, _returnType, _types, _modifiers) = + override this.GetPropertyImpl(name, bindingFlags, _binder, _returnType, _types, _modifiers) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Properties.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakePropertyInfo this) + |> Option.map (gtd.MakePropertyInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetProperties(bindingFlags) + gtd.GetProperties(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (PropertySymbol.Make typeBuilder this) + |> Option.map (PropertySymbol.Make typeBuilder this) |> Option.toObj | _ -> notRequired this "GetPropertyImpl" this.Name - override this.GetEvent(name, bindingFlags) = + override this.GetEvent(name, bindingFlags) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Events.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakeEventInfo this) + |> Option.map (gtd.MakeEventInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetEvents(bindingFlags) + gtd.GetEvents(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (EventSymbol.Make typeBuilder this) + |> Option.map (EventSymbol.Make typeBuilder this) |> Option.toObj | _ -> notRequired this "GetEvent" this.Name @@ -7523,7 +7523,7 @@ namespace ProviderImplementation.ProvidedTypes match kind with | TypeSymbolKind.OtherGeneric gtd -> gtd.MemberType | _ -> notRequired this "MemberType" this.FullName - + #if NETCOREAPP // See bug https://github.com/fsprojects/FSharp.TypeProviders.SDK/issues/236 override __.IsSZArray = @@ -7545,7 +7545,7 @@ namespace ProviderImplementation.ProvidedTypes /// Convert an ILGenericParameterDef read from a binary to a System.Type. and TargetGenericParam (asm, gpsf, pos, inp: ILGenericParameterDef, txILType, txCustomAttributesData, typeBuilder: ITypeBuilder) as this = - inherit TypeDelegator() + inherit TypeDelegator() do this.typeImpl <- this override __.Name = inp.Name override __.Assembly = (asm :> Assembly) @@ -7613,7 +7613,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "txILGenericParam: GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "txILGenericParam: IsDefined" this.Name override this.GetInterface(_name, _ignoreCase) = notRequired this "txILGenericParam: GetInterface" this.Name - override this.Module = notRequired this "txILGenericParam: Module" this.Name: Module + override this.Module = notRequired this "txILGenericParam: Module" this.Name: Module override this.GetElementType() = notRequired this "txILGenericParam: GetElementType" this.Name override this.InvokeMember(_name, _invokeAttr, _binder, _target, _args, _modifiers, _culture, _namedParameters) = notRequired this "txILGenericParam: InvokeMember" this.Name override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegating implementation of this, and we are self-delegating @@ -7700,16 +7700,16 @@ namespace ProviderImplementation.ProvidedTypes override __.GetParameters() = inp.Parameters |> Array.map (txILParameter (gps, gps2)) override __.CallingConvention = if inp.IsStatic then CallingConventions.Standard else CallingConventions.HasThis ||| CallingConventions.Standard - override __.ReturnType = - match returnTypeFixCache with - | None -> + override __.ReturnType = + match returnTypeFixCache with + | None -> let returnType = inp.Return.Type |> txILType (gps, gps2) let returnTypeFix = - match returnType.Namespace, returnType.Name with - | "System", "Void"-> - if ImportProvidedMethodBaseAsILMethodRef_OnStack_HACK() then + match returnType.Namespace, returnType.Name with + | "System", "Void"-> + if ImportProvidedMethodBaseAsILMethodRef_OnStack_HACK() then typeof - else + else returnType | t -> returnType returnTypeFixCache <- Some returnTypeFix @@ -7718,7 +7718,7 @@ namespace ProviderImplementation.ProvidedTypes returnTypeFix override __.GetCustomAttributesData() = inp.CustomAttrs |> txCustomAttributesData - override __.GetGenericArguments() = gps2 + override __.GetGenericArguments() = gps2 override __.IsGenericMethod = (gps2.Length <> 0) override __.IsGenericMethodDefinition = __.IsGenericMethod @@ -7726,7 +7726,7 @@ namespace ProviderImplementation.ProvidedTypes override this.Equals(that:obj) = match that with - | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType + | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType | _ -> false override this.MakeGenericMethod(args) = MethodSymbol2(this, args, typeBuilder) :> MethodInfo @@ -7962,21 +7962,21 @@ namespace ProviderImplementation.ProvidedTypes |> Array.filter (canBindNestedType bindingFlags) override this.GetConstructorImpl(_bindingFlags, _binder, _callConvention, types, _modifiers) = - let md = + let md = match types with | null -> inp.Methods.TryFindUniqueByName(".ctor") - | _ -> + | _ -> inp.Methods.FindByNameAndArity(".ctor", types.Length) |> Array.tryFind (fun md -> eqTypesAndILTypes types md.ParameterTypes) - md - |> Option.map (txILConstructorDef this) + md + |> Option.map (txILConstructorDef this) |> Option.toObj override this.GetMethodImpl(name, _bindingFlags, _binder, _callConvention, types, _modifiers) = - let md = + let md = match types with | null -> inp.Methods.TryFindUniqueByName(name) - | _ -> + | _ -> inp.Methods.FindByNameAndArity(name, types.Length) |> Array.tryFind (fun md -> eqTypesAndILTypes types md.ParameterTypes) md |> Option.map (txILMethodDef this) |> Option.toObj @@ -8023,8 +8023,8 @@ namespace ProviderImplementation.ProvidedTypes override __.IsValueTypeImpl() = inp.IsStructOrEnum - override __.IsEnum = - match this.BaseType with + override __.IsEnum = + match this.BaseType with | null -> false | bt -> bt.FullName = "System.Enum" || bt.IsEnum @@ -8099,13 +8099,13 @@ namespace ProviderImplementation.ProvidedTypes let getReader() = match reader with None -> failwith "the reader on the TargetAssembly has not been set" | Some r -> r let txILTypeDef (declTyOpt: Type option) (inp: ILTypeDef) = - txTable.Get inp.Token (fun () -> - // We never create target types for the types of primitive values that are accepted by the F# compiler as Expr.Value nodes, + txTable.Get inp.Token (fun () -> + // We never create target types for the types of primitive values that are accepted by the F# compiler as Expr.Value nodes, // which fortunately also correspond to element types. We just use the design-time types instead. - // See convertConstExpr in the compiler, e.g. + // See convertConstExpr in the compiler, e.g. // https://github.com/Microsoft/visualfsharp/blob/44fa027b308681a1b78a089e44fa1ab35ff77b41/src/fsharp/MethodCalls.fs#L842 // for the accepted types. - match inp.Namespace, inp.Name with + match inp.Namespace, inp.Name with //| USome "System", "Void"-> typeof (* | USome "System", "Boolean" -> typeof @@ -8123,9 +8123,9 @@ namespace ProviderImplementation.ProvidedTypes | USome "System", "UIntPtr" -> typeof | USome "System", "Double" -> typeof | USome "System", "Single" -> typeof - | USome "System", "Char" -> typeof + | USome "System", "Char" -> typeof *) - | _ -> + | _ -> TargetTypeDefinition(ilGlobals, tryBindAssembly, asm, declTyOpt, inp, typeBuilder) :> System.Type) let types = lazy [| for td in getReader().ILModuleDef.TypeDefs.Entries -> txILTypeDef None td |] @@ -8162,7 +8162,7 @@ namespace ProviderImplementation.ProvidedTypes let r = getReader().ILModuleDef.Resources.Entries |> Seq.find (fun r -> r.Name = resourceName) match r.Location with | ILResourceLocation.Local f -> new MemoryStream(f()) :> Stream - | _ -> + | _ -> notRequired x "reading manifest resource %s" resourceName member __.TxILTypeDef declTyOpt inp = txILTypeDef declTyOpt inp @@ -8179,8 +8179,8 @@ namespace ProviderImplementation.ProvidedTypes | ILScopeRef.Assembly aref2 -> let ass2opt = tryBindAssembly(aref2) match ass2opt with - | Choice1Of2 ass2 -> - match ass2.GetType(joinILTypeName nsp nm) with + | Choice1Of2 ass2 -> + match ass2.GetType(joinILTypeName nsp nm) with | null -> None | ty -> Some ty | Choice2Of2 _err -> None @@ -8197,13 +8197,13 @@ namespace ProviderImplementation.ProvidedTypes override x.ToString() = "tgt assembly " + x.FullName type ProvidedAssembly(isTgt: bool, assemblyName:AssemblyName, assemblyFileName: string, customAttributesData) = - + inherit Assembly() - + let customAttributesImpl = CustomAttributesImpl(isTgt, customAttributesData) - + let theTypes = ResizeArray() - + let addTypes (ptds:ProvidedTypeDefinition[], enclosingTypeNames: string list option) = for pt in ptds do if pt.IsErased then failwith ("The provided type "+pt.Name+"is marked as erased and cannot be converted to a generated type. Set 'IsErased=false' on the ProvidedTypeDefinition") @@ -8212,7 +8212,7 @@ namespace ProviderImplementation.ProvidedTypes theTypes.Add (ptds, enclosingTypeNames) let theTypesArray = lazy (theTypes.ToArray() |> Array.collect (function (ptds, None) -> Array.map (fun ptd -> (ptd :> Type)) ptds | _ -> [| |])) - + member __.AddCustomAttribute(attribute) = customAttributesImpl.AddCustomAttribute(attribute) override __.GetReferencedAssemblies() = [| |] //notRequired x "GetReferencedAssemblies" (assemblyName.ToString()) @@ -8229,7 +8229,7 @@ namespace ProviderImplementation.ProvidedTypes override __.ToString () = assemblyName.ToString() - override x.GetType (nm: string) = + override x.GetType (nm: string) = if nm.Contains("+") then let i = nm.LastIndexOf("+") let enc, nm2 = nm[0..i-1], nm[i+1..] @@ -8237,33 +8237,33 @@ namespace ProviderImplementation.ProvidedTypes | null -> null | t -> t.GetNestedType(nm2, bindAll) else - theTypesArray.Force() - |> Array.tryPick (fun ty -> if ty.FullName = nm then Some ty else None) + theTypesArray.Force() + |> Array.tryPick (fun ty -> if ty.FullName = nm then Some ty else None) |> Option.toObj - - new () = + + new () = let tmpFile = Path.GetTempFileName() let assemblyFileName = Path.ChangeExtension(tmpFile, "dll") File.Delete(tmpFile) let simpleName = Path.GetFileNameWithoutExtension(assemblyFileName) ProvidedAssembly(AssemblyName(simpleName), assemblyFileName) - new (assemblyName, assemblyFileName) = + new (assemblyName, assemblyFileName) = ProvidedAssembly(false, assemblyName, assemblyFileName, K [||]) member __.BelongsToTargetModel = isTgt - member __.AddNestedTypes (types, enclosingGeneratedTypeNames) = + member __.AddNestedTypes (types, enclosingGeneratedTypeNames) = addTypes (Array.ofList types, Some enclosingGeneratedTypeNames) - member __.AddTypes (types) = + member __.AddTypes (types) = addTypes (Array.ofList types, None) - member __.AddTheTypes (types, enclosingGeneratedTypeNames) = + member __.AddTheTypes (types, enclosingGeneratedTypeNames) = addTypes (types, enclosingGeneratedTypeNames) member __.GetTheTypes () = theTypes.ToArray() - + override __.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() //==================================================================================================== @@ -8323,7 +8323,7 @@ namespace ProviderImplementation.ProvidedTypes type ProvidedTypeBuilder() = - static let tupleNames = + static let tupleNames = [| "System.Tuple`1"; "System.Tuple`2"; "System.Tuple`3"; "System.Tuple`4"; "System.Tuple`5"; "System.Tuple`6"; "System.Tuple`7"; "System.Tuple`8"; "System.Tuple" @@ -8332,15 +8332,15 @@ namespace ProviderImplementation.ProvidedTypes "System.ValueTuple`7"; "System.ValueTuple`8"; "System.ValueTuple" |] - static member MakeGenericType(genericTypeDefinition: Type, genericArguments: Type list) = + static member MakeGenericType(genericTypeDefinition: Type, genericArguments: Type list) = if genericArguments.Length = 0 then genericTypeDefinition else - match genericTypeDefinition with + match genericTypeDefinition with | :? TargetTypeDefinition -> failwithf "unexpected target model in ProvidedTypeBuilder.MakeGenericType, stacktrace = %s " Environment.StackTrace | :? ProvidedTypeDefinition as ptd when ptd.BelongsToTargetModel -> failwithf "unexpected target model ptd in MakeGenericType, stacktrace = %s " Environment.StackTrace | :? ProvidedTypeDefinition -> ProvidedTypeSymbol(ProvidedTypeSymbolKind.Generic genericTypeDefinition, genericArguments, ProvidedTypeBuilder.typeBuilder) :> Type | _ -> TypeSymbol(TypeSymbolKind.OtherGeneric genericTypeDefinition, List.toArray genericArguments, ProvidedTypeBuilder.typeBuilder) :> Type - static member MakeGenericMethod(genericMethodDefinition, genericArguments: Type list) = + static member MakeGenericMethod(genericMethodDefinition, genericArguments: Type list) = if genericArguments.Length = 0 then genericMethodDefinition else MethodSymbol2(genericMethodDefinition, Array.ofList genericArguments, ProvidedTypeBuilder.typeBuilder) :> MethodInfo @@ -8351,7 +8351,7 @@ namespace ProviderImplementation.ProvidedTypes let n = min tys.Length maxTuple let tupleFullName = tupleNames[n - 1 + (if isStruct then 9 else 0)] let ty = asm.GetType(tupleFullName) - if tys.Length >= maxTuple then + if tys.Length >= maxTuple then let tysA = (Array.ofList tys)[0..maxTuple-2] |> List.ofArray let tysB = (Array.ofList tys)[maxTuple-1..] |> List.ofArray let tyB = mkTupleType isStruct asm tysB @@ -8362,32 +8362,32 @@ namespace ProviderImplementation.ProvidedTypes static member MakeTupleType(types) = ProvidedTypeBuilder.MakeTupleType(types, false) - static member typeBuilder = + static member typeBuilder = { new ITypeBuilder with - member this.MakeGenericType(typeDef: Type, args)= + member this.MakeGenericType(typeDef: Type, args)= match typeDef with | :? ProvidedTypeDefinition -> ProvidedTypeSymbol(ProvidedTypeSymbolKind.Generic typeDef, Array.toList args, this) :> Type - | _ -> + | _ -> if args |> Array.exists (function :? ProvidedTypeDefinition -> true | _ -> false) then TypeSymbol(TypeSymbolKind.OtherGeneric typeDef, args, this) :> Type else typeDef.MakeGenericType(args) - member this.MakeArrayType(typ) = + member this.MakeArrayType(typ) = match typ with | :? ProvidedTypeDefinition -> TypeSymbol(TypeSymbolKind.SDArray, [| typ |], this) :> Type | _ -> typ.MakeArrayType() - member this.MakeRankedArrayType(typ,rank) = + member this.MakeRankedArrayType(typ,rank) = match typ with | :? ProvidedTypeDefinition -> TypeSymbol(TypeSymbolKind.Array rank, [| typ |], this) :> Type | _ -> typ.MakeArrayType(rank) - member this.MakePointerType(typ) = + member this.MakePointerType(typ) = match typ with | :? ProvidedTypeDefinition -> TypeSymbol(TypeSymbolKind.Pointer, [| typ |], this) :> Type | _ -> typ.MakePointerType() - member this.MakeByRefType(typ) = + member this.MakeByRefType(typ) = match typ with | :? ProvidedTypeDefinition -> TypeSymbol(TypeSymbolKind.ByRef, [| typ |], this) :> Type @@ -8396,10 +8396,10 @@ namespace ProviderImplementation.ProvidedTypes //-------------------------------------------------------------------------------- // The quotation simplifier // - // This is invoked for each quotation specified by the type provider, as part of the translation to - /// the target model, i.e. before it is handed to the F# compiler (for erasing type providers) or - // the TPSDK IL code generator (for generative type providers). This allows a broader range of quotations - // to be used when authoring type providers than are strictly allowed by those tools. + // This is invoked for each quotation specified by the type provider, as part of the translation to + /// the target model, i.e. before it is handed to the F# compiler (for erasing type providers) or + // the TPSDK IL code generator (for generative type providers). This allows a broader range of quotations + // to be used when authoring type providers than are strictly allowed by those tools. // // Specifically we accept: // @@ -8423,7 +8423,7 @@ namespace ProviderImplementation.ProvidedTypes match q with #if !NO_GENERATIVE - // Convert NewTuple to the call to the constructor of the Tuple type (only for generated types, + // Convert NewTuple to the call to the constructor of the Tuple type (only for generated types, // the F# compile does the job for erased types when it receives the quotation) | NewTuple(items) when isGenerated -> let rec mkCtor args ty = @@ -8441,9 +8441,9 @@ namespace ProviderImplementation.ProvidedTypes // convert TupleGet to the chain of PropertyGet calls (only for generated types) | TupleGet(e, i) when isGenerated -> let rec mkGet (ty : Type) i (e: Expr) = - if ty.IsValueType then + if ty.IsValueType then let get index = - let fields = ty.GetFields() |> Array.sortBy (fun fi -> fi.Name) + let fields = ty.GetFields() |> Array.sortBy (fun fi -> fi.Name) if index >= fields.Length then invalidArg "index" (sprintf "The tuple index '%d' was out of range for tuple type %s" index ty.Name) fields[index] @@ -8595,7 +8595,7 @@ namespace ProviderImplementation.ProvidedTypes // ... // body (body, vars) - ||> List.fold (fun b v -> Expr.LetUnchecked(varDict[v.Name], init v.Type, b)) + ||> List.fold (fun b v -> Expr.LetUnchecked(varDict[v.Name], init v.Type, b)) |> simplifyExpr @@ -8660,10 +8660,10 @@ namespace ProviderImplementation.ProvidedTypes yield resultType |] let fastFuncTy = match List.length args with - | 2 -> typedefof>.MakeGenericType(types) - | 3 -> typedefof>.MakeGenericType(types) - | 4 -> typedefof>.MakeGenericType(types) - | 5 -> typedefof>.MakeGenericType(types) + | 2 -> typedefof>.MakeGenericType(types) + | 3 -> typedefof>.MakeGenericType(types) + | 4 -> typedefof>.MakeGenericType(types) + | 5 -> typedefof>.MakeGenericType(types) | _ -> invalidArg "args" "incorrect number of arguments" fastFuncTy.GetMethod("Adapt") @@ -8820,7 +8820,7 @@ namespace ProviderImplementation.ProvidedTypes /// /// The ProvidedTypesContext acts as a way of creating provided objects where the replacement is automatically and /// systematically applied. - + /// Represents the type binding context for the type provider based on the set of assemblies /// referenced by the compilation. @@ -8869,7 +8869,7 @@ namespace ProviderImplementation.ProvidedTypes | None -> typeof.Assembly.GetName().Version // failwith "no reference to FSharp.Core found" | Some r -> r - let ilGlobals = + let ilGlobals = lazy mkILGlobals (systemRuntimeScopeRef.Force()) let mkReader ref = @@ -8880,18 +8880,18 @@ namespace ProviderImplementation.ProvidedTypes let targetAssembliesTable_ = ConcurrentDictionary>() let targetAssemblies_ = ResizeArray() let targetAssembliesQueue = ResizeArray<_>() - do targetAssembliesQueue.Add (fun () -> + do targetAssembliesQueue.Add (fun () -> for ref in referencedAssemblyPaths do - let reader = mkReader ref - let simpleName = Path.GetFileNameWithoutExtension ref + let reader = mkReader ref + let simpleName = Path.GetFileNameWithoutExtension ref targetAssembliesTable_[simpleName] <- reader - match reader with - | Choice2Of2 _ -> () + match reader with + | Choice2Of2 _ -> () | Choice1Of2 asm -> targetAssemblies_.Add asm) - let flush() = + let flush() = let qs = targetAssembliesQueue.ToArray() targetAssembliesQueue.Clear() - for q in qs do q() + for q in qs do q() let getTargetAssemblies() = flush(); targetAssemblies_ let getTargetAssembliesTable() = flush(); targetAssembliesTable_ @@ -8904,8 +8904,8 @@ namespace ProviderImplementation.ProvidedTypes let sourceAssemblies_ = ResizeArray<_>() let sourceAssembliesQueue = ResizeArray<_>() - let enqueueReferencedAssemblies(asm: Assembly) = - do sourceAssembliesQueue.Add (fun () -> + let enqueueReferencedAssemblies(asm: Assembly) = + do sourceAssembliesQueue.Add (fun () -> [| for referencedAssemblyName in asm.GetReferencedAssemblies() do if not (sourceAssembliesTable_.ContainsKey referencedAssemblyName.Name) then let referencedAssembly = try Assembly.Load(referencedAssemblyName) with _ -> null @@ -8914,12 +8914,12 @@ namespace ProviderImplementation.ProvidedTypes do sourceAssembliesQueue.Add (fun () -> List.toArray sourceAssemblies) - let getSourceAssemblies() = + let getSourceAssemblies() = while sourceAssembliesQueue.Count > 0 do let qs = sourceAssembliesQueue.ToArray() sourceAssembliesQueue.Clear() - for q in qs do - for asm in q() do + for q in qs do + for asm in q() do let simpleName = asm.GetName().Name sourceAssembliesTable_.GetOrAdd(simpleName, fun k -> sourceAssemblies_.Add asm @@ -8938,7 +8938,7 @@ namespace ProviderImplementation.ProvidedTypes let fixName (fullName:string) = if fullName.StartsWith("FSI_") then - // when F# Interactive is the host of the design time assembly, + // when F# Interactive is the host of the design time assembly, // all namespaces are prefixed with FSI_, in the runtime assembly // the name won't have that prefix fullName.Substring(fullName.IndexOf('.') + 1) @@ -8946,7 +8946,7 @@ namespace ProviderImplementation.ProvidedTypes fullName let tryGetTypeFromAssembly toTgt (originalAssemblyName:string) fullName (asm:Assembly) = - // if the original assembly of the type being replaced is in `assemblyReplacementMap`, + // if the original assembly of the type being replaced is in `assemblyReplacementMap`, // then we only map it to assemblies with a name specified in `assemblyReplacementMap` let restrictedAndMatching = assemblyReplacementMap @@ -8960,7 +8960,7 @@ namespace ProviderImplementation.ProvidedTypes if not canQuery then None elif restrictedAndMatching then None elif asm.FullName.StartsWith "FSI-ASSEMBLY" then - // when F# Interactive is the host of the design time assembly, + // when F# Interactive is the host of the design time assembly, // for each type in the runtime assembly there might be multiple // versions (FSI_0001.FullTypeName, FSI_0002.FullTypeName, etc). // Get the last one. @@ -8978,17 +8978,17 @@ namespace ProviderImplementation.ProvidedTypes match table.TryGetValue(t) with | true, newT -> newT | false, _ -> - match t with - | :? ProvidedTypeDefinition as ptd when toTgt -> + match t with + | :? ProvidedTypeDefinition as ptd when toTgt -> if ptd.IsErased && ptd.BelongsToTargetModel then failwithf "unexpected erased target ProvidedTypeDefinition '%O'" ptd // recursively get the provided type. convTypeDefToTgt t - - | _ -> + + | _ -> let asms = (if toTgt then getTargetAssemblies() else getSourceAssemblies()) let fullName = fixName t.FullName - let bestGuess = + let bestGuess = asms |> Seq.tryFind(fun a -> a.FullName = t.Assembly.FullName) |> Option.bind(fun a -> tryGetTypeFromAssembly toTgt t.Assembly.FullName fullName a) @@ -9000,8 +9000,8 @@ namespace ProviderImplementation.ProvidedTypes // TODO: this linear search through all available source/target assemblies feels as if it must be too slow in some cases. // However, we store type translations in various tables (typeTableFwd and typeTableBwd) so perhaps it is not a problem - let rec loop i = - if i < 0 then + let rec loop i = + if i < 0 then let msg = if toTgt then sprintf "The design-time type '%O' utilized by a type provider was not found in the target reference assembly set '%A'. You may be referencing a profile which contains fewer types than those needed by the type provider you are using." t (getTargetAssemblies() |> Seq.toList) elif getSourceAssemblies() |> Seq.isEmpty then sprintf "A failure occurred while determining compilation references" @@ -9052,7 +9052,7 @@ namespace ProviderImplementation.ProvidedTypes and convPropertyRefToTgt (p: PropertyInfo) = Debug.Assert((match p with :? ProvidedProperty as x -> not x.BelongsToTargetModel | _ -> true), "unexpected target ProvidedProperty") let t = convTypeToTgt p.DeclaringType - let bindingFlags = bindSome p.IsStatic + let bindingFlags = bindSome p.IsStatic let pT = t.GetProperty(p.Name, bindingFlags) if isNull pT then failwithf "Property '%O' of type '%O' not found. This property may be missing in the types available in the target assemblies." p t Debug.Assert((match pT with :? ProvidedProperty as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedProperty") @@ -9083,7 +9083,7 @@ namespace ProviderImplementation.ProvidedTypes declTyT.GetMethod(m.Name, bindSome m.IsStatic, null, parameterTypesT, null) match mT with | null -> failwithf "Method '%O' not found in type '%O'. This method may be missing in the types available in the target assemblies." m mT - | _ -> + | _ -> Debug.Assert((match mT with :? ProvidedMethod as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedMethod") mT @@ -9091,18 +9091,18 @@ namespace ProviderImplementation.ProvidedTypes Debug.Assert((match cons with :? ProvidedConstructor as x -> not x.BelongsToTargetModel | _ -> true), "unexpected target ProvidedConstructor") let declTyT = convTypeToTgt cons.DeclaringType let parameterTypesT = cons.GetParameters() |> Array.map (fun p -> convTypeToTgt p.ParameterType) - let flags = - (if cons.IsStatic then BindingFlags.Static else BindingFlags.Instance) + let flags = + (if cons.IsStatic then BindingFlags.Static else BindingFlags.Instance) ||| (if cons.IsPublic then BindingFlags.Public else BindingFlags.NonPublic ) let consT = declTyT.GetConstructor(flags, null,parameterTypesT, null ) match consT with | null -> Choice1Of2 (sprintf "Constructor '%O' not found in type '%O'. This constructor may be missing in the types available in the target assemblies." cons declTyT) - | _ -> + | _ -> Debug.Assert((match consT with :? ProvidedConstructor as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedConstructor") Choice2Of2 consT and convConstructorRefToTgt (cons: ConstructorInfo) = - match tryConvConstructorRefToTgt cons with + match tryConvConstructorRefToTgt cons with | Choice1Of2 err -> failwith err | Choice2Of2 res -> res @@ -9157,7 +9157,7 @@ namespace ProviderImplementation.ProvidedTypes | NewObject (c, exprs) -> let exprsR = List.map convExprToTgt exprs Expr.NewObjectUnchecked (convConstructorRefToTgt c, exprsR) - | DefaultValue (t) -> + | DefaultValue (t) -> Expr.DefaultValue (convTypeToTgt t) | Coerce (expr, t) -> Expr.Coerce (convExprToTgt expr, convTypeToTgt t) @@ -9208,7 +9208,7 @@ namespace ProviderImplementation.ProvidedTypes convExprToTgt <@@ (%%(tagExpr): int) = tagNumber @@> | Value (obj, ty) -> - match obj with + match obj with | :? Type as vty -> Expr.Value(convTypeToTgt vty, ty) | _ -> Expr.Value(obj, convTypeToTgt ty) @@ -9220,13 +9220,13 @@ namespace ProviderImplementation.ProvidedTypes | ShapeCombinationUnchecked (o, exprs) -> RebuildShapeCombinationUnchecked (o, List.map convExprToTgt exprs) - and convCodeToTgt (codeFun: Expr list -> Expr, isStatic, isCtor, parameters: ProvidedParameter[], isGenerated) = - (fun argsT -> + and convCodeToTgt (codeFun: Expr list -> Expr, isStatic, isCtor, parameters: ProvidedParameter[], isGenerated) = + (fun argsT -> // argsT: the target arg expressions coming from host tooling. Includes "this" for instance methods and generative constructors. // parameters: the (source) parameters specific by the TPDTC. Does not include "this" // paramNames: equal in length to argsT. The preferred named for the parameters. Seems to include "this" for instance methods and generative constructors. let args = List.map convVarExprToSrc argsT - let paramNames = + let paramNames = // https://github.com/fsprojects/SwaggerProvider/blob/cfb7a665fada77fd0200591f62faba0ba44e172c/src/SwaggerProvider.DesignTime/SwaggerProviderConfig.fs#L79 // "Erased constructors should not pass the instance as the first argument when calling invokeCode!" // "Generated constructors should always pass the instance as the first argument when calling invokeCode!" @@ -9236,8 +9236,8 @@ namespace ProviderImplementation.ProvidedTypes let codeT = convExprToTgt code2 codeT) - and convBaseCallToTgt (codeFun: Expr list -> ConstructorInfo * Expr list, isGenerated) = - (fun argsT -> + and convBaseCallToTgt (codeFun: Expr list -> ConstructorInfo * Expr list, isGenerated) = + (fun argsT -> let args = List.map convVarExprToSrc argsT let ctor, argExprs = codeFun args let argExprs2 = List.map (QuotationSimplifier(isGenerated).TranslateExpression) argExprs @@ -9247,7 +9247,7 @@ namespace ProviderImplementation.ProvidedTypes ctorT, codeT) and convMemberRefToTgt (x: MemberInfo) = - match x with + match x with | :? PropertyInfo as p -> convPropertyRefToTgt p :> MemberInfo | :? FieldInfo as p -> convFieldRefToTgt p :> MemberInfo | :? MethodInfo as p -> convMethodRefToTgt p :> MemberInfo @@ -9261,38 +9261,38 @@ namespace ProviderImplementation.ProvidedTypes and convCustomAttributesNamedArg (x: CustomAttributeNamedArgument) = CustomAttributeNamedArgument(convMemberRefToTgt x.MemberInfo, convCustomAttributesTypedArg x.TypedValue) - and tryConvCustomAttributeDataToTgt (x: CustomAttributeData) = - // Allow a fail on AllowNullLiteralAttribute. Some downlevel FSharp.Core don't have this. + and tryConvCustomAttributeDataToTgt (x: CustomAttributeData) = + // Allow a fail on AllowNullLiteralAttribute. Some downlevel FSharp.Core don't have this. // In this case just skip the attribute which means null is allowed when targeting downlevel FSharp.Core. - match tryConvConstructorRefToTgt x.Constructor with + match tryConvConstructorRefToTgt x.Constructor with | Choice1Of2 _ when x.Constructor.DeclaringType.Name = typeof.Name -> None | Choice1Of2 msg -> failwith msg - | Choice2Of2 res -> + | Choice2Of2 res -> Some { new CustomAttributeData () with member __.Constructor = res member __.ConstructorArguments = [| for arg in x.ConstructorArguments -> convCustomAttributesTypedArg arg |] :> IList<_> member __.NamedArguments = [| for arg in x.NamedArguments -> convCustomAttributesNamedArg arg |] :> IList<_> } - and convCustomAttributesDataToTgt (cattrs: IList) = - cattrs |> Array.ofSeq |> Array.choose tryConvCustomAttributeDataToTgt - + and convCustomAttributesDataToTgt (cattrs: IList) = + cattrs |> Array.ofSeq |> Array.choose tryConvCustomAttributeDataToTgt + and convProvidedTypeDefToTgt (x: ProvidedTypeDefinition) = if x.IsErased && x.BelongsToTargetModel then failwithf "unexpected target type definition '%O'" x match typeTableFwd.TryGetValue(x) with | true, newT -> (newT :?> ProvidedTypeDefinition) | false, _ -> - let container = - match x.Container with + let container = + match x.Container with | TypeContainer.Namespace(assemf, nm) -> - TypeContainer.Namespace((fun () -> - match assemf() with + TypeContainer.Namespace((fun () -> + match assemf() with | :? ProvidedAssembly as assembly -> convProvidedAssembly assembly - | assembly -> - assemblyReplacementMap - |> Seq.tryPick (fun (originalName, newName) -> + | assembly -> + assemblyReplacementMap + |> Seq.tryPick (fun (originalName, newName) -> if assembly.GetName().Name = originalName then - match this.TryBindSimpleAssemblyNameToTarget(newName) with + match this.TryBindSimpleAssemblyNameToTarget(newName) with | Choice1Of2 replacementAssembly -> Some replacementAssembly | Choice2Of2 _ -> None else @@ -9304,43 +9304,43 @@ namespace ProviderImplementation.ProvidedTypes // Create the type definition with contents mapped to the target // Use a 'let rec' to allow access to the target as the declaring // type of the contents in a delayed way. - let rec xT : ProvidedTypeDefinition = - let mutable methodsIdx = 0 - let checkFreshMethods() = + let rec xT : ProvidedTypeDefinition = + let mutable methodsIdx = 0 + let checkFreshMethods() = x.CountMembersFromCursor(methodsIdx) > 0 - - let getFreshMethods() = - let vs, idx2 = x.GetMembersFromCursor(methodsIdx) + + let getFreshMethods() = + let vs, idx2 = x.GetMembersFromCursor(methodsIdx) methodsIdx <- idx2 vs |> Array.map (convMemberDefToTgt xT) - let mutable interfacesIdx = 0 - let getFreshInterfaces() = - let vs, idx2 = x.GetInterfaceImplsFromCursor(interfacesIdx) + let mutable interfacesIdx = 0 + let getFreshInterfaces() = + let vs, idx2 = x.GetInterfaceImplsFromCursor(interfacesIdx) interfacesIdx <- idx2 vs |> Array.map convTypeToTgt - let mutable overridesIdx = 0 - let getFreshMethodOverrides() = - let vs, idx2 = x.GetMethodOverridesFromCursor(overridesIdx) + let mutable overridesIdx = 0 + let getFreshMethodOverrides() = + let vs, idx2 = x.GetMethodOverridesFromCursor(overridesIdx) overridesIdx <- idx2 vs |> Array.map (fun (a, b) -> (convMethodRefToTgt a :?> ProvidedMethod), convMethodRefToTgt b) let backingDataSource = Some (checkFreshMethods, getFreshMethods, getFreshInterfaces, getFreshMethodOverrides) - ProvidedTypeDefinition(true, container, x.Name, - (x.BaseTypeRaw >> Option.map convTypeToTgt), - x.AttributesRaw, - (x.EnumUnderlyingTypeRaw >> Option.map convTypeToTgt), - x.StaticParams |> List.map convStaticParameterDefToTgt, - x.StaticParamsApply |> Option.map (fun f s p -> - let t = f s p + ProvidedTypeDefinition(true, container, x.Name, + (x.BaseTypeRaw >> Option.map convTypeToTgt), + x.AttributesRaw, + (x.EnumUnderlyingTypeRaw >> Option.map convTypeToTgt), + x.StaticParams |> List.map convStaticParameterDefToTgt, + x.StaticParamsApply |> Option.map (fun f s p -> + let t = f s p let tT = convProvidedTypeDefToTgt t - tT), - backingDataSource, - (x.GetCustomAttributesData >> convCustomAttributesDataToTgt), - x.NonNullable, - x.HideObjectMethods, ProvidedTypeBuilder.typeBuilder) + tT), + backingDataSource, + (x.GetCustomAttributesData >> convCustomAttributesDataToTgt), + x.NonNullable, + x.HideObjectMethods, ProvidedTypeBuilder.typeBuilder) Debug.Assert(not (typeTableFwd.ContainsKey(x))) typeTableFwd[x] <- xT @@ -9350,63 +9350,63 @@ namespace ProviderImplementation.ProvidedTypes xT and convTypeDefToTgt (x: Type) = - match x with - | :? ProvidedTypeDefinition as x -> convProvidedTypeDefToTgt x :> Type + match x with + | :? ProvidedTypeDefinition as x -> convProvidedTypeDefToTgt x :> Type | _ -> x - and convParameterDefToTgt (x: ProvidedParameter) = + and convParameterDefToTgt (x: ProvidedParameter) = Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedParameter") - ProvidedParameter(true, x.Name, x.Attributes, - x.ParameterType |> convTypeToTgt, - x.OptionalValue, + ProvidedParameter(true, x.Name, x.Attributes, + x.ParameterType |> convTypeToTgt, + x.OptionalValue, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) - and convStaticParameterDefToTgt (x: ProvidedStaticParameter) = + and convStaticParameterDefToTgt (x: ProvidedStaticParameter) = Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedStaticParameter") - ProvidedStaticParameter(x.Name, convTypeToTgt x.ParameterType, ?parameterDefaultValue=x.ParameterDefaultValue) - - and convMemberDefToTgt declTyT (x: MemberInfo) = - let xT : MemberInfo = - match x with - | :? ProvidedField as x -> + ProvidedStaticParameter(x.Name, convTypeToTgt x.ParameterType, ?parameterDefaultValue=x.ParameterDefaultValue) + + and convMemberDefToTgt declTyT (x: MemberInfo) = + let xT : MemberInfo = + match x with + | :? ProvidedField as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedField") - ProvidedField(true, x.Name, x.Attributes, - x.FieldType |> convTypeToTgt, - x.GetRawConstantValue(), + ProvidedField(true, x.Name, x.Attributes, + x.FieldType |> convTypeToTgt, + x.GetRawConstantValue(), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedProperty as x -> + | :? ProvidedProperty as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedProperty") - ProvidedProperty(true, x.Name, x.Attributes, - x.PropertyType |> convTypeToTgt, - x.IsStatic, - x.Getter |> Option.map (fun f -> f >> convMethodRefToTgt), - x.Setter |> Option.map (fun f -> f >> convMethodRefToTgt), - x.IndexParameters |> Array.map convParameterDefToTgt, + ProvidedProperty(true, x.Name, x.Attributes, + x.PropertyType |> convTypeToTgt, + x.IsStatic, + x.Getter |> Option.map (fun f -> f >> convMethodRefToTgt), + x.Setter |> Option.map (fun f -> f >> convMethodRefToTgt), + x.IndexParameters |> Array.map convParameterDefToTgt, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedEvent as x -> + | :? ProvidedEvent as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedEvent") - ProvidedEvent(true, x.Name, x.Attributes, - x.EventHandlerType |> convTypeToTgt, - x.IsStatic, - (fun () -> convMethodRefToTgt x.Adder), - (fun () -> convMethodRefToTgt x.Remover), + ProvidedEvent(true, x.Name, x.Attributes, + x.EventHandlerType |> convTypeToTgt, + x.IsStatic, + (fun () -> convMethodRefToTgt x.Adder), + (fun () -> convMethodRefToTgt x.Remover), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedConstructor as x -> + | :? ProvidedConstructor as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedConstructor") - ProvidedConstructor(true, x.Attributes, - x.Parameters |> Array.map convParameterDefToTgt, - convCodeToTgt (x.GetInvokeCode, x.IsStatic, true, x.Parameters, not x.IsErased), - (match x.BaseCall with None -> None | Some f -> Some (convBaseCallToTgt(f, not x.IsErased))), - x.IsImplicitConstructor, + ProvidedConstructor(true, x.Attributes, + x.Parameters |> Array.map convParameterDefToTgt, + convCodeToTgt (x.GetInvokeCode, x.IsStatic, true, x.Parameters, not x.IsErased), + (match x.BaseCall with None -> None | Some f -> Some (convBaseCallToTgt(f, not x.IsErased))), + x.IsImplicitConstructor, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedMethod as x -> + | :? ProvidedMethod as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedMethod") - ProvidedMethod(true, x.Name, x.Attributes, - x.Parameters |> Array.map convParameterDefToTgt, - x.ReturnType |> convTypeToTgt, - x.GetInvokeCode |> Option.map (fun invokeCode -> convCodeToTgt (invokeCode, x.IsStatic, false, x.Parameters, not x.IsErased)), - x.StaticParams |> List.map convStaticParameterDefToTgt, - x.StaticParamsApply |> Option.map (fun f s p -> f s p |> convProvidedMethodDefToTgt declTyT), + ProvidedMethod(true, x.Name, x.Attributes, + x.Parameters |> Array.map convParameterDefToTgt, + x.ReturnType |> convTypeToTgt, + x.GetInvokeCode |> Option.map (fun invokeCode -> convCodeToTgt (invokeCode, x.IsStatic, false, x.Parameters, not x.IsErased)), + x.StaticParams |> List.map convStaticParameterDefToTgt, + x.StaticParamsApply |> Option.map (fun f s p -> f s p |> convProvidedMethodDefToTgt declTyT), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ | :? ProvidedTypeDefinition as x -> convTypeDefToTgt x :> _ | _ -> failwith "unknown member type" @@ -9416,10 +9416,10 @@ namespace ProviderImplementation.ProvidedTypes Debug.Assert((xT.DeclaringType :?> ProvidedTypeDefinition).BelongsToTargetModel) xT - and convProvidedMethodDefToTgt declTyT (x: ProvidedMethod) = + and convProvidedMethodDefToTgt declTyT (x: ProvidedMethod) = convMemberDefToTgt declTyT x :?> ProvidedMethod - and convProvidedAssembly (assembly: ProvidedAssembly) = + and convProvidedAssembly (assembly: ProvidedAssembly) = match assemblyTableFwd.TryGetValue(assembly) with | true, newT -> newT | false, _ -> @@ -9427,7 +9427,7 @@ namespace ProviderImplementation.ProvidedTypes for (types, enclosingGeneratedTypeNames) in assembly.GetTheTypes() do let typesT = Array.map convProvidedTypeDefToTgt types - tgtAssembly.AddTheTypes (typesT, enclosingGeneratedTypeNames) + tgtAssembly.AddTheTypes (typesT, enclosingGeneratedTypeNames) assemblyTableFwd.Add(assembly, tgtAssembly) this.AddSourceAssembly(assembly) @@ -9462,7 +9462,7 @@ namespace ProviderImplementation.ProvidedTypes member __.TryBindAssemblyNameToTarget(aref: AssemblyName): Choice = tryBindTargetAssemblySimple(aref.Name) - member __.TryBindSimpleAssemblyNameToTarget(assemblyName: string) = tryBindTargetAssemblySimple(assemblyName) + member __.TryBindSimpleAssemblyNameToTarget(assemblyName: string) = tryBindTargetAssemblySimple(assemblyName) member __.ILGlobals = ilGlobals.Value @@ -9474,12 +9474,12 @@ namespace ProviderImplementation.ProvidedTypes member __.FSharpCoreAssemblyVersion = fsharpCoreRefVersion.Force() - member this.ReadRelatedAssembly(fileName) = + member this.ReadRelatedAssembly(fileName) = let ilg = ilGlobals.Force() - let reader = ILModuleReaderAfterReadingAllBytes(fileName, ilg) + let reader = ILModuleReaderAfterReadingAllBytes(fileName, ilg) TargetAssembly(ilg, this.TryBindILAssemblyRefToTgt, Some reader, fileName, ProvidedTypeBuilder.typeBuilder) :> Assembly - member this.ReadRelatedAssembly(bytes:byte[]) = + member this.ReadRelatedAssembly(bytes:byte[]) = let fileName = "file.dll" let ilg = ilGlobals.Force() let is = ByteFile(bytes) @@ -9489,11 +9489,11 @@ namespace ProviderImplementation.ProvidedTypes let reader = ILModuleReader(fileName, mdfile, ilg, true) TargetAssembly(ilg, this.TryBindILAssemblyRefToTgt, Some reader, fileName, ProvidedTypeBuilder.typeBuilder) :> Assembly - member __.AddSourceAssembly(asm: Assembly) = + member __.AddSourceAssembly(asm: Assembly) = sourceAssembliesQueue.Add (fun () -> [| asm |]) - member __.AddTargetAssembly(asmName: AssemblyName, asm: Assembly) = - targetAssembliesQueue.Add (fun () -> + member __.AddTargetAssembly(asmName: AssemblyName, asm: Assembly) = + targetAssembliesQueue.Add (fun () -> targetAssembliesTable_[asmName.Name] <- Choice1Of2 asm targetAssemblies_.Add asm) @@ -9546,10 +9546,10 @@ namespace ProviderImplementation.ProvidedTypes let getUncodedToken (tab:ILTableName) idx = ((tab.Index <<< 24) ||| idx) - let markerForUnicodeBytes (b:byte[]) = + let markerForUnicodeBytes (b:byte[]) = let len = b.Length - let rec scan i = - i < len/2 && + let rec scan i = + i < len/2 && (let b1 = Bytes.get b (i*2) let b2 = Bytes.get b (i*2+1) (b2 <> 0) @@ -9563,19 +9563,19 @@ namespace ProviderImplementation.ProvidedTypes marker - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Fixups - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /// Check that the data held at a fixup is some special magic value, as a sanity check /// to ensure the fixup is being placed at a ood location. - let checkFixup32 (data: byte[]) offset exp = + let checkFixup32 (data: byte[]) offset exp = if data.[offset + 3] <> b3 exp then failwithf "fixup sanity check failed at %O" offset if data.[offset + 2] <> b2 exp then failwithf "fixup sanity check failed at %O" offset if data.[offset + 1] <> b1 exp then failwithf "fixup sanity check failed at %O" offset if data.[offset] <> b0 exp then failwithf "fixup sanity check failed at %O" offset - let applyFixup32 (data:byte[]) offset v = + let applyFixup32 (data:byte[]) offset v = data[offset] <- b0 v data[offset+1] <- b1 v data[offset+2] <- b2 v @@ -9585,7 +9585,7 @@ namespace ProviderImplementation.ProvidedTypes // TYPES FOR TABLES //--------------------------------------------------------------------- - module RowElementTags = + module RowElementTags = let [] UShort = 0 let [] ULong = 1 let [] Data = 2 @@ -9650,7 +9650,7 @@ namespace ProviderImplementation.ProvidedTypes let [] ResolutionScopeMax = 178 [] - type RowElement(tag:int32, idx: int32) = + type RowElement(tag:int32, idx: int32) = member __.Tag = tag member __.Val = idx @@ -9659,15 +9659,15 @@ namespace ProviderImplementation.ProvidedTypes let UShort (x:uint16) = RowElement(RowElementTags.UShort, int32 x) let ULong (x:int32) = RowElement(RowElementTags.ULong, x) /// Index into cenv.data or cenv.resources. Gets fixed up later once we known an overall - /// location for the data section. flag indicates if offset is relative to cenv.resources. + /// location for the data section. flag indicates if offset is relative to cenv.resources. let Data (x:int, k:bool) = RowElement((if k then RowElementTags.DataResources else RowElementTags.Data ), x) - /// pos. in guid array + /// pos. in guid array let Guid (x:int) = RowElement(RowElementTags.Guid, x) - /// pos. in blob array + /// pos. in blob array let Blob (x:int) = RowElement(RowElementTags.Blob, x) - /// pos. in string array + /// pos. in string array let StringE (x:int) = RowElement(RowElementTags.String, x) - /// pos. in some table + /// pos. in some table let SimpleIndex (t, x:int) = RowElement(RowElementTags.SimpleIndex t, x) let TypeDefOrRefOrSpec (t, x:int) = RowElement(RowElementTags.TypeDefOrRefOrSpec t, x) let TypeOrMethodDef (t, x:int) = RowElement(RowElementTags.TypeOrMethodDef t, x) @@ -9691,18 +9691,18 @@ namespace ProviderImplementation.ProvidedTypes let inline combineHash x2 acc = 37 * acc + x2 // (acc <<< 6 + acc >>> 2 + x2 + 0x9e3779b9) - let hashRow (elems:RowElement[]) = + let hashRow (elems:RowElement[]) = let mutable acc = 0 - for i in 0 .. elems.Length - 1 do - acc <- (acc <<< 1) + elems[i].Tag + elems[i].Val + 631 + for i in 0 .. elems.Length - 1 do + acc <- (acc <<< 1) + elems[i].Tag + elems[i].Val + 631 acc - let equalRows (elems:RowElement[]) (elems2:RowElement[]) = + let equalRows (elems:RowElement[]) (elems2:RowElement[]) = if elems.Length <> elems2.Length then false else let mutable ok = true let n = elems.Length - let mutable i = 0 - while ok && i < n do + let mutable i = 0 + while ok && i < n do if elems[i].Tag <> elems2[i].Tag || elems[i].Val <> elems2[i].Val then ok <- false i <- i + 1 ok @@ -9717,37 +9717,37 @@ namespace ProviderImplementation.ProvidedTypes type SharedRow(elems: RowElement[], hashCode: int) = member __.GenericRow = elems override __.GetHashCode() = hashCode - override __.Equals(obj:obj) = - match obj with + override __.Equals(obj:obj) = + match obj with | :? SharedRow as y -> equalRows elems y.GenericRow | _ -> false let SharedRow(elems: RowElement[]) = new SharedRow(elems, hashRow elems) /// Special representation: Note, only hashing by name - let AssemblyRefRow(s1, s2, s3, s4, l1, b1, nameIdx, str2, b2) = + let AssemblyRefRow(s1, s2, s3, s4, l1, b1, nameIdx, str2, b2) = let hashCode = hash nameIdx let genericRow = [| UShort s1; UShort s2; UShort s3; UShort s4; ULong l1; Blob b1; StringE nameIdx; StringE str2; Blob b2 |] new SharedRow(genericRow, hashCode) /// Special representation the computes the hash more efficiently - let MemberRefRow(mrp:RowElement, nmIdx:StringIndex, blobIdx:BlobIndex) = + let MemberRefRow(mrp:RowElement, nmIdx:StringIndex, blobIdx:BlobIndex) = let hashCode = combineHash (hash blobIdx) (combineHash (hash nmIdx) (hash mrp)) let genericRow = [| mrp; StringE nmIdx; Blob blobIdx |] new SharedRow(genericRow, hashCode) /// Unshared rows are used for definitional tables where elements do not need to be made unique - /// e.g. ILMethodDef and ILTypeDef. Most tables are like this. We don't precompute a + /// e.g. ILMethodDef and ILTypeDef. Most tables are like this. We don't precompute a /// hash code for these rows, and indeed the GetHashCode and Equals should not be needed. [] type UnsharedRow(elems: RowElement[]) = member __.GenericRow = elems override __.GetHashCode() = hashRow elems - override __.Equals(obj:obj) = - match obj with + override __.Equals(obj:obj) = + match obj with | :? UnsharedRow as y -> equalRows elems y.GenericRow | _ -> false - + //===================================================================== //===================================================================== @@ -9755,8 +9755,8 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== //===================================================================== - // This environment keeps track of how many generic parameters are in scope. - // This lets us translate AbsIL type variable number to IL type variable numbering + // This environment keeps track of how many generic parameters are in scope. + // This lets us translate AbsIL type variable number to IL type variable numbering type ILTypeWriterEnv = { EnclosingTyparCount: int } let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length } let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) } @@ -9769,21 +9769,21 @@ namespace ProviderImplementation.ProvidedTypes //--------------------------------------------------------------------- [] - type MetadataTable<'T> = + type MetadataTable<'T> = { name: string dict: Dictionary<'T, int> // given a row, find its entry number mutable rows: ResizeArray<'T> } member x.Count = x.rows.Count - static member New(nm, hashEq) = + static member New(nm, hashEq) = { name=nm dict = new Dictionary<_, _>(100, hashEq) rows= new ResizeArray<_>() } - member tbl.EntriesAsArray = + member tbl.EntriesAsArray = tbl.rows.ToArray() - member tbl.Entries = + member tbl.Entries = tbl.rows.ToArray() |> Array.toList member tbl.AddSharedEntry x = @@ -9804,9 +9804,9 @@ namespace ProviderImplementation.ProvidedTypes else tbl.AddSharedEntry x - /// This is only used in one special place - see further below. - member tbl.SetRowsOfTable (t: _[]) = - tbl.rows <- ResizeArray(t) + /// This is only used in one special place - see further below. + member tbl.SetRowsOfTable (t: _[]) = + tbl.rows <- ResizeArray(t) let h = tbl.dict h.Clear() t |> Array.iteri (fun i x -> h[x] <- (i+1)) @@ -9815,22 +9815,22 @@ namespace ProviderImplementation.ProvidedTypes if tbl.dict.ContainsKey x then failwith ("duplicate entry '"+geterr x+"' in "+nm+" table") else tbl.AddSharedEntry x - member tbl.GetTableEntry x = tbl.dict[x] + member tbl.GetTableEntry x = tbl.dict[x] member tbl.GetTableKeys() = tbl.dict.Keys |> Seq.toArray //--------------------------------------------------------------------- // Keys into some of the tables //--------------------------------------------------------------------- - /// We use this key type to help find ILMethodDefs for MethodRefs + /// We use this key type to help find ILMethodDefs for MethodRefs type MethodDefKey(tidx:int, garity:int, nm:string, rty:ILType, argtys:ILTypes, isStatic:bool) = - // Precompute the hash. The hash doesn't include the return type or + // Precompute the hash. The hash doesn't include the return type or // argument types (only argument type count). This is very important, since // hashing these is way too expensive - let hashCode = - hash tidx - |> combineHash (hash garity) - |> combineHash (hash nm) + let hashCode = + hash tidx + |> combineHash (hash garity) + |> combineHash (hash nm) |> combineHash (hash argtys.Length) |> combineHash (hash isStatic) member __.TypeIdx = tidx @@ -9841,37 +9841,37 @@ namespace ProviderImplementation.ProvidedTypes member __.IsStatic = isStatic override __.ToString() = sprintf "%A" (tidx, garity, nm, rty, argtys, isStatic) override __.GetHashCode() = hashCode - override __.Equals(obj:obj) = - match obj with - | :? MethodDefKey as y -> - tidx = y.TypeIdx && - garity = y.GenericArity && - nm = y.Name && + override __.Equals(obj:obj) = + match obj with + | :? MethodDefKey as y -> + tidx = y.TypeIdx && + garity = y.GenericArity && + nm = y.Name && // note: these next two use structural equality on AbstractIL ILType values - rty = y.ReturnType && + rty = y.ReturnType && argtys = y.ArgTypes && isStatic = y.IsStatic | _ -> false /// We use this key type to help find ILFieldDefs for FieldRefs - type FieldDefKey(tidx:int, nm:string, ty:ILType) = - // precompute the hash. hash doesn't include the type - let hashCode = hash tidx |> combineHash (hash nm) + type FieldDefKey(tidx:int, nm:string, ty:ILType) = + // precompute the hash. hash doesn't include the type + let hashCode = hash tidx |> combineHash (hash nm) member __.TypeIdx = tidx member __.Name = nm member __.Type = ty override __.GetHashCode() = hashCode - override __.Equals(obj:obj) = - match obj with - | :? FieldDefKey as y -> - tidx = y.TypeIdx && - nm = y.Name && - ty = y.Type + override __.Equals(obj:obj) = + match obj with + | :? FieldDefKey as y -> + tidx = y.TypeIdx && + nm = y.Name && + ty = y.Type | _ -> false type PropertyTableKey = PropKey of int (* type. def. idx. *) * string * ILType * ILTypes type EventTableKey = EventKey of int (* type. def. idx. *) * string - type TypeDefTableKey = TdKey of string list * string uoption * string + type TypeDefTableKey = TdKey of string list * string uoption * string //--------------------------------------------------------------------- // The Writer Target @@ -9884,37 +9884,37 @@ namespace ProviderImplementation.ProvidedTypes member t.FindOrAddSharedEntry(x) = match t with Shared u -> u.FindOrAddSharedEntry(x) | Unshared u -> failwithf "FindOrAddSharedEntry: incorrect table kind, u.name = %s" u.name member t.AddSharedEntry(x) = match t with | Shared u -> u.AddSharedEntry(x) | Unshared u -> failwithf "AddSharedEntry: incorrect table kind, u.name = %s" u.name member t.AddUnsharedEntry(x) = match t with Unshared u -> u.AddUnsharedEntry(x) | Shared u -> failwithf "AddUnsharedEntry: incorrect table kind, u.name = %s" u.name - member t.GenericRowsOfTable = match t with Unshared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) | Shared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) + member t.GenericRowsOfTable = match t with Unshared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) | Shared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) member t.SetRowsOfSharedTable rows = match t with Shared u -> u.SetRowsOfTable (Array.map SharedRow rows) | Unshared u -> failwithf "SetRowsOfSharedTable: incorrect table kind, u.name = %s" u.name - member t.Count = match t with Unshared u -> u.Count | Shared u -> u.Count + member t.Count = match t with Unshared u -> u.Count | Shared u -> u.Count [] - type cenv = + type cenv = { ilg: ILGlobals emitTailcalls: bool deterministic: bool showTimes: bool desiredMetadataVersion: Version requiredDataFixups: ResizeArray<(int32 * (int * bool))> - /// References to strings in codestreams: offset of code and a (fixup-location , string token) list) + /// References to strings in codestreams: offset of code and a (fixup-location , string token) list) mutable requiredStringFixups: ResizeArray<(int32 * (int * int)[])> - codeChunks: ByteBuffer + codeChunks: ByteBuffer mutable nextCodeAddr: int32 - + // Collected debug information mutable moduleGuid: byte[] generatePdb: bool - /// Raw data, to go into the data section - data: ByteBuffer - /// Raw resource data, to go into the data section - resources: ByteBuffer - mutable entrypoint: (bool * int) option + /// Raw data, to go into the data section + data: ByteBuffer + /// Raw resource data, to go into the data section + resources: ByteBuffer + mutable entrypoint: (bool * int) option /// Caches trefCache: Dictionary - /// The following are all used to generate unique items in the output + /// The following are all used to generate unique items in the output tables: MetadataTable[] AssemblyRefs: MetadataTable fieldDefs: MetadataTable @@ -9922,16 +9922,16 @@ namespace ProviderImplementation.ProvidedTypes methodDefIdxs: Dictionary propertyDefs: MetadataTable eventDefs: MetadataTable - typeDefs: MetadataTable - guids: MetadataTable - blobs: MetadataTable - strings: MetadataTable + typeDefs: MetadataTable + guids: MetadataTable + blobs: MetadataTable + strings: MetadataTable userStrings: MetadataTable } member cenv.GetTable (tab:ILTableName) = cenv.tables[tab.Index] - member cenv.AddCode ((reqdStringFixupsOffset, requiredStringFixups), code) = + member cenv.AddCode ((reqdStringFixupsOffset, requiredStringFixups), code) = cenv.requiredStringFixups.Add ((cenv.nextCodeAddr + reqdStringFixupsOffset, requiredStringFixups)) cenv.codeChunks.EmitBytes code cenv.nextCodeAddr <- cenv.nextCodeAddr + code.Length @@ -9948,24 +9948,24 @@ namespace ProviderImplementation.ProvidedTypes let AddUnsharedRow (cenv:cenv) tbl (x:UnsharedRow) = cenv.GetTable(tbl).AddUnsharedEntry x let metadataSchemaVersionSupportedByCLRVersion v = 2, 0 - - let headerVersionSupportedByCLRVersion v = - // The COM20HEADER version number - // Whidbey version numbers are 2.5 - // Earlier are 2.0 - // From an email from jeffschw: "Be built with a compiler that marks the COM20HEADER with Major >=2 and Minor >= 5. The V2.0 compilers produce images with 2.5, V1.x produces images with 2.0." + + let headerVersionSupportedByCLRVersion v = + // The COM20HEADER version number + // Whidbey version numbers are 2.5 + // Earlier are 2.0 + // From an email from jeffschw: "Be built with a compiler that marks the COM20HEADER with Major >=2 and Minor >= 5. The V2.0 compilers produce images with 2.5, V1.x produces images with 2.0." 2, 5 - let peOptionalHeaderByteByCLRVersion v = - // A flag in the PE file optional header seems to depend on CLI version - // Whidbey version numbers are 8 - // Earlier are 6 - // Tools are meant to ignore this, but the VS Profiler wants it to have the right value + let peOptionalHeaderByteByCLRVersion v = + // A flag in the PE file optional header seems to depend on CLI version + // Whidbey version numbers are 8 + // Earlier are 6 + // Tools are meant to ignore this, but the VS Profiler wants it to have the right value 8 - - // returned by writeBinaryAndReportMappings + + // returned by writeBinaryAndReportMappings [] - type ILTokenMappings = + type ILTokenMappings = { TypeDefTokenMap: ILTypeDef list * ILTypeDef -> int32 FieldDefTokenMap: ILTypeDef list * ILTypeDef -> ILFieldDef -> int32 MethodDefTokenMap: ILTypeDef list * ILTypeDef -> ILMethodDef -> int32 @@ -9973,295 +9973,295 @@ namespace ProviderImplementation.ProvidedTypes EventTokenMap: ILTypeDef list * ILTypeDef -> ILEventDef -> int32 } let recordRequiredDataFixup (requiredDataFixups: ResizeArray<_>) (buf: ByteBuffer) pos lab = - requiredDataFixups.Add((pos, lab)) - // Write a special value in that we check later when applying the fixup + requiredDataFixups.Add((pos, lab)) + // Write a special value in that we check later when applying the fixup buf.EmitInt32 0xdeaddddd //--------------------------------------------------------------------- // The UserString, BlobHeap, GuidHeap tables //--------------------------------------------------------------------- - let GetUserStringHeapIdx cenv s = + let GetUserStringHeapIdx cenv s = cenv.userStrings.FindOrAddSharedEntry s - let GetBytesAsBlobIdx cenv (bytes:byte[]) = - if bytes.Length = 0 then 0 + let GetBytesAsBlobIdx cenv (bytes:byte[]) = + if bytes.Length = 0 then 0 else cenv.blobs.FindOrAddSharedEntry bytes - let GetStringHeapIdx cenv s = - if s = "" then 0 + let GetStringHeapIdx cenv s = + if s = "" then 0 else cenv.strings.FindOrAddSharedEntry s let GetGuidIdx cenv info = cenv.guids.FindOrAddSharedEntry info let GetStringHeapIdxOption cenv sopt = - match sopt with + match sopt with | USome ns -> GetStringHeapIdx cenv ns | UNone -> 0 - let splitNameAt (nm:string) idx = + let splitNameAt (nm:string) idx = if idx < 0 then failwithf "splitNameAt: idx < 0: %O" idx; - let last = nm.Length - 1 + let last = nm.Length - 1 if idx > last then failwithf "splitNameAt: idx > last: %O %O" idx last; - (nm.Substring(0, idx)), + (nm.Substring(0, idx)), (if idx < last then nm.Substring (idx+1, last - idx) else "") - module String = + module String = let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index for the character was not found in the string")) - let index (s:string) (c:char) = - let r = s.IndexOf(c) + let index (s:string) (c:char) = + let r = s.IndexOf(c) if r = -1 then indexNotFound() else r let rindex (s:string) (c:char) = - let r = s.LastIndexOf(c) + let r = s.LastIndexOf(c) if r = -1 then indexNotFound() else r - let contains (s:string) (c:char) = + let contains (s:string) (c:char) = s.IndexOf(c, 0, String.length s) <> -1 - let splitTypeNameRightAux nm = - if String.contains nm '.' then + let splitTypeNameRightAux nm = + if String.contains nm '.' then let idx = String.rindex nm '.' let s1, s2 = splitNameAt nm idx - Some s1, s2 + Some s1, s2 else None, nm let splitTypeNameRight nm = splitTypeNameRightAux nm let GetTypeNameAsElemPair cenv (n1, n2) = - StringE (GetStringHeapIdxOption cenv n1), + StringE (GetStringHeapIdxOption cenv n1), StringE (GetStringHeapIdx cenv n2) //===================================================================== - // Pass 1 - allocate indexes for types + // Pass 1 - allocate indexes for types //===================================================================== let addILTypeName enc (td: ILTypeDef) = enc@[(if td.IsNested then td.Name else joinILTypeName td.Namespace td.Name)] - let rec GenTypeDefPass1 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass1 enc cenv (td:ILTypeDef) = ignore (cenv.typeDefs.AddUniqueEntry "type index" (fun (TdKey (_, _, n)) -> n) (TdKey (enc, td.Namespace, td.Name))) GenTypeDefsPass1 (addILTypeName enc td) cenv td.NestedTypes.Entries and GenTypeDefsPass1 enc cenv tds = Array.iter (GenTypeDefPass1 enc cenv) tds //===================================================================== - // Pass 2 - allocate indexes for methods and fields and write rows for types + // Pass 2 - allocate indexes for methods and fields and write rows for types //===================================================================== - let rec GetIdxForTypeDef cenv key = + let rec GetIdxForTypeDef cenv key = try cenv.typeDefs.GetTableEntry key - with - :? KeyNotFoundException -> + with + :? KeyNotFoundException -> let (TdKey (enc, nsp, n) ) = key failwithf "One of your modules expects the type '%s' to be defined within the module being emitted. keys = %A" (String.concat "." (enc@[joinILTypeName nsp n])) (cenv.typeDefs.GetTableKeys()) 0 - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Assembly and module references - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let rec GetAssemblyRefAsRow cenv (aref:ILAssemblyRef) = - AssemblyRefRow - ((match aref.Version with UNone -> 0us | USome v -> uint16 v.Major), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Minor), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Build), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Revision), + AssemblyRefRow + ((match aref.Version with UNone -> 0us | USome v -> uint16 v.Major), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Minor), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Build), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Revision), ((match aref.PublicKey with USome (PublicKey _) -> 0x0001 | _ -> 0x0000) - ||| (if aref.Retargetable then 0x0100 else 0x0000)), - BlobIndex (match aref.PublicKey with - | UNone -> 0 - | USome (PublicKey b | PublicKeyToken b) -> GetBytesAsBlobIdx cenv b), - StringIndex (GetStringHeapIdx cenv aref.Name), - StringIndex (match aref.Locale with UNone -> 0 | USome s -> GetStringHeapIdx cenv s), + ||| (if aref.Retargetable then 0x0100 else 0x0000)), + BlobIndex (match aref.PublicKey with + | UNone -> 0 + | USome (PublicKey b | PublicKeyToken b) -> GetBytesAsBlobIdx cenv b), + StringIndex (GetStringHeapIdx cenv aref.Name), + StringIndex (match aref.Locale with UNone -> 0 | USome s -> GetStringHeapIdx cenv s), BlobIndex (match aref.Hash with UNone -> 0 | USome s -> GetBytesAsBlobIdx cenv s)) - - and GetAssemblyRefAsIdx cenv aref = + + and GetAssemblyRefAsIdx cenv aref = FindOrAddSharedRow cenv ILTableNames.AssemblyRef (GetAssemblyRefAsRow cenv aref) and GetModuleRefAsRow cenv (mref:ILModuleRef) = - SharedRow + SharedRow [| StringE (GetStringHeapIdx cenv mref.Name) |] and GetModuleRefAsFileRow cenv (mref:ILModuleRef) = - SharedRow + SharedRow [| ULong (if mref.HasMetadata then 0x0000 else 0x0001) StringE (GetStringHeapIdx cenv mref.Name) (match mref.Hash with UNone -> Blob 0 | USome s -> Blob (GetBytesAsBlobIdx cenv s)) |] - and GetModuleRefAsIdx cenv mref = + and GetModuleRefAsIdx cenv mref = FindOrAddSharedRow cenv ILTableNames.ModuleRef (GetModuleRefAsRow cenv mref) - and GetModuleRefAsFileIdx cenv mref = + and GetModuleRefAsFileIdx cenv mref = FindOrAddSharedRow cenv ILTableNames.File (GetModuleRefAsFileRow cenv mref) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Does a ILScopeRef point to this module? - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let isScopeRefLocal scoref = (scoref = ILScopeRef.Local) + let isScopeRefLocal scoref = (scoref = ILScopeRef.Local) let rec isTypeRefLocal (tref:ILTypeRef) = - isILTypeScopeRefLocal tref.Scope + isILTypeScopeRefLocal tref.Scope and isILTypeScopeRefLocal (scoref:ILTypeRefScope) = - match scoref with + match scoref with | ILTypeRefScope.Top t -> isScopeRefLocal t | ILTypeRefScope.Nested tref -> isTypeRefLocal tref let rec enclosing (scoref:ILTypeRefScope) = - match scoref with + match scoref with | ILTypeRefScope.Top _ -> [] | ILTypeRefScope.Nested tref -> enclosing tref.Scope @ [joinILTypeName tref.Namespace tref.Name] let isTypeLocal (typ:ILType) = typ.IsNominal && isEmpty typ.GenericArgs && isTypeRefLocal typ.TypeRef - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Scopes to Implementation elements. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetScopeRefAsImplementationElem cenv scoref = - match scoref with + let GetScopeRefAsImplementationElem cenv scoref = + match scoref with | ILScopeRef.Local -> (ImplementationTag.AssemblyRef, 0) | ILScopeRef.Assembly aref -> (ImplementationTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) | ILScopeRef.Module mref -> (ImplementationTag.File, GetModuleRefAsFileIdx cenv mref) - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Type references, types etc. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetTypeRefAsTypeRefRow cenv (tref:ILTypeRef) = + let rec GetTypeRefAsTypeRefRow cenv (tref:ILTypeRef) = let nselem, nelem = GetTypeNameAsElemPair cenv (tref.Namespace, tref.Name) let rs1, rs2 = GetResolutionScopeAsElem cenv tref.Scope SharedRow [| ResolutionScope (rs1, rs2); nelem; nselem |] - and GetTypeRefAsTypeRefIdx cenv tref = + and GetTypeRefAsTypeRefIdx cenv tref = let mutable res = 0 - if cenv.trefCache.TryGetValue(tref, &res) then res else + if cenv.trefCache.TryGetValue(tref, &res) then res else let res = FindOrAddSharedRow cenv ILTableNames.TypeRef (GetTypeRefAsTypeRefRow cenv tref) cenv.trefCache[tref] <- res res - and GetTypeDescAsTypeRefIdx cenv (enc, nsp, n) = + and GetTypeDescAsTypeRefIdx cenv (enc, nsp, n) = GetTypeRefAsTypeRefIdx cenv (ILTypeRef (enc, nsp, n)) - and GetResolutionScopeAsElem cenv scoref = - match scoref with - | ILTypeRefScope.Top s -> - match s with - | ILScopeRef.Local -> (ResolutionScopeTag.Module, 1) + and GetResolutionScopeAsElem cenv scoref = + match scoref with + | ILTypeRefScope.Top s -> + match s with + | ILScopeRef.Local -> (ResolutionScopeTag.Module, 1) | ILScopeRef.Assembly aref -> (ResolutionScopeTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) | ILScopeRef.Module mref -> (ResolutionScopeTag.ModuleRef, GetModuleRefAsIdx cenv mref) - - | ILTypeRefScope.Nested tref -> + + | ILTypeRefScope.Nested tref -> (ResolutionScopeTag.TypeRef, GetTypeRefAsTypeRefIdx cenv tref) - - let emitTypeInfoAsTypeDefOrRefEncoded cenv (bb: ByteBuffer) (scoref, nsp, nm) = - if isILTypeScopeRefLocal scoref then + + let emitTypeInfoAsTypeDefOrRefEncoded cenv (bb: ByteBuffer) (scoref, nsp, nm) = + if isILTypeScopeRefLocal scoref then let idx = GetIdxForTypeDef cenv (TdKey(enclosing scoref, nsp, nm)) - bb.EmitZ32 (idx <<< 2) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeDef - else + bb.EmitZ32 (idx <<< 2) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeDef + else let idx = GetTypeDescAsTypeRefIdx cenv (scoref, nsp, nm) - bb.EmitZ32 ((idx <<< 2) ||| 0x01) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeRef + bb.EmitZ32 ((idx <<< 2) ||| 0x01) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeRef let getTypeDefOrRefAsUncodedToken (tag, idx) = - let tab = - if tag = TypeDefOrRefOrSpecTag.TypeDef then ILTableNames.TypeDef - elif tag = TypeDefOrRefOrSpecTag.TypeRef then ILTableNames.TypeRef + let tab = + if tag = TypeDefOrRefOrSpecTag.TypeDef then ILTableNames.TypeDef + elif tag = TypeDefOrRefOrSpecTag.TypeRef then ILTableNames.TypeRef elif tag = TypeDefOrRefOrSpecTag.TypeSpec then ILTableNames.TypeSpec else failwith "getTypeDefOrRefAsUncodedToken" getUncodedToken tab idx // REVIEW: write into an accumulating buffer - let EmitArrayShape (bb: ByteBuffer) (ILArrayShape shape) = + let EmitArrayShape (bb: ByteBuffer) (ILArrayShape shape) = let sized = Array.filter (function (_, USome _) -> true | _ -> false) shape let lobounded = Array.filter (function (USome _, _) -> true | _ -> false) shape bb.EmitZ32 shape.Length bb.EmitZ32 sized.Length sized |> Array.iter (function (_, USome sz) -> bb.EmitZ32 sz | c -> failwithf "%O ?" c) bb.EmitZ32 lobounded.Length - lobounded |> Array.iter (function (USome low, _) -> bb.EmitZ32 low | c -> failwithf "%O ?" c) - + lobounded |> Array.iter (function (USome low, _) -> bb.EmitZ32 low | c -> failwithf "%O ?" c) + let hasthisToByte hasthis = - match hasthis with + match hasthis with | ILThisConvention.Instance -> e_IMAGE_CEE_CS_CALLCONV_INSTANCE | ILThisConvention.InstanceExplicit -> e_IMAGE_CEE_CS_CALLCONV_INSTANCE_EXPLICIT | ILThisConvention.Static -> 0x00uy - let callconvToByte ntypars (Callconv (hasthis, bcc)) = + let callconvToByte ntypars (Callconv (hasthis, bcc)) = hasthisToByte hasthis ||| (if ntypars > 0 then e_IMAGE_CEE_CS_CALLCONV_GENERIC else 0x00uy) ||| - (match bcc with + (match bcc with | ILArgConvention.FastCall -> e_IMAGE_CEE_CS_CALLCONV_FASTCALL | ILArgConvention.StdCall -> e_IMAGE_CEE_CS_CALLCONV_STDCALL | ILArgConvention.ThisCall -> e_IMAGE_CEE_CS_CALLCONV_THISCALL | ILArgConvention.CDecl -> e_IMAGE_CEE_CS_CALLCONV_CDECL | ILArgConvention.Default -> 0x00uy | ILArgConvention.VarArg -> e_IMAGE_CEE_CS_CALLCONV_VARARG) - + // REVIEW: write into an accumulating buffer - let rec EmitTypeSpec cenv env (bb: ByteBuffer) (et, tspec:ILTypeSpec) = - if isEmpty tspec.GenericArgs then + let rec EmitTypeSpec cenv env (bb: ByteBuffer) (et, tspec:ILTypeSpec) = + if isEmpty tspec.GenericArgs then bb.EmitByte et emitTypeInfoAsTypeDefOrRefEncoded cenv bb (tspec.Scope, tspec.Namespace, tspec.Name) - else + else bb.EmitByte et_WITH bb.EmitByte et emitTypeInfoAsTypeDefOrRefEncoded cenv bb (tspec.Scope, tspec.Namespace, tspec.Name) bb.EmitZ32 tspec.GenericArgs.Length EmitTypes cenv env bb tspec.GenericArgs - and GetTypeAsTypeDefOrRef cenv env (ty:ILType) = - if isTypeLocal ty then + and GetTypeAsTypeDefOrRef cenv env (ty:ILType) = + if isTypeLocal ty then let tref = ty.TypeRef (TypeDefOrRefOrSpecTag.TypeDef, GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name))) elif ty.IsNominal && isEmpty ty.GenericArgs then (TypeDefOrRefOrSpecTag.TypeRef, GetTypeRefAsTypeRefIdx cenv ty.TypeRef) - else + else (TypeDefOrRefOrSpecTag.TypeSpec, GetTypeAsTypeSpecIdx cenv env ty) and GetTypeAsBytes cenv env ty = emitBytesViaBuffer (fun bb -> EmitType cenv env bb ty) - and GetTypeOfLocalAsBytes cenv env (l: ILLocal) = + and GetTypeOfLocalAsBytes cenv env (l: ILLocal) = emitBytesViaBuffer (fun bb -> EmitLocalInfo cenv env bb l) - and GetTypeAsBlobIdx cenv env (ty:ILType) = + and GetTypeAsBlobIdx cenv env (ty:ILType) = GetBytesAsBlobIdx cenv (GetTypeAsBytes cenv env ty) - and GetTypeAsTypeSpecRow cenv env (ty:ILType) = + and GetTypeAsTypeSpecRow cenv env (ty:ILType) = SharedRow [| Blob (GetTypeAsBlobIdx cenv env ty) |] - and GetTypeAsTypeSpecIdx cenv env ty = + and GetTypeAsTypeSpecIdx cenv env ty = FindOrAddSharedRow cenv ILTableNames.TypeSpec (GetTypeAsTypeSpecRow cenv env ty) and EmitType cenv env bb ty = - match ty with + match ty with | ElementType et -> bb.EmitByte et | ILType.Boxed tspec -> EmitTypeSpec cenv env bb (et_CLASS, tspec) | ILType.Value tspec -> EmitTypeSpec cenv env bb (et_VALUETYPE, tspec) - | ILType.Array (shape, ty) -> + | ILType.Array (shape, ty) -> if shape = ILArrayShape.SingleDimensional then (bb.EmitByte et_SZARRAY ; EmitType cenv env bb ty) else (bb.EmitByte et_ARRAY; EmitType cenv env bb ty; EmitArrayShape bb shape) - | ILType.Var tv -> + | ILType.Var tv -> let cgparams = env.EnclosingTyparCount - if int32 tv < cgparams then + if int32 tv < cgparams then bb.EmitByte et_VAR bb.EmitZ32 (int32 tv) else bb.EmitByte et_MVAR bb.EmitZ32 (int32 tv - cgparams) - | ILType.Byref typ -> + | ILType.Byref typ -> bb.EmitByte et_BYREF EmitType cenv env bb typ - | ILType.Ptr typ -> + | ILType.Ptr typ -> bb.EmitByte et_PTR EmitType cenv env bb typ - | ILType.Void -> - bb.EmitByte et_VOID + | ILType.Void -> + bb.EmitByte et_VOID | ILType.FunctionPointer x -> bb.EmitByte et_FNPTR EmitCallsig cenv env bb (x.CallingConv, x.ArgTypes, x.ReturnType, None, 0) @@ -10271,31 +10271,31 @@ namespace ProviderImplementation.ProvidedTypes EmitType cenv env bb ty and EmitLocalInfo cenv env (bb:ByteBuffer) (l:ILLocal) = - if l.IsPinned then + if l.IsPinned then bb.EmitByte et_PINNED EmitType cenv env bb l.Type - and EmitCallsig cenv env (bb:ByteBuffer) (callconv, args:ILTypes, ret, varargs:ILVarArgs, genarity) = + and EmitCallsig cenv env (bb:ByteBuffer) (callconv, args:ILTypes, ret, varargs:ILVarArgs, genarity) = bb.EmitByte (callconvToByte genarity callconv) if genarity > 0 then bb.EmitZ32 genarity bb.EmitZ32 ((args.Length + (match varargs with None -> 0 | Some l -> l.Length))) EmitType cenv env bb ret args |> Array.iter (EmitType cenv env bb) - match varargs with - | None -> ()// no extra arg = no sentinel - | Some tys -> - if isEmpty tys then () // no extra arg = no sentinel - else + match varargs with + | None -> ()// no extra arg = no sentinel + | Some tys -> + if isEmpty tys then () // no extra arg = no sentinel + else bb.EmitByte et_SENTINEL Array.iter (EmitType cenv env bb) tys and GetCallsigAsBytes cenv env x = emitBytesViaBuffer (fun bb -> EmitCallsig cenv env bb x) - and EmitTypes cenv env bb (inst: ILTypes) = - inst |> Array.iter (EmitType cenv env bb) + and EmitTypes cenv env bb (inst: ILTypes) = + inst |> Array.iter (EmitType cenv env bb) let GetTypeAsMemberRefParent cenv env ty = - match GetTypeAsTypeDefOrRef cenv env ty with + match GetTypeAsTypeDefOrRef cenv env ty with | (tag, _) when tag = TypeDefOrRefOrSpecTag.TypeDef -> printfn "GetTypeAsMemberRefParent: mspec should have been encoded as mdtMethodDef?"; MemberRefParent (MemberRefParentTag.TypeRef, 1) | (tag, tok) when tag = TypeDefOrRefOrSpecTag.TypeRef -> MemberRefParent (MemberRefParentTag.TypeRef, tok) | (tag, tok) when tag = TypeDefOrRefOrSpecTag.TypeSpec -> MemberRefParent (MemberRefParentTag.TypeSpec, tok) @@ -10304,16 +10304,16 @@ namespace ProviderImplementation.ProvidedTypes - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Native types - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldInitAsBlobIdx cenv (x:ILFieldInit) = + let rec GetFieldInitAsBlobIdx cenv (x:ILFieldInit) = GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> GetFieldInit bb x)) // REVIEW: write into an accumulating buffer - and GetFieldInit (bb: ByteBuffer) x = - match x with + and GetFieldInit (bb: ByteBuffer) x = + match x with | :? string as b -> bb.EmitBytes (Encoding.Unicode.GetBytes b) | :? bool as b -> bb.EmitByte (if b then 0x01uy else 0x00uy) | :? char as x -> bb.EmitUInt16 (uint16 x) @@ -10329,10 +10329,10 @@ namespace ProviderImplementation.ProvidedTypes | :? double as x -> bb.EmitInt64 (bitsOfDouble x) | _ -> bb.EmitInt32 0 - and GetFieldInitFlags (i: ILFieldInit) = - UShort + and GetFieldInitFlags (i: ILFieldInit) = + UShort (uint16 - (match i with + (match i with | :? string -> et_STRING | :? bool -> et_BOOLEAN | :? char -> et_CHAR @@ -10347,13 +10347,13 @@ namespace ProviderImplementation.ProvidedTypes | :? single -> et_R4 | :? double -> et_R8 | _ -> et_CLASS)) - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Type definitions - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetMemberAccessFlags access = - match access with + let GetMemberAccessFlags access = + match access with | ILMemberAccess.CompilerControlled -> 0x00000000 | ILMemberAccess.Public -> 0x00000006 | ILMemberAccess.Private -> 0x00000001 @@ -10362,8 +10362,8 @@ namespace ProviderImplementation.ProvidedTypes | ILMemberAccess.FamilyOrAssembly -> 0x00000005 | ILMemberAccess.Assembly -> 0x00000003 - let GetTypeAccessFlags access = - match access with + let GetTypeAccessFlags access = + match access with | ILTypeDefAccess.Public -> 0x00000001 | ILTypeDefAccess.Private -> 0x00000000 | ILTypeDefAccess.Nested ILMemberAccess.Public -> 0x00000002 @@ -10374,20 +10374,20 @@ namespace ProviderImplementation.ProvidedTypes | ILTypeDefAccess.Nested ILMemberAccess.Assembly -> 0x00000005 | ILTypeDefAccess.Nested ILMemberAccess.CompilerControlled -> failwith "bad type access" - let rec GetTypeDefAsRow cenv env _enc (td:ILTypeDef) = + let rec GetTypeDefAsRow cenv env _enc (td:ILTypeDef) = let nselem, nelem = GetTypeNameAsElemPair cenv (td.Namespace, td.Name) - let flags = + let flags = if td.Name = "" then 0x00000000 else - + int td.Attributes ||| - begin - match td.Layout with + begin + match td.Layout with | ILTypeDefLayout.Auto -> 0x00000000 | ILTypeDefLayout.Sequential _ -> 0x00000008 | ILTypeDefLayout.Explicit _ -> 0x00000010 end ||| - begin + begin match td.Kind with | ILTypeDefKind.Interface -> 0x00000020 | _ -> 0x00000000 @@ -10399,98 +10399,98 @@ namespace ProviderImplementation.ProvidedTypes 0x0 let tdorTag, tdorRow = GetTypeOptionAsTypeDefOrRef cenv env td.Extends - UnsharedRow - [| ULong flags - nelem - nselem - TypeDefOrRefOrSpec (tdorTag, tdorRow) - SimpleIndex (ILTableNames.Field, cenv.fieldDefs.Count + 1) - SimpleIndex (ILTableNames.Method, cenv.methodDefIdxsByKey.Count + 1) |] - - and GetTypeOptionAsTypeDefOrRef cenv env tyOpt = + UnsharedRow + [| ULong flags + nelem + nselem + TypeDefOrRefOrSpec (tdorTag, tdorRow) + SimpleIndex (ILTableNames.Field, cenv.fieldDefs.Count + 1) + SimpleIndex (ILTableNames.Method, cenv.methodDefIdxsByKey.Count + 1) |] + + and GetTypeOptionAsTypeDefOrRef cenv env tyOpt = match tyOpt with | None -> (TypeDefOrRefOrSpecTag.TypeDef, 0) | Some ty -> (GetTypeAsTypeDefOrRef cenv env ty) - and GetTypeDefAsPropertyMapRow cenv tidx = + and GetTypeDefAsPropertyMapRow cenv tidx = UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) - SimpleIndex (ILTableNames.Property, cenv.propertyDefs.Count + 1) |] + SimpleIndex (ILTableNames.Property, cenv.propertyDefs.Count + 1) |] - and GetTypeDefAsEventMapRow cenv tidx = + and GetTypeDefAsEventMapRow cenv tidx = UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) - SimpleIndex (ILTableNames.Event, cenv.eventDefs.Count + 1) |] - - and GetKeyForFieldDef tidx (fd: ILFieldDef) = + SimpleIndex (ILTableNames.Event, cenv.eventDefs.Count + 1) |] + + and GetKeyForFieldDef tidx (fd: ILFieldDef) = FieldDefKey (tidx, fd.Name, fd.FieldType) - and GenFieldDefPass2 cenv tidx fd = + and GenFieldDefPass2 cenv tidx fd = ignore (cenv.fieldDefs.AddUniqueEntry "field" (fun (fdkey:FieldDefKey) -> fdkey.Name) (GetKeyForFieldDef tidx fd)) - and GetKeyForMethodDef tidx (md: ILMethodDef) = + and GetKeyForMethodDef tidx (md: ILMethodDef) = MethodDefKey (tidx, md.GenericParams.Length, md.Name, md.Return.Type, md.ParameterTypes, md.CallingConv.IsStatic) - and GenMethodDefPass2 cenv tidx md = - let idx = + and GenMethodDefPass2 cenv tidx md = + let idx = cenv.methodDefIdxsByKey.AddUniqueEntry - "method" - (fun (key:MethodDefKey) -> + "method" + (fun (key:MethodDefKey) -> printfn "Duplicate in method table is:" printfn "%s" (" Type index: "+string key.TypeIdx) printfn "%s" (" Method name: "+key.Name) printfn "%s" (" Method arity (num generic params): "+string key.GenericArity) key.Name ) - (GetKeyForMethodDef tidx md) - + (GetKeyForMethodDef tidx md) + cenv.methodDefIdxs[md] <- idx - and GetKeyForPropertyDef tidx (x: ILPropertyDef) = + and GetKeyForPropertyDef tidx (x: ILPropertyDef) = PropKey (tidx, x.Name, x.PropertyType, x.IndexParameterTypes) - and GenPropertyDefPass2 cenv tidx x = + and GenPropertyDefPass2 cenv tidx x = ignore (cenv.propertyDefs.AddUniqueEntry "property" (fun (PropKey (_, n, _, _)) -> n) (GetKeyForPropertyDef tidx x)) and GetTypeAsImplementsRow cenv env tidx ty = let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env ty - UnsharedRow - [| SimpleIndex (ILTableNames.TypeDef, tidx) + UnsharedRow + [| SimpleIndex (ILTableNames.TypeDef, tidx) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] and GenImplementsPass2 cenv env tidx ty = AddUnsharedRow cenv ILTableNames.InterfaceImpl (GetTypeAsImplementsRow cenv env tidx ty) |> ignore - - and GetKeyForEvent tidx (x: ILEventDef) = + + and GetKeyForEvent tidx (x: ILEventDef) = EventKey (tidx, x.Name) - and GenEventDefPass2 cenv tidx x = + and GenEventDefPass2 cenv tidx x = ignore (cenv.eventDefs.AddUniqueEntry "event" (fun (EventKey(_, b)) -> b) (GetKeyForEvent tidx x)) and GenTypeDefPass2 pidx enc cenv (td:ILTypeDef) = - try + try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) let tidx2 = AddUnsharedRow cenv ILTableNames.TypeDef (GetTypeDefAsRow cenv env enc td) if tidx <> tidx2 then failwith "index of typedef on second pass does not match index on first pass" - // Add entries to auxiliary mapping tables, e.g. Nested, PropertyMap etc. - // Note Nested is organised differently to the others... + // Add entries to auxiliary mapping tables, e.g. Nested, PropertyMap etc. + // Note Nested is organised differently to the others... if not (isNil enc) then - AddUnsharedRow cenv ILTableNames.Nested - (UnsharedRow - [| SimpleIndex (ILTableNames.TypeDef, tidx) + AddUnsharedRow cenv ILTableNames.Nested + (UnsharedRow + [| SimpleIndex (ILTableNames.TypeDef, tidx) SimpleIndex (ILTableNames.TypeDef, pidx) |]) |> ignore let props = td.Properties.Entries - if not (isEmpty props) then - AddUnsharedRow cenv ILTableNames.PropertyMap (GetTypeDefAsPropertyMapRow cenv tidx) |> ignore + if not (isEmpty props) then + AddUnsharedRow cenv ILTableNames.PropertyMap (GetTypeDefAsPropertyMapRow cenv tidx) |> ignore let events = td.Events.Entries - if not (isEmpty events) then + if not (isEmpty events) then AddUnsharedRow cenv ILTableNames.EventMap (GetTypeDefAsEventMapRow cenv tidx) |> ignore - // 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. + // 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. td.Implements |> Array.iter (GenImplementsPass2 cenv env tidx) props |> Array.iter (GenPropertyDefPass2 cenv tidx) events |> Array.iter (GenEventDefPass2 cenv tidx) @@ -10508,56 +10508,56 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== exception MethodDefNotFound - let FindMethodDefIdx cenv mdkey = + let FindMethodDefIdx cenv mdkey = try cenv.methodDefIdxsByKey.GetTableEntry mdkey - with :? KeyNotFoundException -> - let typeNameOfIdx i = - match - (cenv.typeDefs.dict - |> Seq.fold (fun sofar kvp -> - let tkey2 = kvp.Key - let tidx2 = kvp.Value - if i = tidx2 then - if sofar = None then - Some tkey2 - else failwith "multiple type names map to index" - else sofar) None) with + with :? KeyNotFoundException -> + let typeNameOfIdx i = + match + (cenv.typeDefs.dict + |> Seq.fold (fun sofar kvp -> + let tkey2 = kvp.Key + let tidx2 = kvp.Value + if i = tidx2 then + if sofar = None then + Some tkey2 + else failwith "multiple type names map to index" + else sofar) None) with | Some x -> x - | None -> raise MethodDefNotFound + | None -> raise MethodDefNotFound let (TdKey (tenc, tnsp, tname)) = typeNameOfIdx mdkey.TypeIdx printfn "%s" ("The local method '"+(String.concat "." (tenc@[tname]))+"'::'"+mdkey.Name+"' was referenced but not declared") printfn "generic arity: %s " (string mdkey.GenericArity) - cenv.methodDefIdxsByKey.dict |> Seq.iter (fun (KeyValue(mdkey2, _)) -> - if mdkey2.TypeIdx = mdkey.TypeIdx && mdkey.Name = mdkey2.Name then + cenv.methodDefIdxsByKey.dict |> Seq.iter (fun (KeyValue(mdkey2, _)) -> + if mdkey2.TypeIdx = mdkey.TypeIdx && mdkey.Name = mdkey2.Name then let (TdKey (tenc2, tnsp2, tname2)) = typeNameOfIdx mdkey2.TypeIdx printfn "%s" ("A method in '"+(String.concat "." (tenc2@[tname2]))+"' had the right name but the wrong signature:") - printfn "%s" ("generic arity: "+string mdkey2.GenericArity) + printfn "%s" ("generic arity: "+string mdkey2.GenericArity) printfn "mdkey2 = %s" (mdkey2.ToString())) raise MethodDefNotFound - let rec GetMethodDefIdx cenv md = + let rec GetMethodDefIdx cenv md = cenv.methodDefIdxs[md] - and FindFieldDefIdx cenv fdkey = - try cenv.fieldDefs.GetTableEntry fdkey - with :? KeyNotFoundException -> + and FindFieldDefIdx cenv fdkey = + try cenv.fieldDefs.GetTableEntry fdkey + with :? KeyNotFoundException -> failwith ("The local field "+fdkey.Name+" was referenced but not declared") 1 - and GetFieldDefAsFieldDefIdx cenv tidx fd = - FindFieldDefIdx cenv (GetKeyForFieldDef tidx fd) + and GetFieldDefAsFieldDefIdx cenv tidx fd = + FindFieldDefIdx cenv (GetKeyForFieldDef tidx fd) - // -------------------------------------------------------------------- - // ILMethodRef --> ILMethodDef. - // - // Only successfully converts ILMethodRef's referring to + // -------------------------------------------------------------------- + // ILMethodRef --> ILMethodDef. + // + // Only successfully converts ILMethodRef's referring to // methods in the module being emitted. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let GetMethodRefAsMethodDefIdx cenv (mref:ILMethodRef) = let tref = mref.EnclosingTypeRef - try + try if not (isTypeRefLocal tref) then failwithf "method referred to by method impl, event or property is not in a type defined in this module, method ref is %A" mref let tidx = GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name)) @@ -10567,14 +10567,14 @@ namespace ProviderImplementation.ProvidedTypes failwithf "Error in GetMethodRefAsMethodDefIdx for mref = %A, error: %s" (mref.Name, tref.Name) e.Message let rec MethodRefInfoAsMemberRefRow cenv env fenv (nm, typ, callconv, args, ret, varargs, genarity) = - MemberRefRow(GetTypeAsMemberRefParent cenv env typ, - GetStringHeapIdx cenv nm, + MemberRefRow(GetTypeAsMemberRefParent cenv env typ, + GetStringHeapIdx cenv nm, GetMethodRefInfoAsBlobIdx cenv fenv (callconv, args, ret, varargs, genarity)) - and GetMethodRefInfoAsBlobIdx cenv env info = + and GetMethodRefInfoAsBlobIdx cenv env info = GetBytesAsBlobIdx cenv (GetCallsigAsBytes cenv env info) - let GetMethodRefInfoAsMemberRefIdx cenv env ((_, typ, _, _, _, _, _) as minfo) = + let GetMethodRefInfoAsMemberRefIdx cenv env ((_, typ, _, _, _, _, _) as minfo) = let fenv = envForMethodRef env typ FindOrAddSharedRow cenv ILTableNames.MemberRef (MethodRefInfoAsMemberRefRow cenv env fenv minfo) @@ -10586,39 +10586,39 @@ namespace ProviderImplementation.ProvidedTypes else (MethodDefOrRefTag.MemberRef, GetMethodRefInfoAsMemberRefIdx cenv env minfo) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodSpec --> ILMethodRef/ILMethodDef/ILMethodSpec - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetMethodSpecInfoAsMethodSpecIdx cenv env (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = + let rec GetMethodSpecInfoAsMethodSpecIdx cenv env (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = let mdorTag, mdorRow = GetMethodRefInfoAsMethodRefOrDef false cenv env (nm, typ, cc, args, ret, varargs, minst.Length) - let blob = - emitBytesViaBuffer (fun bb -> + let blob = + emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_GENERICINST bb.EmitZ32 minst.Length minst |> Array.iter (EmitType cenv env bb)) - FindOrAddSharedRow cenv ILTableNames.MethodSpec - (SharedRow + FindOrAddSharedRow cenv ILTableNames.MethodSpec + (SharedRow [| MethodDefOrRef (mdorTag, mdorRow) Blob (GetBytesAsBlobIdx cenv blob) |]) and GetMethodDefOrRefAsUncodedToken (tag, idx) = - let tab = + let tab = if tag = MethodDefOrRefTag.MethodDef then ILTableNames.Method - elif tag = MethodDefOrRefTag.MemberRef then ILTableNames.MemberRef + elif tag = MethodDefOrRefTag.MemberRef then ILTableNames.MemberRef else failwith "GetMethodDefOrRefAsUncodedToken" getUncodedToken tab idx and GetMethodSpecInfoAsUncodedToken cenv env ((_, _, _, _, _, _, minst:ILGenericArgs) as minfo) = - if minst.Length > 0 then + if minst.Length > 0 then getUncodedToken ILTableNames.MethodSpec (GetMethodSpecInfoAsMethodSpecIdx cenv env minfo) - else + else GetMethodDefOrRefAsUncodedToken (GetMethodRefInfoAsMethodRefOrDef false cenv env (GetMethodRefInfoOfMethodSpecInfo minfo)) - and GetMethodSpecAsUncodedToken cenv env mspec = + and GetMethodSpecAsUncodedToken cenv env mspec = GetMethodSpecInfoAsUncodedToken cenv env (InfoOfMethodSpec mspec) - and GetMethodRefInfoOfMethodSpecInfo (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = + and GetMethodRefInfoOfMethodSpecInfo (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = (nm, typ, cc, args, ret, varargs, minst.Length) and GetMethodSpecAsMethodDefOrRef cenv env (mspec, varargs) = @@ -10627,42 +10627,42 @@ namespace ProviderImplementation.ProvidedTypes and GetMethodSpecAsMethodDef cenv env (mspec, varargs) = GetMethodRefInfoAsMethodRefOrDef true cenv env (GetMethodRefInfoOfMethodSpecInfo (InfoOfMethodSpec (mspec, varargs))) - and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) = - (mspec.Name, - mspec.EnclosingType, - mspec.CallingConv, - mspec.MethodRef.ArgTypes, - mspec.FormalReturnType, - varargs, + and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) = + (mspec.Name, + mspec.EnclosingType, + mspec.CallingConv, + mspec.MethodRef.ArgTypes, + mspec.FormalReturnType, + varargs, mspec.GenericArgs) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // method_in_parent --> ILMethodRef/ILMethodDef - // + // // Used for MethodImpls. // -------------------------------------------------------------------- - let rec GetOverridesSpecAsMemberRefIdx cenv env ospec = + let rec GetOverridesSpecAsMemberRefIdx cenv env ospec = let fenv = envForOverrideSpec ospec let row = MethodRefInfoAsMemberRefRow cenv env fenv (ospec.MethodRef.Name, ospec.EnclosingType, ospec.MethodRef.CallingConv, ospec.MethodRef.ArgTypes, ospec.MethodRef.ReturnType, None, ospec.MethodRef.GenericArity) FindOrAddSharedRow cenv ILTableNames.MemberRef row - + and GetOverridesSpecAsMethodDefOrRef cenv env (ospec:ILOverridesSpec) = let typ = ospec.EnclosingType - if isTypeLocal typ then - if not typ.IsNominal then failwith "GetOverridesSpecAsMethodDefOrRef: unexpected local tref-typ" + if isTypeLocal typ then + if not typ.IsNominal then failwith "GetOverridesSpecAsMethodDefOrRef: unexpected local tref-typ" try (MethodDefOrRefTag.MethodDef, GetMethodRefAsMethodDefIdx cenv ospec.MethodRef) - with MethodDefNotFound -> (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) - else - (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) + with MethodDefNotFound -> (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) + else + (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodRef --> ILMethodRef/ILMethodDef - // + // // Used for Custom Attrs. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref:ILMethodRef) = + let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref:ILMethodRef) = let row = MethodRefInfoAsMemberRefRow cenv env fenv (mref.Name, ILType.Boxed (ILTypeSpec (mref.EnclosingTypeRef, [| |])), mref.CallingConv, mref.ArgTypes, mref.ReturnType, None, mref.GenericArity) FindOrAddSharedRow cenv ILTableNames.MemberRef row @@ -10675,14 +10675,14 @@ namespace ProviderImplementation.ProvidedTypes else (CustomAttributeTypeTag.MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mref) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILCustomAttrs --> CustomAttribute rows - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetCustomAttrDataAsBlobIdx cenv (data:byte[]) = + let rec GetCustomAttrDataAsBlobIdx cenv (data:byte[]) = if data.Length = 0 then 0 else GetBytesAsBlobIdx cenv data - and GetCustomAttrRow cenv hca attr = + and GetCustomAttrRow cenv hca attr = let cat = GetMethodRefAsCustomAttribType cenv attr.Method.MethodRef for element in attr.Elements do match element with @@ -10695,13 +10695,13 @@ namespace ProviderImplementation.ProvidedTypes Blob (GetCustomAttrDataAsBlobIdx cenv attr.Data) |] - and GenCustomAttrPass3Or4 cenv hca attr = + and GenCustomAttrPass3Or4 cenv hca attr = AddUnsharedRow cenv ILTableNames.CustomAttribute (GetCustomAttrRow cenv hca attr) |> ignore - and GenCustomAttrsPass3Or4 cenv hca (attrs: ILCustomAttrs) = - attrs.Entries |> Array.iter (GenCustomAttrPass3Or4 cenv hca) + and GenCustomAttrsPass3Or4 cenv hca (attrs: ILCustomAttrs) = + attrs.Entries |> Array.iter (GenCustomAttrPass3Or4 cenv hca) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILPermissionSet --> DeclSecurity rows // -------------------------------------------------------------------- *) @@ -10719,28 +10719,28 @@ namespace ProviderImplementation.ProvidedTypes List.iter (GenSecurityDeclPass3 cenv hds) attrs #endif - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILFieldSpec --> FieldRef or ILFieldDef row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldSpecAsMemberRefRow cenv env fenv (fspec:ILFieldSpec) = - MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.EnclosingType, - GetStringHeapIdx cenv fspec.Name, + let rec GetFieldSpecAsMemberRefRow cenv env fenv (fspec:ILFieldSpec) = + MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.EnclosingType, + GetStringHeapIdx cenv fspec.Name, GetFieldSpecSigAsBlobIdx cenv fenv fspec) - and GetFieldSpecAsMemberRefIdx cenv env fspec = + and GetFieldSpecAsMemberRefIdx cenv env fspec = let fenv = envForFieldSpec fspec FindOrAddSharedRow cenv ILTableNames.MemberRef (GetFieldSpecAsMemberRefRow cenv env fenv fspec) // REVIEW: write into an accumulating buffer - and EmitFieldSpecSig cenv env (bb: ByteBuffer) (fspec:ILFieldSpec) = + and EmitFieldSpecSig cenv env (bb: ByteBuffer) (fspec:ILFieldSpec) = bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD EmitType cenv env bb fspec.FormalType - and GetFieldSpecSigAsBytes cenv env x = - emitBytesViaBuffer (fun bb -> EmitFieldSpecSig cenv env bb x) + and GetFieldSpecSigAsBytes cenv env x = + emitBytesViaBuffer (fun bb -> EmitFieldSpecSig cenv env bb x) - and GetFieldSpecSigAsBlobIdx cenv env x = + and GetFieldSpecSigAsBlobIdx cenv env x = GetBytesAsBlobIdx cenv (GetFieldSpecSigAsBytes cenv env x) and GetFieldSpecAsFieldDefOrRef cenv env (fspec:ILFieldSpec) = @@ -10751,82 +10751,82 @@ namespace ProviderImplementation.ProvidedTypes let tidx = GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name)) let fdkey = FieldDefKey (tidx, fspec.Name, fspec.FormalType) (true, FindFieldDefIdx cenv fdkey) - else + else (false, GetFieldSpecAsMemberRefIdx cenv env fspec) and GetFieldDefOrRefAsUncodedToken (tag, idx) = let tab = if tag then ILTableNames.Field else ILTableNames.MemberRef getUncodedToken tab idx - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // callsig --> StandAloneSig - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetCallsigAsBlobIdx cenv env (callsig:ILCallingSignature, varargs) = - GetBytesAsBlobIdx cenv - (GetCallsigAsBytes cenv env (callsig.CallingConv, - callsig.ArgTypes, + let GetCallsigAsBlobIdx cenv env (callsig:ILCallingSignature, varargs) = + GetBytesAsBlobIdx cenv + (GetCallsigAsBytes cenv env (callsig.CallingConv, + callsig.ArgTypes, callsig.ReturnType, varargs, 0)) - - let GetCallsigAsStandAloneSigRow cenv env x = + + let GetCallsigAsStandAloneSigRow cenv env x = SharedRow [| Blob (GetCallsigAsBlobIdx cenv env x) |] - let GetCallsigAsStandAloneSigIdx cenv env info = + let GetCallsigAsStandAloneSigIdx cenv env info = FindOrAddSharedRow cenv ILTableNames.StandAloneSig (GetCallsigAsStandAloneSigRow cenv env info) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // local signatures --> BlobHeap idx - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let EmitLocalSig cenv env (bb: ByteBuffer) (locals: ILLocals) = + let EmitLocalSig cenv env (bb: ByteBuffer) (locals: ILLocals) = bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_LOCAL_SIG bb.EmitZ32 locals.Length locals |> Array.iter (EmitLocalInfo cenv env bb) - let GetLocalSigAsBlobHeapIdx cenv env locals = + let GetLocalSigAsBlobHeapIdx cenv env locals = GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> EmitLocalSig cenv env bb locals)) - let GetLocalSigAsStandAloneSigIdx cenv env locals = + let GetLocalSigAsStandAloneSigIdx cenv env locals = SharedRow [| Blob (GetLocalSigAsBlobHeapIdx cenv env locals) |] - type ExceptionClauseKind = - | FinallyClause - | FaultClause - | TypeFilterClause of int32 + type ExceptionClauseKind = + | FinallyClause + | FaultClause + | TypeFilterClause of int32 | FilterClause of int type ExceptionClauseSpec = (int * int * int * int * ExceptionClauseKind) - type CodeBuffer = + type CodeBuffer = - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Buffer to write results of emitting code into. Also record: // - branch sources (where fixups will occur) // - possible branch destinations // - locations of embedded handles into the string table // - the exception table - // -------------------------------------------------------------------- - { code: ByteBuffer - /// (instruction; optional short form); start of instr in code buffer; code loc for the end of the instruction the fixup resides in ; where is the destination of the fixup + // -------------------------------------------------------------------- + { code: ByteBuffer + /// (instruction; optional short form); start of instr in code buffer; code loc for the end of the instruction the fixup resides in ; where is the destination of the fixup mutable reqdBrFixups: ResizeArray<((int * int option) * int * ILCodeLabel list)> - availBrFixups: Dictionary - /// code loc to fixup in code buffer + availBrFixups: Dictionary + /// code loc to fixup in code buffer mutable reqdStringFixupsInMethod: ResizeArray<(int * int)> - /// data for exception handling clauses + /// data for exception handling clauses mutable seh: ResizeArray #if DEBUG_INFO seqpoints: ResizeArray #endif } - static member Create _nm = + static member Create _nm = { seh = ResizeArray() code= ByteBuffer.Create 200 reqdBrFixups= ResizeArray() reqdStringFixupsInMethod=ResizeArray() - availBrFixups = Dictionary<_, _>(10, HashIdentity.Structural) + availBrFixups = Dictionary<_, _>(10, HashIdentity.Structural) #if DEBUG_INFO seqpoints = new ResizeArray<_>(10) #endif @@ -10855,51 +10855,51 @@ namespace ProviderImplementation.ProvidedTypes member codebuf.EmitUncodedToken u = codebuf.EmitInt32 u - member codebuf.RecordReqdStringFixup stringidx = + member codebuf.RecordReqdStringFixup stringidx = codebuf.reqdStringFixupsInMethod.Add((codebuf.code.Position, stringidx)) - // Write a special value in that we check later when applying the fixup + // Write a special value in that we check later when applying the fixup codebuf.EmitInt32 0xdeadbeef - member codebuf.RecordReqdBrFixups i tgs = + member codebuf.RecordReqdBrFixups i tgs = codebuf.reqdBrFixups.Add ((i, codebuf.code.Position, tgs)) - // Write a special value in that we check later when applying the fixup - // Value is 0x11 {deadbbbb}* where 11 is for the instruction and deadbbbb is for each target - codebuf.EmitByte 0x11 // for the instruction - (if fst i = i_switch then + // Write a special value in that we check later when applying the fixup + // Value is 0x11 {deadbbbb}* where 11 is for the instruction and deadbbbb is for each target + codebuf.EmitByte 0x11 // for the instruction + (if fst i = i_switch then codebuf.EmitInt32 tgs.Length) List.iter (fun _ -> codebuf.EmitInt32 0xdeadbbbb) tgs member codebuf.RecordReqdBrFixup i tg = codebuf.RecordReqdBrFixups i [tg] - member codebuf.RecordAvailBrFixup tg = + member codebuf.RecordAvailBrFixup tg = codebuf.availBrFixups[tg] <- codebuf.code.Position - module Codebuf = - // -------------------------------------------------------------------- + module Codebuf = + // -------------------------------------------------------------------- // Applying branch fixups. Use short versions of instructions // wherever possible. Sadly we can only determine if we can use a short - // version after we've layed out the code for all other instructions. - // This in turn means that using a short version may change + // version after we've layed out the code for all other instructions. + // This in turn means that using a short version may change // the various offsets into the code. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let binaryChop p (arr: 'T[]) = + let binaryChop p (arr: 'T[]) = let rec go n m = if n > m then raise (KeyNotFoundException("binary chop did not find element")) - else + else let i = (n+m)/2 - let c = p arr[i] + let c = p arr[i] if c = 0 then i elif c < 0 then go n (i-1) else go (i+1) m go 0 (Array.length arr) - let applyBrFixups (origCode :byte[]) origExnClauses origReqdStringFixups (origAvailBrFixups: Dictionary) origReqdBrFixups = + let applyBrFixups (origCode :byte[]) origExnClauses origReqdStringFixups (origAvailBrFixups: Dictionary) origReqdBrFixups = let orderedOrigReqdBrFixups = origReqdBrFixups |> Array.sortBy (fun (_, fixuploc, _) -> fixuploc) let newCode = ByteBuffer.Create origCode.Length - // Copy over all the code, working out whether the branches will be short - // or long and adjusting the branch destinations. Record an adjust function to adjust all the other - // gumpf that refers to fixed offsets in the code stream. - let newCode, newReqdBrFixups, adjuster = + // Copy over all the code, working out whether the branches will be short + // or long and adjusting the branch destinations. Record an adjust function to adjust all the other + // gumpf that refers to fixed offsets in the code stream. + let newCode, newReqdBrFixups, adjuster = let remainingReqdFixups = ref (Array.toList orderedOrigReqdBrFixups) let origWhere = ref 0 let newWhere = ref 0 @@ -10909,32 +10909,32 @@ namespace ProviderImplementation.ProvidedTypes let adjustments = ref [] while (not (isNil !remainingReqdFixups) || not !doneLast) do - let doingLast = isNil !remainingReqdFixups + let doingLast = isNil !remainingReqdFixups let origStartOfNoBranchBlock = !origWhere let newStartOfNoBranchBlock = !newWhere - let origEndOfNoBranchBlock = + let origEndOfNoBranchBlock = if doingLast then origCode.Length - else + else let (_, origStartOfInstr, _) = List.head !remainingReqdFixups origStartOfInstr - // Copy over a chunk of non-branching code + // Copy over a chunk of non-branching code let nobranch_len = origEndOfNoBranchBlock - origStartOfNoBranchBlock newCode.EmitBytes origCode[origStartOfNoBranchBlock..origStartOfNoBranchBlock+nobranch_len-1] - - // Record how to adjust addresses in this range, including the branch instruction - // we write below, or the end of the method if we're doing the last bblock + + // Record how to adjust addresses in this range, including the branch instruction + // we write below, or the end of the method if we're doing the last bblock adjustments := (origStartOfNoBranchBlock, origEndOfNoBranchBlock, newStartOfNoBranchBlock) :: !adjustments - - // Increment locations to the branch instruction we're really interested in + + // Increment locations to the branch instruction we're really interested in origWhere := origEndOfNoBranchBlock newWhere := !newWhere + nobranch_len - - // Now do the branch instruction. Decide whether the fixup will be short or long in the new code - if doingLast then + + // Now do the branch instruction. Decide whether the fixup will be short or long in the new code + if doingLast then doneLast := true - else + else let (i, origStartOfInstr, tgs:ILCodeLabel list) = List.head !remainingReqdFixups remainingReqdFixups := List.tail !remainingReqdFixups if origCode[origStartOfInstr] <> 0x11uy then failwith "br fixup sanity check failed (1)" @@ -10944,85 +10944,85 @@ namespace ProviderImplementation.ProvidedTypes let origEndOfInstr = origStartOfInstr + i_length + 4 * tgs.Length let newEndOfInstrIfSmall = !newWhere + i_length + 1 let newEndOfInstrIfBig = !newWhere + i_length + 4 * tgs.Length - - let short = - match i, tgs with - | (_, Some i_short), [tg] + + let short = + match i, tgs with + | (_, Some i_short), [tg] when - begin - // Use the original offsets to compute if the branch is small or large. This is - // a safe approximation because code only gets smaller. - if not (origAvailBrFixups.ContainsKey tg) then + begin + // Use the original offsets to compute if the branch is small or large. This is + // a safe approximation because code only gets smaller. + if not (origAvailBrFixups.ContainsKey tg) then printfn "%s" ("branch target " + formatCodeLabel tg + " not found in code") - let origDest = + let origDest = match origAvailBrFixups.TryGetValue tg with | true, oaVal -> oaVal | false, _ -> 666666 let origRelOffset = origDest - origEndOfInstr -128 <= origRelOffset && origRelOffset <= 127 - end + end -> newCode.EmitIntAsByte i_short true | (i_long, _), _ -> newCode.EmitIntAsByte i_long - (if i_long = i_switch then + (if i_long = i_switch then newCode.EmitInt32 tgs.Length) false - + newWhere := !newWhere + i_length if !newWhere <> newCode.Position then printfn "mismatch between newWhere and newCode" tgs |> List.iter (fun tg -> let origFixupLoc = !origWhere checkFixup32 origCode origFixupLoc 0xdeadbbbb - - if short then + + if short then newReqdBrFixups := (!newWhere, newEndOfInstrIfSmall, tg, true) :: !newReqdBrFixups newCode.EmitIntAsByte 0x98 (* sanity check *) newWhere := !newWhere + 1 - else + else newReqdBrFixups := (!newWhere, newEndOfInstrIfBig, tg, false) :: !newReqdBrFixups newCode.EmitInt32 0xf00dd00f (* sanity check *) newWhere := !newWhere + 4 if !newWhere <> newCode.Position then printfn "mismatch between newWhere and newCode" origWhere := !origWhere + 4) - + if !origWhere <> origEndOfInstr then printfn "mismatch between origWhere and origEndOfInstr" - let adjuster = + let adjuster = let arr = Array.ofList (List.rev !adjustments) - fun addr -> - let i = - try binaryChop (fun (a1, a2, _) -> if addr < a1 then -1 elif addr > a2 then 1 else 0) arr - with - :? KeyNotFoundException -> + fun addr -> + let i = + try binaryChop (fun (a1, a2, _) -> if addr < a1 then -1 elif addr > a2 then 1 else 0) arr + with + :? KeyNotFoundException -> failwith ("adjuster: address "+string addr+" is out of range") let (origStartOfNoBranchBlock, _, newStartOfNoBranchBlock) = arr[i] - addr - (origStartOfNoBranchBlock - newStartOfNoBranchBlock) + addr - (origStartOfNoBranchBlock - newStartOfNoBranchBlock) - newCode.Close(), - List.toArray !newReqdBrFixups, + newCode.Close(), + List.toArray !newReqdBrFixups, adjuster - // Now adjust everything - let newAvailBrFixups = - let tab = Dictionary<_, _>(10, HashIdentity.Structural) - for (KeyValue(tglab, origBrDest)) in origAvailBrFixups do + // Now adjust everything + let newAvailBrFixups = + let tab = Dictionary<_, _>(10, HashIdentity.Structural) + for (KeyValue(tglab, origBrDest)) in origAvailBrFixups do tab[tglab] <- adjuster origBrDest tab let newReqdStringFixups = Array.map (fun (origFixupLoc, stok) -> adjuster origFixupLoc, stok) origReqdStringFixups #if EMIT_DEBUG_INFO let newSeqPoints = Array.map (fun (sp:PdbDebugPoint) -> {sp with Offset=adjuster sp.Offset}) origSeqPoints #endif - let newExnClauses = + let newExnClauses = origExnClauses |> Array.map (fun (st1, sz1, st2, sz2, kind) -> - (adjuster st1, (adjuster (st1 + sz1) - adjuster st1), - adjuster st2, (adjuster (st2 + sz2) - adjuster st2), - (match kind with + (adjuster st1, (adjuster (st1 + sz1) - adjuster st1), + adjuster st2, (adjuster (st2 + sz2) - adjuster st2), + (match kind with | FinallyClause | FaultClause | TypeFilterClause _ -> kind | FilterClause n -> FilterClause (adjuster n)))) - + #if EMIT_DEBUG_INFO let newScopes = let rec remap scope = @@ -11032,17 +11032,17 @@ namespace ProviderImplementation.ProvidedTypes Array.map remap origScopes #endif - // Now apply the adjusted fixups in the new code + // Now apply the adjusted fixups in the new code newReqdBrFixups |> Array.iter (fun (newFixupLoc, endOfInstr, tg, small) -> - if not (newAvailBrFixups.ContainsKey tg) then + if not (newAvailBrFixups.ContainsKey tg) then failwith ("target "+formatCodeLabel tg+" not found in new fixups") - try + try let n = newAvailBrFixups[tg] let relOffset = (n - endOfInstr) - if small then + if small then if Bytes.get newCode newFixupLoc <> 0x98 then failwith "br fixupsanity check failed" newCode[newFixupLoc] <- b0 relOffset - else + else checkFixup32 newCode newFixupLoc 0xf00dd00fl applyFixup32 newCode newFixupLoc relOffset with :? KeyNotFoundException -> ()) @@ -11050,91 +11050,91 @@ namespace ProviderImplementation.ProvidedTypes newCode, newReqdStringFixups, newExnClauses - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Structured residue of emitting instructions: SEH exception handling // and scopes for local variables. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - // Emitting instructions generates a tree of seh specifications - // We then emit the exception handling specs separately. - // nb. ECMA spec says the SEH blocks must be returned inside-out - type SEHTree = + // Emitting instructions generates a tree of seh specifications + // We then emit the exception handling specs separately. + // nb. ECMA spec says the SEH blocks must be returned inside-out + type SEHTree = | Node of ExceptionClauseSpec option * SEHTree[] - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Table of encodings for instructions without arguments, also indexes // for all instructions. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let encodingsForNoArgInstrs = Dictionary<_, _>(300, HashIdentity.Structural) - let _ = - List.iter + let _ = + List.iter (fun (x, mk) -> encodingsForNoArgInstrs[mk] <- x) (noArgInstrs.Force()) let encodingsOfNoArgInstr si = encodingsForNoArgInstrs[si] - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Emit instructions - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /// Emit the code for an instruction - let emitInstrCode (codebuf: CodeBuffer) i = - if i > 0xFF then - assert (i >>> 8 = 0xFE) - codebuf.EmitByte ((i >>> 8) &&& 0xFF) - codebuf.EmitByte (i &&& 0xFF) - else + let emitInstrCode (codebuf: CodeBuffer) i = + if i > 0xFF then + assert (i >>> 8 = 0xFE) + codebuf.EmitByte ((i >>> 8) &&& 0xFF) + codebuf.EmitByte (i &&& 0xFF) + else codebuf.EmitByte i - let emitTypeInstr cenv codebuf env i ty = - emitInstrCode codebuf i + let emitTypeInstr cenv codebuf env i ty = + emitInstrCode codebuf i codebuf.EmitUncodedToken (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env ty)) - let emitMethodSpecInfoInstr cenv codebuf env i mspecinfo = - emitInstrCode codebuf i + let emitMethodSpecInfoInstr cenv codebuf env i mspecinfo = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetMethodSpecInfoAsUncodedToken cenv env mspecinfo) - let emitMethodSpecInstr cenv codebuf env i mspec = - emitInstrCode codebuf i + let emitMethodSpecInstr cenv codebuf env i mspec = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetMethodSpecAsUncodedToken cenv env mspec) - let emitFieldSpecInstr cenv codebuf env i fspec = - emitInstrCode codebuf i + let emitFieldSpecInstr cenv codebuf env i fspec = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetFieldDefOrRefAsUncodedToken (GetFieldSpecAsFieldDefOrRef cenv env fspec)) - let emitShortUInt16Instr codebuf (i_short, i) x = + let emitShortUInt16Instr codebuf (i_short, i) x = let n = int32 x - if n <= 255 then - emitInstrCode codebuf i_short + if n <= 255 then + emitInstrCode codebuf i_short codebuf.EmitByte n - else - emitInstrCode codebuf i + else + emitInstrCode codebuf i codebuf.EmitUInt16 x - let emitShortInt32Instr codebuf (i_short, i) x = - if x >= (-128) && x <= 127 then - emitInstrCode codebuf i_short + let emitShortInt32Instr codebuf (i_short, i) x = + if x >= (-128) && x <= 127 then + emitInstrCode codebuf i_short codebuf.EmitByte (if x < 0x0 then x + 256 else x) - else - emitInstrCode codebuf i + else + emitInstrCode codebuf i codebuf.EmitInt32 x - let emitTailness (cenv: cenv) codebuf tl = + let emitTailness (cenv: cenv) codebuf tl = if tl = Tailcall && cenv.emitTailcalls then emitInstrCode codebuf i_tail //let emitAfterTailcall codebuf tl = // if tl = Tailcall then emitInstrCode codebuf i_ret - let emitVolatility codebuf tl = + let emitVolatility codebuf tl = if tl = Volatile then emitInstrCode codebuf i_volatile - let emitConstrained cenv codebuf env ty = + let emitConstrained cenv codebuf env ty = emitInstrCode codebuf i_constrained codebuf.EmitUncodedToken (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env ty)) - let emitAlignment codebuf tl = - match tl with + let emitAlignment codebuf tl = + match tl with | Aligned -> () | Unaligned1 -> emitInstrCode codebuf i_unaligned; codebuf.EmitByte 0x1 | Unaligned2 -> emitInstrCode codebuf i_unaligned; codebuf.EmitByte 0x2 @@ -11144,36 +11144,36 @@ namespace ProviderImplementation.ProvidedTypes match instr with | si when isNoArgInstr si -> emitInstrCode codebuf (encodingsOfNoArgInstr si) - | I_brcmp (cmp, tg1) -> + | I_brcmp (cmp, tg1) -> codebuf.RecordReqdBrFixup (ILCmpInstrMap.Value[cmp], Some ILCmpInstrRevMap.Value[cmp]) tg1 | I_br tg -> codebuf.RecordReqdBrFixup (i_br, Some i_br_s) tg #if EMIT_DEBUG_INFO | I_seqpoint s -> codebuf.EmitSeqPoint cenv s #endif | I_leave tg -> codebuf.RecordReqdBrFixup (i_leave, Some i_leave_s) tg - | I_call (tl, mspec, varargs) -> + | I_call (tl, mspec, varargs) -> emitTailness cenv codebuf tl emitMethodSpecInstr cenv codebuf env i_call (mspec, varargs) //emitAfterTailcall codebuf tl - | I_callvirt (tl, mspec, varargs) -> + | I_callvirt (tl, mspec, varargs) -> emitTailness cenv codebuf tl emitMethodSpecInstr cenv codebuf env i_callvirt (mspec, varargs) //emitAfterTailcall codebuf tl - | I_callconstraint (tl, ty, mspec, varargs) -> + | I_callconstraint (tl, ty, mspec, varargs) -> emitTailness cenv codebuf tl emitConstrained cenv codebuf env ty emitMethodSpecInstr cenv codebuf env i_callvirt (mspec, varargs) //emitAfterTailcall codebuf tl - | I_newobj (mspec, varargs) -> + | I_newobj (mspec, varargs) -> emitMethodSpecInstr cenv codebuf env i_newobj (mspec, varargs) - | I_ldftn mspec -> + | I_ldftn mspec -> emitMethodSpecInstr cenv codebuf env i_ldftn (mspec, None) - | I_ldvirtftn mspec -> + | I_ldvirtftn mspec -> emitMethodSpecInstr cenv codebuf env i_ldvirtftn (mspec, None) - | I_calli (tl, callsig, varargs) -> + | I_calli (tl, callsig, varargs) -> emitTailness cenv codebuf tl - emitInstrCode codebuf i_calli + emitInstrCode codebuf i_calli codebuf.EmitUncodedToken (getUncodedToken ILTableNames.StandAloneSig (GetCallsigAsStandAloneSigIdx cenv env (callsig, varargs))) //emitAfterTailcall codebuf tl @@ -11184,165 +11184,165 @@ namespace ProviderImplementation.ProvidedTypes | I_stloc x -> emitShortUInt16Instr codebuf (i_stloc_s, i_stloc) (uint16 x) | I_ldloca x -> emitShortUInt16Instr codebuf (i_ldloca_s, i_ldloca) (uint16 x) - | I_cpblk (al, vol) -> - emitAlignment codebuf al + | I_cpblk (al, vol) -> + emitAlignment codebuf al emitVolatility codebuf vol emitInstrCode codebuf i_cpblk - | I_initblk (al, vol) -> - emitAlignment codebuf al + | I_initblk (al, vol) -> + emitAlignment codebuf al emitVolatility codebuf vol emitInstrCode codebuf i_initblk - | (I_ldc (DT_I4, ILConst.I4 x)) -> + | (I_ldc (DT_I4, ILConst.I4 x)) -> emitShortInt32Instr codebuf (i_ldc_i4_s, i_ldc_i4) x - | (I_ldc (DT_I8, ILConst.I8 x)) -> - emitInstrCode codebuf i_ldc_i8 + | (I_ldc (DT_I8, ILConst.I8 x)) -> + emitInstrCode codebuf i_ldc_i8 codebuf.EmitInt64 x - | (I_ldc (_, ILConst.R4 x)) -> - emitInstrCode codebuf i_ldc_r4 + | (I_ldc (_, ILConst.R4 x)) -> + emitInstrCode codebuf i_ldc_r4 codebuf.EmitInt32 (bitsOfSingle x) - | (I_ldc (_, ILConst.R8 x)) -> - emitInstrCode codebuf i_ldc_r8 + | (I_ldc (_, ILConst.R8 x)) -> + emitInstrCode codebuf i_ldc_r8 codebuf.EmitInt64 (bitsOfDouble x) - | I_ldind (al, vol, dt) -> - emitAlignment codebuf al + | I_ldind (al, vol, dt) -> + emitAlignment codebuf al emitVolatility codebuf vol - emitInstrCode codebuf - (match dt with + emitInstrCode codebuf + (match dt with | DT_I -> i_ldind_i - | DT_I1 -> i_ldind_i1 - | DT_I2 -> i_ldind_i2 - | DT_I4 -> i_ldind_i4 - | DT_U1 -> i_ldind_u1 - | DT_U2 -> i_ldind_u2 - | DT_U4 -> i_ldind_u4 - | DT_I8 -> i_ldind_i8 - | DT_R4 -> i_ldind_r4 - | DT_R8 -> i_ldind_r8 + | DT_I1 -> i_ldind_i1 + | DT_I2 -> i_ldind_i2 + | DT_I4 -> i_ldind_i4 + | DT_U1 -> i_ldind_u1 + | DT_U2 -> i_ldind_u2 + | DT_U4 -> i_ldind_u4 + | DT_I8 -> i_ldind_i8 + | DT_R4 -> i_ldind_r4 + | DT_R8 -> i_ldind_r8 | DT_REF -> i_ldind_ref | _ -> failwith "ldind") - | I_stelem dt -> - emitInstrCode codebuf - (match dt with + | I_stelem dt -> + emitInstrCode codebuf + (match dt with | DT_I | DT_U -> i_stelem_i - | DT_U1 | DT_I1 -> i_stelem_i1 - | DT_I2 | DT_U2 -> i_stelem_i2 - | DT_I4 | DT_U4 -> i_stelem_i4 - | DT_I8 | DT_U8 -> i_stelem_i8 - | DT_R4 -> i_stelem_r4 - | DT_R8 -> i_stelem_r8 + | DT_U1 | DT_I1 -> i_stelem_i1 + | DT_I2 | DT_U2 -> i_stelem_i2 + | DT_I4 | DT_U4 -> i_stelem_i4 + | DT_I8 | DT_U8 -> i_stelem_i8 + | DT_R4 -> i_stelem_r4 + | DT_R8 -> i_stelem_r8 | DT_REF -> i_stelem_ref | _ -> failwith "stelem") - | I_ldelem dt -> - emitInstrCode codebuf - (match dt with + | I_ldelem dt -> + emitInstrCode codebuf + (match dt with | DT_I -> i_ldelem_i - | DT_I1 -> i_ldelem_i1 - | DT_I2 -> i_ldelem_i2 - | DT_I4 -> i_ldelem_i4 - | DT_I8 -> i_ldelem_i8 - | DT_U1 -> i_ldelem_u1 - | DT_U2 -> i_ldelem_u2 - | DT_U4 -> i_ldelem_u4 - | DT_R4 -> i_ldelem_r4 - | DT_R8 -> i_ldelem_r8 + | DT_I1 -> i_ldelem_i1 + | DT_I2 -> i_ldelem_i2 + | DT_I4 -> i_ldelem_i4 + | DT_I8 -> i_ldelem_i8 + | DT_U1 -> i_ldelem_u1 + | DT_U2 -> i_ldelem_u2 + | DT_U4 -> i_ldelem_u4 + | DT_R4 -> i_ldelem_r4 + | DT_R8 -> i_ldelem_r8 | DT_REF -> i_ldelem_ref | _ -> failwith "ldelem") - | I_stind (al, vol, dt) -> - emitAlignment codebuf al + | I_stind (al, vol, dt) -> + emitAlignment codebuf al emitVolatility codebuf vol - emitInstrCode codebuf - (match dt with + emitInstrCode codebuf + (match dt with | DT_U | DT_I -> i_stind_i - | DT_U1 | DT_I1 -> i_stind_i1 - | DT_U2 | DT_I2 -> i_stind_i2 - | DT_U4 | DT_I4 -> i_stind_i4 - | DT_U8 | DT_I8 -> i_stind_i8 - | DT_R4 -> i_stind_r4 - | DT_R8 -> i_stind_r8 + | DT_U1 | DT_I1 -> i_stind_i1 + | DT_U2 | DT_I2 -> i_stind_i2 + | DT_U4 | DT_I4 -> i_stind_i4 + | DT_U8 | DT_I8 -> i_stind_i8 + | DT_R4 -> i_stind_r4 + | DT_R8 -> i_stind_r8 | DT_REF -> i_stind_ref | x -> failwithf "stelem %O" x) | I_switch labs -> codebuf.RecordReqdBrFixups (i_switch, None) labs - | I_ldfld (al, vol, fspec) -> - emitAlignment codebuf al + | I_ldfld (al, vol, fspec) -> + emitAlignment codebuf al emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_ldfld fspec - | I_ldflda fspec -> + | I_ldflda fspec -> emitFieldSpecInstr cenv codebuf env i_ldflda fspec - | I_ldsfld (vol, fspec) -> + | I_ldsfld (vol, fspec) -> emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_ldsfld fspec - | I_ldsflda fspec -> + | I_ldsflda fspec -> emitFieldSpecInstr cenv codebuf env i_ldsflda fspec - | I_stfld (al, vol, fspec) -> - emitAlignment codebuf al + | I_stfld (al, vol, fspec) -> + emitAlignment codebuf al emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_stfld fspec - | I_stsfld (vol, fspec) -> + | I_stsfld (vol, fspec) -> emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_stsfld fspec - | I_ldtoken tok -> + | I_ldtoken tok -> emitInstrCode codebuf i_ldtoken - codebuf.EmitUncodedToken - (match tok with - | ILToken.ILType typ -> - match GetTypeAsTypeDefOrRef cenv env typ with + codebuf.EmitUncodedToken + (match tok with + | ILToken.ILType typ -> + match GetTypeAsTypeDefOrRef cenv env typ with | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeDef -> getUncodedToken ILTableNames.TypeDef idx | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeRef -> getUncodedToken ILTableNames.TypeRef idx | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeSpec -> getUncodedToken ILTableNames.TypeSpec idx | x -> failwithf "%O ?" x | ILToken.ILMethod mspec -> - match GetMethodSpecAsMethodDefOrRef cenv env (mspec, None) with + match GetMethodSpecAsMethodDefOrRef cenv env (mspec, None) with | (tag, idx) when tag = MethodDefOrRefTag.MethodDef -> getUncodedToken ILTableNames.Method idx | (tag, idx) when tag = MethodDefOrRefTag.MemberRef -> getUncodedToken ILTableNames.MemberRef idx | x -> failwithf "%O ?" x | ILToken.ILField fspec -> - match GetFieldSpecAsFieldDefOrRef cenv env fspec with + match GetFieldSpecAsFieldDefOrRef cenv env fspec with | (true, idx) -> getUncodedToken ILTableNames.Field idx | (false, idx) -> getUncodedToken ILTableNames.MemberRef idx) - | I_ldstr s -> + | I_ldstr s -> emitInstrCode codebuf i_ldstr codebuf.RecordReqdStringFixup (GetUserStringHeapIdx cenv s) | I_box ty -> emitTypeInstr cenv codebuf env i_box ty | I_unbox ty -> emitTypeInstr cenv codebuf env i_unbox ty - | I_unbox_any ty -> emitTypeInstr cenv codebuf env i_unbox_any ty + | I_unbox_any ty -> emitTypeInstr cenv codebuf env i_unbox_any ty - | I_newarr (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then + | I_newarr (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then emitTypeInstr cenv codebuf env i_newarr ty else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_newobj (".ctor", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Void, None, [| |]) - | I_stelem_any (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then - emitTypeInstr cenv codebuf env i_stelem_any ty - else + | I_stelem_any (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then + emitTypeInstr cenv codebuf env i_stelem_any ty + else let args = Array.init (shape.Rank+1) (fun i -> if i < shape.Rank then cenv.ilg.typ_Int32 else ty) emitMethodSpecInfoInstr cenv codebuf env i_call ("Set", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Void, None, [| |]) - | I_ldelem_any (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then - emitTypeInstr cenv codebuf env i_ldelem_any ty - else + | I_ldelem_any (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then + emitTypeInstr cenv codebuf env i_ldelem_any ty + else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_call ("Get", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ty, None, [| |]) - | I_ldelema (ro, shape, ty) -> + | I_ldelema (ro, shape, ty) -> if (ro = ReadonlyAddress) then emitInstrCode codebuf i_readonly - if (shape = ILArrayShape.SingleDimensional) then + if (shape = ILArrayShape.SingleDimensional) then emitTypeInstr cenv codebuf env i_ldelema ty - else + else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_call ("Address", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Byref ty, None, [| |]) @@ -11351,17 +11351,17 @@ namespace ProviderImplementation.ProvidedTypes | I_refanyval ty -> emitTypeInstr cenv codebuf env i_refanyval ty | I_mkrefany ty -> emitTypeInstr cenv codebuf env i_mkrefany ty | I_initobj ty -> emitTypeInstr cenv codebuf env i_initobj ty - | I_ldobj (al, vol, ty) -> - emitAlignment codebuf al + | I_ldobj (al, vol, ty) -> + emitAlignment codebuf al emitVolatility codebuf vol emitTypeInstr cenv codebuf env i_ldobj ty - | I_stobj (al, vol, ty) -> - emitAlignment codebuf al + | I_stobj (al, vol, ty) -> + emitAlignment codebuf al emitVolatility codebuf vol emitTypeInstr cenv codebuf env i_stobj ty | I_cpobj ty -> emitTypeInstr cenv codebuf env i_cpobj ty | I_sizeof ty -> emitTypeInstr cenv codebuf env i_sizeof ty - | EI_ldlen_multi (_, m) -> + | EI_ldlen_multi (_, m) -> emitShortInt32Instr codebuf (i_ldc_i4_s, i_ldc_i4) m let mspec = mkILMethSpecInTyRaw(cenv.ilg.typ_Array, ILCallingConv.Instance, "GetLength", [|cenv.ilg.typ_Int32|], cenv.ilg.typ_Int32, [| |]) emitInstr cenv codebuf env (mkNormalCall mspec) @@ -11372,20 +11372,20 @@ namespace ProviderImplementation.ProvidedTypes // Used to put local debug scopes and exception handlers into a tree form let rangeInsideRange (start_pc1, end_pc1) (start_pc2, end_pc2) = (start_pc1:int) >= start_pc2 && start_pc1 < end_pc2 && - (end_pc1:int) > start_pc2 && end_pc1 <= end_pc2 + (end_pc1:int) > start_pc2 && end_pc1 <= end_pc2 - let lranges_of_clause cl = - match cl with + let lranges_of_clause cl = + match cl with | ILExceptionClause.Finally r1 -> [r1] | ILExceptionClause.Fault r1 -> [r1] | ILExceptionClause.FilterCatch (r1, r2) -> [r1;r2] - | ILExceptionClause.TypeCatch (_ty, r1) -> [r1] + | ILExceptionClause.TypeCatch (_ty, r1) -> [r1] let labelsToRange (lab2pc: Dictionary) p = let (l1, l2) = p in lab2pc[l1], lab2pc[l2] - let labelRangeInsideLabelRange lab2pc ls1 ls2 = - rangeInsideRange (labelsToRange lab2pc ls1) (labelsToRange lab2pc ls2) + let labelRangeInsideLabelRange lab2pc ls1 ls2 = + rangeInsideRange (labelsToRange lab2pc ls1) (labelsToRange lab2pc ls2) // This file still gets used when targeting FSharp.Core 3.1.0.0, e.g. in FSharp.Data #if !ABOVE_FSCORE_4_0_0_0 @@ -11402,59 +11402,59 @@ namespace ProviderImplementation.ProvidedTypes acc <- s' res, acc #endif - let findRoots contains vs = + let findRoots contains vs = // For each item, either make it a root or make it a child of an existing root - let addToRoot roots x = + let addToRoot roots x = // Look to see if 'x' is inside one of the roots - let roots, found = - (false, roots) ||> mapFold (fun found (r, children) -> + let roots, found = + (false, roots) ||> mapFold (fun found (r, children) -> if found then ((r, children), true) - elif contains x r then ((r, Array.append [| x |] children), true) + elif contains x r then ((r, Array.append [| x |] children), true) else ((r, children), false)) - if found then roots - else + if found then roots + else // Find the ones that 'x' encompasses and collapse them let yes, others = roots |> Array.partition (fun (r, _) -> contains r x) let yesChild = yes |> Array.collect (fun (r, ch) -> Array.append [| r |] ch) Array.append [| (x, yesChild) |] others - + ([| |], vs) ||> Array.fold addToRoot - let rec makeSEHTree cenv env (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILExceptionSpec[]) = + let rec makeSEHTree cenv env (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILExceptionSpec[]) = let clause_inside_lrange cl lr = - List.forall (fun lr1 -> labelRangeInsideLabelRange lab2pc lr1 lr) (lranges_of_clause cl) + List.forall (fun lr1 -> labelRangeInsideLabelRange lab2pc lr1 lr) (lranges_of_clause cl) let tryspec_inside_lrange (tryspec1: ILExceptionSpec) lr = - (labelRangeInsideLabelRange lab2pc tryspec1.Range lr && clause_inside_lrange tryspec1.Clause lr) + (labelRangeInsideLabelRange lab2pc tryspec1.Range lr && clause_inside_lrange tryspec1.Clause lr) let tryspec_inside_clause tryspec1 cl = - List.exists (fun lr -> tryspec_inside_lrange tryspec1 lr) (lranges_of_clause cl) + List.exists (fun lr -> tryspec_inside_lrange tryspec1 lr) (lranges_of_clause cl) let tryspec_inside_tryspec tryspec1 (tryspec2: ILExceptionSpec) = tryspec_inside_lrange tryspec1 tryspec2.Range || tryspec_inside_clause tryspec1 tryspec2.Clause let roots = findRoots tryspec_inside_tryspec exs - let trees = - roots |> Array.map (fun (cl, ch) -> + let trees = + roots |> Array.map (fun (cl, ch) -> let r1 = labelsToRange lab2pc cl.Range let conv ((s1, e1), (s2, e2)) x = pc2pos[s1], pc2pos[e1] - pc2pos[s1], pc2pos[s2], pc2pos[e2] - pc2pos[s2], x let children = makeSEHTree cenv env pc2pos lab2pc ch - let n = - match cl.Clause with - | ILExceptionClause.Finally r2 -> + let n = + match cl.Clause with + | ILExceptionClause.Finally r2 -> conv (r1, labelsToRange lab2pc r2) ExceptionClauseKind.FinallyClause - | ILExceptionClause.Fault r2 -> + | ILExceptionClause.Fault r2 -> conv (r1, labelsToRange lab2pc r2) ExceptionClauseKind.FaultClause - | ILExceptionClause.FilterCatch ((filterStart, _), r3) -> + | ILExceptionClause.FilterCatch ((filterStart, _), r3) -> conv (r1, labelsToRange lab2pc r3) (ExceptionClauseKind.FilterClause (pc2pos[lab2pc[filterStart]])) - | ILExceptionClause.TypeCatch (typ, r2) -> + | ILExceptionClause.TypeCatch (typ, r2) -> conv (r1, labelsToRange lab2pc r2) (TypeFilterClause (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env typ))) SEHTree.Node (Some n, children) ) - trees + trees #if EMIT_DEBUG_INFO let rec makeLocalsTree cenv localSigs (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILLocalDebugInfo[]) = @@ -11473,14 +11473,14 @@ namespace ProviderImplementation.ProvidedTypes #endif - // Emit the SEH tree - let rec emitExceptionHandlerTree (codebuf: CodeBuffer) (Node (x, childSEH)) = - childSEH |> Array.iter (emitExceptionHandlerTree codebuf) // internal first - x |> Option.iter codebuf.EmitExceptionClause + // Emit the SEH tree + let rec emitExceptionHandlerTree (codebuf: CodeBuffer) (Node (x, childSEH)) = + childSEH |> Array.iter (emitExceptionHandlerTree codebuf) // internal first + x |> Option.iter codebuf.EmitExceptionClause - let emitCode cenv localSigs (codebuf: CodeBuffer) env (code: ILCode) = + let emitCode cenv localSigs (codebuf: CodeBuffer) env (code: ILCode) = let instrs = code.Instrs - + // Build a table mapping Abstract IL pcs to positions in the generated code buffer let pc2pos = Array.zeroCreate (instrs.Length+1) let pc2labs = Dictionary() @@ -11489,12 +11489,12 @@ namespace ProviderImplementation.ProvidedTypes // Emit the instructions for pc = 0 to instrs.Length do - if pc2labs.ContainsKey pc then + if pc2labs.ContainsKey pc then for lab in pc2labs[pc] do codebuf.RecordAvailBrFixup lab pc2pos[pc] <- codebuf.code.Position - if pc < instrs.Length then - match instrs[pc] with + if pc < instrs.Length then + match instrs[pc] with | I_br l when code.Labels[l] = pc + 1 -> () // compress I_br to next instruction | i -> emitInstr cenv codebuf env i @@ -11508,7 +11508,7 @@ namespace ProviderImplementation.ProvidedTypes localsTree #endif - let EmitTopCode cenv localSigs env nm code = + let EmitTopCode cenv localSigs env nm code = let codebuf = CodeBuffer.Create nm let origScopes = emitCode cenv localSigs codebuf env code let origCode = codebuf.code.Close() @@ -11520,8 +11520,8 @@ namespace ProviderImplementation.ProvidedTypes let origSeqPoints = codebuf.seqpoints.ToArray() #endif - let newCode, newReqdStringFixups, newExnClauses = - applyBrFixups origCode origExnClauses origReqdStringFixups origAvailBrFixups origReqdBrFixups + let newCode, newReqdStringFixups, newExnClauses = + applyBrFixups origCode origExnClauses origReqdStringFixups origAvailBrFixups origReqdBrFixups #if EMIT_DEBUG_INFO let rootScope = @@ -11533,31 +11533,31 @@ namespace ProviderImplementation.ProvidedTypes (newReqdStringFixups, newExnClauses, newCode) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodBody --> bytes - // -------------------------------------------------------------------- - let GetFieldDefTypeAsBlobIdx cenv env ty = - let bytes = emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD + // -------------------------------------------------------------------- + let GetFieldDefTypeAsBlobIdx cenv env ty = + let bytes = emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD EmitType cenv env bb ty) GetBytesAsBlobIdx cenv bytes let GenILMethodBody mname cenv env (il: ILMethodBody) = - let localSigs = - if cenv.generatePdb then - il.Locals |> Array.map (fun l -> + let localSigs = + if cenv.generatePdb then + il.Locals |> Array.map (fun l -> // Write a fake entry for the local signature headed by e_IMAGE_CEE_CS_CALLCONV_FIELD. This is referenced by the PDB file ignore (FindOrAddSharedRow cenv ILTableNames.StandAloneSig (SharedRow [| Blob (GetFieldDefTypeAsBlobIdx cenv env l.Type) |])) // Now write the type - GetTypeOfLocalAsBytes cenv env l) - else + GetTypeOfLocalAsBytes cenv env l) + else [| |] let requiredStringFixups, seh, code (* , seqpoints, scopes *) = Codebuf.EmitTopCode cenv localSigs env mname il.Code let codeSize = code.Length let methbuf = ByteBuffer.Create (codeSize * 3) - // Do we use the tiny format? + // Do we use the tiny format? if isEmpty il.Locals && il.MaxStack <= 8 && isEmpty seh && codeSize < 64 then - // Use Tiny format + // Use Tiny format let alignedCodeSize = align 4 (codeSize + 1) let codePadding = (alignedCodeSize - (codeSize + 1)) let requiredStringFixups' = (1, requiredStringFixups) @@ -11566,68 +11566,68 @@ namespace ProviderImplementation.ProvidedTypes methbuf.EmitPadding codePadding 0x0, (requiredStringFixups', methbuf.Close()) // , seqpoints, scopes else - // Use Fat format - let flags = + // Use Fat format + let flags = e_CorILMethod_FatFormat ||| - (if not (isEmpty seh) then e_CorILMethod_MoreSects else 0x0uy) ||| + (if not (isEmpty seh) then e_CorILMethod_MoreSects else 0x0uy) ||| (if il.IsZeroInit then e_CorILMethod_InitLocals else 0x0uy) - let localToken = - if isEmpty il.Locals then 0x0 else + let localToken = + if isEmpty il.Locals then 0x0 else getUncodedToken ILTableNames.StandAloneSig (FindOrAddSharedRow cenv ILTableNames.StandAloneSig (GetLocalSigAsStandAloneSigIdx cenv env il.Locals)) let alignedCodeSize = align 0x4 codeSize let codePadding = (alignedCodeSize - codeSize) - - methbuf.EmitByte flags - methbuf.EmitByte 0x30uy // last four bits record size of fat header in 4 byte chunks - this is always 12 bytes = 3 four word chunks + + methbuf.EmitByte flags + methbuf.EmitByte 0x30uy // last four bits record size of fat header in 4 byte chunks - this is always 12 bytes = 3 four word chunks methbuf.EmitUInt16 (uint16 il.MaxStack) methbuf.EmitInt32 codeSize methbuf.EmitInt32 localToken methbuf.EmitBytes code methbuf.EmitPadding codePadding - if not (isEmpty seh) then - // Can we use the small exception handling table format? + if not (isEmpty seh) then + // Can we use the small exception handling table format? let smallSize = (seh.Length * 12 + 4) - let canUseSmall = + let canUseSmall = smallSize <= 0xFF && - seh |> Array.forall (fun (st1, sz1, st2, sz2, _) -> - st1 <= 0xFFFF && st2 <= 0xFFFF && sz1 <= 0xFF && sz2 <= 0xFF) - - let kindAsInt32 k = - match k with + seh |> Array.forall (fun (st1, sz1, st2, sz2, _) -> + st1 <= 0xFFFF && st2 <= 0xFFFF && sz1 <= 0xFF && sz2 <= 0xFF) + + let kindAsInt32 k = + match k with | FinallyClause -> e_COR_ILEXCEPTION_CLAUSE_FINALLY | FaultClause -> e_COR_ILEXCEPTION_CLAUSE_FAULT | FilterClause _ -> e_COR_ILEXCEPTION_CLAUSE_FILTER | TypeFilterClause _ -> e_COR_ILEXCEPTION_CLAUSE_EXCEPTION - let kindAsExtraInt32 k = - match k with + let kindAsExtraInt32 k = + match k with | FinallyClause | FaultClause -> 0x0 | FilterClause i -> i | TypeFilterClause uncoded -> uncoded - - if canUseSmall then + + if canUseSmall then methbuf.EmitByte e_CorILMethod_Sect_EHTable - methbuf.EmitByte (b0 smallSize |> byte) - methbuf.EmitByte 0x00uy + methbuf.EmitByte (b0 smallSize |> byte) + methbuf.EmitByte 0x00uy methbuf.EmitByte 0x00uy - seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> + seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> let k32 = kindAsInt32 kind - methbuf.EmitInt32AsUInt16 k32 - methbuf.EmitInt32AsUInt16 st1 - methbuf.EmitByte (b0 sz1 |> byte) - methbuf.EmitInt32AsUInt16 st2 + methbuf.EmitInt32AsUInt16 k32 + methbuf.EmitInt32AsUInt16 st1 + methbuf.EmitByte (b0 sz1 |> byte) + methbuf.EmitInt32AsUInt16 st2 methbuf.EmitByte (b0 sz2 |> byte) methbuf.EmitInt32 (kindAsExtraInt32 kind)) - else + else let bigSize = (seh.Length * 24 + 4) methbuf.EmitByte (e_CorILMethod_Sect_EHTable ||| e_CorILMethod_Sect_FatFormat) methbuf.EmitByte (b0 bigSize |> byte) methbuf.EmitByte (b1 bigSize |> byte) methbuf.EmitByte (b2 bigSize |> byte) - seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> + seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> let k32 = kindAsInt32 kind methbuf.EmitInt32 k32 methbuf.EmitInt32 st1 @@ -11635,27 +11635,27 @@ namespace ProviderImplementation.ProvidedTypes methbuf.EmitInt32 st2 methbuf.EmitInt32 sz2 methbuf.EmitInt32 (kindAsExtraInt32 kind)) - + let requiredStringFixups' = (12, requiredStringFixups) localToken, (requiredStringFixups', methbuf.Close()) //, seqpoints, scopes - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILFieldDef --> FieldDef Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldDefAsFieldDefRow cenv env (fd: ILFieldDef) = + let rec GetFieldDefAsFieldDefRow cenv env (fd: ILFieldDef) = let flags = int fd.Attributes ||| (if (fd.LiteralValue <> None) then 0x8000 else 0x0) //||| //(if (fd.Marshal <> None) then 0x1000 else 0x0) ||| //(if (fd.Data <> None) then 0x0100 else 0x0) - UnsharedRow - [| UShort (uint16 flags) + UnsharedRow + [| UShort (uint16 flags) StringE (GetStringHeapIdx cenv fd.Name) Blob (GetFieldDefSigAsBlobIdx cenv env fd ) |] and GetFieldDefSigAsBlobIdx cenv env fd = GetFieldDefTypeAsBlobIdx cenv env fd.FieldType - and GenFieldDefPass3 cenv env fd = + and GenFieldDefPass3 cenv env fd = let fidx = AddUnsharedRow cenv ILTableNames.Field (GetFieldDefAsFieldDefRow cenv env fd) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.FieldDef, fidx) fd.CustomAttrs #if EMIT_FIELD_DATA @@ -11675,29 +11675,29 @@ namespace ProviderImplementation.ProvidedTypes (UnsharedRow [| HasFieldMarshal (hfm_FieldDef, fidx) Blob (GetNativeTypeAsBlobIdx cenv ntyp) |]) |> ignore #endif - // Write Content table - match fd.LiteralValue with + // Write Content table + match fd.LiteralValue with | None -> () - | Some i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | Some i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.FieldDef, fidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore - // Write FieldLayout table - match fd.Offset with + // Write FieldLayout table + match fd.Offset with | None -> () - | Some offset -> - AddUnsharedRow cenv ILTableNames.FieldLayout + | Some offset -> + AddUnsharedRow cenv ILTableNames.FieldLayout (UnsharedRow [| ULong offset; SimpleIndex (ILTableNames.Field, fidx) |]) |> ignore - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // ILGenericParameterDef --> GenericParam Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetGenericParamAsGenericParamRow cenv _env idx owner (gp: ILGenericParameterDef) = - let flags = + let rec GetGenericParamAsGenericParamRow cenv _env idx owner (gp: ILGenericParameterDef) = + let flags = (if gp.IsCovariant then 0x0001 else 0x0000) ||| (if gp.IsContravariant then 0x0002 else 0x0000) ||| (if gp.HasReferenceTypeConstraint then 0x0004 else 0x0000) ||| @@ -11705,62 +11705,62 @@ namespace ProviderImplementation.ProvidedTypes (if gp.HasDefaultConstructorConstraint then 0x0010 else 0x0000) let mdVersionMajor, _ = metadataSchemaVersionSupportedByCLRVersion cenv.desiredMetadataVersion - if (mdVersionMajor = 1) then - SharedRow - [| UShort (uint16 idx) - UShort (uint16 flags) + if (mdVersionMajor = 1) then + SharedRow + [| UShort (uint16 idx) + UShort (uint16 flags) TypeOrMethodDef owner StringE (GetStringHeapIdx cenv gp.Name) TypeDefOrRefOrSpec (TypeDefOrRefOrSpecTag.TypeDef, 0) (* empty kind field in deprecated metadata *) |] else - SharedRow - [| UShort (uint16 idx) - UShort (uint16 flags) + SharedRow + [| UShort (uint16 idx) + UShort (uint16 flags) TypeOrMethodDef owner StringE (GetStringHeapIdx cenv gp.Name) |] - and GenTypeAsGenericParamConstraintRow cenv env gpidx ty = + and GenTypeAsGenericParamConstraintRow cenv env gpidx ty = let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env ty - UnsharedRow + UnsharedRow [| SimpleIndex (ILTableNames.GenericParam, gpidx) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] and GenGenericParamConstraintPass4 cenv env gpidx ty = AddUnsharedRow cenv ILTableNames.GenericParamConstraint (GenTypeAsGenericParamConstraintRow cenv env gpidx ty) |> ignore - and GenGenericParamPass3 cenv env idx owner gp = + and GenGenericParamPass3 cenv env idx owner gp = // here we just collect generic params, its constraints\custom attributes will be processed on pass4 // shared since we look it up again below in GenGenericParamPass4 - AddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) + AddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) |> ignore - and GenGenericParamPass4 cenv env idx owner (gp: ILGenericParameterDef) = + and GenGenericParamPass4 cenv env idx owner (gp: ILGenericParameterDef) = let gpidx = FindOrAddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.GenericParam, gpidx) gp.CustomAttrs - gp.Constraints |> Array.iter (GenGenericParamConstraintPass4 cenv env gpidx) + gp.Constraints |> Array.iter (GenGenericParamConstraintPass4 cenv env gpidx) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // param and return --> Param Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetParamAsParamRow cenv _env seq (param: ILParameter) = - let flags = + let rec GetParamAsParamRow cenv _env seq (param: ILParameter) = + let flags = (if param.IsIn then 0x0001 else 0x0000) ||| (if param.IsOut then 0x0002 else 0x0000) ||| (if param.IsOptional then 0x0010 else 0x0000) ||| (if param.Default.HasValue then 0x1000 else 0x0000) //||| //(if param.Marshal <> None then 0x2000 else 0x0000) - - UnsharedRow - [| UShort (uint16 flags) - UShort (uint16 seq) - StringE (GetStringHeapIdxOption cenv param.Name) |] - and GenParamPass3 cenv env seq (param: ILParameter) = - if not param.IsIn && not param.IsOut && not param.IsOptional && param.Default.IsNone && param.Name.IsNone // && Option.isNone param.Marshal + UnsharedRow + [| UShort (uint16 flags) + UShort (uint16 seq) + StringE (GetStringHeapIdxOption cenv param.Name) |] + + and GenParamPass3 cenv env seq (param: ILParameter) = + if not param.IsIn && not param.IsOut && not param.IsOptional && param.Default.IsNone && param.Name.IsNone // && Option.isNone param.Marshal then () - else + else let pidx = AddUnsharedRow cenv ILTableNames.Param (GetParamAsParamRow cenv env seq param) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ParamDef, pidx) param.CustomAttrs #if EMIT_FIELD_MARSHAL @@ -11774,21 +11774,21 @@ namespace ProviderImplementation.ProvidedTypes #endif match param.Default with | UNone -> () - | USome i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | USome i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.ParamDef, pidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore - let GenReturnAsParamRow (returnv: ILReturn) = + let GenReturnAsParamRow (returnv: ILReturn) = let flags = 0x0000 // || (if returnv.Marshal <> None then 0x2000 else 0x0000) - UnsharedRow - [| UShort (uint16 flags) + UnsharedRow + [| UShort (uint16 flags) UShort 0us (* sequence num. *) - StringE 0 |] + StringE 0 |] - let GenReturnPass3 cenv (returnv: ILReturn) = + let GenReturnPass3 cenv (returnv: ILReturn) = if (* Option.isSome returnv.Marshal || *) not (isEmpty returnv.CustomAttrs.Entries) then let pidx = AddUnsharedRow cenv ILTableNames.Param (GenReturnAsParamRow returnv) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ParamDef, pidx) returnv.CustomAttrs @@ -11802,31 +11802,31 @@ namespace ProviderImplementation.ProvidedTypes Blob (GetNativeTypeAsBlobIdx cenv ntyp) |]) |> ignore #endif - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodDef --> ILMethodDef Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetMethodDefSigAsBytes cenv env (mdef: ILMethodDef) = - emitBytesViaBuffer (fun bb -> + let GetMethodDefSigAsBytes cenv env (mdef: ILMethodDef) = + emitBytesViaBuffer (fun bb -> bb.EmitByte (callconvToByte mdef.GenericParams.Length mdef.CallingConv) if mdef.GenericParams.Length > 0 then bb.EmitZ32 mdef.GenericParams.Length bb.EmitZ32 mdef.Parameters.Length EmitType cenv env bb mdef.Return.Type mdef.ParameterTypes |> Array.iter (EmitType cenv env bb)) - let GenMethodDefSigAsBlobIdx cenv env mdef = + let GenMethodDefSigAsBlobIdx cenv env mdef = GetBytesAsBlobIdx cenv (GetMethodDefSigAsBytes cenv env mdef) - let GenMethodDefAsRow cenv env midx (md: ILMethodDef) = + let GenMethodDefAsRow cenv env midx (md: ILMethodDef) = let flags = int md.Attributes let implflags = int md.ImplAttributes - if md.IsEntryPoint then + if md.IsEntryPoint then if cenv.entrypoint <> None then failwith "duplicate entrypoint" else cenv.entrypoint <- Some (true, midx) - let codeAddr = - (match md.Body with - | Some ilmbody -> + let codeAddr = + (match md.Body with + | Some ilmbody -> let addr = cenv.nextCodeAddr let (localToken, code (* , seqpoints, rootScope *) ) = GenILMethodBody md.Name cenv env ilmbody @@ -11875,34 +11875,34 @@ namespace ProviderImplementation.ProvidedTypes #endif | _ -> 0x0000) - UnsharedRow - [| ULong codeAddr - UShort (uint16 implflags) - UShort (uint16 flags) - StringE (GetStringHeapIdx cenv md.Name) - Blob (GenMethodDefSigAsBlobIdx cenv env md) - SimpleIndex(ILTableNames.Param, cenv.GetTable(ILTableNames.Param).Count + 1) |] + UnsharedRow + [| ULong codeAddr + UShort (uint16 implflags) + UShort (uint16 flags) + StringE (GetStringHeapIdx cenv md.Name) + Blob (GenMethodDefSigAsBlobIdx cenv env md) + SimpleIndex(ILTableNames.Param, cenv.GetTable(ILTableNames.Param).Count + 1) |] let GenMethodImplPass3 cenv env _tgparams tidx mimpl = let midxTag, midxRow = GetMethodSpecAsMethodDef cenv env (mimpl.OverrideBy, None) let midx2Tag, midx2Row = GetOverridesSpecAsMethodDefOrRef cenv env mimpl.Overrides AddUnsharedRow cenv ILTableNames.MethodImpl - (UnsharedRow + (UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) MethodDefOrRef (midxTag, midxRow) MethodDefOrRef (midx2Tag, midx2Row) |]) |> ignore - - let GenMethodDefPass3 cenv env (md:ILMethodDef) = + + let GenMethodDefPass3 cenv env (md:ILMethodDef) = let midx = GetMethodDefIdx cenv md let idx2 = AddUnsharedRow cenv ILTableNames.Method (GenMethodDefAsRow cenv env midx md) if midx <> idx2 then failwith "index of method def on pass 3 does not match index on pass 2" - GenReturnPass3 cenv md.Return - md.Parameters |> Array.iteri (fun n param -> GenParamPass3 cenv env (n+1) param) - md.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.MethodDef, midx) + GenReturnPass3 cenv md.Return + md.Parameters |> Array.iteri (fun n param -> GenParamPass3 cenv env (n+1) param) + md.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.MethodDef, midx) #if EMIT_SECURITY_DECLS md.SecurityDecls.Entries |> GenSecurityDeclsPass3 cenv (hds_MethodDef, midx) #endif - md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) + md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) #if EMIT_PINVOKE match md.Body.Contents with | MethodBody.PInvoke attr -> @@ -11942,51 +11942,51 @@ namespace ProviderImplementation.ProvidedTypes | _ -> () #endif - let GenMethodDefPass4 cenv env md = + let GenMethodDefPass4 cenv env md = let midx = GetMethodDefIdx cenv md - md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) + md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) let GenPropertyMethodSemanticsPass3 cenv pidx kind mref = // REVIEW: why are we catching exceptions here? let midx = try GetMethodRefAsMethodDefIdx cenv mref with MethodDefNotFound -> 1 AddUnsharedRow cenv ILTableNames.MethodSemantics - (UnsharedRow + (UnsharedRow [| UShort (uint16 kind) SimpleIndex (ILTableNames.Method, midx) HasSemantics (HasSemanticsTag.Property, pidx) |]) |> ignore - - let rec GetPropertySigAsBlobIdx cenv env prop = + + let rec GetPropertySigAsBlobIdx cenv env prop = GetBytesAsBlobIdx cenv (GetPropertySigAsBytes cenv env prop) - and GetPropertySigAsBytes cenv env prop = - emitBytesViaBuffer (fun bb -> + and GetPropertySigAsBytes cenv env prop = + emitBytesViaBuffer (fun bb -> let b = ((hasthisToByte prop.CallingConv) ||| e_IMAGE_CEE_CS_CALLCONV_PROPERTY) bb.EmitByte b bb.EmitZ32 prop.IndexParameterTypes.Length EmitType cenv env bb prop.PropertyType prop.IndexParameterTypes |> Array.iter (EmitType cenv env bb)) - and GetPropertyAsPropertyRow cenv env (prop:ILPropertyDef) = - let flags = - (if prop.IsSpecialName then 0x0200 else 0x0) ||| - (if prop.IsRTSpecialName then 0x0400 else 0x0) ||| + and GetPropertyAsPropertyRow cenv env (prop:ILPropertyDef) = + let flags = + (if prop.IsSpecialName then 0x0200 else 0x0) ||| + (if prop.IsRTSpecialName then 0x0400 else 0x0) ||| (if prop.Init <> None then 0x1000 else 0x0) - UnsharedRow - [| UShort (uint16 flags) - StringE (GetStringHeapIdx cenv prop.Name) - Blob (GetPropertySigAsBlobIdx cenv env prop) |] + UnsharedRow + [| UShort (uint16 flags) + StringE (GetStringHeapIdx cenv prop.Name) + Blob (GetPropertySigAsBlobIdx cenv env prop) |] /// ILPropertyDef --> Property Row + MethodSemantics entries - and GenPropertyPass3 cenv env prop = + and GenPropertyPass3 cenv env prop = let pidx = AddUnsharedRow cenv ILTableNames.Property (GetPropertyAsPropertyRow cenv env prop) - prop.SetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0001) - prop.GetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0002) - // Write Constant table - match prop.Init with + prop.SetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0001) + prop.GetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0002) + // Write Constant table + match prop.Init with | None -> () - | Some i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | Some i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.Property, pidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore @@ -11995,42 +11995,42 @@ namespace ProviderImplementation.ProvidedTypes let rec GenEventMethodSemanticsPass3 cenv eidx kind mref = let addIdx = try GetMethodRefAsMethodDefIdx cenv mref with MethodDefNotFound -> 1 AddUnsharedRow cenv ILTableNames.MethodSemantics - (UnsharedRow + (UnsharedRow [| UShort (uint16 kind) SimpleIndex (ILTableNames.Method, addIdx) HasSemantics (HasSemanticsTag.Event, eidx) |]) |> ignore /// ILEventDef --> Event Row + MethodSemantics entries - and GenEventAsEventRow cenv env (md: ILEventDef) = - let flags = - (if md.IsSpecialName then 0x0200 else 0x0) ||| + and GenEventAsEventRow cenv env (md: ILEventDef) = + let flags = + (if md.IsSpecialName then 0x0200 else 0x0) ||| (if md.IsRTSpecialName then 0x0400 else 0x0) let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env md.EventHandlerType - UnsharedRow - [| UShort (uint16 flags) - StringE (GetStringHeapIdx cenv md.Name) + UnsharedRow + [| UShort (uint16 flags) + StringE (GetStringHeapIdx cenv md.Name) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] - and GenEventPass3 cenv env (md: ILEventDef) = + and GenEventPass3 cenv env (md: ILEventDef) = let eidx = AddUnsharedRow cenv ILTableNames.Event (GenEventAsEventRow cenv env md) - md.AddMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0008 - md.RemoveMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0010 - //Option.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0020) md.FireMethod + md.AddMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0008 + md.RemoveMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0010 + //Option.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0020) md.FireMethod //List.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0004) md.OtherMethods GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Event, eidx) md.CustomAttrs - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // resource --> generate ... - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetResourceAsManifestResourceRow cenv r = - let data, impl = + let rec GetResourceAsManifestResourceRow cenv r = + let data, impl = match r.Location with | ILResourceLocation.Local bf -> let b = bf() - // Embedded managed resources must be word-aligned. However resource format is - // not specified in ECMA. Some mscorlib resources appear to be non-aligned - it seems it doesn't matter.. + // Embedded managed resources must be word-aligned. However resource format is + // not specified in ECMA. Some mscorlib resources appear to be non-aligned - it seems it doesn't matter.. let offset = cenv.resources.Position let alignedOffset = (align 0x8 offset) let pad = alignedOffset - offset @@ -12038,24 +12038,24 @@ namespace ProviderImplementation.ProvidedTypes cenv.resources.EmitPadding pad cenv.resources.EmitInt32 resourceSize cenv.resources.EmitBytes b - Data (alignedOffset, true), (ImplementationTag.File, 0) + Data (alignedOffset, true), (ImplementationTag.File, 0) | ILResourceLocation.File (mref, offset) -> ULong offset, (ImplementationTag.File, GetModuleRefAsFileIdx cenv mref) | ILResourceLocation.Assembly aref -> ULong 0x0, (ImplementationTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) - UnsharedRow - [| data + UnsharedRow + [| data ULong (match r.Access with ILResourceAccess.Public -> 0x01 | ILResourceAccess.Private -> 0x02) - StringE (GetStringHeapIdx cenv r.Name) + StringE (GetStringHeapIdx cenv r.Name) Implementation impl |] - and GenResourcePass3 cenv r = + and GenResourcePass3 cenv r = let idx = AddUnsharedRow cenv ILTableNames.ManifestResource (GetResourceAsManifestResourceRow cenv r) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ManifestResource, idx) r.CustomAttrs - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILTypeDef --> generate ILFieldDef, ILMethodDef, ILPropertyDef etc. rows - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GenTypeDefPass3 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass3 enc cenv (td:ILTypeDef) = try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) @@ -12064,22 +12064,22 @@ namespace ProviderImplementation.ProvidedTypes td.Fields.Entries |> Array.iter (GenFieldDefPass3 cenv env) td.Methods.Entries |> Array.iter (GenMethodDefPass3 cenv env) td.MethodImpls.Entries |> Array.iter (GenMethodImplPass3 cenv env td.GenericParams.Length tidx) - // ClassLayout entry if needed - match td.Layout with + // ClassLayout entry if needed + match td.Layout with | ILTypeDefLayout.Auto -> () - | ILTypeDefLayout.Sequential layout | ILTypeDefLayout.Explicit layout -> - if Option.isSome layout.Pack || Option.isSome layout.Size then + | ILTypeDefLayout.Sequential layout | ILTypeDefLayout.Explicit layout -> + if Option.isSome layout.Pack || Option.isSome layout.Size then AddUnsharedRow cenv ILTableNames.ClassLayout - (UnsharedRow + (UnsharedRow [| UShort (defaultArg layout.Pack (uint16 0x0)) ULong (defaultArg layout.Size 0x0) SimpleIndex (ILTableNames.TypeDef, tidx) |]) |> ignore - + #if EMIT_SECURITY_DECLS td.SecurityDecls.Entries |> GenSecurityDeclsPass3 cenv (hds_TypeDef, tidx) #endif td.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.TypeDef, tidx) - td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) + td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) td.NestedTypes.Entries |> GenTypeDefsPass3 (addILTypeName enc td) cenv with e -> failwith ("Error in pass3 for type "+td.Name+", error: "+e.ToString()) @@ -12092,12 +12092,12 @@ namespace ProviderImplementation.ProvidedTypes /// ILTypeDef --> generate generic params on ILMethodDef: ensures /// GenericParam table is built sorted by owner. - let rec GenTypeDefPass4 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass4 enc cenv (td:ILTypeDef) = try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) - td.Methods.Entries |> Array.iter (GenMethodDefPass4 cenv env) - td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) + td.Methods.Entries |> Array.iter (GenMethodDefPass4 cenv env) + td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) GenTypeDefsPass4 (addILTypeName enc td) cenv td.NestedTypes.Entries with e -> failwith ("Error in pass4 for type "+td.Name+", error: "+e.Message) @@ -12111,19 +12111,19 @@ namespace ProviderImplementation.ProvidedTypes let DateTime1970Jan01 = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc) (* ECMA Spec (Oct2002), Part II, 24.2.2 PE File Header. *) let timestamp = (System.DateTime.UtcNow - DateTime1970Jan01).TotalSeconds |> int - // -------------------------------------------------------------------- - // ILExportedTypesAndForwarders --> ILExportedTypeOrForwarder table - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- + // ILExportedTypesAndForwarders --> ILExportedTypeOrForwarder table + // -------------------------------------------------------------------- - let rec GenNestedExportedTypePass3 cenv cidx (ce: ILNestedExportedType) = + let rec GenNestedExportedTypePass3 cenv cidx (ce: ILNestedExportedType) = let flags = GetMemberAccessFlags ce.Access - let nidx = - AddUnsharedRow cenv ILTableNames.ExportedType - (UnsharedRow - [| ULong flags + let nidx = + AddUnsharedRow cenv ILTableNames.ExportedType + (UnsharedRow + [| ULong flags ULong 0x0 - StringE (GetStringHeapIdx cenv ce.Name) - StringE 0 + StringE (GetStringHeapIdx cenv ce.Name) + StringE 0 Implementation (ImplementationTag.ExportedType, cidx) |]) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ExportedType, nidx) ce.CustomAttrs GenNestedExportedTypesPass3 cenv nidx ce.Nested @@ -12131,39 +12131,39 @@ namespace ProviderImplementation.ProvidedTypes and GenNestedExportedTypesPass3 cenv nidx (nce: ILNestedExportedTypesAndForwarders) = nce.Entries |> Array.iter (GenNestedExportedTypePass3 cenv nidx) - and GenExportedTypePass3 cenv (ce: ILExportedTypeOrForwarder) = + and GenExportedTypePass3 cenv (ce: ILExportedTypeOrForwarder) = let nselem, nelem = GetTypeNameAsElemPair cenv (ce.Namespace, ce.Name) let flags = GetTypeAccessFlags ce.Access let flags = if ce.IsForwarder then 0x00200000 ||| flags else flags let impl = GetScopeRefAsImplementationElem cenv ce.ScopeRef - let cidx = - AddUnsharedRow cenv ILTableNames.ExportedType - (UnsharedRow - [| ULong flags + let cidx = + AddUnsharedRow cenv ILTableNames.ExportedType + (UnsharedRow + [| ULong flags ULong 0x0 - nelem - nselem + nelem + nselem Implementation impl |]) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ExportedType, cidx) ce.CustomAttrs GenNestedExportedTypesPass3 cenv cidx ce.Nested - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // manifest --> generate Assembly row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - and GetManifestAsAssemblyRow cenv m = - UnsharedRow + and GetManifestAsAssemblyRow cenv m = + UnsharedRow [|ULong m.AuxModuleHashAlgorithm UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Major) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Minor) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Build) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Revision) - ULong - ( //(match m.AssemblyLongevity with + ULong + ( //(match m.AssemblyLongevity with //| ILAssemblyLongevity.Unspecified -> 0x0000 - //| ILAssemblyLongevity.Library -> 0x0002 + //| ILAssemblyLongevity.Library -> 0x0002 //| ILAssemblyLongevity.PlatformAppDomain -> 0x0004 // | ILAssemblyLongevity.PlatformProcess -> 0x0006 // | ILAssemblyLongevity.PlatformSystem -> 0x0008) ||| @@ -12171,28 +12171,28 @@ namespace ProviderImplementation.ProvidedTypes // Setting these causes peverify errors. Hence both ilread and ilwrite ignore them and refuse to set them. // Any debugging customattributes will automatically propagate // REVIEW: No longer appears to be the case - (if m.JitTracking then 0x8000 else 0x0) ||| + (if m.JitTracking then 0x8000 else 0x0) ||| (match m.PublicKey with UNone -> 0x0000 | USome _ -> 0x0001) ||| 0x0000) (match m.PublicKey with UNone -> Blob 0 | USome x -> Blob (GetBytesAsBlobIdx cenv x)) StringE (GetStringHeapIdx cenv m.Name) (match m.Locale with UNone -> StringE 0 | USome x -> StringE (GetStringHeapIdx cenv x)) |] - and GenManifestPass3 cenv m = + and GenManifestPass3 cenv m = let aidx = AddUnsharedRow cenv ILTableNames.Assembly (GetManifestAsAssemblyRow cenv m) #if EMIT_SECURITY_DECLS GenSecurityDeclsPass3 cenv (hds_Assembly, aidx) m.SecurityDecls.Entries #endif GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Assembly, aidx) m.CustomAttrs - m.ExportedTypes.Entries |> Array.iter (GenExportedTypePass3 cenv) - // Record the entrypoint decl if needed. + m.ExportedTypes.Entries |> Array.iter (GenExportedTypePass3 cenv) + // Record the entrypoint decl if needed. match m.EntrypointElsewhere with - | Some mref -> + | Some mref -> match cenv.entrypoint with | Some e -> failwithf "duplicate entrypoint %O" e | None -> cenv.entrypoint <- Some (false, GetModuleRefAsIdx cenv mref) | None -> () - and newGuid (modul: ILModuleDef) = + and newGuid (modul: ILModuleDef) = let n = timestamp let m = hash n let m2 = hash modul.Name @@ -12204,44 +12204,44 @@ namespace ProviderImplementation.ProvidedTypes let m2 = hash modul.Name [| b0 m; b1 m; b2 m; b3 m; b0 m2; b1 m2; b2 m2; b3 m2; 0xa7uy; 0x45uy; 0x03uy; 0x83uy; b0 n; b1 n; b2 n; b3 n |] - and GetModuleAsRow (cenv:cenv) (modul: ILModuleDef) = + and GetModuleAsRow (cenv:cenv) (modul: ILModuleDef) = // Store the generated MVID in the environment (needed for generating debug information) let modulGuid = if cenv.deterministic then deterministicGuid modul else newGuid modul cenv.moduleGuid <- modulGuid - UnsharedRow - [| UShort (uint16 0x0) - StringE (GetStringHeapIdx cenv modul.Name) - Guid (GetGuidIdx cenv modulGuid) - Guid 0 + UnsharedRow + [| UShort (uint16 0x0) + StringE (GetStringHeapIdx cenv modul.Name) + Guid (GetGuidIdx cenv modulGuid) + Guid 0 Guid 0 |] - let rowElemCompare (e1: RowElement) (e2: RowElement) = - let c = compare e1.Val e2.Val - if c <> 0 then c else + let rowElemCompare (e1: RowElement) (e2: RowElement) = + let c = compare e1.Val e2.Val + if c <> 0 then c else compare e1.Tag e2.Tag - module List = - let rec assoc x l = - match l with + module List = + let rec assoc x l = + match l with | [] -> failwith "index not found" | ((h, r)::t) -> if x = h then r else assoc x t - let rec memAssoc x l = - match l with + let rec memAssoc x l = + match l with | [] -> false | ((h, _)::t) -> x = h || memAssoc x t - let TableRequiresSorting tab = - List.memAssoc tab ILTableNames.sortedTableInfo + let TableRequiresSorting tab = + List.memAssoc tab ILTableNames.sortedTableInfo - let SortTableRows tab (rows:GenericRow[]) = + let SortTableRows tab (rows:GenericRow[]) = assert (TableRequiresSorting tab) let col = List.assoc tab ILTableNames.sortedTableInfo - rows + rows // This needs to be a stable sort, so we use List.sortWith |> Array.toList - |> List.sortWith (fun r1 r2 -> rowElemCompare r1[col] r2[col]) + |> List.sortWith (fun r1 r2 -> rowElemCompare r1[col] r2[col]) |> Array.ofList //|> Array.map SharedRow @@ -12262,38 +12262,38 @@ namespace ProviderImplementation.ProvidedTypes Properties=props Events=events Token=0 - //SecurityDecls=emptyILSecurityDecls; + //SecurityDecls=emptyILSecurityDecls; //HasSecurity=false; - } - let mkILTypeDefForGlobalFunctions ilg (methods, fields) = + } + let mkILTypeDefForGlobalFunctions ilg (methods, fields) = mkILSimpleClass ilg (UNone, typeNameForGlobalFunctions, methods, fields, emptyILTypeDefs, emptyILProperties, emptyILEvents, emptyILCustomAttrs) - let destTypeDefsWithGlobalFunctionsFirst ilg (tdefs: ILTypeDefs) = + let destTypeDefsWithGlobalFunctionsFirst ilg (tdefs: ILTypeDefs) = let l = tdefs.Entries let top, nontop = l |> Array.partition (fun td -> td.Name = typeNameForGlobalFunctions) let top2 = if isEmpty top then [| mkILTypeDefForGlobalFunctions ilg (emptyILMethods, emptyILFields) |] else top Array.append top2 nontop - let GenModule (cenv: cenv) (modul: ILModuleDef) = + let GenModule (cenv: cenv) (modul: ILModuleDef) = let midx = AddUnsharedRow cenv ILTableNames.Module (GetModuleAsRow cenv modul) - Array.iter (GenResourcePass3 cenv) modul.Resources.Entries + Array.iter (GenResourcePass3 cenv) modul.Resources.Entries let tds = destTypeDefsWithGlobalFunctionsFirst cenv.ilg modul.TypeDefs GenTypeDefsPass1 [] cenv tds GenTypeDefsPass2 0 [] cenv tds (match modul.Manifest with None -> () | Some m -> GenManifestPass3 cenv m) GenTypeDefsPass3 [] cenv tds GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Module, midx) modul.CustomAttrs - // GenericParam is the only sorted table indexed by Columns in other tables (GenericParamConstraint\CustomAttributes). - // Hence we need to sort it before we emit any entries in GenericParamConstraint\CustomAttributes that are attached to generic params. - // Note this mutates the rows in a table. 'SetRowsOfTable' clears - // the key --> index map since it is no longer valid + // GenericParam is the only sorted table indexed by Columns in other tables (GenericParamConstraint\CustomAttributes). + // Hence we need to sort it before we emit any entries in GenericParamConstraint\CustomAttributes that are attached to generic params. + // Note this mutates the rows in a table. 'SetRowsOfTable' clears + // the key --> index map since it is no longer valid cenv.GetTable(ILTableNames.GenericParam).SetRowsOfSharedTable (SortTableRows ILTableNames.GenericParam (cenv.GetTable(ILTableNames.GenericParam).GenericRowsOfTable)) GenTypeDefsPass4 [] cenv tds let generateIL requiredDataFixups (desiredMetadataVersion, generatePdb, ilg: ILGlobals, emitTailcalls, deterministic, showTimes) (m: ILModuleDef) cilStartAddress = let isDll = m.IsDLL - let cenv = + let cenv = { emitTailcalls=emitTailcalls deterministic = deterministic showTimes=showTimes @@ -12305,8 +12305,8 @@ namespace ProviderImplementation.ProvidedTypes nextCodeAddr = cilStartAddress data = ByteBuffer.Create 200 resources = ByteBuffer.Create 200 - tables= - Array.init 64 (fun i -> + tables= + Array.init 64 (fun i -> if (i = ILTableNames.AssemblyRef.Index || i = ILTableNames.MemberRef.Index || i = ILTableNames.ModuleRef.Index || @@ -12315,7 +12315,7 @@ namespace ProviderImplementation.ProvidedTypes i = ILTableNames.TypeSpec.Index || i = ILTableNames.MethodSpec.Index || i = ILTableNames.StandAloneSig.Index || - i = ILTableNames.GenericParam.Index) then + i = ILTableNames.GenericParam.Index) then MetadataTable.Shared (MetadataTable.New ("row table "+string i, EqualityComparer.Default)) else MetadataTable.Unshared (MetadataTable.New ("row table "+string i, EqualityComparer.Default))) @@ -12339,19 +12339,19 @@ namespace ProviderImplementation.ProvidedTypes // These must use structural comparison since they are keyed by arrays guids=MetadataTable<_>.New("guids", HashIdentity.Structural) blobs= MetadataTable<_>.New("blobs", HashIdentity.Structural) - strings= MetadataTable<_>.New("strings", EqualityComparer.Default) + strings= MetadataTable<_>.New("strings", EqualityComparer.Default) userStrings= MetadataTable<_>.New("user strings", EqualityComparer.Default) } - // Now the main compilation step + // Now the main compilation step GenModule cenv m // .exe files have a .entrypoint instruction. Do not write it to the entrypoint when writing dll. - let entryPointToken = - match cenv.entrypoint with - | Some (epHere, tok) -> + let entryPointToken = + match cenv.entrypoint with + | Some (epHere, tok) -> if isDll then 0x0 - else getUncodedToken (if epHere then ILTableNames.Method else ILTableNames.File) tok - | None -> + else getUncodedToken (if epHere then ILTableNames.Method else ILTableNames.File) tok + | None -> if not isDll then printfn "warning: no entrypoint specified in executable binary" 0x0 @@ -12375,9 +12375,9 @@ namespace ProviderImplementation.ProvidedTypes let userStrings = cenv.userStrings.EntriesAsArray |> Array.map Encoding.Unicode.GetBytes let blobs = cenv.blobs.EntriesAsArray let guids = cenv.guids.EntriesAsArray - let tables = cenv.tables - let code = cenv.GetCode() - // turn idx tbls into token maps + let tables = cenv.tables + let code = cenv.GetCode() + // turn idx tbls into token maps let mappings = { TypeDefTokenMap = (fun t -> getUncodedToken ILTableNames.TypeDef (idxForNestedTypeDef t)) @@ -12393,7 +12393,7 @@ namespace ProviderImplementation.ProvidedTypes EventTokenMap = (fun t ed -> let tidx = idxForNestedTypeDef t getUncodedToken ILTableNames.Event (cenv.eventDefs.GetTableEntry (EventKey (tidx, ed.Name)))) } - // New return the results + // New return the results let data = cenv.data.Close() let resources = cenv.resources.Close() (strings, userStrings, blobs, guids, tables, entryPointToken, code, cenv.requiredStringFixups, data, resources, pdbData, mappings) @@ -12402,47 +12402,47 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== // TABLES+BLOBS --> PHYSICAL METADATA+BLOBS //===================================================================== - let chunk sz next = ({addr=next; size=sz}, next + sz) + let chunk sz next = ({addr=next; size=sz}, next + sz) let nochunk next = ({addr= 0x0;size= 0x0; } , next) - let count f arr = - Array.fold (fun x y -> x + f y) 0x0 arr + let count f arr = + Array.fold (fun x y -> x + f y) 0x0 arr let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailcalls, deterministic, showTimes) modul cilStartAddress = - // When we know the real RVAs of the data section we fixup the references for the FieldRVA table. - // These references are stored as offsets into the metadata we return from this function + // When we know the real RVAs of the data section we fixup the references for the FieldRVA table. + // These references are stored as offsets into the metadata we return from this function let requiredDataFixups = ResizeArray() let next = cilStartAddress - let strings, userStrings, blobs, guids, tables, entryPointToken, code, requiredStringFixups, data, resources, pdbData, mappings = + let strings, userStrings, blobs, guids, tables, entryPointToken, code, requiredStringFixups, data, resources, pdbData, mappings = generateIL requiredDataFixups (desiredMetadataVersion, generatePdb, ilg, emitTailcalls, deterministic, showTimes) modul cilStartAddress let tableSize (tab: ILTableName) = tables[tab.Index].Count - // Now place the code + // Now place the code let codeSize = code.Length let alignedCodeSize = align 0x4 codeSize let codep, next = chunk codeSize next let codePadding = Array.create (alignedCodeSize - codeSize) 0x0uy let _codePaddingChunk, next = chunk codePadding.Length next - // Now layout the chunks of metadata and IL + // Now layout the chunks of metadata and IL let metadataHeaderStartChunk, _next = chunk 0x10 next let numStreams = 0x05 let (mdtableVersionMajor, mdtableVersionMinor) = metadataSchemaVersionSupportedByCLRVersion desiredMetadataVersion - let version = + let version = Encoding.UTF8.GetBytes (sprintf "v%d.%d.%d" desiredMetadataVersion.Major desiredMetadataVersion.Minor desiredMetadataVersion.Build) let paddedVersionLength = align 0x4 (Array.length version) - // Most addresses after this point are measured from the MD root - // Switch to md-rooted addresses + // Most addresses after this point are measured from the MD root + // Switch to md-rooted addresses let next = metadataHeaderStartChunk.size let _metadataHeaderVersionChunk, next = chunk paddedVersionLength next let _metadataHeaderEndChunk, next = chunk 0x04 next @@ -12456,13 +12456,13 @@ namespace ProviderImplementation.ProvidedTypes let stringsStreamUnpaddedSize = count (fun (s:byte[]) -> s.Length) strings + 1 let stringsStreamPaddedSize = align 4 stringsStreamUnpaddedSize - + let userStringsStreamUnpaddedSize = count (fun (s:byte[]) -> let n = s.Length + 1 in n + ByteBuffer.Z32Size n) userStrings + 1 let userStringsStreamPaddedSize = align 4 userStringsStreamUnpaddedSize - + let guidsStreamUnpaddedSize = (Array.length guids) * 0x10 let guidsStreamPaddedSize = align 4 guidsStreamUnpaddedSize - + let blobsStreamUnpaddedSize = count (fun (blob:byte[]) -> let n = blob.Length in n + ByteBuffer.Z32Size n) blobs + 1 let blobsStreamPaddedSize = align 4 blobsStreamUnpaddedSize @@ -12470,30 +12470,30 @@ namespace ProviderImplementation.ProvidedTypes let stringsBig = stringsStreamPaddedSize >= 0x10000 let blobsBig = blobsStreamPaddedSize >= 0x10000 - // 64bit bitvector indicating which tables are in the metadata. - let (valid1, valid2), _ = - (((0, 0), 0), tables) ||> Array.fold (fun ((valid1, valid2) as valid, n) rows -> - let valid = + // 64bit bitvector indicating which tables are in the metadata. + let (valid1, valid2), _ = + (((0, 0), 0), tables) ||> Array.fold (fun ((valid1, valid2) as valid, n) rows -> + let valid = if rows.Count = 0 then valid else - ( (if n < 32 then valid1 ||| (1 <<< n ) else valid1), + ( (if n < 32 then valid1 ||| (1 <<< n ) else valid1), (if n >= 32 then valid2 ||| (1 <<< (n-32)) else valid2) ) (valid, n+1)) - // 64bit bitvector indicating which tables are sorted. - // Constant - REVIEW: make symbolic! compute from sorted table info! + // 64bit bitvector indicating which tables are sorted. + // Constant - REVIEW: make symbolic! compute from sorted table info! let sorted1 = 0x3301fa00 - let sorted2 = - // If there are any generic parameters in the binary we're emitting then mark that - // table as sorted, otherwise don't. This maximizes the number of assemblies we emit - // which have an ECMA-v.1. compliant set of sorted tables. - (if tableSize (ILTableNames.GenericParam) > 0 then 0x00000400 else 0x00000000) ||| - (if tableSize (ILTableNames.GenericParamConstraint) > 0 then 0x00001000 else 0x00000000) ||| + let sorted2 = + // If there are any generic parameters in the binary we're emitting then mark that + // table as sorted, otherwise don't. This maximizes the number of assemblies we emit + // which have an ECMA-v.1. compliant set of sorted tables. + (if tableSize (ILTableNames.GenericParam) > 0 then 0x00000400 else 0x00000000) ||| + (if tableSize (ILTableNames.GenericParamConstraint) > 0 then 0x00001000 else 0x00000000) ||| 0x00000200 - + let guidAddress n = (if n = 0 then 0 else (n - 1) * 0x10 + 0x01) - let stringAddressTable = + let stringAddressTable = let tab = Array.create (strings.Length + 1) 0 let pos = ref 1 for i = 1 to strings.Length do @@ -12502,11 +12502,11 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + s.Length tab - let stringAddress n = + let stringAddress n = if n >= Array.length stringAddressTable then failwith ("string index "+string n+" out of range") stringAddressTable[n] - - let userStringAddressTable = + + let userStringAddressTable = let tab = Array.create (Array.length userStrings + 1) 0 let pos = ref 1 for i = 1 to Array.length userStrings do @@ -12516,11 +12516,11 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + n + ByteBuffer.Z32Size n tab - let userStringAddress n = + let userStringAddress n = if n >= Array.length userStringAddressTable then failwith "userString index out of range" userStringAddressTable[n] - - let blobAddressTable = + + let blobAddressTable = let tab = Array.create (blobs.Length + 1) 0 let pos = ref 1 for i = 1 to blobs.Length do @@ -12529,42 +12529,42 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + blob.Length + ByteBuffer.Z32Size blob.Length tab - let blobAddress n = + let blobAddress n = if n >= blobAddressTable.Length then failwith "blob index out of range" blobAddressTable[n] - - let sortedTables = - Array.init 64 (fun i -> + + let sortedTables = + Array.init 64 (fun i -> let tab = tables[i] let tabName = ILTableName.FromIndex i let rows = tab.GenericRowsOfTable if TableRequiresSorting tabName then SortTableRows tabName rows else rows) - - let codedTables = - + + let codedTables = + let bignessTable = Array.map (fun rows -> Array.length rows >= 0x10000) sortedTables let bigness (tab:int32) = bignessTable[tab] - + let codedBigness nbits tab = (tableSize tab) >= (0x10000 >>> nbits) - - let tdorBigness = - codedBigness 2 ILTableNames.TypeDef || - codedBigness 2 ILTableNames.TypeRef || + + let tdorBigness = + codedBigness 2 ILTableNames.TypeDef || + codedBigness 2 ILTableNames.TypeRef || codedBigness 2 ILTableNames.TypeSpec - - let tomdBigness = - codedBigness 1 ILTableNames.TypeDef || + + let tomdBigness = + codedBigness 1 ILTableNames.TypeDef || codedBigness 1 ILTableNames.Method - - let hcBigness = + + let hcBigness = codedBigness 2 ILTableNames.Field || codedBigness 2 ILTableNames.Param || codedBigness 2 ILTableNames.Property - - let hcaBigness = + + let hcaBigness = codedBigness 5 ILTableNames.Method || codedBigness 5 ILTableNames.Field || codedBigness 5 ILTableNames.TypeRef || @@ -12588,82 +12588,82 @@ namespace ProviderImplementation.ProvidedTypes codedBigness 5 ILTableNames.GenericParamConstraint || codedBigness 5 ILTableNames.MethodSpec - - let hfmBigness = - codedBigness 1 ILTableNames.Field || + + let hfmBigness = + codedBigness 1 ILTableNames.Field || codedBigness 1 ILTableNames.Param - - let hdsBigness = - codedBigness 2 ILTableNames.TypeDef || + + let hdsBigness = + codedBigness 2 ILTableNames.TypeDef || codedBigness 2 ILTableNames.Method || codedBigness 2 ILTableNames.Assembly - - let mrpBigness = + + let mrpBigness = codedBigness 3 ILTableNames.TypeRef || codedBigness 3 ILTableNames.ModuleRef || codedBigness 3 ILTableNames.Method || codedBigness 3 ILTableNames.TypeSpec - - let hsBigness = - codedBigness 1 ILTableNames.Event || - codedBigness 1 ILTableNames.Property - + + let hsBigness = + codedBigness 1 ILTableNames.Event || + codedBigness 1 ILTableNames.Property + let mdorBigness = - codedBigness 1 ILTableNames.Method || - codedBigness 1 ILTableNames.MemberRef - + codedBigness 1 ILTableNames.Method || + codedBigness 1 ILTableNames.MemberRef + let mfBigness = codedBigness 1 ILTableNames.Field || - codedBigness 1 ILTableNames.Method - + codedBigness 1 ILTableNames.Method + let iBigness = - codedBigness 2 ILTableNames.File || - codedBigness 2 ILTableNames.AssemblyRef || - codedBigness 2 ILTableNames.ExportedType - - let catBigness = - codedBigness 3 ILTableNames.Method || - codedBigness 3 ILTableNames.MemberRef - - let rsBigness = - codedBigness 2 ILTableNames.Module || - codedBigness 2 ILTableNames.ModuleRef || + codedBigness 2 ILTableNames.File || + codedBigness 2 ILTableNames.AssemblyRef || + codedBigness 2 ILTableNames.ExportedType + + let catBigness = + codedBigness 3 ILTableNames.Method || + codedBigness 3 ILTableNames.MemberRef + + let rsBigness = + codedBigness 2 ILTableNames.Module || + codedBigness 2 ILTableNames.ModuleRef || codedBigness 2 ILTableNames.AssemblyRef || codedBigness 2 ILTableNames.TypeRef let tablesBuf = ByteBuffer.Create 20000 - // Now the coded tables themselves - first the schemata header - tablesBuf.EmitIntsAsBytes - [| 0x00; 0x00; 0x00; 0x00; - mdtableVersionMajor // major version of table schemata - mdtableVersionMinor // minor version of table schemata - - ((if stringsBig then 0x01 else 0x00) ||| // bit vector for heap size - (if guidsBig then 0x02 else 0x00) ||| + // Now the coded tables themselves - first the schemata header + tablesBuf.EmitIntsAsBytes + [| 0x00; 0x00; 0x00; 0x00; + mdtableVersionMajor // major version of table schemata + mdtableVersionMinor // minor version of table schemata + + ((if stringsBig then 0x01 else 0x00) ||| // bit vector for heap size + (if guidsBig then 0x02 else 0x00) ||| (if blobsBig then 0x04 else 0x00)) 0x01 (* reserved, always 1 *) |] - + tablesBuf.EmitInt32 valid1 tablesBuf.EmitInt32 valid2 tablesBuf.EmitInt32 sorted1 tablesBuf.EmitInt32 sorted2 - - // Numbers of rows in various tables - for rows in sortedTables do - if rows.Length <> 0 then - tablesBuf.EmitInt32 rows.Length - - - - // The tables themselves + + // Numbers of rows in various tables for rows in sortedTables do - for row in rows do - for x in row do - // Emit the coded token for the array element + if rows.Length <> 0 then + tablesBuf.EmitInt32 rows.Length + + + + // The tables themselves + for rows in sortedTables do + for row in rows do + for x in row do + // Emit the coded token for the array element let t = x.Tag let n = x.Val - match t with + match t with | _ when t = RowElementTags.UShort -> tablesBuf.EmitUInt16 (uint16 n) | _ when t = RowElementTags.ULong -> tablesBuf.EmitInt32 n | _ when t = RowElementTags.Data -> recordRequiredDataFixup requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, false) @@ -12678,8 +12678,8 @@ namespace ProviderImplementation.ProvidedTypes | _ when t <= RowElementTags.HasCustomAttributeMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasCustomAttributeMin) 5 hcaBigness n | _ when t <= RowElementTags.HasFieldMarshalMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasFieldMarshalMin) 1 hfmBigness n | _ when t <= RowElementTags.HasDeclSecurityMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasDeclSecurityMin) 2 hdsBigness n - | _ when t <= RowElementTags.MemberRefParentMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberRefParentMin) 3 mrpBigness n - | _ when t <= RowElementTags.HasSemanticsMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasSemanticsMin) 1 hsBigness n + | _ when t <= RowElementTags.MemberRefParentMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberRefParentMin) 3 mrpBigness n + | _ when t <= RowElementTags.HasSemanticsMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasSemanticsMin) 1 hsBigness n | _ when t <= RowElementTags.MethodDefOrRefMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MethodDefOrRefMin) 1 mdorBigness n | _ when t <= RowElementTags.MemberForwardedMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberForwardedMin) 1 mfBigness n | _ when t <= RowElementTags.ImplementationMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.ImplementationMin) 2 iBigness n @@ -12691,8 +12691,8 @@ namespace ProviderImplementation.ProvidedTypes let tablesStreamUnpaddedSize = codedTables.Length - // QUERY: extra 4 empty bytes in array.exe - why? Include some extra padding after - // the tables just in case there is a mistake in the ECMA spec. + // QUERY: extra 4 empty bytes in array.exe - why? Include some extra padding after + // the tables just in case there is a mistake in the ECMA spec. let tablesStreamPaddedSize = align 4 (tablesStreamUnpaddedSize + 4) let tablesChunk, next = chunk tablesStreamPaddedSize next let tablesStreamPadding = tablesChunk.size - tablesStreamUnpaddedSize @@ -12704,24 +12704,24 @@ namespace ProviderImplementation.ProvidedTypes let guidsChunk, next = chunk (0x10 * guids.Length) next let blobsChunk, _next = chunk blobsStreamPaddedSize next let blobsStreamPadding = blobsChunk.size - blobsStreamUnpaddedSize - + let metadata, guidStart = - let mdbuf = ByteBuffer.Create 500000 - mdbuf.EmitIntsAsBytes - [| 0x42; 0x53; 0x4a; 0x42; // Magic signature - 0x01; 0x00; // Major version - 0x01; 0x00; // Minor version + let mdbuf = ByteBuffer.Create 500000 + mdbuf.EmitIntsAsBytes + [| 0x42; 0x53; 0x4a; 0x42; // Magic signature + 0x01; 0x00; // Major version + 0x01; 0x00; // Minor version |]; - mdbuf.EmitInt32 0x0; // Reserved + mdbuf.EmitInt32 0x0; // Reserved mdbuf.EmitInt32 paddedVersionLength; mdbuf.EmitBytes version; - for i = 1 to (paddedVersionLength - Array.length version) do + for i = 1 to (paddedVersionLength - Array.length version) do mdbuf.EmitIntAsByte 0x00; - mdbuf.EmitBytes - [| 0x00uy; 0x00uy; // flags, reserved + mdbuf.EmitBytes + [| 0x00uy; 0x00uy; // flags, reserved b0 numStreams; b1 numStreams; |]; mdbuf.EmitInt32 tablesChunk.addr; mdbuf.EmitInt32 tablesChunk.size; @@ -12738,46 +12738,46 @@ namespace ProviderImplementation.ProvidedTypes mdbuf.EmitInt32 blobsChunk.addr; mdbuf.EmitInt32 blobsChunk.size; mdbuf.EmitIntsAsBytes [| 0x23; 0x42; 0x6c; 0x6f; 0x62; 0x00; 0x00; 0x00; (* #Blob000 *)|]; - - // Now the coded tables themselves - mdbuf.EmitBytes codedTables; - for i = 1 to tablesStreamPadding do + + // Now the coded tables themselves + mdbuf.EmitBytes codedTables; + for i = 1 to tablesStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The string stream + // The string stream mdbuf.EmitByte 0x00uy; for s in strings do mdbuf.EmitBytes s; - for i = 1 to stringsStreamPadding do + for i = 1 to stringsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The user string stream + // The user string stream mdbuf.EmitByte 0x00uy; for s in userStrings do mdbuf.EmitZ32 (s.Length + 1); mdbuf.EmitBytes s; mdbuf.EmitIntAsByte (markerForUnicodeBytes s) - for i = 1 to userStringsStreamPadding do + for i = 1 to userStringsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The GUID stream + // The GUID stream let guidStart = mdbuf.Position Array.iter mdbuf.EmitBytes guids; - - // The blob stream + + // The blob stream mdbuf.EmitByte 0x00uy; - for s in blobs do + for s in blobs do mdbuf.EmitZ32 s.Length; mdbuf.EmitBytes s - for i = 1 to blobsStreamPadding do + for i = 1 to blobsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // Done - close the buffer and return the result. + // Done - close the buffer and return the result. mdbuf.Close(), guidStart - - // Now we know the user string tables etc. we can fixup the - // uses of strings in the code + + // Now we know the user string tables etc. we can fixup the + // uses of strings in the code for (codeStartAddr, l) in requiredStringFixups do - for (codeOffset, userStringIndex) in l do + for (codeOffset, userStringIndex) in l do if codeStartAddr < codep.addr || codeStartAddr >= codep.addr + codep.size then failwith "strings-in-code fixup: a group of fixups is located outside the code array"; let locInCode = ((codeStartAddr + codeOffset) - codep.addr) checkFixup32 code locInCode 0xdeadbeef; @@ -12791,17 +12791,17 @@ namespace ProviderImplementation.ProvidedTypes // PHYSICAL METADATA+BLOBS --> PHYSICAL PE FORMAT //--------------------------------------------------------------------- - // THIS LAYS OUT A 2-SECTION .NET PE BINARY - // SECTIONS + // THIS LAYS OUT A 2-SECTION .NET PE BINARY + // SECTIONS // TEXT: physical 0x0200 --> RVA 0x00020000 - // e.g. raw size 0x9600, + // e.g. raw size 0x9600, // e.g. virt size 0x9584 // RELOC: physical 0x9800 --> RVA 0x0000c000 // i.e. physbase --> rvabase // where physbase = textbase + text raw size // phsrva = roundup(0x2000, 0x0002000 + text virt size) - let msdosHeader: byte[] = + let msdosHeader: byte[] = [| 0x4duy; 0x5auy; 0x90uy; 0x00uy; 0x03uy; 0x00uy; 0x00uy; 0x00uy 0x04uy; 0x00uy; 0x00uy; 0x00uy; 0xFFuy; 0xFFuy; 0x00uy; 0x00uy 0xb8uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy @@ -12829,97 +12829,97 @@ namespace ProviderImplementation.ProvidedTypes os.Write (dw6 x); os.Write (dw7 x) - let writeInt32 (os: BinaryWriter) x = + let writeInt32 (os: BinaryWriter) x = os.Write (b0 x) os.Write (b1 x) os.Write (b2 x) - os.Write (b3 x) + os.Write (b3 x) - let writeInt32AsUInt16 (os: BinaryWriter) x = + let writeInt32AsUInt16 (os: BinaryWriter) x = os.Write (b0 x) os.Write (b1 x) - + let writeDirectory os dict = writeInt32 os (if dict.size = 0x0 then 0x0 else dict.addr); writeInt32 os dict.size - let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk, 0, chunk.Length) + let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk, 0, chunk.Length) - let writeBinaryAndReportMappings (outfile: string, - ilg: ILGlobals, pdbfile: string option, (* signer: ILStrongNameSigner option, *) portablePDB, embeddedPDB, + let writeBinaryAndReportMappings (outfile: string, + ilg: ILGlobals, pdbfile: string option, (* signer: ILStrongNameSigner option, *) portablePDB, embeddedPDB, embedAllSource, embedSourceList, sourceLink, emitTailcalls, deterministic, showTimes, dumpDebugInfo ) modul = let isDll = modul.IsDLL - - let os = + + let os = try // Ensure the output directory exists otherwise it will fail let dir = Path.GetDirectoryName(outfile) if not (Directory.Exists(dir)) then Directory.CreateDirectory(dir) |>ignore new BinaryWriter(System.IO.File.OpenWrite(outfile)) - with e -> - failwith ("Could not open file for writing (binary mode): " + outfile + "\n" + e.ToString()) + with e -> + failwith ("Could not open file for writing (binary mode): " + outfile + "\n" + e.ToString()) let pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings = - try + try let imageBaseReal = modul.ImageBase // FIXED CHOICE let alignVirt = modul.VirtualAlignment // FIXED CHOICE let alignPhys = modul.PhysicalAlignment // FIXED CHOICE - + let isItanium = modul.Platform = Some(IA64) - - let numSections = 3 // .text, .sdata, .reloc + + let numSections = 3 // .text, .sdata, .reloc - // HEADERS + // HEADERS let next = 0x0 let headerSectionPhysLoc = 0x0 let headerAddr = next let next = headerAddr - + let msdosHeaderSize = 0x80 let msdosHeaderChunk, next = chunk msdosHeaderSize next - + let peSignatureSize = 0x04 let peSignatureChunk, next = chunk peSignatureSize next - + let peFileHeaderSize = 0x14 let peFileHeaderChunk, next = chunk peFileHeaderSize next - + let peOptionalHeaderSize = if modul.Is64Bit then 0xf0 else 0xe0 let peOptionalHeaderChunk, next = chunk peOptionalHeaderSize next - + let textSectionHeaderSize = 0x28 let textSectionHeaderChunk, next = chunk textSectionHeaderSize next - + let dataSectionHeaderSize = 0x28 let dataSectionHeaderChunk, next = chunk dataSectionHeaderSize next - + let relocSectionHeaderSize = 0x28 let relocSectionHeaderChunk, next = chunk relocSectionHeaderSize next - + let headerSize = next - headerAddr let nextPhys = align alignPhys (headerSectionPhysLoc + headerSize) let headerSectionPhysSize = nextPhys - headerSectionPhysLoc let next = align alignVirt (headerAddr + headerSize) - - // TEXT SECTION: 8 bytes IAT table 72 bytes CLI header + + // TEXT SECTION: 8 bytes IAT table 72 bytes CLI header let textSectionPhysLoc = nextPhys let textSectionAddr = next let next = textSectionAddr - + let importAddrTableChunk, next = chunk 0x08 next let cliHeaderPadding = (if isItanium then (align 16 next) else next) - next let next = next + cliHeaderPadding let cliHeaderChunk, next = chunk 0x48 next - - let desiredMetadataVersion = + + let desiredMetadataVersion = if modul.MetadataVersion <> "" then Version.Parse modul.MetadataVersion else - match ilg.systemRuntimeScopeRef with - | ILScopeRef.Local -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Local" + match ilg.systemRuntimeScopeRef with + | ILScopeRef.Local -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Local" | ILScopeRef.Module(_) -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Module" | ILScopeRef.Assembly(aref) -> match aref.Version with @@ -12931,9 +12931,9 @@ namespace ProviderImplementation.ProvidedTypes let _codeChunk, next = chunk code.Length next let _codePaddingChunk, next = chunk codePadding.Length next - + let metadataChunk, next = chunk metadata.Length next - + #if EMIT_STRONG_NAME let strongnameChunk, next = match signer with @@ -12944,7 +12944,7 @@ namespace ProviderImplementation.ProvidedTypes #endif let resourcesChunk, next = chunk resources.Length next - + let rawdataChunk, next = chunk data.Length next let vtfixupsChunk, next = nochunk next // Note: only needed for mixed mode assemblies @@ -12958,7 +12958,7 @@ namespace ProviderImplementation.ProvidedTypes let next = align 0x10 (next + 0x05) - 0x05 let importTableChunk = { addr=importTableChunk.addr; size = next - importTableChunk.addr} let importTableChunkPadding = importTableChunk.size - (0x28 + 0x14 + 0x0e + 0x0c) - + let next = next + 0x03 let entrypointCodeChunk, next = chunk 0x06 next let globalpointerCodeChunk, next = chunk (if isItanium then 0x8 else 0x0) next @@ -13013,13 +13013,13 @@ namespace ProviderImplementation.ProvidedTypes let nextPhys = align alignPhys (textSectionPhysLoc + textSectionSize) let textSectionPhysSize = nextPhys - textSectionPhysLoc let next = align alignVirt (textSectionAddr + textSectionSize) - - // .RSRC SECTION (DATA) + + // .RSRC SECTION (DATA) let dataSectionPhysLoc = nextPhys let dataSectionAddr = next let dataSectionVirtToPhys v = v - dataSectionAddr + dataSectionPhysLoc - - + + #if EMIT_NATIVE_RESOURCES let resourceFormat = if modul.Is64Bit then Support.X64 else Support.X86 let nativeResources = @@ -13040,15 +13040,15 @@ namespace ProviderImplementation.ProvidedTypes let nativeResourcesChunk, next = chunk 0x0 next #endif - + let dummydatap, next = chunk (if next = dataSectionAddr then 0x01 else 0x0) next - + let dataSectionSize = next - dataSectionAddr let nextPhys = align alignPhys (dataSectionPhysLoc + dataSectionSize) let dataSectionPhysSize = nextPhys - dataSectionPhysLoc let next = align alignVirt (dataSectionAddr + dataSectionSize) - - // .RELOC SECTION base reloc table: 0x0c size + + // .RELOC SECTION base reloc table: 0x0c size let relocSectionPhysLoc = nextPhys let relocSectionAddr = next let baseRelocTableChunk, next = chunk 0x0c next @@ -13058,64 +13058,64 @@ namespace ProviderImplementation.ProvidedTypes let relocSectionPhysSize = nextPhys - relocSectionPhysLoc let next = align alignVirt (relocSectionAddr + relocSectionSize) - // Now we know where the data section lies we can fix up the - // references into the data section from the metadata tables. - begin + // Now we know where the data section lies we can fix up the + // references into the data section from the metadata tables. + begin requiredDataFixups |> Array.iter - (fun (metadataOffset32, (dataOffset, kind)) -> + (fun (metadataOffset32, (dataOffset, kind)) -> let metadataOffset = metadataOffset32 if metadataOffset < 0 || metadataOffset >= metadata.Length - 4 then failwith "data RVA fixup: fixup located outside metadata"; checkFixup32 metadata metadataOffset 0xdeaddddd; - let dataRva = + let dataRva = if kind then let res = dataOffset if res >= resourcesChunk.size then printfn ("resource offset bigger than resource data section"); res - else + else let res = rawdataChunk.addr + dataOffset if res < rawdataChunk.addr then printfn ("data rva before data section"); if res >= rawdataChunk.addr + rawdataChunk.size then printfn "%s" ("data rva after end of data section, dataRva = "+string res+", rawdataChunk.addr = "+string rawdataChunk.addr+", rawdataChunk.size = "+string rawdataChunk.size); res applyFixup32 metadata metadataOffset dataRva); end; - - // IMAGE TOTAL SIZE + + // IMAGE TOTAL SIZE let imageEndSectionPhysLoc = nextPhys let imageEndAddr = next - let write p (os: BinaryWriter) chunkName chunk = - match p with - | None -> () - | Some pExpected -> - os.Flush(); + let write p (os: BinaryWriter) chunkName chunk = + match p with + | None -> () + | Some pExpected -> + os.Flush(); let pCurrent = int32 os.BaseStream.Position - if pCurrent <> pExpected then - failwith ("warning: "+chunkName+" not where expected, pCurrent = "+string pCurrent+", p.addr = "+string pExpected) - writeBytes os chunk - + if pCurrent <> pExpected then + failwith ("warning: "+chunkName+" not where expected, pCurrent = "+string pCurrent+", p.addr = "+string pExpected) + writeBytes os chunk + let writePadding (os: BinaryWriter) _comment sz = if sz < 0 then failwith "writePadding: size < 0"; - for i = 0 to sz - 1 do + for i = 0 to sz - 1 do os.Write 0uy - - // Now we've computed all the offsets, write the image - + + // Now we've computed all the offsets, write the image + write (Some msdosHeaderChunk.addr) os "msdos header" msdosHeader; - + write (Some peSignatureChunk.addr) os "pe signature" [| |]; - + writeInt32 os 0x4550; - + write (Some peFileHeaderChunk.addr) os "pe file header" [| |]; - + if (modul.Platform = Some(AMD64)) then - writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 + writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 elif isItanium then writeInt32AsUInt16 os 0x200 else - writeInt32AsUInt16 os 0x014c; // Machine - IMAGE_FILE_MACHINE_I386 - + writeInt32AsUInt16 os 0x014c; // Machine - IMAGE_FILE_MACHINE_I386 + writeInt32AsUInt16 os numSections; #if EMIT_DEBUG_INFO @@ -13148,193 +13148,193 @@ namespace ProviderImplementation.ProvidedTypes writeInt32 os timestamp // date since 1970 #endif - writeInt32 os 0x00; // Pointer to Symbol Table Always 0 - // 00000090 - writeInt32 os 0x00; // Number of Symbols Always 0 - writeInt32AsUInt16 os peOptionalHeaderSize; // Size of the optional header, the format is described below. - + writeInt32 os 0x00; // Pointer to Symbol Table Always 0 + // 00000090 + writeInt32 os 0x00; // Number of Symbols Always 0 + writeInt32AsUInt16 os peOptionalHeaderSize; // Size of the optional header, the format is described below. + // 64bit: IMAGE_FILE_32BIT_MACHINE ||| IMAGE_FILE_LARGE_ADDRESS_AWARE // 32bit: IMAGE_FILE_32BIT_MACHINE // Yes, 32BIT_MACHINE is set for AMD64... let iMachineCharacteristic = match modul.Platform with | Some IA64 -> 0x20 | Some AMD64 -> 0x0120 | _ -> 0x0100 - + writeInt32AsUInt16 os ((if isDll then 0x2000 else 0x0000) ||| 0x0002 ||| 0x0004 ||| 0x0008 ||| iMachineCharacteristic); - - // Now comes optional header + + // Now comes optional header let peOptionalHeaderByte = peOptionalHeaderByteByCLRVersion desiredMetadataVersion write (Some peOptionalHeaderChunk.addr) os "pe optional header" [| |]; if modul.Is64Bit then - writeInt32AsUInt16 os 0x020B // Magic number is 0x020B for 64-bit + writeInt32AsUInt16 os 0x020B // Magic number is 0x020B for 64-bit else - writeInt32AsUInt16 os 0x010b; // Always 0x10B (see Section 23.1). - writeInt32AsUInt16 os peOptionalHeaderByte; // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8 - writeInt32 os textSectionPhysSize; // Size of the code (text) section, or the sum of all code sections if there are multiple sections. - // 000000a0 - writeInt32 os dataSectionPhysSize; // Size of the initialized data section, or the sum of all such sections if there are multiple data sections. - writeInt32 os 0x00; // Size of the uninitialized data section, or the sum of all such sections if there are multiple uninitialized data sections. - writeInt32 os entrypointCodeChunk.addr; // RVA of entry point , needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 in a section marked execute/read for EXEs or 0 for DLLs e.g. 0x0000b57e - writeInt32 os textSectionAddr; // e.g. 0x0002000 - // 000000b0 + writeInt32AsUInt16 os 0x010b; // Always 0x10B (see Section 23.1). + writeInt32AsUInt16 os peOptionalHeaderByte; // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8 + writeInt32 os textSectionPhysSize; // Size of the code (text) section, or the sum of all code sections if there are multiple sections. + // 000000a0 + writeInt32 os dataSectionPhysSize; // Size of the initialized data section, or the sum of all such sections if there are multiple data sections. + writeInt32 os 0x00; // Size of the uninitialized data section, or the sum of all such sections if there are multiple uninitialized data sections. + writeInt32 os entrypointCodeChunk.addr; // RVA of entry point , needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 in a section marked execute/read for EXEs or 0 for DLLs e.g. 0x0000b57e + writeInt32 os textSectionAddr; // e.g. 0x0002000 + // 000000b0 if modul.Is64Bit then - writeInt64 os ((int64)imageBaseReal) // REVIEW: For 64-bit, we should use a 64-bit image base - else - writeInt32 os dataSectionAddr; // e.g. 0x0000c000 - writeInt32 os imageBaseReal; // Image Base Always 0x400000 (see Section 23.1). - QUERY: no it's not always 0x400000, e.g. 0x034f0000 - - writeInt32 os alignVirt; // Section Alignment Always 0x2000 (see Section 23.1). - writeInt32 os alignPhys; // File Alignment Either 0x200 or 0x1000. - // 000000c0 - writeInt32AsUInt16 os 0x04; // OS Major Always 4 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // OS Minor Always 0 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // User Major Always 0 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // User Minor Always 0 (see Section 23.1). + writeInt64 os ((int64)imageBaseReal) // REVIEW: For 64-bit, we should use a 64-bit image base + else + writeInt32 os dataSectionAddr; // e.g. 0x0000c000 + writeInt32 os imageBaseReal; // Image Base Always 0x400000 (see Section 23.1). - QUERY: no it's not always 0x400000, e.g. 0x034f0000 + + writeInt32 os alignVirt; // Section Alignment Always 0x2000 (see Section 23.1). + writeInt32 os alignPhys; // File Alignment Either 0x200 or 0x1000. + // 000000c0 + writeInt32AsUInt16 os 0x04; // OS Major Always 4 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // OS Minor Always 0 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // User Major Always 0 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // User Minor Always 0 (see Section 23.1). do let (major, minor) = modul.SubsystemVersion writeInt32AsUInt16 os major; writeInt32AsUInt16 os minor; - writeInt32 os 0x00; // Reserved Always 0 (see Section 23.1). - // 000000d0 - writeInt32 os imageEndAddr; // Image Size: Size, in bytes, of image, including all headers and padding; shall be a multiple of Section Alignment. e.g. 0x0000e000 - writeInt32 os headerSectionPhysSize; // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding; shall be a multiple of the file alignment. - writeInt32 os 0x00; // File Checksum Always 0 (see Section 23.1). QUERY: NOT ALWAYS ZERO - writeInt32AsUInt16 os modul.SubSystemFlags; // SubSystem Subsystem required to run this image. Shall be either IMAGE_SUBSYSTEM_WINDOWS_CE_GUI (0x3) or IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2). QUERY: Why is this 3 on the images ILASM produces + writeInt32 os 0x00; // Reserved Always 0 (see Section 23.1). + // 000000d0 + writeInt32 os imageEndAddr; // Image Size: Size, in bytes, of image, including all headers and padding; shall be a multiple of Section Alignment. e.g. 0x0000e000 + writeInt32 os headerSectionPhysSize; // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding; shall be a multiple of the file alignment. + writeInt32 os 0x00; // File Checksum Always 0 (see Section 23.1). QUERY: NOT ALWAYS ZERO + writeInt32AsUInt16 os modul.SubSystemFlags; // SubSystem Subsystem required to run this image. Shall be either IMAGE_SUBSYSTEM_WINDOWS_CE_GUI (0x3) or IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2). QUERY: Why is this 3 on the images ILASM produces // DLL Flags Always 0x400 (no unmanaged windows exception handling - see Section 23.1). - // Itanium: see notes at end of file - // IMAGE_DLLCHARACTERISTICS_NX_COMPAT: See FSharp 1.0 bug 5019 and http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx + // Itanium: see notes at end of file + // IMAGE_DLLCHARACTERISTICS_NX_COMPAT: See FSharp 1.0 bug 5019 and http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx // Itanium: IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE | IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT // x86: IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT // x64: IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT - let dllCharacteristics = - let flags = + let dllCharacteristics = + let flags = if modul.Is64Bit then (if isItanium then 0x8540 else 0x540) else 0x540 if modul.UseHighEntropyVA then flags ||| 0x20 // IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA else flags writeInt32AsUInt16 os dllCharacteristics - // 000000e0 + // 000000e0 // Note that the defaults differ between x86 and x64 if modul.Is64Bit then let size = defaultArg modul.StackReserveSize 0x400000 |> int64 - writeInt64 os size // Stack Reserve Size Always 0x400000 (4Mb) (see Section 23.1). - writeInt64 os 0x4000L // Stack Commit Size Always 0x4000 (16Kb) (see Section 23.1). - writeInt64 os 0x100000L // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt64 os 0x2000L // Heap Commit Size Always 0x800 (8Kb) (see Section 23.1). + writeInt64 os size // Stack Reserve Size Always 0x400000 (4Mb) (see Section 23.1). + writeInt64 os 0x4000L // Stack Commit Size Always 0x4000 (16Kb) (see Section 23.1). + writeInt64 os 0x100000L // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt64 os 0x2000L // Heap Commit Size Always 0x800 (8Kb) (see Section 23.1). else let size = defaultArg modul.StackReserveSize 0x100000 - writeInt32 os size // Stack Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt32 os 0x1000 // Stack Commit Size Always 0x1000 (4Kb) (see Section 23.1). - writeInt32 os 0x100000 // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt32 os 0x1000 // Heap Commit Size Always 0x1000 (4Kb) (see Section 23.1). - // 000000f0 - x86 location, moving on, for x64, add 0x10 - writeInt32 os 0x00 // Loader Flags Always 0 (see Section 23.1) - writeInt32 os 0x10 // Number of Data Directories: Always 0x10 (see Section 23.1). - writeInt32 os 0x00 - writeInt32 os 0x00 // Export Table Always 0 (see Section 23.1). - // 00000100 - writeDirectory os importTableChunk // Import Table RVA of Import Table, (see clause 24.3.1). e.g. 0000b530 - // Native Resource Table: ECMA says Always 0 (see Section 23.1), but mscorlib and other files with resources bound into executable do not. For the moment assume the resources table is always the first resource in the file. + writeInt32 os size // Stack Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt32 os 0x1000 // Stack Commit Size Always 0x1000 (4Kb) (see Section 23.1). + writeInt32 os 0x100000 // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt32 os 0x1000 // Heap Commit Size Always 0x1000 (4Kb) (see Section 23.1). + // 000000f0 - x86 location, moving on, for x64, add 0x10 + writeInt32 os 0x00 // Loader Flags Always 0 (see Section 23.1) + writeInt32 os 0x10 // Number of Data Directories: Always 0x10 (see Section 23.1). + writeInt32 os 0x00 + writeInt32 os 0x00 // Export Table Always 0 (see Section 23.1). + // 00000100 + writeDirectory os importTableChunk // Import Table RVA of Import Table, (see clause 24.3.1). e.g. 0000b530 + // Native Resource Table: ECMA says Always 0 (see Section 23.1), but mscorlib and other files with resources bound into executable do not. For the moment assume the resources table is always the first resource in the file. writeDirectory os nativeResourcesChunk - // 00000110 - writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). - // 00000120 - writeDirectory os baseRelocTableChunk - writeDirectory os debugDirectoryChunk // Debug Directory - // 00000130 - writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). - writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). - writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). - writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). - // 00000140 - writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). - // 00000150 - writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). - writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). - writeDirectory os importAddrTableChunk // Import Addr Table, (see clause 24.3.1). e.g. 0x00002000 - // 00000160 - writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). - writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). + // 00000110 + writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). + // 00000120 + writeDirectory os baseRelocTableChunk + writeDirectory os debugDirectoryChunk // Debug Directory + // 00000130 + writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). + writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). + writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). + writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). + // 00000140 + writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). + // 00000150 + writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). + writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). + writeDirectory os importAddrTableChunk // Import Addr Table, (see clause 24.3.1). e.g. 0x00002000 + // 00000160 + writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). + writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). writeDirectory os cliHeaderChunk - // 00000170 - writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). - writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). - + // 00000170 + writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). + writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). + write (Some textSectionHeaderChunk.addr) os "text section header" [| |] - - // 00000178 - writeBytes os [| 0x2euy; 0x74uy; 0x65uy; 0x78uy; 0x74uy; 0x00uy; 0x00uy; 0x00uy; |] // ".text\000\000\000" - // 00000180 - writeInt32 os textSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x00009584 - writeInt32 os textSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x00020000 - writeInt32 os textSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. 0x00009600 - writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200 - // 00000190 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 00000198 - writeInt32AsUInt16 os 0x00// NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section's characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ - + + // 00000178 + writeBytes os [| 0x2euy; 0x74uy; 0x65uy; 0x78uy; 0x74uy; 0x00uy; 0x00uy; 0x00uy; |] // ".text\000\000\000" + // 00000180 + writeInt32 os textSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x00009584 + writeInt32 os textSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x00020000 + writeInt32 os textSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. 0x00009600 + writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200 + // 00000190 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 00000198 + writeInt32AsUInt16 os 0x00// NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section's characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ + write (Some dataSectionHeaderChunk.addr) os "data section header" [| |] - - // 000001a0 - writeBytes os [| 0x2euy; 0x72uy; 0x73uy; 0x72uy; 0x63uy; 0x00uy; 0x00uy; 0x00uy; |] // ".rsrc\000\000\000" - // writeBytes os [| 0x2e; 0x73; 0x64; 0x61; 0x74; 0x61; 0x00; 0x00; |] // ".sdata\000\000" - writeInt32 os dataSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c + + // 000001a0 + writeBytes os [| 0x2euy; 0x72uy; 0x73uy; 0x72uy; 0x63uy; 0x00uy; 0x00uy; 0x00uy; |] // ".rsrc\000\000\000" + // writeBytes os [| 0x2e; 0x73; 0x64; 0x61; 0x74; 0x61; 0x00; 0x00; |] // ".sdata\000\000" + writeInt32 os dataSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c writeInt32 os dataSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000 - // 000001b0 - writeInt32 os dataSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. e.g. 0x00000200 - writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800 - // 000001b8 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 000001c0 - writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x40uy |] // Characteristics Flags: IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA - + // 000001b0 + writeInt32 os dataSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. e.g. 0x00000200 + writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800 + // 000001b8 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 000001c0 + writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x40uy |] // Characteristics Flags: IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA + write (Some relocSectionHeaderChunk.addr) os "reloc section header" [| |] - // 000001a0 - writeBytes os [| 0x2euy; 0x72uy; 0x65uy; 0x6cuy; 0x6fuy; 0x63uy; 0x00uy; 0x00uy; |] // ".reloc\000\000" - writeInt32 os relocSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c + // 000001a0 + writeBytes os [| 0x2euy; 0x72uy; 0x65uy; 0x6cuy; 0x6fuy; 0x63uy; 0x00uy; 0x00uy; |] // ".reloc\000\000" + writeInt32 os relocSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c writeInt32 os relocSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000 - // 000001b0 - writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00000200 - writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800 - // 000001b8 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 000001c0 - writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x42uy |] // Characteristics Flags: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | - + // 000001b0 + writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00000200 + writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800 + // 000001b8 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 000001c0 + writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x42uy |] // Characteristics Flags: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | + writePadding os "pad to text begin" (textSectionPhysLoc - headerSize) - - // TEXT SECTION: e.g. 0x200 - + + // TEXT SECTION: e.g. 0x200 + let textV2P v = v - textSectionAddr + textSectionPhysLoc - - // e.g. 0x0200 + + // e.g. 0x0200 write (Some (textV2P importAddrTableChunk.addr)) os "import addr table" [| |] - writeInt32 os importNameHintTableChunk.addr - writeInt32 os 0x00 // QUERY 4 bytes of zeros not 2 like ECMA 24.3.1 says - - // e.g. 0x0208 - - let flags = - (if modul.IsILOnly then 0x01 else 0x00) ||| - (if modul.Is32Bit then 0x02 else 0x00) ||| - (if modul.Is32BitPreferred then 0x00020003 else 0x00) ||| + writeInt32 os importNameHintTableChunk.addr + writeInt32 os 0x00 // QUERY 4 bytes of zeros not 2 like ECMA 24.3.1 says + + // e.g. 0x0208 + + let flags = + (if modul.IsILOnly then 0x01 else 0x00) ||| + (if modul.Is32Bit then 0x02 else 0x00) ||| + (if modul.Is32BitPreferred then 0x00020003 else 0x00) ||| #if EMIT_STRONG_NAME (if (match signer with None -> false | Some s -> s.IsFullySigned) then 0x08 else 0x00) ||| #endif @@ -13342,36 +13342,36 @@ namespace ProviderImplementation.ProvidedTypes let headerVersionMajor, headerVersionMinor = headerVersionSupportedByCLRVersion desiredMetadataVersion - writePadding os "pad to cli header" cliHeaderPadding + writePadding os "pad to cli header" cliHeaderPadding write (Some (textV2P cliHeaderChunk.addr)) os "cli header" [| |] - writeInt32 os 0x48 // size of header - writeInt32AsUInt16 os headerVersionMajor // Major part of minimum version of CLR reqd. - writeInt32AsUInt16 os headerVersionMinor // Minor part of minimum version of CLR reqd. ... - // e.g. 0x0210 + writeInt32 os 0x48 // size of header + writeInt32AsUInt16 os headerVersionMajor // Major part of minimum version of CLR reqd. + writeInt32AsUInt16 os headerVersionMinor // Minor part of minimum version of CLR reqd. ... + // e.g. 0x0210 writeDirectory os metadataChunk writeInt32 os flags - - writeInt32 os entryPointToken + + writeInt32 os entryPointToken write None os "rest of cli header" [| |] - - // e.g. 0x0220 + + // e.g. 0x0220 writeDirectory os resourcesChunk writeDirectory os strongnameChunk - // e.g. 0x0230 - writeInt32 os 0x00 // code manager table, always 0 - writeInt32 os 0x00 // code manager table, always 0 - writeDirectory os vtfixupsChunk - // e.g. 0x0240 - writeInt32 os 0x00 // export addr table jumps, always 0 - writeInt32 os 0x00 // export addr table jumps, always 0 - writeInt32 os 0x00 // managed native header, always 0 - writeInt32 os 0x00 // managed native header, always 0 - + // e.g. 0x0230 + writeInt32 os 0x00 // code manager table, always 0 + writeInt32 os 0x00 // code manager table, always 0 + writeDirectory os vtfixupsChunk + // e.g. 0x0240 + writeInt32 os 0x00 // export addr table jumps, always 0 + writeInt32 os 0x00 // export addr table jumps, always 0 + writeInt32 os 0x00 // managed native header, always 0 + writeInt32 os 0x00 // managed native header, always 0 + writeBytes os code write None os "code padding" codePadding - + writeBytes os metadata - + #if EMIT_STRONG_NAME // write 0x80 bytes of empty space for encrypted SHA1 hash, written by SN.EXE or call to signing API if signer <> None then @@ -13385,9 +13385,9 @@ namespace ProviderImplementation.ProvidedTypes writePadding os "start of import table" importTableChunkPrePadding - // vtfixups would go here + // vtfixups would go here write (Some (textV2P importTableChunk.addr)) os "import table" [| |] - + writeInt32 os importLookupTableChunk.addr writeInt32 os 0x00 writeInt32 os 0x00 @@ -13397,38 +13397,38 @@ namespace ProviderImplementation.ProvidedTypes writeInt32 os 0x00 writeInt32 os 0x00 writeInt32 os 0x00 - writeInt32 os 0x00 - + writeInt32 os 0x00 + write (Some (textV2P importLookupTableChunk.addr)) os "import lookup table" [| |] - writeInt32 os importNameHintTableChunk.addr - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - + writeInt32 os importNameHintTableChunk.addr + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + write (Some (textV2P importNameHintTableChunk.addr)) os "import name hint table" [| |] - // Two zero bytes of hint, then Case sensitive, null-terminated ASCII string containing name to import. + // Two zero bytes of hint, then Case sensitive, null-terminated ASCII string containing name to import. // Shall _CorExeMain a .exe file _CorDllMain for a .dll file. - if isDll then + if isDll then writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy ; 0x6fuy; 0x72uy; 0x44uy; 0x6cuy; 0x6cuy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] - else + else writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy; 0x6fuy; 0x72uy; 0x45uy; 0x78uy; 0x65uy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] - + write (Some (textV2P mscoreeStringChunk.addr)) os "mscoree string" [| 0x6duy; 0x73uy; 0x63uy; 0x6fuy ; 0x72uy; 0x65uy ; 0x65uy; 0x2euy ; 0x64uy; 0x6cuy ; 0x6cuy; 0x00uy ; |] - + writePadding os "end of import tab" importTableChunkPadding - + writePadding os "head of entrypoint" 0x03 let ep = (imageBaseReal + textSectionAddr) write (Some (textV2P entrypointCodeChunk.addr)) os " entrypoint code" [| 0xFFuy; 0x25uy; (* x86 Instructions for entry *) b0 ep; b1 ep; b2 ep; b3 ep |] - if isItanium then + if isItanium then write (Some (textV2P globalpointerCodeChunk.addr)) os " itanium global pointer" [| 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy |] - if pdbfile.IsSome then + if pdbfile.IsSome then write (Some (textV2P debugDirectoryChunk.addr)) os "debug directory" (Array.create debugDirectoryChunk.size 0x0uy) write (Some (textV2P debugDataChunk.addr)) os "debug data" (Array.create debugDataChunk.size 0x0uy) @@ -13436,8 +13436,8 @@ namespace ProviderImplementation.ProvidedTypes write (Some (textV2P debugEmbeddedPdbChunk.addr)) os "debug data" (Array.create debugEmbeddedPdbChunk.size 0x0uy) writePadding os "end of .text" (dataSectionPhysLoc - textSectionPhysLoc - textSectionSize) - - // DATA SECTION + + // DATA SECTION #if EMIT_NATIVE_RESOURCES match nativeResources with | [||] -> () @@ -13449,41 +13449,41 @@ namespace ProviderImplementation.ProvidedTypes if dummydatap.size <> 0x0 then write (Some (dataSectionVirtToPhys dummydatap.addr)) os "dummy data" [| 0x0uy |] - writePadding os "end of .rsrc" (relocSectionPhysLoc - dataSectionPhysLoc - dataSectionSize) - - // RELOC SECTION + writePadding os "end of .rsrc" (relocSectionPhysLoc - dataSectionPhysLoc - dataSectionSize) + + // RELOC SECTION - // See ECMA 24.3.2 + // See ECMA 24.3.2 let relocV2P v = v - relocSectionAddr + relocSectionPhysLoc - + let entrypointFixupAddr = entrypointCodeChunk.addr + 0x02 let entrypointFixupBlock = (entrypointFixupAddr / 4096) * 4096 let entrypointFixupOffset = entrypointFixupAddr - entrypointFixupBlock let reloc = (if modul.Is64Bit then 0xA000 (* IMAGE_REL_BASED_DIR64 *) else 0x3000 (* IMAGE_REL_BASED_HIGHLOW *)) ||| entrypointFixupOffset // For the itanium, you need to set a relocation entry for the global pointer - let reloc2 = - if not isItanium then + let reloc2 = + if not isItanium then 0x0 else 0xA000 ||| (globalpointerCodeChunk.addr - ((globalpointerCodeChunk.addr / 4096) * 4096)) - - write (Some (relocV2P baseRelocTableChunk.addr)) os "base reloc table" + + write (Some (relocV2P baseRelocTableChunk.addr)) os "base reloc table" [| b0 entrypointFixupBlock; b1 entrypointFixupBlock; b2 entrypointFixupBlock; b3 entrypointFixupBlock; 0x0cuy; 0x00uy; 0x00uy; 0x00uy; - b0 reloc; b1 reloc; + b0 reloc; b1 reloc; b0 reloc2; b1 reloc2; |] writePadding os "end of .reloc" (imageEndSectionPhysLoc - relocSectionPhysLoc - relocSectionSize) os.Dispose() - + pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings // Looks like a finally - with e -> - (try + with e -> + (try os.Dispose() - File.Delete outfile - with _ -> ()) + File.Delete outfile + with _ -> ()) reraise() //Finished writing and signing the binary and debug info... @@ -13506,8 +13506,8 @@ namespace ProviderImplementation.ProvidedTypes dumpDebugInfo:bool } let WriteILBinary (outfile, (args: options), modul) = - writeBinaryAndReportMappings (outfile, - args.ilg, args.pdbfile, (* args.signer, *) args.portablePDB, args.embeddedPDB, args.embedAllSource, + writeBinaryAndReportMappings (outfile, + args.ilg, args.pdbfile, (* args.signer, *) args.portablePDB, args.embeddedPDB, args.embedAllSource, args.embedSourceList, args.sourceLink, args.emitTailcalls, args.deterministic, args.showTimes, args.dumpDebugInfo) modul |> ignore @@ -13534,11 +13534,11 @@ namespace ProviderImplementation.ProvidedTypes open ProviderImplementation.ProvidedTypes open ProviderImplementation.ProvidedTypes.AssemblyReader open ProviderImplementation.ProvidedTypes.UncheckedQuotations - + type ILLocalBuilder(i: int) = member __.LocalIndex = i - + [] type ILExceptionClauseBuilder = | Finally of ILCodeLabel @@ -13560,47 +13560,47 @@ namespace ProviderImplementation.ProvidedTypes let mutable labels = Dictionary() let mutable exceptionBlocks = Stack() - member __.Content = + member __.Content = { IsZeroInit = true MaxStack = instrs.Count Locals = locals.ToArray() - Code = + Code = { Labels = labels Instrs = instrs.ToArray() Exceptions = exceptions.ToArray() Locals = [| |] (* TODO ILLocalDebugInfo *) } } - member __.DeclareLocal(ty: ILType) = + member __.DeclareLocal(ty: ILType) = let idx = locals.Count let local = { Type = ty; IsPinned = false; DebugInfo = None } locals.Add(local) ILLocalBuilder(idx) - + member ilg.BeginExceptionBlock() = exceptionBlocks.Push(ILExceptionBlockBuilder(ilg.DefineLabelHere(), ilg.DefineLabel())) - + member ilg.EndGuardedBlock() = let block = exceptionBlocks.Peek() ilg.Emit(I_leave block.Leave) block.EndIndex <- ilg.DefineLabelHere() - + member ilg.BeginCatchBlock(typ: ILType) = exceptionBlocks.Peek().Clause <- Some <| ILExceptionClauseBuilder.TypeCatch(ilg.DefineLabelHere(), typ) - + member ilg.BeginCatchFilterBlock(range: ILCodeLabel * ILCodeLabel) = exceptionBlocks.Peek().Clause <- Some <| ILExceptionClauseBuilder.FilterCatch(ilg.DefineLabelHere(), range) - + member ilg.BeginFinallyBlock() = exceptionBlocks.Peek().Clause <- Some <| ILExceptionClauseBuilder.Finally (ilg.DefineLabelHere()) - + member ilg.BeginFaultBlock() = exceptionBlocks.Peek().Clause <- Some <| ILExceptionClauseBuilder.Fault (ilg.DefineLabelHere()) - + member ilg.EndExceptionBlock() = let exnBlock = exceptionBlocks.Pop() match exnBlock.Clause.Value with @@ -13608,13 +13608,13 @@ namespace ProviderImplementation.ProvidedTypes ilg.Emit(I_endfinally) | ILExceptionClauseBuilder.Fault(start) -> ilg.Emit(I_endfinally) - | ILExceptionClauseBuilder.FilterCatch _ -> + | ILExceptionClauseBuilder.FilterCatch _ -> ilg.Emit(I_leave exnBlock.Leave) - | ILExceptionClauseBuilder.TypeCatch _ -> + | ILExceptionClauseBuilder.TypeCatch _ -> ilg.Emit(I_leave exnBlock.Leave) let endIndex = ilg.DefineLabelHere() ilg.MarkLabel(exnBlock.Leave) - let clause = + let clause = match exnBlock.Clause.Value with | ILExceptionClauseBuilder.Finally(start) -> ILExceptionClause.Finally (start, endIndex) @@ -13624,7 +13624,7 @@ namespace ProviderImplementation.ProvidedTypes ILExceptionClause.FilterCatch (range, (start, endIndex)) | ILExceptionClauseBuilder.TypeCatch(start, typ) -> ILExceptionClause.TypeCatch(typ, (start, endIndex)) - + exceptions.Add { Range = (exnBlock.StartIndex, exnBlock.EndIndex) ; Clause = clause } @@ -13653,7 +13653,7 @@ namespace ProviderImplementation.ProvidedTypes LiteralValue = lit Attributes = attrs Offset = None - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken() } override __.ToString() = "builder for " + nm @@ -13668,7 +13668,7 @@ namespace ProviderImplementation.ProvidedTypes member __.Content = { Name=nm Constraints= constraints.ToArray() - Attributes = attrs + Attributes = attrs CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken() } override __.ToString() = "builder for " + nm @@ -13684,7 +13684,7 @@ namespace ProviderImplementation.ProvidedTypes member __.SetConstant(obj) = dflt <- USome obj member __.SetCustomAttribute(ca) = cattrs.Add(ca) - member __.Content = + member __.Content = { Name=nm ParameterType=ty Default=dflt @@ -13703,19 +13703,19 @@ namespace ProviderImplementation.ProvidedTypes member __.DefineParameter(i, attrs, parameterName) = ilParams[i].SetData(attrs, parameterName) ; ilParams[i] member __.SetCustomAttribute(ca) = cattrs.Add(ca) member __.GetILGenerator() = let ilg = ILGenerator(methodName) in body <- Some ilg; ilg - member __.FormalMethodRef = + member __.FormalMethodRef = let cc = (if ILMethodDef.ComputeIsStatic attrs then ILCallingConv.Static else ILCallingConv.Instance) ILMethodRef (enclosing.TypeRef, cc, gparams.Count, methodName, argtys, retty) - member this.FormalMethodSpec = + member this.FormalMethodSpec = ILMethodSpec(this.FormalMethodRef, enclosing, mkILFormalGenericArgs enclosing.TypeSpec.GenericArgs.Length gparams.Count) - member __.Content = + member __.Content = { Token = genToken() Name = methodName Attributes = attrs ImplAttributes = implflags - GenericParams = [| for x in gparams -> x.Content |] - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + GenericParams = [| for x in gparams -> x.Content |] + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Parameters = [| for p in ilParams[1..] -> p.Content |] CallingConv = (if attrs &&& MethodAttributes.Static <> enum<_>(0) then ILCallingConv.Static else ILCallingConv.Instance) Return = (let p = ilParams[0].Content in { Type = p.ParameterType; CustomAttrs = p.CustomAttrs }) @@ -13728,24 +13728,24 @@ namespace ProviderImplementation.ProvidedTypes let mutable setMethod = None let mutable getMethod = None let cattrs = ResizeArray() - + member __.SetGetMethod(mb: ILMethodBuilder) = getMethod <- Some mb member __.SetSetMethod(mb: ILMethodBuilder) = setMethod <- Some mb member __.SetCustomAttribute(ca) = cattrs.Add(ca) - member __.Content = + member __.Content = { Name=nm - CallingConv = - (if (getMethod.IsSome && getMethod.Value.Content.IsStatic) || - (setMethod.IsSome && setMethod.Value.Content.IsStatic) then - ILThisConvention.Static + CallingConv = + (if (getMethod.IsSome && getMethod.Value.Content.IsStatic) || + (setMethod.IsSome && setMethod.Value.Content.IsStatic) then + ILThisConvention.Static else ILThisConvention.Instance) Attributes = attrs GetMethod = (getMethod |> Option.map (fun mb -> mb.FormalMethodRef)) SetMethod = (setMethod |> Option.map (fun mb -> mb.FormalMethodRef)) - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) PropertyType=retty - Init= None // TODO if (attrs &&& PropertyAttributes.HasDefault) = 0 then None else + Init= None // TODO if (attrs &&& PropertyAttributes.HasDefault) = 0 then None else IndexParameterTypes=argtys Token = genToken() } override __.ToString() = "builder for " + nm @@ -13759,12 +13759,12 @@ namespace ProviderImplementation.ProvidedTypes member __.SetAddOnMethod(mb: ILMethodBuilder) = addMethod <- Some mb member __.SetRemoveOnMethod(mb: ILMethodBuilder) = removeMethod <- Some mb member __.SetCustomAttribute(ca) = cattrs.Add(ca) - member __.Content = + member __.Content = { Name = nm Attributes = attrs AddMethod = addMethod.Value.FormalMethodRef RemoveMethod = removeMethod.Value.FormalMethodRef - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken()} override __.ToString() = "builder for " + nm @@ -13783,7 +13783,7 @@ namespace ProviderImplementation.ProvidedTypes member __.ILTypeRef = ILTypeRef(scoref, nsp, nm) member this.ILTypeSpec = ILTypeSpec(this.ILTypeRef, mkILFormalGenericArgs 0 gparams.Count) - member this.ILType = + member this.ILType = match ILTypeDef.ComputeKind (int attrs) extends nsp nm with | ILTypeDefKind.ValueType | ILTypeDefKind.Enum -> ILType.Value this.ILTypeSpec | _ -> ILType.Boxed this.ILTypeSpec @@ -13801,8 +13801,8 @@ namespace ProviderImplementation.ProvidedTypes member __.AddInterfaceImplementation(ty) = implements.Add(ty) member this.DefineTypeInitializer () = let mb = ILMethodBuilder(this.ILType, ".cctor", MethodAttributes.Static ||| MethodAttributes.SpecialName ||| MethodAttributes.RTSpecialName ||| MethodAttributes.Private, ILType.Void, [| |]) in methods.Add mb; mb member __.SetParent ty = (extends <- Some ty) - member this.DefineDefaultConstructor(attrs, baseCtor: ILMethodSpec) = - let ctor = this.DefineConstructor(attrs, [| |]) + member this.DefineDefaultConstructor(attrs, baseCtor: ILMethodSpec) = + let ctor = this.DefineConstructor(attrs, [| |]) let ilg = ctor.GetILGenerator() ilg.Emit(I_ldarg 0) ilg.Emit(I_call (Normalcall, baseCtor, None)) @@ -13810,24 +13810,24 @@ namespace ProviderImplementation.ProvidedTypes ctor - member __.Content = + member __.Content = { Namespace=nsp Name=nm - GenericParams= [| for x in gparams -> x.Content |] + GenericParams= [| for x in gparams -> x.Content |] Implements = implements.ToArray() Attributes = attrs Layout=ILTypeDefLayout.Auto Extends=extends Token=genToken() - //SecurityDecls=emptyILSecurityDecls; + //SecurityDecls=emptyILSecurityDecls; //HasSecurity=false; - NestedTypes = ILTypeDefs( lazy [| for x in nestedTypes -> let td = x.Content in td.Namespace, td.Name, lazy td |] ) - Fields = { new ILFieldDefs with member __.Entries = [| for x in fields -> x.Content |] } - Properties = { new ILPropertyDefs with member __.Entries = [| for x in props -> x.Content |] } - Events = { new ILEventDefs with member __.Entries = [| for x in events -> x.Content |] } + NestedTypes = ILTypeDefs( lazy [| for x in nestedTypes -> let td = x.Content in td.Namespace, td.Name, lazy td |] ) + Fields = { new ILFieldDefs with member __.Entries = [| for x in fields -> x.Content |] } + Properties = { new ILPropertyDefs with member __.Entries = [| for x in props -> x.Content |] } + Events = { new ILEventDefs with member __.Entries = [| for x in events -> x.Content |] } Methods = ILMethodDefs (lazy [| for x in methods -> x.Content |]) - MethodImpls = { new ILMethodImplDefs with member __.Entries = methodImpls.ToArray() } - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + MethodImpls = { new ILMethodImplDefs with member __.Entries = methodImpls.ToArray() } + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) } override __.ToString() = "builder for " + joinILTypeName nsp nm @@ -13838,7 +13838,7 @@ namespace ProviderImplementation.ProvidedTypes member __.DefineType(nsp, name, attrs) = let tb = ILTypeBuilder(ILTypeRefScope.Top scoref, nsp, name, attrs) in typeDefs.Add tb; tb member __.SetCustomAttribute(ca) = cattrs.Add(ca) - member __.Content = + member __.Content = { Manifest=manifest Name=moduleName SubsystemVersion = (4, 0) @@ -13856,14 +13856,14 @@ namespace ProviderImplementation.ProvidedTypes ImageBase=0x034f0000 MetadataVersion="" Resources=ILResources (lazy [| |]) - TypeDefs = ILTypeDefs( lazy [| for x in typeDefs-> let td = x.Content in td.Namespace, td.Name, lazy td |] ) + TypeDefs = ILTypeDefs( lazy [| for x in typeDefs-> let td = x.Content in td.Namespace, td.Name, lazy td |] ) CustomAttrs = { new ILCustomAttrs with member __.Entries = cattrs.ToArray() } - } + } override __.ToString() = "builder for " + moduleName type ILAssemblyBuilder(assemblyName: AssemblyName, fileName, ilg, attrs : ILCustomAttribute seq) = let cattrs = ResizeArray(attrs) - let manifest = + let manifest = { Name = assemblyName.Name AuxModuleHashAlgorithm = 0x8004 // SHA1 PublicKey = UNone @@ -13879,29 +13879,29 @@ namespace ProviderImplementation.ProvidedTypes EntrypointElsewhere=None } let mb = ILModuleBuilder(ILScopeRef.Local, "MainModule", Some manifest) member __.MainModule = mb - member __.Save() = + member __.Save() = let il = mb.Content let options: BinaryWriter.options = { ilg = ilg; pdbfile = None; portablePDB = false; embeddedPDB = false; embedAllSource = false; embedSourceList = []; sourceLink = ""; emitTailcalls = true; deterministic = false; showTimes = false; dumpDebugInfo = false } BinaryWriter.WriteILBinary (fileName, options, il) override __.ToString() = "builder for " + (assemblyName.ToString()) - + type ExpectedStackState = | Empty = 1 | Address = 2 | Value = 3 - type CodeGenerator(assemblyMainModule: ILModuleBuilder, - genUniqueTypeName: (unit -> string), - implicitCtorArgsAsFields: ILFieldBuilder list, - convTypeToTgt: Type -> Type, - transType: Type -> ILType, - transFieldSpec: FieldInfo -> ILFieldSpec, - transMeth: MethodInfo -> ILMethodSpec, - transMethRef: MethodInfo -> ILMethodRef, - transCtorSpec: ConstructorInfo -> ILMethodSpec, - ilg: ILGenerator, - localsMap:Dictionary, + type CodeGenerator(assemblyMainModule: ILModuleBuilder, + genUniqueTypeName: (unit -> string), + implicitCtorArgsAsFields: ILFieldBuilder list, + convTypeToTgt: Type -> Type, + transType: Type -> ILType, + transFieldSpec: FieldInfo -> ILFieldSpec, + transMeth: MethodInfo -> ILMethodSpec, + transMethRef: MethodInfo -> ILMethodRef, + transCtorSpec: ConstructorInfo -> ILMethodSpec, + ilg: ILGenerator, + localsMap:Dictionary, parameterVars) = // TODO: this works over FSharp.Core 4.4.0.0 types and methods. These types need to be retargeted to the target runtime. @@ -13913,13 +13913,13 @@ namespace ProviderImplementation.ProvidedTypes let dateTimeConstructor() = (convTypeToTgt typeof).GetConstructor([| typeof; typeof |]) let dateTimeOffsetConstructor() = (convTypeToTgt typeof).GetConstructor([| typeof; typeof |]) let timeSpanConstructor() = (convTypeToTgt typeof).GetConstructor([|typeof|]) - + let decimalTypeTgt = convTypeToTgt typeof let convertTypeTgt = convTypeToTgt typeof let stringTypeTgt = convTypeToTgt typeof let mathTypeTgt = convTypeToTgt typeof - let makeTypePattern tp = + let makeTypePattern tp = let tt = convTypeToTgt tp fun (t : Type) -> if t = tt then Some() else None @@ -13939,31 +13939,31 @@ namespace ProviderImplementation.ProvidedTypes let (|String|_|) = makeTypePattern(typeof) let (|StaticMethod|_|) name tps (t : Type) = - match t.GetMethod(name, BindingFlags.Static ||| BindingFlags.Public, null, tps, null) with + match t.GetMethod(name, BindingFlags.Static ||| BindingFlags.Public, null, tps, null) with | null -> None | m -> Some m - + let (|StaticMethodWithReturnType|_|) name tps returnType (t : Type) = - t.GetMethods(BindingFlags.Static ||| BindingFlags.Public) - |> Array.tryFind - (fun x -> + t.GetMethods(BindingFlags.Static ||| BindingFlags.Public) + |> Array.tryFind + (fun x -> x.Name = name && Type.(=)(x.ReturnType, returnType) && (x.GetParameters() |> Array.map (fun i -> i.ParameterType)) = tps) - - let (|SpecificCall|_|) templateParameter = + + let (|SpecificCall|_|) templateParameter = // Note: precomputation match templateParameter with | (Lambdas(_, Call(_, minfo1, _)) | Call(_, minfo1, _)) -> let targetType = convTypeToTgt minfo1.DeclaringType let minfo1 = targetType.GetMethod(minfo1.Name, bindAll) let isg1 = minfo1.IsGenericMethod - let gmd = - if minfo1.IsGenericMethodDefinition then + let gmd = + if minfo1.IsGenericMethodDefinition then minfo1 - elif isg1 then - minfo1.GetGenericMethodDefinition() + elif isg1 then + minfo1.GetGenericMethodDefinition() else null // end-of-precomputation @@ -13985,7 +13985,7 @@ namespace ProviderImplementation.ProvidedTypes | _ -> invalidArg "templateParameter" "The parameter is not a recognized method name" - let (|MakeDecimal|_|) = + let (|MakeDecimal|_|) = let minfo1 = languagePrimitivesType().GetNestedType("IntrinsicFunctions").GetMethod("MakeDecimal") (fun tm -> match tm with @@ -13998,11 +13998,11 @@ namespace ProviderImplementation.ProvidedTypes minfo1 = minfo2) -> Some(args) | _ -> None) - + let (|NaN|_|) = let operatorsType = convTypeToTgt (typedefof>.Assembly.GetType("Microsoft.FSharp.Core.Operators")) let minfo1 = operatorsType.GetProperty("NaN").GetGetMethod() - (fun e -> + (fun e -> match e with | Call(None, minfo2, []) #if FX_NO_REFLECTION_METADATA_TOKENS @@ -14013,11 +14013,11 @@ namespace ProviderImplementation.ProvidedTypes minfo1 = minfo2) -> Some() | _ -> None) - + let (|NaNSingle|_|) = let operatorsType = convTypeToTgt (typedefof>.Assembly.GetType("Microsoft.FSharp.Core.Operators")) let minfo1 = operatorsType.GetProperty("NaNSingle").GetGetMethod() - (fun e -> + (fun e -> match e with | Call(None, minfo2, []) #if FX_NO_REFLECTION_METADATA_TOKENS @@ -14028,7 +14028,7 @@ namespace ProviderImplementation.ProvidedTypes minfo1 = minfo2) -> Some() | _ -> None) - + let (|TypeOf|_|) = (|SpecificCall|_|) <@ typeof @> let (|LessThan|_|) = (|SpecificCall|_|) <@ (<) @> @@ -14074,7 +14074,7 @@ namespace ProviderImplementation.ProvidedTypes let (|GetArray2D|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.GetArray2D @> let (|GetArray3D|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.GetArray3D @> let (|GetArray4D|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.GetArray4D @> - + let (|Abs|_|) = (|SpecificCall|_|) <@ abs @> let (|Acos|_|) = (|SpecificCall|_|) <@ acos @> let (|Asin|_|) = (|SpecificCall|_|) <@ asin @> @@ -14099,9 +14099,9 @@ namespace ProviderImplementation.ProvidedTypes //let (|RangeStep|_|) = (|SpecificCall|_|) <@ (.. ..) @> let (|Pow|_|) = (|SpecificCall|_|) <@ ( ** ) @> //let (|Pown|_|) = (|SpecificCall|_|) <@ pown @> - - let mathOp t1 name = - match t1 with + + let mathOp t1 name = + match t1 with | Double -> let m = mathTypeTgt.GetMethod(name, [|t1|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) @@ -14110,18 +14110,18 @@ namespace ProviderImplementation.ProvidedTypes let m = mathTypeTgt.GetMethod(name, [|convTypeToTgt typeof|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) ilg.Emit(I_conv DT_R4) - | StaticMethod name [|t1|] m -> + | StaticMethod name [|t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "%s not supported for type %s" name t1.Name - let lessThan (a1 : Expr) (a2 : Expr) = - match <@@ (<) @@> with - | DerivedPatterns.Lambdas(vars, Call(None, meth, _)) -> + let lessThan (a1 : Expr) (a2 : Expr) = + match <@@ (<) @@> with + | DerivedPatterns.Lambdas(vars, Call(None, meth, _)) -> let targetType = convTypeToTgt meth.DeclaringType let m = targetType.GetMethod(meth.Name, bindAll).MakeGenericMethod(a1.Type) Expr.Call(m, [a1; a2]) | _ -> failwith "Unreachable" - + let isEmpty s = (s = ExpectedStackState.Empty) let isAddress s = (s = ExpectedStackState.Address) let rec emitLambda(callSiteIlg: ILGenerator, v: Var, body: Expr, freeVars: seq, lambdaLocals: Dictionary<_, ILLocalBuilder>, parameters) = @@ -14129,11 +14129,11 @@ namespace ProviderImplementation.ProvidedTypes let fsharpFuncType = convTypeToTgt (typedefof>) let voidType = convTypeToTgt typeof - let rec lambdaType (t : Type) = - if t.IsGenericType then + let rec lambdaType (t : Type) = + if t.IsGenericType then let args = t.GetGenericArguments() let gdef = t.GetGenericTypeDefinition() - if args.Length = 2 && gdef.FullName = fsharpFuncType.FullName && args[1] = voidType then + if args.Length = 2 && gdef.FullName = fsharpFuncType.FullName && args[1] = voidType then gdef.MakeGenericType(lambdaType args[0], typeof) else gdef.MakeGenericType(args |> Array.map lambdaType) @@ -14175,7 +14175,7 @@ namespace ProviderImplementation.ProvidedTypes let lambdaParamVars = [| Var("this", typeof); v|] let codeGen = CodeGenerator(assemblyMainModule, genUniqueTypeName, implicitCtorArgsAsFields, convTypeToTgt, transType, transFieldSpec, transMeth, transMethRef, transCtorSpec, ilg, lambdaLocals, lambdaParamVars) codeGen.EmitExpr (expectedState, body) - if retType.QualifiedName = unitType.QualifiedName then + if retType.QualifiedName = unitType.QualifiedName then ilg.Emit(I_ldnull) ilg.Emit(I_ret) @@ -14302,20 +14302,20 @@ namespace ProviderImplementation.ProvidedTypes ilg.Emit(I_castclass (transType targetTy)) popIfEmptyExpected expectedState - - | TypeOf(None, [t1], []) -> emitExpr expectedState (Expr.Value(t1)) + + | TypeOf(None, [t1], []) -> emitExpr expectedState (Expr.Value(t1)) | NaN -> emitExpr ExpectedStackState.Value <@@ Double.NaN @@> | NaNSingle -> emitExpr ExpectedStackState.Value <@@ Single.NaN @@> - | MakeDecimal(args) -> + | MakeDecimal(args) -> emitExpr ExpectedStackState.Value (Expr.NewObjectUnchecked(decimalConstructor(), args)) - | LessThan(None, [t1], [a1; a2]) -> + | LessThan(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | Bool | SByte | Char | Double | Single | Int16 | Int32 | Int64 -> ilg.Emit(I_clt) @@ -14325,15 +14325,15 @@ namespace ProviderImplementation.ProvidedTypes ilg.Emit(I_call(Normalcall, (convTypeToTgt typeof).GetMethod("CompareOrdinal", [|t1; t1|]) |> transMeth, None)) emitExpr ExpectedStackState.Value <@@ 0 @@> ilg.Emit(I_clt) - | StaticMethod "op_LessThan" [|t1; t1|] m -> + | StaticMethod "op_LessThan" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (<) not supported for type %s" t1.Name - - | GreaterThan(None, [t1], [a1; a2]) -> + + | GreaterThan(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | Bool | SByte | Char | Double | Single | Int16 | Int32 | Int64 -> ilg.Emit(I_cgt) @@ -14343,23 +14343,23 @@ namespace ProviderImplementation.ProvidedTypes ilg.Emit(I_call(Normalcall, (convTypeToTgt typeof).GetMethod("CompareOrdinal", [|t1; t1|]) |> transMeth, None)) emitExpr ExpectedStackState.Value <@@ 0 @@> ilg.Emit(I_cgt) - | StaticMethod "op_GreaterThan" [|t1; t1|] m -> + | StaticMethod "op_GreaterThan" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (>) not supported for type %s" t1.Name - - - | LessThanOrEqual(None, [t1], [a1; a2]) -> + + + | LessThanOrEqual(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | Bool | SByte | Char - | Int16 | Int32 | Int64 -> + | Int16 | Int32 | Int64 -> ilg.Emit(I_cgt) emitExpr ExpectedStackState.Value <@@ false @@> ilg.Emit(I_ceq) | Byte | Double | Single - | UInt16 | UInt32 | UInt64 -> + | UInt16 | UInt32 | UInt64 -> ilg.Emit(I_cgt_un) emitExpr ExpectedStackState.Value <@@ false @@> ilg.Emit(I_ceq) @@ -14369,23 +14369,23 @@ namespace ProviderImplementation.ProvidedTypes ilg.Emit(I_cgt) emitExpr ExpectedStackState.Value <@@ false @@> ilg.Emit(I_ceq) - | StaticMethod "op_LessThanOrEqual" [|t1; t1|] m -> + | StaticMethod "op_LessThanOrEqual" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (<=) not supported for type %s" t1.Name - - | GreaterThanOrEqual(None, [t1], [a1; a2]) -> + + | GreaterThanOrEqual(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | Bool | SByte | Char - | Int16 | Int32 | Int64 -> + | Int16 | Int32 | Int64 -> ilg.Emit(I_clt) emitExpr ExpectedStackState.Value <@@ false @@> ilg.Emit(I_ceq) | Byte | Double | Single - | UInt16 | UInt32 | UInt64 -> + | UInt16 | UInt32 | UInt64 -> ilg.Emit(I_clt_un) emitExpr ExpectedStackState.Value <@@ false @@> ilg.Emit(I_ceq) @@ -14395,34 +14395,34 @@ namespace ProviderImplementation.ProvidedTypes ilg.Emit(I_clt) emitExpr ExpectedStackState.Value <@@ false @@> ilg.Emit(I_ceq) - | StaticMethod "op_GreaterThanOrEqual" [|t1; t1|] m -> + | StaticMethod "op_GreaterThanOrEqual" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (>=) not supported for type %s" t1.Name - - | Equals(None, [t1], [a1; a2]) -> + + | Equals(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | Bool | SByte | Char | Double | Single - | Int16 | Int32 | Int64 + | Int16 | Int32 | Int64 | Byte | UInt16 | UInt32 | UInt64 -> ilg.Emit(I_ceq) | String -> ilg.Emit(I_call(Normalcall, (convTypeToTgt typeof).GetMethod("Equals", [|t1; t1|]) |> transMeth, None)) - | StaticMethod "op_Equality" [|t1; t1|] m -> + | StaticMethod "op_Equality" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (=) not supported for type %s" t1.Name - - | NotEquals(None, [t1], [a1; a2]) -> + + | NotEquals(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | Bool | SByte | Char | Double | Single - | Int16 | Int32 | Int64 + | Int16 | Int32 | Int64 | Byte - | UInt16 | UInt32 | UInt64 -> + | UInt16 | UInt32 | UInt64 -> ilg.Emit(I_ceq) emitExpr ExpectedStackState.Value <@@ false @@> ilg.Emit(I_ceq) @@ -14430,193 +14430,193 @@ namespace ProviderImplementation.ProvidedTypes ilg.Emit(I_call(Normalcall, (convTypeToTgt typeof).GetMethod("Equals", [|t1; t1|]) |> transMeth, None)) emitExpr ExpectedStackState.Value <@@ false @@> ilg.Emit(I_ceq) - | StaticMethod "op_Inequality" [|t1; t1|] m -> + | StaticMethod "op_Inequality" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (<>) not supported for type %s" t1.Name | Multiply(None, [t1; t2; _], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | SByte | Byte | Int16 | Int32 | Int64 | UInt16 | UInt32 | UInt64 | Double | Single -> ilg.Emit(I_mul) - | StaticMethod "op_Multiply" [|t1; t1|] m -> + | StaticMethod "op_Multiply" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (*) not supported for type %s" t1.Name emitConvIfNecessary t1 - - | Addition(None, [t1; t2; _], [a1; a2]) -> + + | Addition(None, [t1; t2; _], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | SByte | Byte | Int16 | Int32 | Int64 | UInt16 | UInt32 | UInt64 - | Double | Single + | Double | Single | Char -> ilg.Emit(I_add) - | String -> + | String -> ilg.Emit(I_call(Normalcall, (convTypeToTgt typeof).GetMethod("Concat", [|t1; t1|]) |> transMeth, None)) - | StaticMethod "op_Addition" [|t1; t1|] m -> + | StaticMethod "op_Addition" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (+) not supported for type %s" t1.Name emitConvIfNecessary t1 - - | Subtraction(None, [t1; t2; _], [a1; a2]) -> + + | Subtraction(None, [t1; t2; _], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | SByte | Byte | Int16 | Int32 | Int64 | UInt16 | UInt32 | UInt64 | Double | Single -> ilg.Emit(I_sub) - | StaticMethod "op_Subtraction" [|t1; t1|] m -> + | StaticMethod "op_Subtraction" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (-) not supported for type %s" t1.Name emitConvIfNecessary t1 - - | UnaryNegation(None, [t1], [a1]) -> + + | UnaryNegation(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with - | SByte + match t1 with + | SByte | Int16 | Int32 | Int64 | Double | Single -> ilg.Emit(I_neg) - | StaticMethod "op_UnaryNegation" [|t1|] m -> + | StaticMethod "op_UnaryNegation" [|t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (~-) not supported for type %s" t1.Name - - | Division(None, [t1; t2; _], [a1; a2]) -> + + | Division(None, [t1; t2; _], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with - | Byte | UInt16 | UInt32 | UInt64 -> + match t1 with + | Byte | UInt16 | UInt32 | UInt64 -> ilg.Emit(I_div_un) | SByte | Int16 | Int32 | Int64 | Double | Single -> ilg.Emit(I_div) - | StaticMethod "op_Division" [|t1; t1|] m -> + | StaticMethod "op_Division" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (/) not supported for type %s" t1.Name emitConvIfNecessary t1 - | UnaryPlus(None, [t1], [a1]) -> - match t1.GetMethod("op_UnaryPlus", [|t1|]) with + | UnaryPlus(None, [t1], [a1]) -> + match t1.GetMethod("op_UnaryPlus", [|t1|]) with | null -> emitExpr expectedState a1 - | m -> + | m -> emitExpr ExpectedStackState.Value a1 ilg.Emit(I_call(Normalcall, transMeth m, None)) - - | Modulus(None, [t1; t2; _], [a1; a2]) -> + + | Modulus(None, [t1; t2; _], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with - | Byte | UInt16 | UInt32 | UInt64 -> + match t1 with + | Byte | UInt16 | UInt32 | UInt64 -> ilg.Emit(I_rem_un) | SByte | Int16 | Int32 | Int64 | Double | Single -> ilg.Emit(I_rem) - | StaticMethod "op_Modulus" [|t1; t1|] m -> + | StaticMethod "op_Modulus" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (%%) not supported for type %s" t1.Name emitConvIfNecessary t1 - - | LeftShift(None, [t1], [a1; a2]) -> + + | LeftShift(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 let maskShift (x : int) = - match a2 with - | Patterns.Value(:? int as v , _) -> + match a2 with + | Patterns.Value(:? int as v , _) -> emitExpr ExpectedStackState.Value (Expr.Value (v &&& x)) - | _ -> + | _ -> emitExpr ExpectedStackState.Value a2 emitExpr ExpectedStackState.Value (Expr.Value x) ilg.Emit(I_and) - ilg.Emit(I_shl) - match t1 with + ilg.Emit(I_shl) + match t1 with | Int32 | UInt32 -> maskShift 31 | Int64 | UInt64 -> maskShift 63 | Int16 | UInt16 -> maskShift 15 | SByte | Byte -> maskShift 7 - | StaticMethod "op_LeftShift" [|t1; t1|] m -> + | StaticMethod "op_LeftShift" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (<<<) not supported for type %s" t1.Name emitConvIfNecessary t1 - | RightShift(None, [t1], [a1; a2]) -> + | RightShift(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 let maskShift (x : int) = - match a2 with - | Patterns.Value(:? int as v , _) -> + match a2 with + | Patterns.Value(:? int as v , _) -> emitExpr ExpectedStackState.Value (Expr.Value (v &&& x)) - | _ -> + | _ -> emitExpr ExpectedStackState.Value a2 emitExpr ExpectedStackState.Value (Expr.Value x) ilg.Emit(I_and) - ilg.Emit(I_shr) - match t1 with + ilg.Emit(I_shr) + match t1 with | Int32 | UInt32 -> maskShift 31 | Int64 | UInt64 -> maskShift 63 | Int16 | UInt16 -> maskShift 15 | SByte | Byte -> maskShift 7 - | StaticMethod "op_RightShift" [|t1; t1|] m -> + | StaticMethod "op_RightShift" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (>>>) not supported for type %s" t1.Name emitConvIfNecessary t1 - | And(None, [t1], [a1; a2]) -> + | And(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with - | Int32 | UInt32 - | Int64 | UInt64 - | Int16 | UInt16 + match t1 with + | Int32 | UInt32 + | Int64 | UInt64 + | Int16 | UInt16 | SByte | Byte -> ilg.Emit(I_and) - | StaticMethod "op_And" [|t1; t1|] m -> + | StaticMethod "op_And" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (&&&) not supported for type %s" t1.Name - - | Or(None, [t1], [a1; a2]) -> + + | Or(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with - | Int32 | UInt32 - | Int64 | UInt64 - | Int16 | UInt16 + match t1 with + | Int32 | UInt32 + | Int64 | UInt64 + | Int16 | UInt16 | SByte | Byte -> ilg.Emit(I_or) - | StaticMethod "op_Or" [|t1; t1|] m -> + | StaticMethod "op_Or" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (|||) not supported for type %s" t1.Name - - | Xor(None, [t1], [a1; a2]) -> + + | Xor(None, [t1], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with - | Int32 | UInt32 - | Int64 | UInt64 - | Int16 | UInt16 + match t1 with + | Int32 | UInt32 + | Int64 | UInt64 + | Int16 | UInt16 | SByte | Byte -> ilg.Emit(I_xor) - | StaticMethod "op_Xor" [|t1; t1|] m -> + | StaticMethod "op_Xor" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (^^^) not supported for type %s" t1.Name - - | Not(None, [t1], [a1]) -> + + | Not(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with - | Int32 | UInt32 - | Int64 | UInt64 - | Int16 | UInt16 + match t1 with + | Int32 | UInt32 + | Int64 | UInt64 + | Int16 | UInt16 | SByte | Byte -> ilg.Emit(I_not) - | StaticMethod "op_Not" [|t1; t1|] m -> + | StaticMethod "op_Not" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator (~~~) not supported for type %s" t1.Name - | Max(None, [t1], [a1; a2]) -> - match t1 with + | Max(None, [t1], [a1; a2]) -> + match t1 with | Double -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 @@ -14630,31 +14630,31 @@ namespace ProviderImplementation.ProvidedTypes let m = mathTypeTgt.GetMethod("Max", [|t;t|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) ilg.Emit(I_conv DT_R4) - | _ -> - match a1, a2 with - | (Var _ | Value _), (Var _ | Value _) -> + | _ -> + match a1, a2 with + | (Var _ | Value _), (Var _ | Value _) -> Expr.IfThenElseUnchecked(lessThan a1 a2, a2, a1) |> emitExpr ExpectedStackState.Value - | (Var _ | Value _), _ -> + | (Var _ | Value _), _ -> let e2 = Var("e2", a2.Type) - Expr.Let(e2, a2, + Expr.Let(e2, a2, Expr.IfThenElseUnchecked(lessThan a1 (Expr.Var e2), Expr.Var e2, a1)) |> emitExpr ExpectedStackState.Value - | _, (Var _ | Value _) -> + | _, (Var _ | Value _) -> let e1 = Var("e1", a1.Type) - Expr.Let(e1, a1, + Expr.Let(e1, a1, Expr.IfThenElseUnchecked((lessThan (Expr.Var e1) a2, a2, (Expr.Var e1)))) |> emitExpr ExpectedStackState.Value - | _ -> + | _ -> let e1 = Var("e1", a1.Type) let e2 = Var("e2", a2.Type) - Expr.Let(e1, a1, - Expr.Let(e2, a2, + Expr.Let(e1, a1, + Expr.Let(e2, a2, Expr.IfThenElseUnchecked(lessThan (Expr.Var e1) (Expr.Var e2), Expr.Var e2, Expr.Var e1))) |> emitExpr ExpectedStackState.Value - - | Min(None, [t1], [a1; a2]) -> - match t1 with + + | Min(None, [t1], [a1; a2]) -> + match t1 with | Double -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 @@ -14668,236 +14668,236 @@ namespace ProviderImplementation.ProvidedTypes let m = mathTypeTgt.GetMethod("Min", [|t;t|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) ilg.Emit(I_conv DT_R4) - | _ -> - match a1, a2 with - | (Var _ | Value _), (Var _ | Value _) -> + | _ -> + match a1, a2 with + | (Var _ | Value _), (Var _ | Value _) -> Expr.IfThenElseUnchecked(lessThan a1 a2, a1, a2) |> emitExpr ExpectedStackState.Value - | (Var _ | Value _), _ -> + | (Var _ | Value _), _ -> let e2 = Var("e2", a2.Type) - Expr.Let(e2, a2, + Expr.Let(e2, a2, Expr.IfThenElseUnchecked(lessThan a1 (Expr.Var e2), a1, Expr.Var e2)) |> emitExpr ExpectedStackState.Value - | _, (Var _ | Value _) -> + | _, (Var _ | Value _) -> let e1 = Var("e1", a1.Type) - Expr.Let(e1, a1, + Expr.Let(e1, a1, Expr.IfThenElseUnchecked((lessThan (Expr.Var e1) a2, Expr.Var e1, a2))) |> emitExpr ExpectedStackState.Value - | _ -> + | _ -> let e1 = Var("e1", a1.Type) let e2 = Var("e2", a2.Type) - Expr.Let(e1, a1, - Expr.Let(e2, a2, + Expr.Let(e1, a1, + Expr.Let(e2, a2, Expr.IfThenElseUnchecked(lessThan (Expr.Var e1) (Expr.Var e2), Expr.Var e1, Expr.Var e2))) |> emitExpr ExpectedStackState.Value | CallByte(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Char | Double | Single - | Int32 | UInt32 - | Int64 | UInt64 - | Int16 | UInt16 - | SByte | Byte -> ilg.Emit(I_conv DT_U1) - | String -> + | Int32 | UInt32 + | Int64 | UInt64 + | Int16 | UInt16 + | SByte | Byte -> ilg.Emit(I_conv DT_U1) + | String -> let m = languagePrimitivesType().GetMethod("ParseUInt32") ilg.Emit(I_call(Normalcall, transMeth m, None)) - ilg.Emit(I_conv_ovf DT_U1) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + ilg.Emit(I_conv_ovf DT_U1) + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'byte' not supported for type %s" t1.Name - | CallSByte(None, [t1], [a1]) -> + | CallSByte(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Char | Double | Single - | Int32 | UInt32 - | Int64 | UInt64 - | Int16 | UInt16 - | SByte | Byte -> ilg.Emit(I_conv DT_I1) - | String -> + | Int32 | UInt32 + | Int64 | UInt64 + | Int16 | UInt16 + | SByte | Byte -> ilg.Emit(I_conv DT_I1) + | String -> let m = languagePrimitivesType().GetMethod("ParseInt32") ilg.Emit(I_call(Normalcall, transMeth m, None)) - ilg.Emit(I_conv_ovf DT_I1) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + ilg.Emit(I_conv_ovf DT_I1) + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'sbyte' not supported for type %s" t1.Name - | CallUInt16(None, [t1], [a1]) -> + | CallUInt16(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Char | Double | Single - | Int32 | UInt32 - | Int64 | UInt64 - | Int16 | UInt16 - | SByte | Byte -> ilg.Emit(I_conv DT_U2) - | String -> + | Int32 | UInt32 + | Int64 | UInt64 + | Int16 | UInt16 + | SByte | Byte -> ilg.Emit(I_conv DT_U2) + | String -> let m = languagePrimitivesType().GetMethod("ParseUInt32") ilg.Emit(I_call(Normalcall, transMeth m, None)) - ilg.Emit(I_conv_ovf DT_U2) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + ilg.Emit(I_conv_ovf DT_U2) + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'uint16' not supported for type %s" t1.Name - | CallInt16(None, [t1], [a1]) -> + | CallInt16(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Char | Double | Single - | Int32 | UInt32 - | Int64 | UInt64 - | Int16 | UInt16 - | SByte | Byte -> ilg.Emit(I_conv DT_I2) - | String -> + | Int32 | UInt32 + | Int64 | UInt64 + | Int16 | UInt16 + | SByte | Byte -> ilg.Emit(I_conv DT_I2) + | String -> let m = languagePrimitivesType().GetMethod("ParseInt32") ilg.Emit(I_call(Normalcall, transMeth m, None)) - ilg.Emit(I_conv_ovf DT_I2) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + ilg.Emit(I_conv_ovf DT_I2) + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'int16' not supported for type %s" t1.Name - | CallUInt32(None, [t1], [a1]) -> + | CallUInt32(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Char | Double | Single - | UInt16 | UInt32 - | Int64 | UInt64 - | Byte -> ilg.Emit(I_conv DT_U4) + | UInt16 | UInt32 + | Int64 | UInt64 + | Byte -> ilg.Emit(I_conv DT_U4) | Int32 | Int16 | SByte -> () - | String -> + | String -> let m = languagePrimitivesType().GetMethod("ParseUInt32") ilg.Emit(I_call(Normalcall, transMeth m, None)) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'uint32' not supported for type %s" t1.Name | CallInt(None, [t1], [a1]) - | CallInt32(None, [t1], [a1]) -> + | CallInt32(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Char | Double | Single - | UInt16 - | Int64 | UInt64 - | Byte -> ilg.Emit(I_conv DT_I4) + | UInt16 + | Int64 | UInt64 + | Byte -> ilg.Emit(I_conv DT_I4) | UInt32 | Int32 | Int16 | SByte -> () - | String -> + | String -> let m = languagePrimitivesType().GetMethod("ParseInt32") ilg.Emit(I_call(Normalcall, transMeth m, None)) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'int32' not supported for type %s" t1.Name - | CallUInt64(None, [t1], [a1]) -> + | CallUInt64(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Char | Double | Single - | UInt16 | UInt32 - | Byte -> ilg.Emit(I_conv DT_U8) - | SByte | Int32 | Int16 -> ilg.Emit(I_conv DT_I8) + | UInt16 | UInt32 + | Byte -> ilg.Emit(I_conv DT_U8) + | SByte | Int32 | Int16 -> ilg.Emit(I_conv DT_I8) | Int64 | UInt64 -> () - | String -> + | String -> let m = languagePrimitivesType().GetMethod("ParseUInt64") ilg.Emit(I_call(Normalcall, transMeth m, None)) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'uint64' not supported for type %s" t1.Name - | CallInt64(None, [t1], [a1]) -> + | CallInt64(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Double | Single - | Int64 | Int32 | Int16 - | SByte -> ilg.Emit(I_conv DT_I8) - | Char | Byte | UInt16 | UInt32 -> - ilg.Emit(I_conv DT_U8) + | Int64 | Int32 | Int16 + | SByte -> ilg.Emit(I_conv DT_I8) + | Char | Byte | UInt16 | UInt32 -> + ilg.Emit(I_conv DT_U8) | UInt64 -> () - | String -> + | String -> let m = languagePrimitivesType().GetMethod("ParseInt64") ilg.Emit(I_call(Normalcall, transMeth m, None)) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'int64' not supported for type %s" t1.Name | CallSingle(None, [t1], [a1]) - | CallFloat32(None, [t1], [a1]) -> + | CallFloat32(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Double | Single - | Int64 | Int32 | Int16 - | SByte -> ilg.Emit(I_conv DT_R4) - | Char | Byte | UInt16 | UInt32 | UInt64 -> - ilg.Emit(I_conv DT_R) - ilg.Emit(I_conv DT_R4) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + | Int64 | Int32 | Int16 + | SByte -> ilg.Emit(I_conv DT_R4) + | Char | Byte | UInt16 | UInt32 | UInt64 -> + ilg.Emit(I_conv DT_R) + ilg.Emit(I_conv DT_R4) + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) - | _ -> - match expr.Type with - | StaticMethodWithReturnType "Parse" [|t1|] expr.Type m -> + | _ -> + match expr.Type with + | StaticMethodWithReturnType "Parse" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'float32' not supported for type %s" t1.Name | CallDouble(None, [t1], [a1]) - | CallFloat(None, [t1], [a1]) -> + | CallFloat(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Double | Single - | Int64 | Int32 | Int16 - | SByte -> ilg.Emit(I_conv DT_R8) - | Char | Byte | UInt16 | UInt32 | UInt64 -> - ilg.Emit(I_conv DT_R) - ilg.Emit(I_conv DT_R8) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + | Int64 | Int32 | Int16 + | SByte -> ilg.Emit(I_conv DT_R8) + | Char | Byte | UInt16 | UInt32 | UInt64 -> + ilg.Emit(I_conv DT_R) + ilg.Emit(I_conv DT_R8) + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) - | _ -> - match expr.Type with - | StaticMethodWithReturnType "Parse" [|t1|] expr.Type m -> + | _ -> + match expr.Type with + | StaticMethodWithReturnType "Parse" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'float' not supported for type %s" t1.Name - + | CallDecimal(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 let rtTgt = decimalTypeTgt - if t1 = stringTypeTgt then + if t1 = stringTypeTgt then let m = rtTgt.GetMethod("Parse", [|stringTypeTgt|]) - ilg.Emit(I_call(Normalcall, transMeth m, None)) + ilg.Emit(I_call(Normalcall, transMeth m, None)) else - match convertTypeTgt.GetMethod("ToDecimal", [|t1|]) with - | null -> - let m = - t1.GetMethods(BindingFlags.Static ||| BindingFlags.Public) - |> Array.tryFind - (fun x -> - x.Name = "op_Explicit" + match convertTypeTgt.GetMethod("ToDecimal", [|t1|]) with + | null -> + let m = + t1.GetMethods(BindingFlags.Static ||| BindingFlags.Public) + |> Array.tryFind + (fun x -> + x.Name = "op_Explicit" && Type.(=)(x.ReturnType, rtTgt) && (x.GetParameters() |> Array.map (fun i -> i.ParameterType)) = [|t1|]) - match m with - | None -> + match m with + | None -> failwithf "decimal operator on %s not supported" (t1.Name) - | Some m -> + | Some m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) - | toDecimal -> ilg.Emit(I_call(Normalcall, transMeth toDecimal, None)) - - | CallChar(None, [t1], [a1]) -> + | toDecimal -> ilg.Emit(I_call(Normalcall, transMeth toDecimal, None)) + + | CallChar(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Double | Single - | Int64 | Int32 | Int16 + | Int64 | Int32 | Int16 | Char | Byte | UInt16 | UInt32 | UInt64 - | SByte -> ilg.Emit(I_conv DT_U2) - | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> + | SByte -> ilg.Emit(I_conv DT_U2) + | StaticMethodWithReturnType "op_Explicit" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) - | _ -> - match expr.Type with - | StaticMethodWithReturnType "Parse" [|t1|] expr.Type m -> + | _ -> + match expr.Type with + | StaticMethodWithReturnType "Parse" [|t1|] expr.Type m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Operator 'char' not supported for type %s" t1.Name - + | Ignore(None, [t1], [a1]) -> emitExpr expectedState a1 | GetArray(None, [ty], [arr; index]) -> @@ -14931,13 +14931,13 @@ namespace ProviderImplementation.ProvidedTypes popIfEmptyExpected expectedState - | Abs(None, [t1], [a1]) -> + | Abs(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Int32 | Double | Single | Int64 | Int16 | SByte | Decimal -> let m = mathTypeTgt.GetMethod("Abs", [|t1|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) - | StaticMethod "Abs" [|t1|] m -> + | StaticMethod "Abs" [|t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Abs not supported for type %s" t1.Name @@ -14956,7 +14956,7 @@ namespace ProviderImplementation.ProvidedTypes | Atan2(None, [t1;t2], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | Double -> let m = mathTypeTgt.GetMethod("Atan2", [|t1; t1|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) @@ -14966,7 +14966,7 @@ namespace ProviderImplementation.ProvidedTypes let m = mathTypeTgt.GetMethod("Atan2", [|t;t|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) ilg.Emit(I_conv DT_R4) - | StaticMethod "Atan2" [|t1; t1|] m -> + | StaticMethod "Atan2" [|t1; t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Atan2 not supported for type %s" t1.Name @@ -14992,7 +14992,7 @@ namespace ProviderImplementation.ProvidedTypes | Sign(None, [t1], [a1]) -> emitExpr ExpectedStackState.Value a1 - match t1 with + match t1 with | Int32 | Double | Single | Int64 | Int16 | SByte | Decimal -> let m = mathTypeTgt.GetMethod("Sign", [|t1|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) @@ -15001,7 +15001,7 @@ namespace ProviderImplementation.ProvidedTypes let m = mathTypeTgt.GetMethod("Sign", [|convTypeToTgt typeof|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) ilg.Emit(I_conv DT_R4) - | StaticMethod "Sign" [|t1|] m -> + | StaticMethod "Sign" [|t1|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Sign not supported for type %s" t1.Name @@ -15044,7 +15044,7 @@ namespace ProviderImplementation.ProvidedTypes | Pow(None, [t1; t2], [a1; a2]) -> emitExpr ExpectedStackState.Value a1 emitExpr ExpectedStackState.Value a2 - match t1 with + match t1 with | Double -> let m = mathTypeTgt.GetMethod("Pow", [|t1; t1|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) @@ -15054,7 +15054,7 @@ namespace ProviderImplementation.ProvidedTypes let m = mathTypeTgt.GetMethod("Pow", [|t;t|]) ilg.Emit(I_call(Normalcall, transMeth m, None)) ilg.Emit(I_conv DT_R4) - | StaticMethod "Pow" [|t1; t2|] m -> + | StaticMethod "Pow" [|t1; t2|] m -> ilg.Emit(I_call(Normalcall, transMeth m, None)) | _ -> failwithf "Pow not supported for type %s" t1.Name @@ -15094,9 +15094,9 @@ namespace ProviderImplementation.ProvidedTypes match objOpt with | Some obj when meth.IsAbstract || meth.IsVirtual -> - if obj.Type.IsValueType then + if obj.Type.IsValueType then ilg.Emit(I_callconstraint (Normalcall, transType obj.Type, mappedMeth, None)) - else + else ilg.Emit(I_callvirt (Normalcall, mappedMeth, None)) | _ -> ilg.Emit(mkNormalCall mappedMeth) @@ -15117,7 +15117,7 @@ namespace ProviderImplementation.ProvidedTypes ilg.Emit(I_newobj (transCtorSpec ctor, None)) popIfEmptyExpected expectedState - + | DefaultValue (t) -> let ilt = transType t let lb = ilg.DeclareLocal ilt @@ -15244,7 +15244,7 @@ namespace ProviderImplementation.ProvidedTypes let stres = fun () -> ilg.Emit(I_stloc local.LocalIndex) let ldres = fun () -> ilg.Emit(I_ldloc local.LocalIndex) stres, ldres - + ilg.BeginExceptionBlock() |> ignore emitExpr expectedState body @@ -15273,13 +15273,13 @@ namespace ProviderImplementation.ProvidedTypes | n -> failwithf "unknown expression '%A' in generated method" n - + member __.EmitExpr (expectedState, expr) = emitExpr expectedState expr //------------------------------------------------------------------------------------------------- // AssemblyCompiler: the assembly compiler for generative type providers. - /// Implements System.Reflection.Assembly backed by ILModuleReader over generated bytes + /// Implements System.Reflection.Assembly backed by ILModuleReader over generated bytes type AssemblyCompiler(targetAssembly: ProvidedAssembly, context: ProvidedTypesContext) = @@ -15304,7 +15304,7 @@ namespace ProviderImplementation.ProvidedTypes if pntd.IsErased then failwith ("The nested provided type "+pntd.Name+" is marked as erased and cannot be converted to a generated type. Set 'IsErased=false' on the ProvidedTypeDefinition") Debug.Assert(pntd.BelongsToTargetModel, "expected a target ProvidedTypeDefinition in nested type") // Adjust the attributes - we're codegen'ing this type as nested - let attributes = adjustTypeAttributes true ntd.Attributes + let attributes = adjustTypeAttributes true ntd.Attributes let ntb = tb.DefineNestedType(pntd.Name, attributes) typeMap[pntd] <- ntb defineNestedTypes ntb pntd @@ -15327,51 +15327,51 @@ namespace ProviderImplementation.ProvidedTypes else ILType.Boxed (transTypeSpec ty) and transTypeSpec (ty: Type) = - if ty.IsGenericType then + if ty.IsGenericType then ILTypeSpec(transTypeRef (ty.GetGenericTypeDefinition()), Array.map transType (ty.GetGenericArguments())) - else + else ILTypeSpec(transTypeRef ty, [| |]) - and transTypeRef (ty: Type) = + and transTypeRef (ty: Type) = let ty = if ty.IsGenericType then ty.GetGenericTypeDefinition() else ty ILTypeRef(transTypeRefScope ty, StructOption.ofObj (if ty.IsNested then null else ty.Namespace), ty.Name) - and transTypeRefScope (ty: Type): ILTypeRefScope = - match ty.DeclaringType with - | null -> + and transTypeRefScope (ty: Type): ILTypeRefScope = + match ty.DeclaringType with + | null -> if isNull ty.Assembly then failwithf "null assembly for type %s" ty.FullName ILTypeRefScope.Top (transScopeRef ty.Assembly) | dt -> ILTypeRefScope.Nested (transTypeRef dt) - and transScopeRef (assem: Assembly): ILScopeRef = - // Note: this simple equality check on assembly objects doesn't work on Mono, there must be some small difference in the + and transScopeRef (assem: Assembly): ILScopeRef = + // Note: this simple equality check on assembly objects doesn't work on Mono, there must be some small difference in the // implementation of equality on System.Assembly objects // if assem = (targetAssembly :> Assembly) then ILScopeRef.Local if assem.GetName().Name = targetAssembly.GetName().Name then ILScopeRef.Local else ILScopeRef.Assembly (ILAssemblyRef.FromAssemblyName (assem.GetName())) - let transCtorRef (m:ConstructorInfo) = + let transCtorRef (m:ConstructorInfo) = // Remove the generic instantiations to get the uninstantiated identity of the method let m2 = m.GetDefinition() let cc = (if m2.IsStatic then ILCallingConv.Static else ILCallingConv.Instance) let ptys = [| for p in m2.GetParameters() -> transType p.ParameterType |] ILMethodRef (transTypeRef m2.DeclaringType, cc, 0, m2.Name, ptys, ILType.Void) - let transCtorSpec (f:ConstructorInfo) = + let transCtorSpec (f:ConstructorInfo) = if (match f with :? ProvidedConstructor as f -> not f.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" f - match f with + match f with | :? ProvidedConstructor as pc when ctorMap.ContainsKey pc -> ctorMap[pc].FormalMethodSpec | m -> ILMethodSpec(transCtorRef f, transType m.DeclaringType, [| |]) - let transFieldSpec (f:FieldInfo) = + let transFieldSpec (f:FieldInfo) = if (match f with :? ProvidedField as f -> not f.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" f - match f with + match f with | :? ProvidedField as pf when fieldMap.ContainsKey pf -> fieldMap[pf].FormalFieldSpec - | f -> + | f -> let f2 = f.GetDefinition() ILFieldSpec(ILFieldRef (transTypeRef f2.DeclaringType, f2.Name, transType f2.FieldType), transType f.DeclaringType) - let transMethRef (m:MethodInfo) = + let transMethRef (m:MethodInfo) = if (match m with :? ProvidedMethod as m -> not m.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" m // Remove the generic instantiations to get the uninstantiated identity of the method let m2 = m.GetDefinition() @@ -15380,10 +15380,10 @@ namespace ProviderImplementation.ProvidedTypes let cc = (if m2.IsStatic then ILCallingConv.Static else ILCallingConv.Instance) ILMethodRef (transTypeRef m2.DeclaringType, cc, genarity, m2.Name, ptys, transType m2.ReturnType) - let transMeth (m:MethodInfo): ILMethodSpec = - match m with + let transMeth (m:MethodInfo): ILMethodSpec = + match m with | :? ProvidedMethod as pm when methMap.ContainsKey pm -> methMap[pm].FormalMethodSpec - | m -> + | m -> //Debug.Assert (m.Name <> "get_Item1" || m.DeclaringType.Name <> "Tuple`2") let mref = transMethRef m let minst = (if m.IsGenericMethod then Array.map transType (m.GetGenericArguments()) else [| |]) @@ -15416,12 +15416,12 @@ namespace ProviderImplementation.ProvidedTypes let defineCustomAttrs f (cattrs: IList) = for attr in cattrs do let constructorArgs = [ for x in attr.ConstructorArguments -> x.Value ] - let transValue (o:obj) = - match o with + let transValue (o:obj) = + match o with | :? Type as t -> box (transType t) | v -> v - let namedProps = [ for x in attr.NamedArguments do match x.MemberInfo with :? PropertyInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] - let namedFields = [ for x in attr.NamedArguments do match x.MemberInfo with :? FieldInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] + let namedProps = [ for x in attr.NamedArguments do match x.MemberInfo with :? PropertyInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] + let namedFields = [ for x in attr.NamedArguments do match x.MemberInfo with :? FieldInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] let ca = mkILCustomAttribMethRef (transCtorSpec attr.Constructor, constructorArgs, namedProps, namedFields) f ca @@ -15430,7 +15430,7 @@ namespace ProviderImplementation.ProvidedTypes let ilg = context.ILGlobals let assemblyName = targetAssembly.GetName() let assemblyFileName = targetAssembly.Location - let assemblyBuilder = + let assemblyBuilder = let attrs = targetAssembly.GetCustomAttributesData() let cattrs = ResizeArray() defineCustomAttrs cattrs.Add attrs @@ -15469,10 +15469,10 @@ namespace ProviderImplementation.ProvidedTypes let attributes = adjustTypeAttributes otb.IsSome attributes let tb = match otb with - | None -> + | None -> let nsp, n = splitILTypeName n assemblyMainModule.DefineType(nsp, n, attributes) - | Some (otb:ILTypeBuilder) -> + | Some (otb:ILTypeBuilder) -> otb.DefineNestedType(n, attributes) typeMapExtra[fullName] <- tb tb @@ -15485,8 +15485,8 @@ namespace ProviderImplementation.ProvidedTypes match ptdT with | None -> () | Some ptdT -> - match ptdT.BaseType with - | null -> () + match ptdT.BaseType with + | null -> () | bt -> tb.SetParent(transType bt)) // phase 2 - emit member definitions @@ -15518,7 +15518,7 @@ namespace ProviderImplementation.ProvidedTypes | :? ProvidedField as pinfo -> let fb = tb.DefineField(finfo.Name, transType finfo.FieldType, finfo.Attributes) - if finfo.IsLiteral then + if finfo.IsLiteral then fb.SetConstant (pinfo.GetRawConstantValue()) defineCustomAttrs fb.SetCustomAttribute (pinfo.GetCustomAttributesData()) @@ -15668,7 +15668,7 @@ namespace ProviderImplementation.ProvidedTypes | None when pminfo.IsAbstract || ptdT.IsInterface -> // abstract and interface methods have no body at all () - | None -> + | None -> let ilg = mb.GetILGenerator() ilg.Emit I_ret | Some invokeCode -> @@ -15722,7 +15722,7 @@ namespace ProviderImplementation.ProvidedTypes #endif // Use a real Reflection Load when running in F# Interactive - if isHostedExecution then + if isHostedExecution then let realTargetAssembly = Assembly.Load(bytes) for (ptdT, _) in providedTypeDefinitionsT do ptdT.SetAssemblyInternal (K realTargetAssembly) @@ -15763,12 +15763,12 @@ namespace ProviderImplementation.ProvidedTypes #if !NO_GENERATIVE let theTable = ConcurrentDictionary() - // When using hosted execution (i.e. in F# Interactive), ensure the generated assembly for a generated type is + // When using hosted execution (i.e. in F# Interactive), ensure the generated assembly for a generated type is // actually fully compiled and loaded as a reflection-load assembly before handing the type back to the API. let ensureCompiled (t: Type) = - match t with + match t with | :? ProvidedTypeDefinition as pt when pt.IsErased || pt.GetStaticParametersInternal().Length > 0 || not config.IsHostedExecution -> t - | _ -> + | _ -> let origAssembly = t.Assembly // We expect the results reported by t.Assembly to actually change after this call, because the act of compilation @@ -15784,11 +15784,11 @@ namespace ProviderImplementation.ProvidedTypes let newAssemblyName = newAssembly.GetName().Name let origAssemblyName = origAssembly.GetName().Name // check the assembly was generated with the correct name - if newAssemblyName <> origAssemblyName then + if newAssemblyName <> origAssemblyName then failwithf "expected identical assembly name keys '%s' and '%s'" origAssemblyName newAssemblyName // check the type really exists - if isNull (t.Assembly.GetType tyName) then + if isNull (t.Assembly.GetType tyName) then failwithf "couldn't find type '%s' in assembly '%O'" tyName t.Assembly t @@ -15799,7 +15799,7 @@ namespace ProviderImplementation.ProvidedTypes let makeProvidedNamespace (namespaceName:string) (typesSrc:ProvidedTypeDefinition list) = let typesSrc = [| for ty in typesSrc -> ty :> Type |] - let nsSrc = + let nsSrc = { new IProvidedNamespace with member __.GetNestedNamespaces() = [| |] member __.NamespaceName = namespaceName @@ -15810,7 +15810,7 @@ namespace ProviderImplementation.ProvidedTypes let namespacesT = ResizeArray() - do for (namespaceName, types) in namespacesAndTypes do + do for (namespaceName, types) in namespacesAndTypes do namespacesT.Add (makeProvidedNamespace namespaceName types) let invalidateE = new Event() @@ -15827,17 +15827,17 @@ namespace ProviderImplementation.ProvidedTypes // By default add the location of the TPDTC assembly (which is assumed to contain this file) // as a probing location. do if addDefaultProbingLocation then - let thisAssembly = Assembly.GetExecutingAssembly() + let thisAssembly = Assembly.GetExecutingAssembly() let folder = thisAssembly.Location |> Path.GetDirectoryName - probingFolders.Add folder + probingFolders.Add folder - new (config, namespaceName, types, ?sourceAssemblies, ?assemblyReplacementMap, ?addDefaultProbingLocation) = + new (config, namespaceName, types, ?sourceAssemblies, ?assemblyReplacementMap, ?addDefaultProbingLocation) = let sourceAssemblies = defaultArg sourceAssemblies [ Assembly.GetCallingAssembly() ] let assemblyReplacementMap = defaultArg assemblyReplacementMap [] let addDefaultProbingLocation = defaultArg addDefaultProbingLocation false new TypeProviderForNamespaces(config, [(namespaceName, types)], assemblyReplacementMap=assemblyReplacementMap, sourceAssemblies=sourceAssemblies, addDefaultProbingLocation=addDefaultProbingLocation) - new (config, ?sourceAssemblies, ?assemblyReplacementMap, ?addDefaultProbingLocation) = + new (config, ?sourceAssemblies, ?assemblyReplacementMap, ?addDefaultProbingLocation) = let sourceAssemblies = defaultArg sourceAssemblies [ Assembly.GetCallingAssembly() ] let assemblyReplacementMap = defaultArg assemblyReplacementMap [] let addDefaultProbingLocation = defaultArg addDefaultProbingLocation false @@ -15884,13 +15884,13 @@ namespace ProviderImplementation.ProvidedTypes AppDomain.CurrentDomain.remove_AssemblyResolve handler #endif - member __.AddNamespace (namespaceName, types) = + member __.AddNamespace (namespaceName, types) = namespacesT.Add (makeProvidedNamespace namespaceName types) - member __.Namespaces = + member __.Namespaces = namespacesT.ToArray() - member this.Invalidate() = + member this.Invalidate() = invalidateE.Trigger(this, EventArgs()) member __.GetStaticParametersForMethod(mb: MethodBase) = @@ -15915,7 +15915,7 @@ namespace ProviderImplementation.ProvidedTypes /// This checks that the GetInvokeCodeInternal doesn't return things containing calls to other provided methods or constructors. let rec check expr = match expr with - | NewObject((:? ProvidedConstructor), _) + | NewObject((:? ProvidedConstructor), _) | Call(_, :? ProvidedMethod, _) -> failwithf "The invokeCode for a ProvidedConstructor or ProvidedMethod included a use or another ProvidedConstructor or ProvidedMethod '%A'. This is not allowed. Instead, the invokeCode should be the compiled representation without invoking other provided objects" expr | ShapeCombinationUnchecked(shape, args) -> RebuildShapeCombinationUnchecked(shape, List.map check args) | ShapeVarUnchecked v -> Expr.Var v @@ -15968,7 +15968,7 @@ namespace ProviderImplementation.ProvidedTypes member __.ApplyStaticArguments(ty, typePathAfterArguments:string[], objs) = let typePathAfterArguments = typePathAfterArguments[typePathAfterArguments.Length-1] match ty with - | :? ProvidedTypeDefinition as t -> + | :? ProvidedTypeDefinition as t -> let ty = (t.ApplyStaticArguments(typePathAfterArguments, objs) :> Type) ensureCompiled ty @@ -15983,8 +15983,8 @@ namespace ProviderImplementation.ProvidedTypes match theTable.TryGetValue key with | true, bytes -> bytes | _ -> - let bytes = - match assembly with + let bytes = + match assembly with | :? ProvidedAssembly as targetAssembly -> AssemblyCompiler(targetAssembly, ctxt).Compile(config.IsHostedExecution) | _ -> File.ReadAllBytes assembly.ManifestModule.FullyQualifiedName theTable[key] <- bytes @@ -15994,8 +15994,8 @@ namespace ProviderImplementation.ProvidedTypes member __.RegisterGeneratedTargetAssembly (fileName:string) = let assemblyBytes = File.ReadAllBytes fileName //printfn "registering assembly in '%s'" fileName - let assembly = - if config.IsHostedExecution then + let assembly = + if config.IsHostedExecution then Assembly.Load(assemblyBytes) // we need a real on-disk assembly else ctxt.ReadRelatedAssembly(fileName) @@ -16004,5 +16004,5 @@ namespace ProviderImplementation.ProvidedTypes theTable[key] <- assemblyBytes assembly -#endif +#endif #endif diff --git a/tests/service/data/TestTP/ProvidedTypes.fsi b/tests/service/data/TestTP/ProvidedTypes.fsi index b2d088190af..13ed1ac741e 100644 --- a/tests/service/data/TestTP/ProvidedTypes.fsi +++ b/tests/service/data/TestTP/ProvidedTypes.fsi @@ -334,13 +334,13 @@ type ProvidedTypeDefinition = member AddDefinitionLocation: line:int * column:int * filePath:string -> unit /// Suppress Object entries in intellisense menus in instances of this provided type - member HideObjectMethods: bool + member HideObjectMethods: bool /// Disallows the use of the null literal. member NonNullable: bool /// Get a flag indicating if the ProvidedTypeDefinition is erased - member IsErased: bool + member IsErased: bool /// Get or set a flag indicating if the ProvidedTypeDefinition has type-relocation suppressed [] @@ -396,13 +396,13 @@ type ProvidedAssembly = /// Represents the context for which code is to be generated. Normally you should not need to use this directly. [] -type ProvidedTypesContext = - +type ProvidedTypesContext = + /// Try to find the given target assembly in the context - member TryBindAssemblyNameToTarget: aref: AssemblyName -> Choice + member TryBindAssemblyNameToTarget: aref: AssemblyName -> Choice /// Try to find the given target assembly in the context - member TryBindSimpleAssemblyNameToTarget: assemblyName: string -> Choice + member TryBindSimpleAssemblyNameToTarget: assemblyName: string -> Choice /// Get the list of referenced assemblies determined by the type provider configuration member ReferencedAssemblyPaths: string list @@ -444,17 +444,17 @@ type TypeProviderForNamespaces = /// Type provider config. /// Name of namespace. /// Provided type definitions. - /// + /// /// /// Optionally specify the design-time assemblies available to use as a basis for authoring provided types. /// The transitive dependencies of these assemblies are also included. By default /// Assembly.GetCallingAssembly() and its transitive dependencies are used. /// - /// + /// /// /// Optionally specify a map of assembly names from source model to referenced assemblies. /// - /// + /// /// /// Optionally specify that the location of the type provider design-time component should be used to resolve failing assembly resolutions. /// This flag or an equivalent call to RegisterProbingFolder is generally needed for any type provider design-time components loaded into .NET Core tooling. @@ -468,11 +468,11 @@ type TypeProviderForNamespaces = /// The transitive dependencies of these assemblies are also included. By default /// Assembly.GetCallingAssembly() and its transitive dependencies are used. /// - /// + /// /// /// Optionally specify a map of assembly names from source model to referenced assemblies. /// - /// + /// /// /// Optionally specify that the location of the type provider design-time component should be used to resolve failing assembly resolutions. /// This flag or an equivalent call to RegisterProbingFolder is generally needed for any type provider design-time components loaded into .NET Core tooling. @@ -518,7 +518,7 @@ type TypeProviderForNamespaces = member Disposing: IEvent /// The context for which code is eventually to be generated. You should not normally - /// need to use this property directly, as translation from the compiler-hosted context to + /// need to use this property directly, as translation from the compiler-hosted context to /// the design-time context will normally be performed automatically. member TargetContext: ProvidedTypesContext @@ -554,7 +554,6 @@ module internal AssemblyReader = module Reader = type ILModuleReader = class end - + val GetWeakReaderCache : unit -> System.Collections.Concurrent.ConcurrentDictionary> val GetStrongReaderCache : unit -> System.Collections.Concurrent.ConcurrentDictionary - \ No newline at end of file diff --git a/tests/service/data/TestTP/TestTP.fs b/tests/service/data/TestTP/TestTP.fs index 062e1b8510d..ab970c285be 100644 --- a/tests/service/data/TestTP/TestTP.fs +++ b/tests/service/data/TestTP/TestTP.fs @@ -19,15 +19,15 @@ module Helper = let doNothingGenericWithTypeConstraint(x: 'T when 'T :> _ seq) = () let mutable moduleValue = 0 - + type I = abstract DoNothing: unit -> unit - + type B() = abstract VirtualDoNothing: unit -> unit - default this.VirtualDoNothing() = () + default this.VirtualDoNothing() = () - type C() = + type C() = inherit B() let mutable p = 0 static member DoNothing() = () @@ -52,10 +52,10 @@ module Helper = member val AutoProperty = 0 with get, set static member val StaticAutoProperty = 0 with get, set - interface I with + interface I with member this.DoNothing() = () - type G<'U>() = + type G<'U>() = static member DoNothing() = () static member DoNothingOneArg(x:int) = () static member DoNothingTwoArg(c:C, x:int) = () @@ -202,7 +202,7 @@ type BasicProvider (config : TypeProviderConfig) as this = // These do not seem to compile correctly when used in provided expressions: //Helper.G().InstanceDoNothingGeneric(3) - + let someMethod = ProvidedMethod("GenericClassDoNothingOneArg", [], typeof, invokeCode = fun args -> <@@ Helper.G.DoNothingOneArg(3) @@>) myType.AddMember(someMethod) @@ -285,7 +285,7 @@ type BasicProvider (config : TypeProviderConfig) as this = invokeCode = fun args -> <@@ Helper.C.StaticAutoProperty <- 1; Helper.C.StaticAutoProperty @@>) myType.AddMember(someMethod) - [myType] + [myType] do this.AddNamespace(ns, createTypes()) @@ -307,7 +307,7 @@ type BasicGenerativeProvider (config : TypeProviderConfig) as this = let ctor2 = ProvidedConstructor([ProvidedParameter("InnerState", typeof)], invokeCode = fun args -> <@@ (%%(args[1]):string) :> obj @@>) myType.AddMember(ctor2) - for i in 1 .. count do + for i in 1 .. count do let prop = ProvidedProperty("Property" + string i, typeof, getterCode = fun args -> <@@ i @@>) myType.AddMember(prop) @@ -317,7 +317,7 @@ type BasicGenerativeProvider (config : TypeProviderConfig) as this = myType - let myParamType = + let myParamType = let t = ProvidedTypeDefinition(asm, ns, "GenerativeProvider", Some typeof, isErased=false) t.DefineStaticParameters( [ProvidedStaticParameter("Count", typeof)], fun typeName args -> createType typeName (unbox args[0])) t diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/Library1.fs b/vsintegration/ProjectTemplates/LibraryProject/Template/Library1.fs index c8a8cd1b462..3aa193e2348 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/Library1.fs +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/Library1.fs @@ -1,4 +1,4 @@ namespace $safeprojectname$ -type Class1() = +type Class1() = member this.X = "F#" diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs index e5fb92ff337..a32c26a419f 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -namespace DummyProviderForLanguageServiceTesting +namespace DummyProviderForLanguageServiceTesting open Microsoft.FSharp.Core.CompilerServices open ProviderImplementation.ProvidedTypes @@ -13,7 +13,7 @@ open FSharp.Quotations open FSharp.Core.CompilerServices // Runtime methods, these are called instead of “erased†methods -type RuntimeAPI = +type RuntimeAPI = static member Convert(x:float) : decimal = decimal x static member AddInt(x:int) = x+1 static member AddInt(x:int,y:int) = x+y @@ -21,7 +21,7 @@ type RuntimeAPI = static member IdentityInt(x : int) = x // Linq Expression functions for erased methods calls. -module InvokeAPI = +module InvokeAPI = let addIntX (args : Quotations.Expr list) = match Seq.length args with | 1 -> <@@ RuntimeAPI.AddInt %%args.[0] @@> @@ -33,14 +33,14 @@ module InvokeAPI = | 2 -> <@@ RuntimeAPI.IdentityInt (%%args.[1]) @@> | _ -> failwithf "instanceX: expect arity 2 (got %d)" (Seq.length args) - let ctor (args:Quotations.Expr list) = + let ctor (args:Quotations.Expr list) = match Seq.length args with | 0 -> <@@ new System.Object() @@> | _ -> failwithf "ctor:expect arity 1 (got %d)" (Seq.length args) -module internal TPModule = - - let namespaceName = "N1" +module internal TPModule = + + let namespaceName = "N1" let thisAssembly = System.Reflection.Assembly.GetExecutingAssembly() // A parametric type N1.T @@ -50,9 +50,9 @@ module internal TPModule = // The instantiated type has a static property that evaluates to the param passed let instantiateParametricType (typeName:string) (args:System.Object[]) = match args with - [| :? string as value; :? int as ignoredvalue; |] -> - let typeParam = ProvidedTypeDefinition(thisAssembly,namespaceName, typeName, Some typeof) - let propParam = ProvidedProperty("Param1", typeof, + [| :? string as value; :? int as ignoredvalue; |] -> + let typeParam = ProvidedTypeDefinition(thisAssembly,namespaceName, typeName, Some typeof) + let propParam = ProvidedProperty("Param1", typeof, isStatic = true, // A complicated was to basically return the constant value... Maybe there's a better/simpler way? getterCode = fun _ -> <@@ RuntimeAPI.Identity(value) @@>) @@ -115,7 +115,7 @@ module internal TPModule = let types = [ typeT1 ; typeT; typeWithNestedTypes ] // Used by unit testing to check that Dispose is being called on the type provider -module GlobalCounters = +module GlobalCounters = let counterLock = obj() let mutable private creations = 0 let mutable private disposals = 0 @@ -126,15 +126,15 @@ module GlobalCounters = let IncrementDisposals() = lock counterLock (fun () -> disposals <- disposals + 1) let AddConfig c = lock counterLock (fun () -> configs <- c :: configs) let GetConfigs() = lock counterLock (fun () -> configs) - let CheckAllConfigsDisposed() = + let CheckAllConfigsDisposed() = let cs = GetConfigs() - lock counterLock (fun () -> + lock counterLock (fun () -> configs <- []) - for c in cs do - try + for c in cs do + try c.SystemRuntimeContainsType("System.Object") |> ignore failwith "expected configuration object to be disposed" - with :? System.ObjectDisposedException -> + with :? System.ObjectDisposedException -> () [] @@ -144,8 +144,8 @@ type HelloWorldProvider(config: TypeProviderConfig) = do GlobalCounters.IncrementCreations() let mutable disposed = false do GlobalCounters.AddConfig config - interface System.IDisposable with - member x.Dispose() = + interface System.IDisposable with + member x.Dispose() = System.Diagnostics.Debug.Assert(not disposed) disposed <- true do GlobalCounters.IncrementDisposals() @@ -154,9 +154,9 @@ type HelloWorldProvider(config: TypeProviderConfig) = // implementation of a poorly behaving TP that sleeps for various numbers of seconds when traversing into members. // simulates high network-latency, for testing VS robustness against badly-behaved providers. -module internal SlowIntelliSenseTPModule = - - let namespaceName = "SlowIntelliSense" +module internal SlowIntelliSenseTPModule = + + let namespaceName = "SlowIntelliSense" let thisAssembly = System.Reflection.Assembly.GetExecutingAssembly() let typeT = ProvidedTypeDefinition(thisAssembly,namespaceName,"T",Some typeof) @@ -192,7 +192,7 @@ type SlowIntellisenseProvider(config: TypeProviderConfig) = ignore() // for breakpoint [] -type ShowOffCreationTimeProvider(config: TypeProviderConfig) as this= +type ShowOffCreationTimeProvider(config: TypeProviderConfig) as this= inherit TypeProviderForNamespaces(config) let namespaceName = "ShowOffCreationTime" let thisAssembly = System.Reflection.Assembly.GetExecutingAssembly() @@ -207,7 +207,7 @@ type ShowOffCreationTimeProvider(config: TypeProviderConfig) as this= this.AddNamespace(namespaceName,types) -module TypeProviderThatThrowsErrorsModule = +module TypeProviderThatThrowsErrorsModule = type private Marker = interface end let assembly = typeof.Assembly let rootNamespace = "TPErrors" @@ -231,7 +231,7 @@ type TypeProviderThatThrowsErrors(config: TypeProviderConfig) = open System.ComponentModel type TPBaseTy() = - [] + [] [] member this.DoNotShowHidden = () @@ -252,13 +252,13 @@ type HiddenMembersInBaseClassProvider(config: TypeProviderConfig) as this = do this.AddNamespace(namespaceName,types) -module TypeProviderForTestingTuplesErasureModule = +module TypeProviderForTestingTuplesErasureModule = type private Marker = interface end let assembly = typeof.Assembly - + let rootNamespace = "TupleErasure" - let handle f = + let handle f = function | [arg] -> f arg | _ -> failwith "One argument expected" @@ -266,7 +266,7 @@ module TypeProviderForTestingTuplesErasureModule = let erasedTup = ProvidedTypeDefinition(assembly, rootNamespace, "TupleType", Some(typeof)) erasedTup.AddMember(ProvidedConstructor([ProvidedParameter("tup", typeof)], invokeCode = handle (fun tup -> tup))) erasedTup.AddMember(ProvidedProperty("SecondComponent", typeof, getterCode = handle (fun tup -> Quotations.Expr.TupleGet(tup, 1)))) - + let objT = typedefof.MakeGenericType(typeof, erasedTup) let erasedCompoundTup = ProvidedTypeDefinition(assembly, rootNamespace, "CompoundTupleType", Some(objT)) erasedCompoundTup.AddMember(ProvidedConstructor([ProvidedParameter("tup", objT)], invokeCode = handle (fun tup -> tup))) @@ -277,7 +277,7 @@ module TypeProviderForTestingTuplesErasureModule = type TypeProviderForTestingTuplesErasure(config: TypeProviderConfig) = inherit TypeProviderForNamespaces(config, TypeProviderForTestingTuplesErasureModule.rootNamespace, [TypeProviderForTestingTuplesErasureModule.erasedTup; TypeProviderForTestingTuplesErasureModule.erasedCompoundTup]) -module TypeProviderThatEmitsBadMethodsModule = +module TypeProviderThatEmitsBadMethodsModule = let assembly = System.Reflection.Assembly.GetExecutingAssembly() let rootNamespace = "BadMethods" let arrayUser = ProvidedTypeDefinition(assembly, rootNamespace, "Arr", None) @@ -286,26 +286,26 @@ module TypeProviderThatEmitsBadMethodsModule = let addr = typeof.GetMethod("Address") arrayUser.AddMember( ProvidedMethod( - methodName = "GetFirstElement", - parameters = [ProvidedParameter("array", typeof)], - returnType = typeof, - isStatic = true, + methodName = "GetFirstElement", + parameters = [ProvidedParameter("array", typeof)], + returnType = typeof, + isStatic = true, invokeCode = function [arr] -> Quotations.Expr.Call(arr, get, [Quotations.Expr.Value 0]) | _ -> failwith "One argument expected") ) arrayUser.AddMember( ProvidedMethod( - methodName = "SetFirstElement", - parameters = [ProvidedParameter("array", typeof); ProvidedParameter("val", typeof)], - returnType = typeof, - isStatic = true, + methodName = "SetFirstElement", + parameters = [ProvidedParameter("array", typeof); ProvidedParameter("val", typeof)], + returnType = typeof, + isStatic = true, invokeCode = function [arr; v] -> Quotations.Expr.Call(arr, set, [Quotations.Expr.Value 0; v]) | _ -> failwith "Two argument expected") ) arrayUser.AddMember( ProvidedMethod( - methodName = "AddressOfFirstElement", - parameters = [ProvidedParameter("array", typeof)], - returnType = typeof.MakeByRefType(), - isStatic = true, + methodName = "AddressOfFirstElement", + parameters = [ProvidedParameter("array", typeof)], + returnType = typeof.MakeByRefType(), + isStatic = true, invokeCode = function [arr] -> Quotations.Expr.Call(arr, addr, [Quotations.Expr.Value 0]) | _ -> failwith "One argument expected") ) @@ -316,7 +316,7 @@ type TypeProviderThatEmitsBadMethods(config: TypeProviderConfig) = module TypeProvidersVisibilityChecks = let Namespace = "GeneratedType" let setMethodVisibility (m : ProvidedMethod) visibility = m.SetMethodAttrs((m.Attributes &&& ~~~System.Reflection.MethodAttributes.MemberAccessMask) ||| visibility) - let addMethod name value visibility (ty : ProvidedTypeDefinition) = + let addMethod name value visibility (ty : ProvidedTypeDefinition) = let m = ProvidedMethod(name, [], value.GetType(), isStatic=false, invokeCode = (fun args -> Expr.Value(null, value.GetType()))) setMethodVisibility m visibility ty.AddMember m @@ -333,7 +333,7 @@ module TypeProvidersVisibilityChecks = ty.AddMember f let assem = ProvidedAssembly() - let providedTy = + let providedTy = let ty = ProvidedTypeDefinition(assem, Namespace, "SampleType", Some typeof, isErased=false) /// unseal type @@ -380,35 +380,35 @@ module RegexTypeProvider = let regexTy = ProvidedTypeDefinition(thisAssembly, rootNamespace, "RegexTyped", Some baseTy) do regexTy.DefineStaticParameters( - parameters=staticParams, + parameters=staticParams, instantiationFunction=(fun typeName parameterValues -> - match parameterValues with - | [| :? string as pattern|] -> - // Create an instance of the regular expression. + match parameterValues with + | [| :? string as pattern|] -> + // Create an instance of the regular expression. // - // This will fail with System.ArgumentException if the regular expression is invalid. + // This will fail with System.ArgumentException if the regular expression is invalid. // The exception will escape the type provider and be reported in client code. - let r = System.Text.RegularExpressions.Regex(pattern) + let r = System.Text.RegularExpressions.Regex(pattern) // Declare the typed regex provided type. // The type erasure of this typs ia 'obj', even though the representation will always be a Regex // This, combined with hiding the object methods, makes the IntelliSense experience simpler. let ty = ProvidedTypeDefinition( - thisAssembly, - rootNamespace, - typeName, + thisAssembly, + rootNamespace, + typeName, baseType = Some baseTy) ty.AddXmlDoc "A strongly typed interface to the regular expression '%s'" // Provide strongly typed version of Regex.IsMatch static method let isMatch = ProvidedMethod( - methodName = "IsMatch", - parameters = [ProvidedParameter("input", typeof)], - returnType = typeof, + methodName = "IsMatch", + parameters = [ProvidedParameter("input", typeof)], + returnType = typeof, isStatic = true, - invokeCode = fun args -> <@@ Regex.IsMatch(%%args.[0], pattern) @@>) + invokeCode = fun args -> <@@ Regex.IsMatch(%%args.[0], pattern) @@>) isMatch.AddXmlDoc "Indicates whether the regular expression finds a match in the specified input string" @@ -417,8 +417,8 @@ module RegexTypeProvider = // Provided type for matches // Again, erase to obj even though the representation will always be a Match let matchTy = ProvidedTypeDefinition( - "MatchType", - baseType = Some baseTy, + "MatchType", + baseType = Some baseTy, hideObjectMethods = true) // Nest the match type within parameterized Regex type @@ -429,34 +429,34 @@ module RegexTypeProvider = // ignore the group named 0, which represents all input if group <> "0" then let prop = ProvidedProperty( - propertyName = group, - propertyType = typeof, + propertyName = group, + propertyType = typeof, getterCode = fun args -> <@@ ((%%args.[0]:obj) :?> Match).Groups.[group] @@>) prop.AddXmlDoc(sprintf @"Gets the ""%s"" group from this match" group) matchTy.AddMember(prop) // Provide strongly typed version of Regex.Match instance method let matchMeth = ProvidedMethod( - methodName = "Match", - parameters = [ProvidedParameter("input", typeof)], - returnType = matchTy, + methodName = "Match", + parameters = [ProvidedParameter("input", typeof)], + returnType = matchTy, invokeCode = fun args -> <@@ ((%%args.[0]:obj) :?> Regex).Match(%%args.[1]) :> obj @@>) matchMeth.AddXmlDoc "Searches the specified input string for the first occurrence of this regular expression" - + ty.AddMember matchMeth - + // Declare a constructor let ctor = ProvidedConstructor( - parameters = [], + parameters = [], invokeCode = fun args -> <@@ Regex(pattern) :> obj @@>) // Add documentation to the constructor ctor.AddXmlDoc "Initializes a regular expression instance" ty.AddMember ctor - + ty - | _ -> failwith "unexpected parameter values")) + | _ -> failwith "unexpected parameter values")) do this.AddNamespace(rootNamespace, [regexTy]) @@ -477,22 +477,22 @@ module RegexTypeProviderUsingMethod = let regexTyStatic = ProvidedTypeDefinition(thisAssembly, rootNamespace, "RegexTypedStatic", Some baseTy) let meth = ProvidedMethod("IsMatch", [], typeof, isStatic=true, invokeCode = fun _ -> <@@ true @@>) do meth.DefineStaticParameters( - parameters=staticParams, + parameters=staticParams, instantiationFunction=(fun methName parameterValues -> - match parameterValues with - | [| :? string as pattern1 |] -> + match parameterValues with + | [| :? string as pattern1 |] -> let isMatch = ProvidedMethod( - methodName = methName, - parameters = [ProvidedParameter("input", typeof)], - returnType = typeof, + methodName = methName, + parameters = [ProvidedParameter("input", typeof)], + returnType = typeof, isStatic = true, - invokeCode = fun args -> <@@ true @@>) + invokeCode = fun args -> <@@ true @@>) isMatch.AddXmlDoc "Indicates whether the regular expression finds a match in the specified input string" regexTyStatic.AddMember isMatch isMatch - | _ -> failwith "unexpected parameter values")) + | _ -> failwith "unexpected parameter values")) do regexTyStatic.AddMember meth do this.AddNamespace(rootNamespace, [regexTyStatic]) diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs index c051f4da698..8d4c2f1aa57 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation, Tomas Petricek, Gustavo Guerra, and other contributors -// +// // Licensed under the MIT License see LICENSE.md in this project namespace ProviderImplementation.ProvidedTypes @@ -21,13 +21,13 @@ namespace ProviderImplementation.ProvidedTypes open Microsoft.FSharp.Core.CompilerServices [] - module Utils = + module Utils = let K x = (fun () -> x) let isNull x = match x with null -> true | _ -> false let isNil x = match x with [] -> true | _ -> false let isEmpty x = match x with [| |] -> true | _ -> false - module Option = + module Option = let toObj x = match x with None -> null | Some x -> x let ofObj x = match x with null -> None | _ -> Some x @@ -44,7 +44,7 @@ namespace ProviderImplementation.ProvidedTypes let USome v = uoption<'T>(true, v) let (|UNone|USome|) (x:uoption<'T>) = if x.HasValue then USome x.Value else UNone - module StructOption = + module StructOption = let toObj x = match x with UNone -> null | USome x -> x let ofObj x = match x with null -> UNone | x -> USome x @@ -92,22 +92,22 @@ namespace ProviderImplementation.ProvidedTypes let isAssignableFrom (ty: Type) (otherTy: Type) = eqTypes ty otherTy || (match otherTy.BaseType with null -> false | bt -> ty.IsAssignableFrom(bt)) - /// General implementation of .IsSubclassOf logic for System.Type, regardless of specific implementation, with + /// General implementation of .IsSubclassOf logic for System.Type, regardless of specific implementation, with /// an added hack to make the types usable with the FSharp.Core quotations implementation let isSubclassOf (this: Type) (otherTy: Type) = (this.IsClass && otherTy.IsClass && this.IsAssignableFrom(otherTy) && not (eqTypes this otherTy)) // The FSharp.Core implementation of FSharp.Quotations uses - // let isDelegateType (typ:Type) = + // let isDelegateType (typ:Type) = // if typ.IsSubclassOf(typeof) then ... // This means even target type definitions must process the case where ``otherTy`` is typeof rather than // the System.Delegate type for the target assemblies. - || (match this.BaseType with - | null -> false + || (match this.BaseType with + | null -> false | bt -> bt.FullName = "System.MulticastDelegate" && (let fn = otherTy.FullName in fn = "System.Delegate" || fn = "System.MulticastDelegate" )) - /// General implementation of .GetAttributeFlags logic for System.Type over symbol types - let getAttributeFlagsImpl (ty: Type) = + /// General implementation of .GetAttributeFlags logic for System.Type over symbol types + let getAttributeFlagsImpl (ty: Type) = if ty.IsGenericType then ty.GetGenericTypeDefinition().Attributes elif ty.IsArray then typeof.Attributes elif ty.IsPointer then typeof.MakePointerType().Attributes @@ -117,7 +117,7 @@ namespace ProviderImplementation.ProvidedTypes let bindAll = BindingFlags.DeclaredOnly ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Static ||| BindingFlags.Instance let bindSome isStatic = BindingFlags.DeclaredOnly ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| (if isStatic then BindingFlags.Static else BindingFlags.Instance) - let memberBinds isType (bindingFlags: BindingFlags) isStatic isPublic = + let memberBinds isType (bindingFlags: BindingFlags) isStatic isPublic = (isType || bindingFlags.HasFlag(if isStatic then BindingFlags.Static else BindingFlags.Instance)) && ((bindingFlags.HasFlag(BindingFlags.Public) && isPublic) || (bindingFlags.HasFlag(BindingFlags.NonPublic) && not isPublic)) @@ -144,13 +144,13 @@ namespace ProviderImplementation.ProvidedTypes else ty - let mutable token = 0 + let mutable token = 0 let genToken() = token <- token + 1; token /// Internal code of .NET expects the obj[] returned by GetCustomAttributes to be an Attribute[] even in the case of empty arrays let emptyAttributes = (([| |]: Attribute[]) |> box |> unbox) let nonNone str x = match x with None -> failwithf "No value has been specified for '%s', stacktrace = '%s'" str Environment.StackTrace | Some v -> v - let patchOption v f = match v with None -> f() | Some _ -> failwithf "Already patched, stacktrace = '%s'" Environment.StackTrace + let patchOption v f = match v with None -> f() | Some _ -> failwithf "Already patched, stacktrace = '%s'" Environment.StackTrace let notRequired this opname item = let msg = sprintf "The operation '%s' on item '%s' should not be called on provided type, member or parameter of type '%O'. Stack trace:\n%s" opname item (this.GetType()) Environment.StackTrace @@ -174,24 +174,24 @@ namespace ProviderImplementation.ProvidedTypes type ConstructorInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetConstructors(bindAll) + gdty.GetConstructors(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic constructor definition via metadata token, stacktrace = '%s'" m.DeclaringType m.Name Environment.StackTrace else m type PropertyInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetProperties(bindAll) + gdty.GetProperties(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic property definition via metadata token" m.DeclaringType m.Name else @@ -201,12 +201,12 @@ namespace ProviderImplementation.ProvidedTypes member p.IsPublic = p.CanRead && p.GetGetMethod().IsPublic || p.CanWrite && p.GetSetMethod().IsPublic type EventInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetEvents(bindAll) + gdty.GetEvents(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic event definition via metadata token" m.DeclaringType m.Name else @@ -216,33 +216,33 @@ namespace ProviderImplementation.ProvidedTypes member p.IsPublic = p.GetAddMethod().IsPublic || p.GetRemoveMethod().IsPublic type FieldInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType - if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + if (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through the original type definition looking for the one with a matching metadata token let gdty = dty.GetGenericTypeDefinition() - gdty.GetFields(bindAll) + gdty.GetFields(bindAll) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind %O::%s back to generic event definition via metadata token" m.DeclaringType m.Name else m type MethodInfo with - member m.GetDefinition() = + member m.GetDefinition() = let dty = m.DeclaringType if (m.IsGenericMethod && not dty.IsGenericType) then m.GetGenericMethodDefinition() - elif (m.IsGenericMethod && (not m.IsGenericMethodDefinition || not dty.IsGenericTypeDefinition)) || - (dty.IsGenericType && not dty.IsGenericTypeDefinition) then + elif (m.IsGenericMethod && (not m.IsGenericMethodDefinition || not dty.IsGenericTypeDefinition)) || + (dty.IsGenericType && not dty.IsGenericTypeDefinition) then // Search through ALL the methods on the original type definition looking for the one // with a matching metadata token let gdty = if dty.IsGenericType then dty.GetGenericTypeDefinition() else dty - gdty.GetMethods(bindSome m.IsStatic) + gdty.GetMethods(bindSome m.IsStatic) |> Array.tryFind (fun c -> c.MetadataToken = m.MetadataToken) |> function Some m2 -> m2 | None -> failwithf "couldn't rebind generic instantiation of %O::%s back to generic method definition via metadata token" m.DeclaringType m.Name else - m + m let canBindConstructor (bindingFlags: BindingFlags) (c: ConstructorInfo) = bindingFlags.HasFlag(BindingFlags.Public) && c.IsPublic || bindingFlags.HasFlag(BindingFlags.NonPublic) && not c.IsPublic @@ -413,19 +413,19 @@ namespace ProviderImplementation.ProvidedTypes let op = letOp.Invoke(null, [| |]) mkFE2.Invoke(null, [| box op; box e; box lam |]) :?> Expr - static member ForIntegerRangeLoopUnchecked (loopVariable, startExpr:Expr, endExpr:Expr, body:Expr) = + static member ForIntegerRangeLoopUnchecked (loopVariable, startExpr:Expr, endExpr:Expr, body:Expr) = let lam = Expr.Lambda(loopVariable, body) let op = forIntegerRangeLoopOp.Invoke(null, [| |]) mkFE3.Invoke(null, [| box op; box startExpr; box endExpr; box lam |] ) :?> Expr - static member WhileLoopUnchecked (guard:Expr, body:Expr) = + static member WhileLoopUnchecked (guard:Expr, body:Expr) = let op = whileLoopOp.Invoke(null, [| |]) mkFE2.Invoke(null, [| box op; box guard; box body |] ):?> Expr - static member IfThenElseUnchecked (e:Expr, t:Expr, f:Expr) = + static member IfThenElseUnchecked (e:Expr, t:Expr, f:Expr) = let op = ifThenElseOp.Invoke(null, [| |]) mkFE3.Invoke(null, [| box op; box e; box t; box f |] ):?> Expr - + type Shape = Shape of (Expr list -> Expr) let (|ShapeCombinationUnchecked|ShapeVarUnchecked|ShapeLambdaUnchecked|) e = @@ -521,7 +521,7 @@ namespace ProviderImplementation.ProvidedTypes | ProvidedTypeSymbolKind.Generic gty -> gty.DeclaringType | ProvidedTypeSymbolKind.FSharpTypeAbbreviation _ -> null - override _.Name = + override _.Name = match kind,typeArgs with | ProvidedTypeSymbolKind.SDArray,[| arg |] -> arg.Name + "[]" | ProvidedTypeSymbolKind.Array _,[| arg |] -> arg.Name + "[*]" @@ -673,7 +673,7 @@ namespace ProviderImplementation.ProvidedTypes override this.MakeArrayType arg = ProvidedTypeSymbol(ProvidedTypeSymbolKind.Array arg, [this]) :> Type - override _.MetadataToken = + override _.MetadataToken = match kind with | ProvidedTypeSymbolKind.SDArray -> typeof.MetadataToken | ProvidedTypeSymbolKind.Array _ -> typeof.MetadataToken @@ -835,14 +835,14 @@ namespace ProviderImplementation.ProvidedTypes let customAttributesImpl = CustomAttributesImpl(customAttributesData) - new (parameterName:string, parameterType:Type, ?parameterDefaultValue:obj) = + new (parameterName:string, parameterType:Type, ?parameterDefaultValue:obj) = ProvidedStaticParameter(false, parameterName, parameterType, parameterDefaultValue, (K [| |])) member _.AddXmlDocDelayed xmlDocFunction = customAttributesImpl.AddXmlDocDelayed xmlDocFunction member _.AddXmlDocComputed xmlDocFunction = customAttributesImpl.AddXmlDocComputed xmlDocFunction member _.AddXmlDoc xmlDoc = customAttributesImpl.AddXmlDoc xmlDoc - member _.ParameterDefaultValue = parameterDefaultValue + member _.ParameterDefaultValue = parameterDefaultValue member _.BelongsToTargetModel = isTgt override _.RawDefaultValue = defaultArg parameterDefaultValue null @@ -855,15 +855,15 @@ namespace ProviderImplementation.ProvidedTypes override _.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() type ProvidedParameter(isTgt: bool, parameterName:string, attrs, parameterType:Type, optionalValue:obj option, customAttributesData) = - + inherit ParameterInfo() let customAttributesImpl = CustomAttributesImpl(customAttributesData) - new (parameterName:string, parameterType:Type, ?isOut:bool, ?optionalValue:obj) = + new (parameterName:string, parameterType:Type, ?isOut:bool, ?optionalValue:obj) = ProvidedParameter(false, parameterName, parameterType, isOut, optionalValue) - new (_isTgt, parameterName:string, parameterType:Type, isOut:bool option, optionalValue:obj option) = + new (_isTgt, parameterName:string, parameterType:Type, isOut:bool option, optionalValue:obj option) = let isOut = defaultArg isOut false let attrs = (if isOut then ParameterAttributes.Out else enum 0) ||| (match optionalValue with None -> enum 0 | Some _ -> ParameterAttributes.Optional ||| ParameterAttributes.HasDefault) @@ -871,7 +871,7 @@ namespace ProviderImplementation.ProvidedTypes member _.IsParamArray with set(v) = customAttributesImpl.HasParamArray <- v member _.IsReflectedDefinition with set(v) = customAttributesImpl.HasReflectedDefinition <- v - member _.OptionalValue = optionalValue + member _.OptionalValue = optionalValue member _.HasDefaultParameterValue = Option.isSome optionalValue member _.BelongsToTargetModel = isTgt member _.AddCustomAttribute(attribute) = customAttributesImpl.AddCustomAttribute(attribute) @@ -883,11 +883,11 @@ namespace ProviderImplementation.ProvidedTypes override _.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() and ProvidedConstructor(isTgt: bool, attrs: MethodAttributes, parameters: ProvidedParameter[], invokeCode: (Expr list -> Expr), baseCall, isImplicitCtor, customAttributesData) = - + inherit ConstructorInfo() let parameterInfos = parameters |> Array.map (fun p -> p :> ParameterInfo) let mutable baseCall = baseCall - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let mutable isImplicitCtor = isImplicitCtor let mutable attrs = attrs let isStatic() = attrs.HasFlag(MethodAttributes.Static) @@ -944,7 +944,7 @@ namespace ProviderImplementation.ProvidedTypes inherit MethodInfo() let parameterInfos = parameters |> Array.map (fun p -> p :> ParameterInfo) - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let mutable attrs = attrs let mutable staticParams = staticParams let mutable staticParamsApply = staticParamsApply @@ -995,7 +995,7 @@ namespace ProviderImplementation.ProvidedTypes member this.IsErased = (nonNone "DeclaringType" this.DeclaringProvidedType).IsErased // Implement overloads - override _.GetParameters() = parameterInfos + override _.GetParameters() = parameterInfos override _.Attributes = attrs override _.Name = methodName override _.DeclaringType = declaringType |> nonNone "DeclaringType" :> Type @@ -1028,7 +1028,7 @@ namespace ProviderImplementation.ProvidedTypes and ProvidedProperty(isTgt: bool, propertyName: string, attrs: PropertyAttributes, propertyType: Type, isStatic: bool, getter: (unit -> MethodInfo) option, setter: (unit -> MethodInfo) option, indexParameters: ProvidedParameter[], customAttributesData) = inherit PropertyInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(customAttributesData) @@ -1050,11 +1050,11 @@ namespace ProviderImplementation.ProvidedTypes override _.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() member _.PatchDeclaringType x = - if not isTgt then + if not isTgt then match getter with Some f -> (match f() with (:? ProvidedMethod as g) -> g.PatchDeclaringType x | _ -> ()) | _ -> () match setter with Some f -> (match f() with (:? ProvidedMethod as s) -> s.PatchDeclaringType x | _ -> ()) | _ -> () patchOption declaringType (fun () -> declaringType <- Some x) - + member _.IsStatic = isStatic member _.IndexParameters = indexParameters member _.BelongsToTargetModel = isTgt @@ -1065,7 +1065,7 @@ namespace ProviderImplementation.ProvidedTypes override this.SetValue(_obj, _value, _invokeAttr, _binder, _index, _culture) = notRequired this "SetValue" propertyName override this.GetAccessors _nonPublic = notRequired this "nonPublic" propertyName override _.GetGetMethod _nonPublic = match getter with None -> null | Some g -> g() - override _.GetSetMethod _nonPublic = match setter with None -> null | Some s -> s() + override _.GetSetMethod _nonPublic = match setter with None -> null | Some s -> s() override _.GetIndexParameters() = [| for p in indexParameters -> upcast p |] override _.Attributes = attrs override _.CanRead = getter.IsSome @@ -1083,11 +1083,11 @@ namespace ProviderImplementation.ProvidedTypes and ProvidedEvent(isTgt: bool, eventName:string, attrs: EventAttributes, eventHandlerType:Type, isStatic: bool, adder: (unit -> MethodInfo), remover: (unit -> MethodInfo), customAttributesData) = inherit EventInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(customAttributesData) - new (eventName, eventHandlerType, adderCode, removerCode, ?isStatic) = + new (eventName, eventHandlerType, adderCode, removerCode, ?isStatic) = let isStatic = defaultArg isStatic false let pattrs = (if isStatic then MethodAttributes.Static else enum(0)) ||| MethodAttributes.Public ||| MethodAttributes.SpecialName let adder = ProvidedMethod(false, "add_" + eventName, pattrs, [| ProvidedParameter(false, "handler", eventHandlerType, isOut=Some false, optionalValue=None) |], typeof, adderCode, [], None, K [| |]) :> MethodInfo @@ -1100,7 +1100,7 @@ namespace ProviderImplementation.ProvidedTypes member _.AddDefinitionLocation(line,column,filePath) = customAttributesImpl.AddDefinitionLocation(line, column, filePath) member _.PatchDeclaringType x = - if not isTgt then + if not isTgt then match adder() with :? ProvidedMethod as a -> a.PatchDeclaringType x | _ -> () match remover() with :? ProvidedMethod as r -> r.PatchDeclaringType x | _ -> () patchOption declaringType (fun () -> declaringType <- Some x) @@ -1111,7 +1111,7 @@ namespace ProviderImplementation.ProvidedTypes member _.BelongsToTargetModel = isTgt override _.EventHandlerType = eventHandlerType - override _.GetAddMethod _nonPublic = adder() + override _.GetAddMethod _nonPublic = adder() override _.GetRemoveMethod _nonPublic = remover() override _.Attributes = attrs override _.Name = eventName @@ -1128,7 +1128,7 @@ namespace ProviderImplementation.ProvidedTypes and ProvidedField(isTgt: bool, fieldName:string, attrs, fieldType:Type, rawConstantValue: obj, customAttributesData) = inherit FieldInfo() - let mutable declaringType : ProvidedTypeDefinition option = None + let mutable declaringType : ProvidedTypeDefinition option = None let customAttributesImpl = CustomAttributesImpl(customAttributesData) let mutable attrs = attrs @@ -1166,10 +1166,10 @@ namespace ProviderImplementation.ProvidedTypes override this.GetValue(_obj): obj = notRequired this "GetValue" fieldName override this.FieldHandle = notRequired this "FieldHandle" fieldName - static member Literal(fieldName:string, fieldType:Type, literalValue: obj) = + static member Literal(fieldName:string, fieldType:Type, literalValue: obj) = ProvidedField(false, fieldName, (FieldAttributes.Static ||| FieldAttributes.Literal ||| FieldAttributes.Public), fieldType, literalValue, K [| |]) - + and ProvidedMeasureBuilder() = // TODO: this shouldn't be hardcoded, but without creating a dependency on FSharp.Compiler.Service @@ -1183,7 +1183,7 @@ namespace ProviderImplementation.ProvidedTypes static let unitSymbolsTypeAbbreviations = [ "m"; "kg"; "s"; "A"; "K"; "mol"; "cd"; "Hz"; "N"; "Pa"; "J"; "W"; "C" "V"; "F"; "S"; "Wb"; "T"; "lm"; "lx"; "Bq"; "Gy"; "Sv"; "kat"; "H" ] - |> Set.ofList + |> Set.ofList static member One = typeof static member Product (measure1, measure2) = typedefof>.MakeGenericType [| measure1;measure2 |] @@ -1211,8 +1211,8 @@ namespace ProviderImplementation.ProvidedTypes static member AnnotateType (basic, argument) = ProvidedTypeSymbol(Generic basic, argument) :> Type - and - [] + and + [] TypeContainer = | Namespace of (unit -> Assembly) * string // namespace | Type of ProvidedTypeDefinition @@ -1225,17 +1225,17 @@ namespace ProviderImplementation.ProvidedTypes | TypeContainer.Namespace _, Some logger when not isTgt -> logger (sprintf "Creating ProvidedTypeDefinition %s [%d]" className (System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode this)) | _ -> () - static let defaultAttributes isErased = - TypeAttributes.Public ||| - TypeAttributes.Class ||| - TypeAttributes.Sealed ||| + static let defaultAttributes isErased = + TypeAttributes.Public ||| + TypeAttributes.Class ||| + TypeAttributes.Sealed ||| enum (if isErased then int32 TypeProviderTypeAttributes.IsErased else 0) // state let mutable attrs = attrs let mutable enumUnderlyingType = lazy getEnumUnderlyingType() let mutable baseType = lazy getBaseType() - + /// Represents the evaluated members so far let members = ResizeArray() @@ -1251,8 +1251,8 @@ namespace ProviderImplementation.ProvidedTypes let methodOverrides = ResizeArray() let methodOverridesQueue = ResizeArray (ProvidedMethod * MethodInfo)[]>() - do match initialData with - | None -> () + do match initialData with + | None -> () | Some (getFreshMembers, getFreshInterfaces, getFreshMethodOverrides) -> membersQueue.Add getFreshMembers interfacesQueue.Add getFreshInterfaces @@ -1265,22 +1265,22 @@ namespace ProviderImplementation.ProvidedTypes for f in elems do for m in f() do members.Add m - + // Implicitly add the property and event methods (only for the source model where they are not explicitly declared) match m with | :? ProvidedProperty as p -> - if not p.BelongsToTargetModel then + if not p.BelongsToTargetModel then if p.CanRead then members.Add (p.GetGetMethod true) if p.CanWrite then members.Add (p.GetSetMethod true) | :? ProvidedEvent as e -> - if not e.BelongsToTargetModel then + if not e.BelongsToTargetModel then members.Add (e.GetAddMethod true) members.Add (e.GetRemoveMethod true) | _ -> () - + // re-add the getFreshMembers call from the initialData to make sure we fetch the latest translated members from the source model - match initialData with - | None -> () + match initialData with + | None -> () | Some (getFreshMembers, _getInterfaceImpls, _getMethodOverrides) -> membersQueue.Add getFreshMembers @@ -1296,8 +1296,8 @@ namespace ProviderImplementation.ProvidedTypes for f in elems do for i in f() do interfaceImpls.Add i - match initialData with - | None -> () + match initialData with + | None -> () | Some (_getFreshMembers, getInterfaces, _getMethodOverrides) -> interfacesQueue.Add getInterfaces @@ -1312,8 +1312,8 @@ namespace ProviderImplementation.ProvidedTypes for f in elems do for i in f() do methodOverrides.Add i - match initialData with - | None -> () + match initialData with + | None -> () | Some (_getFreshMembers, _getInterfaceImpls, getMethodOverrides) -> methodOverridesQueue.Add getMethodOverrides @@ -1329,7 +1329,7 @@ namespace ProviderImplementation.ProvidedTypes override _.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() - new (assembly:Assembly, namespaceName, className, baseType, ?hideObjectMethods, ?nonNullable, ?isErased) = + new (assembly:Assembly, namespaceName, className, baseType, ?hideObjectMethods, ?nonNullable, ?isErased) = let isErased = defaultArg isErased true let nonNullable = defaultArg nonNullable false let hideObjectMethods = defaultArg hideObjectMethods false @@ -1337,7 +1337,7 @@ namespace ProviderImplementation.ProvidedTypes //if not isErased && assembly.GetType().Name <> "ProvidedAssembly" then failwithf "a non-erased (i.e. generative) ProvidedTypeDefinition '%s.%s' was placed in an assembly '%s' that is not a ProvidedAssembly" namespaceName className (assembly.GetName().Name) ProvidedTypeDefinition(false, TypeContainer.Namespace (K assembly,namespaceName), className, K baseType, attrs, K None, [], None, None, K [| |], nonNullable, hideObjectMethods) - new (className:string, baseType, ?hideObjectMethods, ?nonNullable, ?isErased) = + new (className:string, baseType, ?hideObjectMethods, ?nonNullable, ?isErased) = let isErased = defaultArg isErased true let nonNullable = defaultArg nonNullable false let hideObjectMethods = defaultArg hideObjectMethods false @@ -1349,13 +1349,13 @@ namespace ProviderImplementation.ProvidedTypes override _.UnderlyingSystemType = typeof // Implement overloads - override _.Assembly = + override _.Assembly = match container with | TypeContainer.Namespace (theAssembly,_) -> theAssembly() | TypeContainer.Type t -> t.Assembly | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not yet added as a member to a declaring type, stacktrace = %s" className Environment.StackTrace - override _.FullName = + override _.FullName = match container with | TypeContainer.Type declaringType -> declaringType.FullName + "+" + className | TypeContainer.Namespace (_,namespaceName) -> @@ -1365,7 +1365,7 @@ namespace ProviderImplementation.ProvidedTypes | _ -> namespaceName + "." + className | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not added as a member to a declaring type" className - override _.Namespace = + override _.Namespace = match container with | TypeContainer.Namespace (_,nsp) -> nsp | TypeContainer.Type t -> t.Namespace @@ -1374,35 +1374,35 @@ namespace ProviderImplementation.ProvidedTypes override _.BaseType = match baseType.Value with Some ty -> ty | None -> null override _.GetConstructors bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? ConstructorInfo as c when memberBinds false bindingFlags c.IsStatic c.IsPublic -> Some c | _ -> None) override this.GetMethods bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? MethodInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetMethods(bindingFlags)))) override this.GetFields bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? FieldInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetFields(bindingFlags)))) override this.GetProperties bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? PropertyInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetProperties(bindingFlags)))) override this.GetEvents bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? EventInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetEvents(bindingFlags)))) override _.GetNestedTypes bindingFlags = - getMembers() + getMembers() |> Array.choose (function :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> Some m | _ -> None) |> (if bindingFlags.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then id else (fun mems -> Array.append mems (this.ErasedBaseType.GetNestedTypes(bindingFlags)))) - override this.GetConstructorImpl(bindingFlags, _binder, _callConventions, _types, _modifiers) = + override this.GetConstructorImpl(bindingFlags, _binder, _callConventions, _types, _modifiers) = let xs = this.GetConstructors bindingFlags |> Array.filter (fun m -> m.Name = ".ctor") if xs.Length > 1 then failwith "GetConstructorImpl. not support overloads" if xs.Length > 0 then xs.[0] else null @@ -1430,7 +1430,7 @@ namespace ProviderImplementation.ProvidedTypes override _.GetInterface(_name, _ignoreCase) = notRequired this "GetInterface" this.Name - override _.GetInterfaces() = getInterfaces() + override _.GetInterfaces() = getInterfaces() override _.MakeArrayType() = ProvidedTypeSymbol(ProvidedTypeSymbolKind.SDArray, [this]) :> Type @@ -1445,13 +1445,13 @@ namespace ProviderImplementation.ProvidedTypes // However, it's possible for the framework to generate other sets of flags in some corner cases (e.g. via use of `enum` with a provided type as the target) override _.GetMembers bindingFlags = [| for m in getMembers() do - match m with + match m with | :? ConstructorInfo as c when memberBinds false bindingFlags c.IsStatic c.IsPublic -> yield (c :> MemberInfo) | :? MethodInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? FieldInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? PropertyInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) | :? EventInfo as m when memberBinds false bindingFlags m.IsStatic m.IsPublic -> yield (m :> _) - | :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> yield (m :> _) + | :? Type as m when memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic -> yield (m :> _) | _ -> () |] override this.GetMember(name,mt,_bindingFlags) = @@ -1459,15 +1459,15 @@ namespace ProviderImplementation.ProvidedTypes this.GetMembers() |> Array.filter (fun m -> 0 <> int(m.MemberType &&& mt) && m.Name = name) // Attributes, etc.. - override _.GetAttributeFlagsImpl() = adjustTypeAttributes this.IsNested attrs + override _.GetAttributeFlagsImpl() = adjustTypeAttributes this.IsNested attrs - override this.IsValueTypeImpl() = - match this.BaseType with - | null -> false - | bt -> bt.FullName = "System.Enum" || bt.FullName = "System.ValueType" || bt.IsValueType + override this.IsValueTypeImpl() = + match this.BaseType with + | null -> false + | bt -> bt.FullName = "System.Enum" || bt.FullName = "System.ValueType" || bt.IsValueType - override _.IsEnum = - match this.BaseType with + override _.IsEnum = + match this.BaseType with | null -> false | bt -> bt.FullName = "System.Enum" || bt.IsEnum @@ -1486,7 +1486,7 @@ namespace ProviderImplementation.ProvidedTypes override _.HasElementTypeImpl() = false override _.Name = className - override _.DeclaringType = + override _.DeclaringType = match container with | TypeContainer.Namespace _ -> null | TypeContainer.Type enclosingTyp -> (enclosingTyp :> Type) @@ -1527,8 +1527,8 @@ namespace ProviderImplementation.ProvidedTypes member _.BaseTypeRaw() = baseType.Force() member _.StaticParams = staticParams member _.StaticParamsApply = staticParamsApply - - // Fetch the members declared since the indicated position in the members list. This allows the target model to observe + + // Fetch the members declared since the indicated position in the members list. This allows the target model to observe // incremental additions made to the source model member _.GetMembersFromCursor(idx: int) = evalMembers(); members.GetRange(idx, members.Count - idx).ToArray(), members.Count @@ -1538,7 +1538,7 @@ namespace ProviderImplementation.ProvidedTypes // Fetch the method overrides declared since the indicated position in the list member _.GetMethodOverridesFromCursor(idx: int) = evalMethodOverrides(); methodOverrides.GetRange(idx, methodOverrides.Count - idx).ToArray(), methodOverrides.Count - // Fetch the method overrides + // Fetch the method overrides member _.GetMethodOverrides() = getMethodOverrides() member this.ErasedBaseType : Type = ProvidedTypeDefinition.EraseType(this.BaseType) @@ -1553,15 +1553,15 @@ namespace ProviderImplementation.ProvidedTypes member _.AddCustomAttribute attribute = customAttributesImpl.AddCustomAttribute attribute member _.SetEnumUnderlyingType(ty) = enumUnderlyingType <- lazy Some ty - member _.SetBaseType t = + member _.SetBaseType t = if baseType.IsValueCreated then failwithf "The base type has already been evaluated for this type. Please call SetBaseType before any operations which traverse the type hierarchy. stacktrace = %A" Environment.StackTrace baseType <- lazy Some t - member _.SetBaseTypeDelayed baseTypeFunction = + member _.SetBaseTypeDelayed baseTypeFunction = if baseType.IsValueCreated then failwithf "The base type has already been evaluated for this type. Please call SetBaseType before any operations which traverse the type hierarchy. stacktrace = %A" Environment.StackTrace baseType <- lazy (Some (baseTypeFunction())) member _.SetAttributes x = attrs <- x - member this.AddMembers(memberInfos:list<#MemberInfo>) = + member this.AddMembers(memberInfos:list<#MemberInfo>) = memberInfos |> List.iter this.PatchDeclaringTypeOfMember membersQueue.Add (fun () -> memberInfos |> List.toArray |> Array.map (fun x -> x :> MemberInfo )) @@ -1618,7 +1618,7 @@ namespace ProviderImplementation.ProvidedTypes staticParams <- parameters staticParamsApply <- Some instantiationFunction - /// Get ParameterInfo[] for the parametric type parameters + /// Get ParameterInfo[] for the parametric type parameters member _.GetStaticParametersInternal() = [| for p in staticParams -> p :> ParameterInfo |] /// Instantiate parametric type @@ -1650,8 +1650,8 @@ namespace ProviderImplementation.ProvidedTypes member _.AddInterfaceImplementationsDelayed interfacesFunction = interfacesQueue.Add (interfacesFunction >> Array.ofList) - member _.SetAssemblyInternal (assembly: unit -> Assembly) = - match container with + member _.SetAssemblyInternal (assembly: unit -> Assembly) = + match container with | TypeContainer.Namespace (_, ns) -> container <- TypeContainer.Namespace (assembly, ns) | TypeContainer.Type _ -> failwithf "can't set assembly of nested type '%s'" className | TypeContainer.TypeToBeDecided -> failwithf "type '%s' was not added as a member to a declaring type" className @@ -1683,10 +1683,10 @@ namespace ProviderImplementation.ProvidedTypes member this.PatchDeclaringTypeOfMember (m:MemberInfo) = match m with - | :? ProvidedConstructor as c -> c.PatchDeclaringType this - | :? ProvidedMethod as m -> m.PatchDeclaringType this - | :? ProvidedProperty as p -> p.PatchDeclaringType this - | :? ProvidedEvent as e -> e.PatchDeclaringType this + | :? ProvidedConstructor as c -> c.PatchDeclaringType this + | :? ProvidedMethod as m -> m.PatchDeclaringType this + | :? ProvidedProperty as p -> p.PatchDeclaringType this + | :? ProvidedEvent as e -> e.PatchDeclaringType this | :? ProvidedTypeDefinition as t -> t.PatchDeclaringType this | :? ProvidedField as l -> l.PatchDeclaringType this | _ -> () @@ -1723,13 +1723,13 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader // the public key. //--------------------------------------------------------------------- - // Little-endian encoding of int32 + // Little-endian encoding of int32 let b0 n = byte (n &&& 0xFF) let b1 n = byte ((n >>> 8) &&& 0xFF) let b2 n = byte ((n >>> 16) &&& 0xFF) let b3 n = byte ((n >>> 24) &&& 0xFF) - // Little-endian encoding of int64 + // Little-endian encoding of int64 let dw7 n = byte ((n >>> 56) &&& 0xFFL) let dw6 n = byte ((n >>> 48) &&& 0xFFL) let dw5 n = byte ((n >>> 40) &&& 0xFFL) @@ -1868,10 +1868,10 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader member x.ToAssemblyName() = let asmName = AssemblyName(Name=x.Name) - match x.PublicKey with + match x.PublicKey with | USome bytes -> asmName.SetPublicKeyToken(bytes.ToToken()) | UNone -> () - match x.Version with + match x.Version with | USome v -> asmName.Version <- v | UNone -> () #if NETSTANDARD @@ -2199,8 +2199,8 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader type ILCodeLabel = int // -------------------------------------------------------------------- - // Instruction set. - // -------------------------------------------------------------------- + // Instruction set. + // -------------------------------------------------------------------- type ILBasicType = | DT_R @@ -2219,52 +2219,52 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | DT_REF [] - type ILToken = - | ILType of ILType - | ILMethod of ILMethodSpec + type ILToken = + | ILType of ILType + | ILMethod of ILMethodSpec | ILField of ILFieldSpec [] - type ILConst = + type ILConst = | I4 of int32 | I8 of int64 | R4 of single | R8 of double - type ILTailcall = + type ILTailcall = | Tailcall | Normalcall - type ILAlignment = + type ILAlignment = | Aligned | Unaligned1 | Unaligned2 | Unaligned4 - type ILVolatility = + type ILVolatility = | Volatile | Nonvolatile - type ILReadonly = + type ILReadonly = | ReadonlyAddress | NormalAddress type ILVarArgs = ILTypes option [] - type ILComparisonInstr = - | I_beq - | I_bge - | I_bge_un - | I_bgt - | I_bgt_un - | I_ble - | I_ble_un - | I_blt - | I_blt_un - | I_bne_un - | I_brfalse - | I_brtrue + type ILComparisonInstr = + | I_beq + | I_bge + | I_bge_un + | I_bgt + | I_bgt_un + | I_ble + | I_ble_un + | I_blt + | I_blt_un + | I_bne_un + | I_brfalse + | I_brtrue #if DEBUG_INFO @@ -2289,42 +2289,42 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader #endif [] - type ILInstr = - | I_add + type ILInstr = + | I_add | I_add_ovf | I_add_ovf_un - | I_and - | I_div + | I_and + | I_div | I_div_un - | I_ceq - | I_cgt - | I_cgt_un - | I_clt - | I_clt_un + | I_ceq + | I_cgt + | I_cgt_un + | I_clt + | I_clt_un | I_conv of ILBasicType | I_conv_ovf of ILBasicType | I_conv_ovf_un of ILBasicType - | I_mul - | I_mul_ovf + | I_mul + | I_mul_ovf | I_mul_ovf_un - | I_rem - | I_rem_un - | I_shl - | I_shr + | I_rem + | I_rem_un + | I_shl + | I_shr | I_shr_un - | I_sub - | I_sub_ovf - | I_sub_ovf_un - | I_xor - | I_or - | I_neg - | I_not - | I_ldnull - | I_dup + | I_sub + | I_sub_ovf + | I_sub_ovf_un + | I_xor + | I_or + | I_neg + | I_not + | I_ldnull + | I_dup | I_pop - | I_ckfinite + | I_ckfinite | I_nop - | I_ldc of ILBasicType * ILConst + | I_ldc of ILBasicType * ILConst | I_ldarg of int | I_ldarga of int | I_ldind of ILAlignment * ILVolatility * ILBasicType @@ -2336,9 +2336,9 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_br of ILCodeLabel | I_jmp of ILMethodSpec - | I_brcmp of ILComparisonInstr * ILCodeLabel - | I_switch of ILCodeLabel list - | I_ret + | I_brcmp of ILComparisonInstr * ILCodeLabel + | I_switch of ILCodeLabel list + | I_ret | I_call of ILTailcall * ILMethodSpec * ILVarArgs | I_callvirt of ILTailcall * ILMethodSpec * ILVarArgs @@ -2346,7 +2346,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_calli of ILTailcall * ILCallingSignature * ILVarArgs | I_ldftn of ILMethodSpec | I_newobj of ILMethodSpec * ILVarArgs - + | I_throw | I_endfinally | I_endfilter @@ -2356,7 +2356,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_ldsfld of ILVolatility * ILFieldSpec | I_ldfld of ILAlignment * ILVolatility * ILFieldSpec | I_ldsflda of ILFieldSpec - | I_ldflda of ILFieldSpec + | I_ldflda of ILFieldSpec | I_stsfld of ILVolatility * ILFieldSpec | I_stfld of ILAlignment * ILVolatility * ILFieldSpec | I_ldstr of string @@ -2379,70 +2379,70 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_ldelema of ILReadonly * ILArrayShape * ILType | I_ldelem_any of ILArrayShape * ILType | I_stelem_any of ILArrayShape * ILType - | I_newarr of ILArrayShape * ILType + | I_newarr of ILArrayShape * ILType | I_ldlen | I_mkrefany of ILType - | I_refanytype + | I_refanytype | I_refanyval of ILType - | I_break + | I_break #if EMIT_DEBUG_INFO | I_seqpoint of ILSourceMarker #endif - | I_arglist + | I_arglist | I_localloc | I_cpblk of ILAlignment * ILVolatility | I_initblk of ILAlignment * ILVolatility - (* FOR EXTENSIONS, e.g. MS-ILX *) + (* FOR EXTENSIONS, e.g. MS-ILX *) | EI_ilzero of ILType | EI_ldlen_multi of int32 * int32 [] - type ILExceptionClause = + type ILExceptionClause = | Finally of (ILCodeLabel * ILCodeLabel) | Fault of (ILCodeLabel * ILCodeLabel) | FilterCatch of (ILCodeLabel * ILCodeLabel) * (ILCodeLabel * ILCodeLabel) | TypeCatch of ILType * (ILCodeLabel * ILCodeLabel) [] - type ILExceptionSpec = + type ILExceptionSpec = { Range: (ILCodeLabel * ILCodeLabel); Clause: ILExceptionClause } - /// Indicates that a particular local variable has a particular source - /// language name within a given set of ranges. This does not effect local - /// variable numbering, which is global over the whole method. + /// Indicates that a particular local variable has a particular source + /// language name within a given set of ranges. This does not effect local + /// variable numbering, which is global over the whole method. [] type ILLocalDebugMapping = { LocalIndex: int; LocalName: string; } [] - type ILLocalDebugInfo = + type ILLocalDebugInfo = { Range: (ILCodeLabel * ILCodeLabel); DebugMappings: ILLocalDebugMapping[] } [] - type ILCode = - { Labels: Dictionary - Instrs:ILInstr[] + type ILCode = + { Labels: Dictionary + Instrs:ILInstr[] Exceptions: ILExceptionSpec[] Locals: ILLocalDebugInfo[] } [] - type ILLocal = + type ILLocal = { Type: ILType; IsPinned: bool; DebugInfo: (string * int * int) option } - + type ILLocals = ILLocal[] [] - type ILMethodBody = + type ILMethodBody = { IsZeroInit: bool MaxStack: int32 Locals: ILLocals @@ -2459,9 +2459,9 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader type ILCustomAttrNamedArg = ILCustomAttrNamedArg of (string * ILType * obj) - type ILCustomAttribute = + type ILCustomAttribute = { Method: ILMethodSpec - Data: byte[] + Data: byte[] Elements: obj list} type ILCustomAttrs = @@ -2526,7 +2526,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader { Name: string Constraints: ILTypes Attributes: GenericParameterAttributes - CustomAttrs: ILCustomAttrs + CustomAttrs: ILCustomAttrs Token: int } member x.HasReferenceTypeConstraint= (x.Attributes &&& GenericParameterAttributes.ReferenceTypeConstraint) <> enum 0 @@ -2555,7 +2555,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader CustomAttrs: ILCustomAttrs } member x.ParameterTypes = x.Parameters |> Array.map (fun p -> p.ParameterType) static member ComputeIsStatic attrs = attrs &&& MethodAttributes.Static <> enum 0 - member x.IsStatic = ILMethodDef.ComputeIsStatic x.Attributes + member x.IsStatic = ILMethodDef.ComputeIsStatic x.Attributes member x.IsAbstract = x.Attributes &&& MethodAttributes.Abstract <> enum 0 member x.IsVirtual = x.Attributes &&& MethodAttributes.Virtual <> enum 0 member x.IsCheckAccessOnOverride = x.Attributes &&& MethodAttributes.CheckAccessOnOverride <> enum 0 @@ -2595,9 +2595,9 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader member _.Entries = larr.Force() member _.FindByName nm = getmap().[nm] member x.FindByNameAndArity (nm,arity) = x.FindByName nm |> Array.filter (fun x -> x.Parameters.Length = arity) - member x.TryFindUniqueByName name = + member x.TryFindUniqueByName name = match x.FindByName(name) with - | [| md |] -> Some md + | [| md |] -> Some md | [| |] -> None | _ -> failwithf "multiple methods exist with name %s" name @@ -2634,7 +2634,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader CustomAttrs: ILCustomAttrs Token: int } member x.IsStatic = (match x.CallingConv with ILThisConvention.Static -> true | _ -> false) - member x.IndexParameters = + member x.IndexParameters = x.IndexParameterTypes |> Array.mapi (fun i ty -> { Name = USome("arg"+string i) ParameterType = ty @@ -2705,13 +2705,13 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader and ILTypeDefLayoutInfo = { Size: int32 option - Pack: uint16 option } + Pack: uint16 option } type ILTypeDefAccess = | Public | Private | Nested of ILMemberAccess - static member OfFlags flags = + static member OfFlags flags = let f = (flags &&& 0x00000007) if f = 0x00000001 then ILTypeDefAccess.Public elif f = 0x00000002 then ILTypeDefAccess.Nested ILMemberAccess.Public @@ -2747,7 +2747,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader Properties: ILPropertyDefs CustomAttrs: ILCustomAttrs Token: int } - static member ComputeKind flags (super: ILType option) (nsp: string uoption) (nm: string) = + static member ComputeKind flags (super: ILType option) (nsp: string uoption) (nm: string) = if (flags &&& 0x00000020) <> 0x0 then ILTypeDefKind.Interface else let isEnum = (match super with None -> false | Some ty -> ty.TypeSpec.Namespace = USome "System" && ty.TypeSpec.Name = "Enum") let isDelegate = (match super with None -> false | Some ty -> ty.TypeSpec.Namespace = USome "System" && ty.TypeSpec.Name = "Delegate") @@ -2772,7 +2772,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader member x.Access = ILTypeDefAccess.OfFlags (int x.Attributes) member x.IsNested = - match x.Access with + match x.Access with | ILTypeDefAccess.Nested _ -> true | _ -> false @@ -2781,13 +2781,13 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | ILTypeDefKind.ValueType | ILTypeDefKind.Enum -> true | _ -> false - member x.Encoding = + member x.Encoding = let f = (int x.Attributes &&& 0x00030000) if f = 0x00020000 then ILDefaultPInvokeEncoding.Auto elif f = 0x00010000 then ILDefaultPInvokeEncoding.Unicode else ILDefaultPInvokeEncoding.Ansi - member x.InitSemantics = + member x.InitSemantics = if x.Kind = ILTypeDefKind.Interface then ILTypeInit.OnAny elif (int x.Attributes &&& 0x00100000) <> 0x0 then ILTypeInit.BeforeField else ILTypeInit.OnAny @@ -2833,10 +2833,10 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader { ScopeRef: ILScopeRef Namespace: string uoption Name: string - IsForwarder: bool - Access: ILTypeDefAccess; + IsForwarder: bool + Access: ILTypeDefAccess; Nested: ILNestedExportedTypesAndForwarders; - CustomAttrs: ILCustomAttrs } + CustomAttrs: ILCustomAttrs } override x.ToString() = "fwd " + x.Name and ILExportedTypesAndForwarders(larr:Lazy) = @@ -2889,10 +2889,10 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader member x.GetName() = let asmName = AssemblyName(Name=x.Name) - match x.PublicKey with + match x.PublicKey with | USome bytes -> asmName.SetPublicKey(bytes) | UNone -> () - match x.Version with + match x.Version with | USome v -> asmName.Version <- v | UNone -> () #if NETSTANDARD @@ -2915,7 +2915,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader SubSystemFlags: int32 IsDLL: bool IsILOnly: bool - Platform: ILPlatform option + Platform: ILPlatform option StackReserveSize: int32 option Is32Bit: bool Is32BitPreferred: bool @@ -3014,14 +3014,14 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let GenericParamConstraint = ILTableName 44 let UserStrings = ILTableName 0x70 (* Special encoding of embedded UserString tokens - See 1.9 Partition III *) - /// Which tables are sorted and by which column. + /// Which tables are sorted and by which column. // - // Sorted bit-vector as stored by CLR V1: 00fa 0133 0002 0000 - // But what does this mean? The ECMA spec does not say! - // Metainfo -schema reports sorting as shown below. - // But some sorting, e.g. EventMap does not seem to show - let sortedTableInfo = - [ (InterfaceImpl,0) + // Sorted bit-vector as stored by CLR V1: 00fa 0133 0002 0000 + // But what does this mean? The ECMA spec does not say! + // Metainfo -schema reports sorting as shown below. + // But some sorting, e.g. EventMap does not seem to show + let sortedTableInfo = + [ (InterfaceImpl,0) (Constant, 1) (CustomAttribute, 0) (FieldMarshal, 0) @@ -3033,7 +3033,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader (ImplMap, 1) (FieldRVA, 1) (Nested, 0) - (GenericParam, 2) + (GenericParam, 2) (GenericParamConstraint, 0) ] [] @@ -3194,7 +3194,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader type VarArgMethodData = VarArgMethodData of ILType * ILCallingConv * string * ILTypes * ILVarArgs * ILType * ILTypes [] - module Constants = + module Constants = let et_END = 0x00uy let et_VOID = 0x01uy let et_BOOLEAN = 0x02uy @@ -3287,221 +3287,221 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let idx = tok >>>& nbits TaggedIndex(f tag, idx) - let i_nop = 0x00 - let i_break = 0x01 - let i_ldarg_0 = 0x02 - let i_ldarg_1 = 0x03 - let i_ldarg_2 = 0x04 - let i_ldarg_3 = 0x05 - let i_ldloc_0 = 0x06 - let i_ldloc_1 = 0x07 - let i_ldloc_2 = 0x08 - let i_ldloc_3 = 0x09 - let i_stloc_0 = 0x0a - let i_stloc_1 = 0x0b - let i_stloc_2 = 0x0c - let i_stloc_3 = 0x0d - let i_ldarg_s = 0x0e - let i_ldarga_s = 0x0f - let i_starg_s = 0x10 - let i_ldloc_s = 0x11 - let i_ldloca_s = 0x12 - let i_stloc_s = 0x13 - let i_ldnull = 0x14 - let i_ldc_i4_m1 = 0x15 - let i_ldc_i4_0 = 0x16 - let i_ldc_i4_1 = 0x17 - let i_ldc_i4_2 = 0x18 - let i_ldc_i4_3 = 0x19 - let i_ldc_i4_4 = 0x1a - let i_ldc_i4_5 = 0x1b - let i_ldc_i4_6 = 0x1c - let i_ldc_i4_7 = 0x1d - let i_ldc_i4_8 = 0x1e - let i_ldc_i4_s = 0x1f - let i_ldc_i4 = 0x20 - let i_ldc_i8 = 0x21 - let i_ldc_r4 = 0x22 - let i_ldc_r8 = 0x23 - let i_dup = 0x25 - let i_pop = 0x26 - let i_jmp = 0x27 - let i_call = 0x28 - let i_calli = 0x29 - let i_ret = 0x2a - let i_br_s = 0x2b - let i_brfalse_s = 0x2c - let i_brtrue_s = 0x2d - let i_beq_s = 0x2e - let i_bge_s = 0x2f - let i_bgt_s = 0x30 - let i_ble_s = 0x31 - let i_blt_s = 0x32 - let i_bne_un_s = 0x33 - let i_bge_un_s = 0x34 - let i_bgt_un_s = 0x35 - let i_ble_un_s = 0x36 - let i_blt_un_s = 0x37 - let i_br = 0x38 - let i_brfalse = 0x39 - let i_brtrue = 0x3a - let i_beq = 0x3b - let i_bge = 0x3c - let i_bgt = 0x3d - let i_ble = 0x3e - let i_blt = 0x3f - let i_bne_un = 0x40 - let i_bge_un = 0x41 - let i_bgt_un = 0x42 - let i_ble_un = 0x43 - let i_blt_un = 0x44 - let i_switch = 0x45 - let i_ldind_i1 = 0x46 - let i_ldind_u1 = 0x47 - let i_ldind_i2 = 0x48 - let i_ldind_u2 = 0x49 - let i_ldind_i4 = 0x4a - let i_ldind_u4 = 0x4b - let i_ldind_i8 = 0x4c - let i_ldind_i = 0x4d - let i_ldind_r4 = 0x4e - let i_ldind_r8 = 0x4f - let i_ldind_ref = 0x50 - let i_stind_ref = 0x51 - let i_stind_i1 = 0x52 - let i_stind_i2 = 0x53 - let i_stind_i4 = 0x54 - let i_stind_i8 = 0x55 - let i_stind_r4 = 0x56 - let i_stind_r8 = 0x57 - let i_add = 0x58 - let i_sub = 0x59 - let i_mul = 0x5a - let i_div = 0x5b - let i_div_un = 0x5c - let i_rem = 0x5d - let i_rem_un = 0x5e - let i_and = 0x5f - let i_or = 0x60 - let i_xor = 0x61 - let i_shl = 0x62 - let i_shr = 0x63 - let i_shr_un = 0x64 - let i_neg = 0x65 - let i_not = 0x66 - let i_conv_i1 = 0x67 - let i_conv_i2 = 0x68 - let i_conv_i4 = 0x69 - let i_conv_i8 = 0x6a - let i_conv_r4 = 0x6b - let i_conv_r8 = 0x6c - let i_conv_u4 = 0x6d - let i_conv_u8 = 0x6e - let i_callvirt = 0x6f - let i_cpobj = 0x70 - let i_ldobj = 0x71 - let i_ldstr = 0x72 - let i_newobj = 0x73 - let i_castclass = 0x74 - let i_isinst = 0x75 - let i_conv_r_un = 0x76 - let i_unbox = 0x79 - let i_throw = 0x7a - let i_ldfld = 0x7b - let i_ldflda = 0x7c - let i_stfld = 0x7d - let i_ldsfld = 0x7e - let i_ldsflda = 0x7f - let i_stsfld = 0x80 - let i_stobj = 0x81 - let i_conv_ovf_i1_un= 0x82 - let i_conv_ovf_i2_un= 0x83 - let i_conv_ovf_i4_un= 0x84 - let i_conv_ovf_i8_un= 0x85 - let i_conv_ovf_u1_un= 0x86 - let i_conv_ovf_u2_un= 0x87 - let i_conv_ovf_u4_un= 0x88 - let i_conv_ovf_u8_un= 0x89 - let i_conv_ovf_i_un = 0x8a - let i_conv_ovf_u_un = 0x8b - let i_box = 0x8c - let i_newarr = 0x8d - let i_ldlen = 0x8e - let i_ldelema = 0x8f - let i_ldelem_i1 = 0x90 - let i_ldelem_u1 = 0x91 - let i_ldelem_i2 = 0x92 - let i_ldelem_u2 = 0x93 - let i_ldelem_i4 = 0x94 - let i_ldelem_u4 = 0x95 - let i_ldelem_i8 = 0x96 - let i_ldelem_i = 0x97 - let i_ldelem_r4 = 0x98 - let i_ldelem_r8 = 0x99 - let i_ldelem_ref = 0x9a - let i_stelem_i = 0x9b - let i_stelem_i1 = 0x9c - let i_stelem_i2 = 0x9d - let i_stelem_i4 = 0x9e - let i_stelem_i8 = 0x9f - let i_stelem_r4 = 0xa0 - let i_stelem_r8 = 0xa1 - let i_stelem_ref = 0xa2 - let i_conv_ovf_i1 = 0xb3 - let i_conv_ovf_u1 = 0xb4 - let i_conv_ovf_i2 = 0xb5 - let i_conv_ovf_u2 = 0xb6 - let i_conv_ovf_i4 = 0xb7 - let i_conv_ovf_u4 = 0xb8 - let i_conv_ovf_i8 = 0xb9 - let i_conv_ovf_u8 = 0xba - let i_refanyval = 0xc2 - let i_ckfinite = 0xc3 - let i_mkrefany = 0xc6 - let i_ldtoken = 0xd0 - let i_conv_u2 = 0xd1 - let i_conv_u1 = 0xd2 - let i_conv_i = 0xd3 - let i_conv_ovf_i = 0xd4 - let i_conv_ovf_u = 0xd5 - let i_add_ovf = 0xd6 - let i_add_ovf_un = 0xd7 - let i_mul_ovf = 0xd8 - let i_mul_ovf_un = 0xd9 - let i_sub_ovf = 0xda - let i_sub_ovf_un = 0xdb - let i_endfinally = 0xdc - let i_leave = 0xdd - let i_leave_s = 0xde - let i_stind_i = 0xdf - let i_conv_u = 0xe0 + let i_nop = 0x00 + let i_break = 0x01 + let i_ldarg_0 = 0x02 + let i_ldarg_1 = 0x03 + let i_ldarg_2 = 0x04 + let i_ldarg_3 = 0x05 + let i_ldloc_0 = 0x06 + let i_ldloc_1 = 0x07 + let i_ldloc_2 = 0x08 + let i_ldloc_3 = 0x09 + let i_stloc_0 = 0x0a + let i_stloc_1 = 0x0b + let i_stloc_2 = 0x0c + let i_stloc_3 = 0x0d + let i_ldarg_s = 0x0e + let i_ldarga_s = 0x0f + let i_starg_s = 0x10 + let i_ldloc_s = 0x11 + let i_ldloca_s = 0x12 + let i_stloc_s = 0x13 + let i_ldnull = 0x14 + let i_ldc_i4_m1 = 0x15 + let i_ldc_i4_0 = 0x16 + let i_ldc_i4_1 = 0x17 + let i_ldc_i4_2 = 0x18 + let i_ldc_i4_3 = 0x19 + let i_ldc_i4_4 = 0x1a + let i_ldc_i4_5 = 0x1b + let i_ldc_i4_6 = 0x1c + let i_ldc_i4_7 = 0x1d + let i_ldc_i4_8 = 0x1e + let i_ldc_i4_s = 0x1f + let i_ldc_i4 = 0x20 + let i_ldc_i8 = 0x21 + let i_ldc_r4 = 0x22 + let i_ldc_r8 = 0x23 + let i_dup = 0x25 + let i_pop = 0x26 + let i_jmp = 0x27 + let i_call = 0x28 + let i_calli = 0x29 + let i_ret = 0x2a + let i_br_s = 0x2b + let i_brfalse_s = 0x2c + let i_brtrue_s = 0x2d + let i_beq_s = 0x2e + let i_bge_s = 0x2f + let i_bgt_s = 0x30 + let i_ble_s = 0x31 + let i_blt_s = 0x32 + let i_bne_un_s = 0x33 + let i_bge_un_s = 0x34 + let i_bgt_un_s = 0x35 + let i_ble_un_s = 0x36 + let i_blt_un_s = 0x37 + let i_br = 0x38 + let i_brfalse = 0x39 + let i_brtrue = 0x3a + let i_beq = 0x3b + let i_bge = 0x3c + let i_bgt = 0x3d + let i_ble = 0x3e + let i_blt = 0x3f + let i_bne_un = 0x40 + let i_bge_un = 0x41 + let i_bgt_un = 0x42 + let i_ble_un = 0x43 + let i_blt_un = 0x44 + let i_switch = 0x45 + let i_ldind_i1 = 0x46 + let i_ldind_u1 = 0x47 + let i_ldind_i2 = 0x48 + let i_ldind_u2 = 0x49 + let i_ldind_i4 = 0x4a + let i_ldind_u4 = 0x4b + let i_ldind_i8 = 0x4c + let i_ldind_i = 0x4d + let i_ldind_r4 = 0x4e + let i_ldind_r8 = 0x4f + let i_ldind_ref = 0x50 + let i_stind_ref = 0x51 + let i_stind_i1 = 0x52 + let i_stind_i2 = 0x53 + let i_stind_i4 = 0x54 + let i_stind_i8 = 0x55 + let i_stind_r4 = 0x56 + let i_stind_r8 = 0x57 + let i_add = 0x58 + let i_sub = 0x59 + let i_mul = 0x5a + let i_div = 0x5b + let i_div_un = 0x5c + let i_rem = 0x5d + let i_rem_un = 0x5e + let i_and = 0x5f + let i_or = 0x60 + let i_xor = 0x61 + let i_shl = 0x62 + let i_shr = 0x63 + let i_shr_un = 0x64 + let i_neg = 0x65 + let i_not = 0x66 + let i_conv_i1 = 0x67 + let i_conv_i2 = 0x68 + let i_conv_i4 = 0x69 + let i_conv_i8 = 0x6a + let i_conv_r4 = 0x6b + let i_conv_r8 = 0x6c + let i_conv_u4 = 0x6d + let i_conv_u8 = 0x6e + let i_callvirt = 0x6f + let i_cpobj = 0x70 + let i_ldobj = 0x71 + let i_ldstr = 0x72 + let i_newobj = 0x73 + let i_castclass = 0x74 + let i_isinst = 0x75 + let i_conv_r_un = 0x76 + let i_unbox = 0x79 + let i_throw = 0x7a + let i_ldfld = 0x7b + let i_ldflda = 0x7c + let i_stfld = 0x7d + let i_ldsfld = 0x7e + let i_ldsflda = 0x7f + let i_stsfld = 0x80 + let i_stobj = 0x81 + let i_conv_ovf_i1_un= 0x82 + let i_conv_ovf_i2_un= 0x83 + let i_conv_ovf_i4_un= 0x84 + let i_conv_ovf_i8_un= 0x85 + let i_conv_ovf_u1_un= 0x86 + let i_conv_ovf_u2_un= 0x87 + let i_conv_ovf_u4_un= 0x88 + let i_conv_ovf_u8_un= 0x89 + let i_conv_ovf_i_un = 0x8a + let i_conv_ovf_u_un = 0x8b + let i_box = 0x8c + let i_newarr = 0x8d + let i_ldlen = 0x8e + let i_ldelema = 0x8f + let i_ldelem_i1 = 0x90 + let i_ldelem_u1 = 0x91 + let i_ldelem_i2 = 0x92 + let i_ldelem_u2 = 0x93 + let i_ldelem_i4 = 0x94 + let i_ldelem_u4 = 0x95 + let i_ldelem_i8 = 0x96 + let i_ldelem_i = 0x97 + let i_ldelem_r4 = 0x98 + let i_ldelem_r8 = 0x99 + let i_ldelem_ref = 0x9a + let i_stelem_i = 0x9b + let i_stelem_i1 = 0x9c + let i_stelem_i2 = 0x9d + let i_stelem_i4 = 0x9e + let i_stelem_i8 = 0x9f + let i_stelem_r4 = 0xa0 + let i_stelem_r8 = 0xa1 + let i_stelem_ref = 0xa2 + let i_conv_ovf_i1 = 0xb3 + let i_conv_ovf_u1 = 0xb4 + let i_conv_ovf_i2 = 0xb5 + let i_conv_ovf_u2 = 0xb6 + let i_conv_ovf_i4 = 0xb7 + let i_conv_ovf_u4 = 0xb8 + let i_conv_ovf_i8 = 0xb9 + let i_conv_ovf_u8 = 0xba + let i_refanyval = 0xc2 + let i_ckfinite = 0xc3 + let i_mkrefany = 0xc6 + let i_ldtoken = 0xd0 + let i_conv_u2 = 0xd1 + let i_conv_u1 = 0xd2 + let i_conv_i = 0xd3 + let i_conv_ovf_i = 0xd4 + let i_conv_ovf_u = 0xd5 + let i_add_ovf = 0xd6 + let i_add_ovf_un = 0xd7 + let i_mul_ovf = 0xd8 + let i_mul_ovf_un = 0xd9 + let i_sub_ovf = 0xda + let i_sub_ovf_un = 0xdb + let i_endfinally = 0xdc + let i_leave = 0xdd + let i_leave_s = 0xde + let i_stind_i = 0xdf + let i_conv_u = 0xe0 let i_arglist = 0xfe00 let i_ceq = 0xfe01 let i_cgt = 0xfe02 let i_cgt_un = 0xfe03 let i_clt = 0xfe04 let i_clt_un = 0xfe05 - let i_ldftn = 0xfe06 - let i_ldvirtftn = 0xfe07 - let i_ldarg = 0xfe09 - let i_ldarga = 0xfe0a - let i_starg = 0xfe0b - let i_ldloc = 0xfe0c - let i_ldloca = 0xfe0d - let i_stloc = 0xfe0e - let i_localloc = 0xfe0f - let i_endfilter = 0xfe11 - let i_unaligned = 0xfe12 - let i_volatile = 0xfe13 + let i_ldftn = 0xfe06 + let i_ldvirtftn = 0xfe07 + let i_ldarg = 0xfe09 + let i_ldarga = 0xfe0a + let i_starg = 0xfe0b + let i_ldloc = 0xfe0c + let i_ldloca = 0xfe0d + let i_stloc = 0xfe0e + let i_localloc = 0xfe0f + let i_endfilter = 0xfe11 + let i_unaligned = 0xfe12 + let i_volatile = 0xfe13 let i_constrained = 0xfe16 let i_readonly = 0xfe1e - let i_tail = 0xfe14 - let i_initobj = 0xfe15 - let i_cpblk = 0xfe17 - let i_initblk = 0xfe18 - let i_rethrow = 0xfe1a - let i_sizeof = 0xfe1c - let i_refanytype = 0xfe1d + let i_tail = 0xfe14 + let i_initobj = 0xfe15 + let i_cpblk = 0xfe17 + let i_initblk = 0xfe18 + let i_rethrow = 0xfe1a + let i_sizeof = 0xfe1c + let i_refanytype = 0xfe1d let i_ldelem_any = 0xa3 let i_stelem_any = 0xa4 @@ -3514,7 +3514,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader Array.init n (fun i -> ILType.Var (numtypars + i)) - let noArgInstrs = + let noArgInstrs = lazy [ i_ldc_i4_0, mk_ldc 0 i_ldc_i4_1, mk_ldc 1 i_ldc_i4_2, mk_ldc 2 @@ -3550,63 +3550,63 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader 0xfe04, I_clt 0xfe05, I_clt_un 0x67, I_conv DT_I1 - 0x68, I_conv DT_I2 + 0x68, I_conv DT_I2 0x69, I_conv DT_I4 - 0x6a, I_conv DT_I8 - 0xd3, I_conv DT_I - 0x6b, I_conv DT_R4 - 0x6c, I_conv DT_R8 - 0xd2, I_conv DT_U1 - 0xd1, I_conv DT_U2 - 0x6d, I_conv DT_U4 - 0x6e, I_conv DT_U8 - 0xe0, I_conv DT_U - 0x76, I_conv DT_R - 0xb3, I_conv_ovf DT_I1 - 0xb5, I_conv_ovf DT_I2 - 0xb7, I_conv_ovf DT_I4 - 0xb9, I_conv_ovf DT_I8 - 0xd4, I_conv_ovf DT_I - 0xb4, I_conv_ovf DT_U1 - 0xb6, I_conv_ovf DT_U2 - 0xb8, I_conv_ovf DT_U4 - 0xba, I_conv_ovf DT_U8 - 0xd5, I_conv_ovf DT_U - 0x82, I_conv_ovf_un DT_I1 - 0x83, I_conv_ovf_un DT_I2 - 0x84, I_conv_ovf_un DT_I4 - 0x85, I_conv_ovf_un DT_I8 - 0x8a, I_conv_ovf_un DT_I - 0x86, I_conv_ovf_un DT_U1 - 0x87, I_conv_ovf_un DT_U2 - 0x88, I_conv_ovf_un DT_U4 - 0x89, I_conv_ovf_un DT_U8 - 0x8b, I_conv_ovf_un DT_U - 0x9c, I_stelem DT_I1 + 0x6a, I_conv DT_I8 + 0xd3, I_conv DT_I + 0x6b, I_conv DT_R4 + 0x6c, I_conv DT_R8 + 0xd2, I_conv DT_U1 + 0xd1, I_conv DT_U2 + 0x6d, I_conv DT_U4 + 0x6e, I_conv DT_U8 + 0xe0, I_conv DT_U + 0x76, I_conv DT_R + 0xb3, I_conv_ovf DT_I1 + 0xb5, I_conv_ovf DT_I2 + 0xb7, I_conv_ovf DT_I4 + 0xb9, I_conv_ovf DT_I8 + 0xd4, I_conv_ovf DT_I + 0xb4, I_conv_ovf DT_U1 + 0xb6, I_conv_ovf DT_U2 + 0xb8, I_conv_ovf DT_U4 + 0xba, I_conv_ovf DT_U8 + 0xd5, I_conv_ovf DT_U + 0x82, I_conv_ovf_un DT_I1 + 0x83, I_conv_ovf_un DT_I2 + 0x84, I_conv_ovf_un DT_I4 + 0x85, I_conv_ovf_un DT_I8 + 0x8a, I_conv_ovf_un DT_I + 0x86, I_conv_ovf_un DT_U1 + 0x87, I_conv_ovf_un DT_U2 + 0x88, I_conv_ovf_un DT_U4 + 0x89, I_conv_ovf_un DT_U8 + 0x8b, I_conv_ovf_un DT_U + 0x9c, I_stelem DT_I1 0x9d, I_stelem DT_I2 - 0x9e, I_stelem DT_I4 - 0x9f, I_stelem DT_I8 - 0xa0, I_stelem DT_R4 - 0xa1, I_stelem DT_R8 - 0x9b, I_stelem DT_I - 0xa2, I_stelem DT_REF + 0x9e, I_stelem DT_I4 + 0x9f, I_stelem DT_I8 + 0xa0, I_stelem DT_R4 + 0xa1, I_stelem DT_R8 + 0x9b, I_stelem DT_I + 0xa2, I_stelem DT_REF 0x90, I_ldelem DT_I1 - 0x92, I_ldelem DT_I2 - 0x94, I_ldelem DT_I4 - 0x96, I_ldelem DT_I8 - 0x91, I_ldelem DT_U1 - 0x93, I_ldelem DT_U2 - 0x95, I_ldelem DT_U4 - 0x98, I_ldelem DT_R4 - 0x99, I_ldelem DT_R8 - 0x97, I_ldelem DT_I - 0x9a, I_ldelem DT_REF + 0x92, I_ldelem DT_I2 + 0x94, I_ldelem DT_I4 + 0x96, I_ldelem DT_I8 + 0x91, I_ldelem DT_U1 + 0x93, I_ldelem DT_U2 + 0x95, I_ldelem DT_U4 + 0x98, I_ldelem DT_R4 + 0x99, I_ldelem DT_R8 + 0x97, I_ldelem DT_I + 0x9a, I_ldelem DT_REF 0x5a, I_mul 0xd8, I_mul_ovf 0xd9, I_mul_ovf_un 0x5d, I_rem 0x5e, I_rem_un - 0x62, I_shl + 0x62, I_shl 0x63, I_shr 0x64, I_shr_un 0x59, I_sub @@ -3631,91 +3631,91 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader i_ldlen, I_ldlen i_rethrow, I_rethrow ] - let isNoArgInstr i = - match i with + let isNoArgInstr i = + match i with | I_ldc (DT_I4, ILConst.I4 n) when -1 <= n && n <= 8 -> true | I_stloc n | I_ldloc n | I_ldarg n when n <= 3 -> true | I_ret | I_add | I_add_ovf | I_add_ovf_un - | I_and - | I_div + | I_and + | I_div | I_div_un - | I_ceq - | I_cgt + | I_ceq + | I_cgt | I_cgt_un | I_clt | I_clt_un - | I_conv DT_I1 - | I_conv DT_I2 - | I_conv DT_I4 - | I_conv DT_I8 - | I_conv DT_I - | I_conv DT_R4 - | I_conv DT_R8 - | I_conv DT_U1 - | I_conv DT_U2 - | I_conv DT_U4 - | I_conv DT_U8 - | I_conv DT_U - | I_conv DT_R - | I_conv_ovf DT_I1 - | I_conv_ovf DT_I2 - | I_conv_ovf DT_I4 - | I_conv_ovf DT_I8 - | I_conv_ovf DT_I - | I_conv_ovf DT_U1 - | I_conv_ovf DT_U2 - | I_conv_ovf DT_U4 - | I_conv_ovf DT_U8 - | I_conv_ovf DT_U - | I_conv_ovf_un DT_I1 - | I_conv_ovf_un DT_I2 - | I_conv_ovf_un DT_I4 - | I_conv_ovf_un DT_I8 - | I_conv_ovf_un DT_I - | I_conv_ovf_un DT_U1 - | I_conv_ovf_un DT_U2 - | I_conv_ovf_un DT_U4 - | I_conv_ovf_un DT_U8 - | I_conv_ovf_un DT_U - | I_stelem DT_I1 - | I_stelem DT_I2 - | I_stelem DT_I4 - | I_stelem DT_I8 - | I_stelem DT_R4 - | I_stelem DT_R8 - | I_stelem DT_I - | I_stelem DT_REF - | I_ldelem DT_I1 - | I_ldelem DT_I2 - | I_ldelem DT_I4 - | I_ldelem DT_I8 - | I_ldelem DT_U1 - | I_ldelem DT_U2 - | I_ldelem DT_U4 - | I_ldelem DT_R4 - | I_ldelem DT_R8 - | I_ldelem DT_I - | I_ldelem DT_REF - | I_mul + | I_conv DT_I1 + | I_conv DT_I2 + | I_conv DT_I4 + | I_conv DT_I8 + | I_conv DT_I + | I_conv DT_R4 + | I_conv DT_R8 + | I_conv DT_U1 + | I_conv DT_U2 + | I_conv DT_U4 + | I_conv DT_U8 + | I_conv DT_U + | I_conv DT_R + | I_conv_ovf DT_I1 + | I_conv_ovf DT_I2 + | I_conv_ovf DT_I4 + | I_conv_ovf DT_I8 + | I_conv_ovf DT_I + | I_conv_ovf DT_U1 + | I_conv_ovf DT_U2 + | I_conv_ovf DT_U4 + | I_conv_ovf DT_U8 + | I_conv_ovf DT_U + | I_conv_ovf_un DT_I1 + | I_conv_ovf_un DT_I2 + | I_conv_ovf_un DT_I4 + | I_conv_ovf_un DT_I8 + | I_conv_ovf_un DT_I + | I_conv_ovf_un DT_U1 + | I_conv_ovf_un DT_U2 + | I_conv_ovf_un DT_U4 + | I_conv_ovf_un DT_U8 + | I_conv_ovf_un DT_U + | I_stelem DT_I1 + | I_stelem DT_I2 + | I_stelem DT_I4 + | I_stelem DT_I8 + | I_stelem DT_R4 + | I_stelem DT_R8 + | I_stelem DT_I + | I_stelem DT_REF + | I_ldelem DT_I1 + | I_ldelem DT_I2 + | I_ldelem DT_I4 + | I_ldelem DT_I8 + | I_ldelem DT_U1 + | I_ldelem DT_U2 + | I_ldelem DT_U4 + | I_ldelem DT_R4 + | I_ldelem DT_R8 + | I_ldelem DT_I + | I_ldelem DT_REF + | I_mul | I_mul_ovf | I_mul_ovf_un - | I_rem - | I_rem_un - | I_shl - | I_shr + | I_rem + | I_rem_un + | I_shl + | I_shr | I_shr_un - | I_sub + | I_sub | I_sub_ovf - | I_sub_ovf_un - | I_xor - | I_or - | I_neg - | I_not - | I_ldnull - | I_dup + | I_sub_ovf_un + | I_xor + | I_or + | I_neg + | I_not + | I_ldnull + | I_dup | I_pop | I_ckfinite | I_nop @@ -3730,7 +3730,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | I_rethrow -> true | _ -> false - let ILCmpInstrMap = + let ILCmpInstrMap = lazy ( let dict = Dictionary 12 dict.Add (I_beq , i_beq ) @@ -3748,7 +3748,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader dict ) - let ILCmpInstrRevMap = + let ILCmpInstrRevMap = lazy ( let dict = Dictionary 12 dict.Add ( I_beq , i_beq_s ) @@ -3766,7 +3766,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader dict ) - // From corhdr.h + // From corhdr.h let nt_VOID = 0x1uy let nt_BOOLEAN = 0x2uy @@ -3860,7 +3860,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let vt_ARRAY = 0x2000 let vt_BYREF = 0x4000 - + let e_CorILMethod_TinyFormat = 0x02uy let e_CorILMethod_FatFormat = 0x03uy @@ -3879,136 +3879,136 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let e_COR_ILEXCEPTION_CLAUSE_FAULT = 0x4 - module Bytes = + module Bytes = let dWw1 n = int32 ((n >>> 32) &&& 0xFFFFFFFFL) let dWw0 n = int32 (n &&& 0xFFFFFFFFL) - let get (b:byte[]) n = int32 (Array.get b n) - let zeroCreate n: byte[] = Array.zeroCreate n + let get (b:byte[]) n = int32 (Array.get b n) + let zeroCreate n: byte[] = Array.zeroCreate n - let sub ( b:byte[]) s l = Array.sub b s l - let blit (a:byte[]) b c d e = Array.blit a b c d e + let sub ( b:byte[]) s l = Array.sub b s l + let blit (a:byte[]) b c d e = Array.blit a b c d e - let ofInt32Array (arr:int[]) = Array.init arr.Length (fun i -> byte arr.[i]) + let ofInt32Array (arr:int[]) = Array.init arr.Length (fun i -> byte arr.[i]) - let stringAsUtf8NullTerminated (s:string) = - Array.append (Encoding.UTF8.GetBytes s) (ofInt32Array [| 0x0 |]) + let stringAsUtf8NullTerminated (s:string) = + Array.append (Encoding.UTF8.GetBytes s) (ofInt32Array [| 0x0 |]) - let stringAsUnicodeNullTerminated (s:string) = - Array.append (Encoding.Unicode.GetBytes s) (ofInt32Array [| 0x0;0x0 |]) + let stringAsUnicodeNullTerminated (s:string) = + Array.append (Encoding.Unicode.GetBytes s) (ofInt32Array [| 0x0;0x0 |]) - type ByteStream = - { bytes: byte[] - mutable pos: int + type ByteStream = + { bytes: byte[] + mutable pos: int max: int } - member b.ReadByte() = + member b.ReadByte() = if b.pos >= b.max then failwith "end of stream" let res = b.bytes.[b.pos] b.pos <- b.pos + 1 - res - member b.ReadUtf8String n = - let res = Encoding.UTF8.GetString(b.bytes,b.pos,n) - b.pos <- b.pos + n; res - - static member FromBytes (b:byte[],n,len) = + res + member b.ReadUtf8String n = + let res = Encoding.UTF8.GetString(b.bytes,b.pos,n) + b.pos <- b.pos + n; res + + static member FromBytes (b:byte[],n,len) = if n < 0 || (n+len) > b.Length then failwith "FromBytes" { bytes = b; pos = n; max = n+len } - member b.ReadBytes n = + member b.ReadBytes n = if b.pos + n > b.max then failwith "ReadBytes: end of stream" let res = Bytes.sub b.bytes b.pos n b.pos <- b.pos + n - res + res - member b.Position = b.pos + member b.Position = b.pos - type ByteBuffer = - { mutable bbArray: byte[] + type ByteBuffer = + { mutable bbArray: byte[] mutable bbCurrent: int } - member buf.Ensure newSize = - let oldBufSize = buf.bbArray.Length - if newSize > oldBufSize then - let old = buf.bbArray + member buf.Ensure newSize = + let oldBufSize = buf.bbArray.Length + if newSize > oldBufSize then + let old = buf.bbArray buf.bbArray <- Bytes.zeroCreate (max newSize (oldBufSize * 2)) Bytes.blit old 0 buf.bbArray 0 buf.bbCurrent member buf.Close () = Bytes.sub buf.bbArray 0 buf.bbCurrent - member buf.EmitIntAsByte (i:int) = - let newSize = buf.bbCurrent + 1 + member buf.EmitIntAsByte (i:int) = + let newSize = buf.bbCurrent + 1 buf.Ensure newSize buf.bbArray.[buf.bbCurrent] <- byte i - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize member buf.EmitByte (b:byte) = buf.EmitIntAsByte (int b) - member buf.EmitIntsAsBytes (arr:int[]) = + member buf.EmitIntsAsBytes (arr:int[]) = let n = arr.Length - let newSize = buf.bbCurrent + n + let newSize = buf.bbCurrent + n buf.Ensure newSize let bbarr = buf.bbArray let bbbase = buf.bbCurrent - for i = 0 to n - 1 do - bbarr.[bbbase + i] <- byte arr.[i] - buf.bbCurrent <- newSize + for i = 0 to n - 1 do + bbarr.[bbbase + i] <- byte arr.[i] + buf.bbCurrent <- newSize - member bb.FixupInt32 pos n = + member bb.FixupInt32 pos n = bb.bbArray.[pos] <- (b0 n |> byte) bb.bbArray.[pos + 1] <- (b1 n |> byte) bb.bbArray.[pos + 2] <- (b2 n |> byte) bb.bbArray.[pos + 3] <- (b3 n |> byte) - member buf.EmitInt32 n = - let newSize = buf.bbCurrent + 4 + member buf.EmitInt32 n = + let newSize = buf.bbCurrent + 4 buf.Ensure newSize buf.FixupInt32 buf.bbCurrent n - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize - member buf.EmitBytes (i:byte[]) = - let n = i.Length - let newSize = buf.bbCurrent + n + member buf.EmitBytes (i:byte[]) = + let n = i.Length + let newSize = buf.bbCurrent + n buf.Ensure newSize Bytes.blit i 0 buf.bbArray buf.bbCurrent n - buf.bbCurrent <- newSize + buf.bbCurrent <- newSize - member buf.EmitInt32AsUInt16 n = - let newSize = buf.bbCurrent + 2 + member buf.EmitInt32AsUInt16 n = + let newSize = buf.bbCurrent + 2 buf.Ensure newSize buf.bbArray.[buf.bbCurrent] <- (b0 n |> byte) buf.bbArray.[buf.bbCurrent + 1] <- (b1 n |> byte) - buf.bbCurrent <- newSize - + buf.bbCurrent <- newSize + member buf.EmitBoolAsByte (b:bool) = buf.EmitIntAsByte (if b then 1 else 0) member buf.EmitUInt16 (x:uint16) = buf.EmitInt32AsUInt16 (int32 x) - member buf.EmitInt64 x = + member buf.EmitInt64 x = buf.EmitInt32 (Bytes.dWw0 x) buf.EmitInt32 (Bytes.dWw1 x) member buf.Position = buf.bbCurrent - static member Create sz = - { bbArray=Bytes.zeroCreate sz + static member Create sz = + { bbArray=Bytes.zeroCreate sz bbCurrent = 0 } - /// Z32 = compressed unsigned integer - static member Z32Size n = + /// Z32 = compressed unsigned integer + static member Z32Size n = if n <= 0x7F then 1 elif n <= 0x3FFF then 2 else 4 /// Emit int32 as compressed unsigned integer - member buf.EmitZ32 n = - if n >= 0 && n <= 0x7F then - buf.EmitIntAsByte n - elif n >= 0x80 && n <= 0x3FFF then + member buf.EmitZ32 n = + if n >= 0 && n <= 0x7F then + buf.EmitIntAsByte n + elif n >= 0x80 && n <= 0x3FFF then buf.EmitIntAsByte (0x80 ||| (n >>> 8)) - buf.EmitIntAsByte (n &&& 0xFF) - else + buf.EmitIntAsByte (n &&& 0xFF) + else buf.EmitIntAsByte (0xc0l ||| ((n >>> 24) &&& 0xFF)) buf.EmitIntAsByte ( (n >>> 16) &&& 0xFF) buf.EmitIntAsByte ( (n >>> 8) &&& 0xFF) @@ -4016,14 +4016,14 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader static member Z32 n = let bb = ByteBuffer.Create (ByteBuffer.Z32Size n) in bb.EmitZ32 n; bb.Close() - member buf.EmitPadding n = + member buf.EmitPadding n = for i = 0 to n-1 do buf.EmitByte 0x0uy // Emit compressed untagged integer - member buf.EmitZUntaggedIndex big idx = + member buf.EmitZUntaggedIndex big idx = if big then buf.EmitInt32 idx - elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) + elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) else buf.EmitInt32AsUInt16 idx // Emit compressed tagged integer @@ -4939,26 +4939,26 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let valIdx = seekReadBlobIdx &addr (parentIdx, typeIdx, valIdx) - //let seekReadFieldMarshalRow idx = + //let seekReadFieldMarshalRow idx = // let mutable addr = rowAddr TableNames.FieldMarshal idx // let parentIdx = seekReadHasFieldMarshalIdx &addr // let typeIdx = seekReadBlobIdx &addr // (parentIdx, typeIdx) - /// Read Table ClassLayout. + /// Read Table ClassLayout. let seekReadClassLayoutRow idx = let mutable addr = rowAddr ILTableNames.ClassLayout idx let pack = seekReadUInt16Adv &addr let size = seekReadInt32Adv &addr let tidx = seekReadUntaggedIdx ILTableNames.TypeDef &addr - (pack, size, tidx) + (pack, size, tidx) - /// Read Table FieldLayout. + /// Read Table FieldLayout. let seekReadFieldLayoutRow idx = let mutable addr = rowAddr ILTableNames.FieldLayout idx let offset = seekReadInt32Adv &addr let fidx = seekReadUntaggedIdx ILTableNames.Field &addr - (offset, fidx) + (offset, fidx) /// Read Table EventMap let seekReadEventMapRow idx = @@ -5003,7 +5003,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let tidx = seekReadUntaggedIdx ILTableNames.TypeDef &addr let mbodyIdx = seekReadMethodDefOrRefIdx &addr let mdeclIdx = seekReadMethodDefOrRefIdx &addr - (tidx, mbodyIdx, mdeclIdx) + (tidx, mbodyIdx, mdeclIdx) /// Read Table ILModuleRef let seekReadModuleRefRow idx = @@ -5180,7 +5180,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader Retargetable = 0 <> (flags &&& 0x100); DisableJitOptimizations = 0 <> (flags &&& 0x4000); JitTracking = 0 <> (flags &&& 0x8000) - IgnoreSymbolStoreSequencePoints = 0 <> (flags &&& 0x2000) + IgnoreSymbolStoreSequencePoints = 0 <> (flags &&& 0x2000) } and seekReadAssemblyRef idx = cacheAssemblyRef seekReadAssemblyRefUncached idx @@ -5393,16 +5393,16 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader and seekReadMethodDefOrRef numtypars (TaggedIndex(tag, idx)) = - match tag with - | tag when tag = MethodDefOrRefTag.MethodDef -> + match tag with + | tag when tag = MethodDefOrRefTag.MethodDef -> let (MethodData(enclTyp, cc, nm, argtys, retty, minst)) = seekReadMethodDefAsMethodData idx VarArgMethodData(enclTyp, cc, nm, argtys, None, retty, minst) - | tag when tag = MethodDefOrRefTag.MemberRef -> + | tag when tag = MethodDefOrRefTag.MemberRef -> seekReadMemberRefAsMethodData numtypars idx | _ -> failwith "seekReadMethodDefOrRef ctxt" and seekReadMethodDefOrRefNoVarargs numtypars x = - let (VarArgMethodData(enclTyp, cc, nm, argtys, varargs, retty, minst)) = seekReadMethodDefOrRef numtypars x + let (VarArgMethodData(enclTyp, cc, nm, argtys, varargs, retty, minst)) = seekReadMethodDefOrRef numtypars x MethodData(enclTyp, cc, nm, argtys, retty, minst) and seekReadCustomAttrType (TaggedIndex(tag,idx) ) = @@ -5460,7 +5460,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader if hasLayout && not isStatic then Some (seekReadIndexedRow (getNumRows ILTableNames.FieldLayout,seekReadFieldLayoutRow, snd,simpleIndexCompare idx,isSorted ILTableNames.FieldLayout,fst)) else None - CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.FieldDef,idx)) + CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.FieldDef,idx)) Token = idx } and seekReadFields (numtypars, hasLayout) fidx1 fidx2 = @@ -5789,7 +5789,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader RemoveMethod=seekReadMethodSemantics (0x0010,TaggedIndex(HasSemanticsTag.Event,idx)) //FireMethod=seekReadOptionalMethodSemantics (0x0020,TaggedIndex(HasSemanticsTag.Event,idx)) //OtherMethods = seekReadMultipleMethodSemantics (0x0004, TaggedIndex(HasSemanticsTag.Event, idx)) - CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.Event,idx)) + CustomAttrs=seekReadCustomAttrs (TaggedIndex(HasCustomAttributeTag.Event,idx)) Token = idx} and seekReadEvents numtypars tidx = @@ -5860,7 +5860,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let data = match readBlobHeapOption valIdx with | USome bytes -> bytes - | UNone -> [| |] + | UNone -> [| |] { Method=seekReadCustomAttrType catIdx; Data= data Elements = [] } @@ -6063,17 +6063,17 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let (|ElementType|_|) (ty: ILType) = - match ty with - | ILType.Boxed tspec -> - match tspec.Namespace, tspec.Name with + match ty with + | ILType.Boxed tspec -> + match tspec.Namespace, tspec.Name with | USome "System", "String"-> Some et_STRING | USome "System", "Object"-> Some et_OBJECT | _ -> None - | ILType.Value tspec -> + | ILType.Value tspec -> match tspec.Namespace, tspec.Name with | USome "System", "Int32" -> Some et_I4 | USome "System", "SByte" -> Some et_I1 - | USome "System", "Int16"-> Some et_I2 + | USome "System", "Int16"-> Some et_I2 | USome "System", "Int64" -> Some et_I8 | USome "System", "IntPtr" -> Some et_I | USome "System", "Byte" -> Some et_U1 @@ -6089,22 +6089,22 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | _ -> None | _ -> None - let encodeCustomAttrString (s: string) = + let encodeCustomAttrString (s: string) = let arr = Encoding.UTF8.GetBytes s - Array.concat [ ByteBuffer.Z32 arr.Length; arr ] + Array.concat [ ByteBuffer.Z32 arr.Length; arr ] - let rec encodeCustomAttrElemType x = + let rec encodeCustomAttrElemType x = match x with - | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| 0x51uy |] + | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| 0x51uy |] | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Type" -> [| 0x50uy |] | ElementType et -> [| et |] | ILType.Value tspec -> Array.append [| 0x55uy |] (encodeCustomAttrString tspec.TypeRef.QualifiedName) - | ILType.Array (shape, elemType) when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, elemType) when shape = ILArrayShape.SingleDimensional -> Array.append [| et_SZARRAY |] (encodeCustomAttrElemType elemType) | _ -> failwith "encodeCustomAttrElemType: unrecognized custom element type" /// Given a custom attribute element, work out the type of the .NET argument for that element. - let rec encodeCustomAttrElemTypeForObject (x: obj) = + let rec encodeCustomAttrElemTypeForObject (x: obj) = match x with | :? string -> [| et_STRING |] | :? bool -> [| et_BOOLEAN |] @@ -6123,11 +6123,11 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | :? single -> [| et_R4 |] | :? double -> [| et_R8 |] | :? (obj[]) -> failwith "TODO: can't yet emit arrays in attrs" // [| yield et_SZARRAY; yield! encodeCustomAttrElemType elemTy |] - | _ -> failwith "unexpected value in custom attribute" + | _ -> failwith "unexpected value in custom attribute" /// Given a custom attribute element, encode it to a binary representation according to the rules in Ecma 335 Partition II. - let rec encodeCustomAttrPrimValue (c: obj) = - match c with + let rec encodeCustomAttrPrimValue (c: obj) = + match c with | :? bool as b -> [| (if b then 0x01uy else 0x00uy) |] | null -> [| 0xFFuy |] | :? string as s -> encodeCustomAttrString s @@ -6142,40 +6142,40 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader | :? UInt64 as x -> u64AsBytes x | :? Single as x -> ieee32AsBytes x | :? Double as x -> ieee64AsBytes x - | :? ILType as ty -> encodeCustomAttrString ty.QualifiedName - | :? Type as ty -> encodeCustomAttrString ty.FullName - | :? (obj[]) as elems -> + | :? ILType as ty -> encodeCustomAttrString ty.QualifiedName + | :? Type as ty -> encodeCustomAttrString ty.FullName + | :? (obj[]) as elems -> [| yield! i32AsBytes elems.Length; for elem in elems do yield! encodeCustomAttrPrimValue elem |] | _ -> failwith "unexpected value in custom attribute" - and encodeCustomAttrValue ty (c: obj) = - match ty, c with - | ILType.Boxed tspec, _ when tspec.Namespace = USome "System" && tspec.Name = "Object" -> + and encodeCustomAttrValue ty (c: obj) = + match ty, c with + | ILType.Boxed tspec, _ when tspec.Namespace = USome "System" && tspec.Name = "Object" -> [| yield! encodeCustomAttrElemTypeForObject c; yield! encodeCustomAttrPrimValue c |] - | ILType.Array (shape, _), null when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, _), null when shape = ILArrayShape.SingleDimensional -> [| yield! i32AsBytes 0xFFFFFFFF |] - | ILType.Array (shape, elemType), (:? (obj[]) as elems) when shape = ILArrayShape.SingleDimensional -> + | ILType.Array (shape, elemType), (:? (obj[]) as elems) when shape = ILArrayShape.SingleDimensional -> [| yield! i32AsBytes elems.Length; for elem in elems do yield! encodeCustomAttrValue elemType elem |] - | _ -> + | _ -> encodeCustomAttrPrimValue c - let encodeCustomAttrNamedArg prop (ILCustomAttrNamedArg (nm, ty, elem)) = - [| yield (if prop then 0x54uy else 0x53uy) + let encodeCustomAttrNamedArg prop (ILCustomAttrNamedArg (nm, ty, elem)) = + [| yield (if prop then 0x54uy else 0x53uy) yield! encodeCustomAttrElemType ty yield! encodeCustomAttrString nm yield! encodeCustomAttrValue ty elem |] - let mkILCustomAttribMethRef (mspec:ILMethodSpec, fixedArgs: obj list, propArgs: ILCustomAttrNamedArg list, fieldArgs: ILCustomAttrNamedArg list) = + let mkILCustomAttribMethRef (mspec:ILMethodSpec, fixedArgs: obj list, propArgs: ILCustomAttrNamedArg list, fieldArgs: ILCustomAttrNamedArg list) = let argtys = mspec.MethodRef.ArgTypes let nnamed = propArgs.Length + fieldArgs.Length - let data = + let data = [| yield! [| 0x01uy; 0x00uy; |] for (argty,fixedArg) in Seq.zip argtys fixedArgs do yield! encodeCustomAttrValue argty fixedArg yield! u16AsBytes (uint16 nnamed ) - for arg in propArgs do + for arg in propArgs do yield! encodeCustomAttrNamedArg true arg - for arg in fieldArgs do + for arg in fieldArgs do yield! encodeCustomAttrNamedArg false arg |] //printfn "mkILCustomAttribMethRef, nnamed = %d, data.Length = %d, data = %A" nnamed data.Length data { Method = mspec; @@ -6445,7 +6445,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader if n = 0 then List.rev acc, sigptr else let v,sigptr = parseVal elemTy sigptr parseElems (v ::acc) (n-1) sigptr - let elems, sigptr = parseElems [] n sigptr + let elems, sigptr = parseElems [] n sigptr let elems = elems |> List.map snd |> List.toArray (argty, box elems), sigptr | ILType.Value _ -> (* assume it is an enumeration *) @@ -6498,7 +6498,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let named = parseNamed [] (int nnamed) sigptr fixedArgs, named - with err -> + with err -> failwithf "FAILED decodeILCustomAttribData, data.Length = %d, data = %A, meth = %A, argtypes = %A, fixedArgs=%A, nnamed = %A, sigptr before named = %A, innerError = %A" bytes.Length bytes ca.Method.EnclosingType ca.Method.FormalArgTypes fixedArgs nnamed sigptr (err.ToString()) type CacheValue = ILModuleReader @@ -6526,7 +6526,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let EcmaMscorlibScopeRef = ILScopeRef.Assembly (ILAssemblyRef("mscorlib", UNone, USome EcmaPublicKey, true, UNone, UNone)) //==================================================================================================== -// TargetAssembly +// TargetAssembly // // An implementation of reflection objects over on-disk assemblies, sufficient to give // System.Type, System.MethodInfo, System.ConstructorInfo etc. objects @@ -6734,7 +6734,7 @@ namespace ProviderImplementation.ProvidedTypes | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes dty that.DeclaringType && lengthsEqAndForall2 (gmd.GetGenericArguments()) (that.GetGenericArguments()) (=) | _ -> false - + override this.MethodHandle = notRequired this "MethodHandle" this.Name override this.ReturnParameter = notRequired this "ReturnParameter" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name @@ -6751,7 +6751,7 @@ namespace ProviderImplementation.ProvidedTypes /// Represents a constructor in an instantiated type type ConstructorSymbol (declTy: Type, inp: ConstructorInfo) = - inherit ConstructorInfo() + inherit ConstructorInfo() let gps = ((if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]), [| |]) override _.Name = ".ctor" @@ -6778,12 +6778,12 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_inherited) = notRequired this "GetCustomAttributes" this.Name override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name - override _.ToString() = sprintf "tgt constructor(...) in type %s" declTy.FullName + override _.ToString() = sprintf "tgt constructor(...) in type %s" declTy.FullName static member Make (declTy: Type) md = ConstructorSymbol (declTy, md) :> ConstructorInfo /// Represents a method in an instantiated type type MethodSymbol (declTy: Type, inp: MethodInfo) = - inherit MethodInfo() + inherit MethodInfo() let gps1 = (if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]) let gps2 = inp.GetGenericArguments() let gps = (gps1, gps2) @@ -6803,7 +6803,7 @@ namespace ProviderImplementation.ProvidedTypes override _.GetHashCode() = inp.GetHashCode() override this.Equals(that:obj) = match that with - | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType + | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType | _ -> false override this.MakeGenericMethod(args) = MethodSymbol2(this, args) :> MethodInfo @@ -6821,13 +6821,13 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_inherited) = notRequired this "GetCustomAttributes" this.Name override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name - override _.ToString() = sprintf "tgt method %s(...) in type %s" inp.Name declTy.FullName + override _.ToString() = sprintf "tgt method %s(...) in type %s" inp.Name declTy.FullName static member Make (declTy: Type) md = MethodSymbol (declTy, md) :> MethodInfo /// Represents a property in an instantiated type type PropertySymbol (declTy: Type, inp: PropertyInfo) = - inherit PropertyInfo() + inherit PropertyInfo() let gps = ((if declTy.IsGenericType then declTy.GetGenericArguments() else [| |]), [| |]) override _.Name = inp.Name @@ -6858,7 +6858,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name - override _.ToString() = sprintf "tgt property %s(...) in type %s" inp.Name declTy.Name + override _.ToString() = sprintf "tgt property %s(...) in type %s" inp.Name declTy.Name static member Make (declTy: Type) md = PropertySymbol (declTy, md) :> PropertyInfo @@ -6890,13 +6890,13 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "IsDefined" this.Name - override _.ToString() = sprintf "tgt event %s(...) in type %s" inp.Name declTy.FullName + override _.ToString() = sprintf "tgt event %s(...) in type %s" inp.Name declTy.FullName static member Make (declTy: Type) md = EventSymbol (declTy, md) :> EventInfo /// Represents a field in an instantiated type type FieldSymbol (declTy: Type, inp: FieldInfo) = - inherit FieldInfo() + inherit FieldInfo() let gps = if declTy.IsGenericType then declTy.GetGenericArguments() else [| |] override _.Name = inp.Name @@ -6923,7 +6923,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetValue(_obj) = notRequired this "GetValue" this.Name override this.FieldHandle = notRequired this "FieldHandle" this.Name - override _.ToString() = sprintf "tgt literal field %s(...) in type %s" inp.Name declTy.FullName + override _.ToString() = sprintf "tgt literal field %s(...) in type %s" inp.Name declTy.FullName static member Make (declTy: Type) md = FieldSymbol (declTy, md) :> FieldInfo @@ -7020,71 +7020,71 @@ namespace ProviderImplementation.ProvidedTypes member _.Kind = kind member _.Args = typeArgs - override this.GetConstructors bindingFlags = + override this.GetConstructors bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Methods.Entries - |> Array.filter (fun md -> md.Name = ".ctor" || md.Name = ".cctor") - |> Array.map (gtd.MakeConstructorInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Methods.Entries + |> Array.filter (fun md -> md.Name = ".ctor" || md.Name = ".cctor") + |> Array.map (gtd.MakeConstructorInfo this) |> Array.filter (canBindConstructor bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetConstructors(bindingFlags) - |> Array.map (ConstructorSymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetConstructors(bindingFlags) + |> Array.map (ConstructorSymbol.Make this) | _ -> notRequired this "GetConstructors" this.Name - override this.GetMethods bindingFlags = + override this.GetMethods bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Methods.Entries - |> Array.filter (fun md -> md.Name <> ".ctor" && md.Name <> ".cctor") - |> Array.map (gtd.MakeMethodInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Methods.Entries + |> Array.filter (fun md -> md.Name <> ".ctor" && md.Name <> ".cctor") + |> Array.map (gtd.MakeMethodInfo this) |> Array.filter (canBindMethod bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetMethods(bindingFlags) - |> Array.map (MethodSymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetMethods(bindingFlags) + |> Array.map (MethodSymbol.Make this) | _ -> notRequired this "GetMethods" this.Name - override this.GetFields bindingFlags = + override this.GetFields bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Fields.Entries - |> Array.map (gtd.MakeFieldInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Fields.Entries + |> Array.map (gtd.MakeFieldInfo this) |> Array.filter (canBindField bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetFields(bindingFlags) - |> Array.map (FieldSymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetFields(bindingFlags) + |> Array.map (FieldSymbol.Make this) | _ -> notRequired this "GetFields" this.Name - override this.GetProperties bindingFlags = + override this.GetProperties bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Properties.Entries - |> Array.map (gtd.MakePropertyInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Properties.Entries + |> Array.map (gtd.MakePropertyInfo this) |> Array.filter (canBindProperty bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetProperties(bindingFlags) - |> Array.map (PropertySymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetProperties(bindingFlags) + |> Array.map (PropertySymbol.Make this) | _ -> notRequired this "GetProperties" this.Name - override this.GetEvents bindingFlags = + override this.GetEvents bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.Events.Entries - |> Array.map (gtd.MakeEventInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.Events.Entries + |> Array.map (gtd.MakeEventInfo this) |> Array.filter (canBindEvent bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetEvents(bindingFlags) - |> Array.map (EventSymbol.Make this) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetEvents(bindingFlags) + |> Array.map (EventSymbol.Make this) | _ -> notRequired this "GetEvents" this.Name - override this.GetNestedTypes bindingFlags = + override this.GetNestedTypes bindingFlags = match kind with - | TypeSymbolKind.TargetGeneric gtd -> - gtd.Metadata.NestedTypes.Entries - |> Array.map (gtd.MakeNestedTypeInfo this) + | TypeSymbolKind.TargetGeneric gtd -> + gtd.Metadata.NestedTypes.Entries + |> Array.map (gtd.MakeNestedTypeInfo this) |> Array.filter (canBindNestedType bindingFlags) - | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetNestedTypes(bindingFlags) + | TypeSymbolKind.OtherGeneric gtd -> + gtd.GetNestedTypes(bindingFlags) | _ -> notRequired this "GetNestedTypes" this.Name override this.GetConstructorImpl(bindingFlags, _binderBinder, _callConvention, types, _modifiers) = @@ -7092,68 +7092,68 @@ namespace ProviderImplementation.ProvidedTypes match ctors with | [| |] -> null | [| ci |] -> ci - | _ -> failwithf "multiple constructors exist" + | _ -> failwithf "multiple constructors exist" override this.GetMethodImpl(name, bindingFlags, _binderBinder, _callConvention, types, _modifiers) = match kind with | TypeSymbolKind.TargetGeneric gtd -> let md = match types with - | null -> gtd.Metadata.Methods.TryFindUniqueByName(name) + | null -> gtd.Metadata.Methods.TryFindUniqueByName(name) | _ -> - let mds = gtd.Metadata.Methods.FindByNameAndArity(name, types.Length) + let mds = gtd.Metadata.Methods.FindByNameAndArity(name, types.Length) match mds |> Array.filter (fun md -> eqTypesAndILTypesWithInst typeArgs types md.ParameterTypes) with | [| |] -> None | [| md |] -> Some md | _ -> failwithf "multiple methods exist with name %s" name md |> Option.map (gtd.MakeMethodInfo this) |> Option.toObj - | TypeSymbolKind.OtherGeneric _ -> + | TypeSymbolKind.OtherGeneric _ -> match this.GetMethods(bindingFlags) |> Array.filter (fun c -> name = c.Name && match types with null -> true | t -> c.GetParameters().Length = t.Length) with | [| |] -> null | [| mi |] -> mi | _ -> failwithf "multiple methods exist with name %s" name | _ -> notRequired this "GetMethodImpl" this.Name - override this.GetField(name, bindingFlags) = + override this.GetField(name, bindingFlags) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Fields.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakeFieldInfo this) + |> Option.map (gtd.MakeFieldInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetFields(bindingFlags) + gtd.GetFields(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (FieldSymbol.Make this) + |> Option.map (FieldSymbol.Make this) |> Option.toObj | _ -> notRequired this "GetField" this.Name - override this.GetPropertyImpl(name, bindingFlags, _binder, _returnType, _types, _modifiers) = + override this.GetPropertyImpl(name, bindingFlags, _binder, _returnType, _types, _modifiers) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Properties.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakePropertyInfo this) + |> Option.map (gtd.MakePropertyInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetProperties(bindingFlags) + gtd.GetProperties(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (PropertySymbol.Make this) + |> Option.map (PropertySymbol.Make this) |> Option.toObj | _ -> notRequired this "GetPropertyImpl" this.Name - override this.GetEvent(name, bindingFlags) = + override this.GetEvent(name, bindingFlags) = match kind with | TypeSymbolKind.TargetGeneric gtd -> gtd.Metadata.Events.Entries |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (gtd.MakeEventInfo this) + |> Option.map (gtd.MakeEventInfo this) |> Option.toObj | TypeSymbolKind.OtherGeneric gtd -> - gtd.GetEvents(bindingFlags) + gtd.GetEvents(bindingFlags) |> Array.tryFind (fun md -> md.Name = name) - |> Option.map (EventSymbol.Make this) + |> Option.map (EventSymbol.Make this) |> Option.toObj | _ -> notRequired this "GetEvent" this.Name @@ -7277,7 +7277,7 @@ namespace ProviderImplementation.ProvidedTypes override this.Equals(that:obj) = match that with - | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType + | :? MethodInfo as that -> this.MetadataToken = that.MetadataToken && eqTypes this.DeclaringType that.DeclaringType | _ -> false override this.MakeGenericMethod(args) = MethodSymbol2(this, args) :> MethodInfo @@ -7521,7 +7521,7 @@ namespace ProviderImplementation.ProvidedTypes override this.GetCustomAttributes(_attributeType, _inherited) = notRequired this "txILGenericParam: GetCustomAttributes" this.Name override this.IsDefined(_attributeType, _inherited) = notRequired this "txILGenericParam: IsDefined" this.Name override this.GetInterface(_name, _ignoreCase) = notRequired this "txILGenericParam: GetInterface" this.Name - override this.Module = notRequired this "txILGenericParam: Module" this.Name: Module + override this.Module = notRequired this "txILGenericParam: Module" this.Name: Module override this.GetElementType() = notRequired this "txILGenericParam: GetElementType" this.Name override this.InvokeMember(_name, _invokeAttr, _binder, _target, _args, _modifiers, _culture, _namedParameters) = notRequired this "txILGenericParam: InvokeMember" this.Name @@ -7584,21 +7584,21 @@ namespace ProviderImplementation.ProvidedTypes |> Array.filter (canBindNestedType bindingFlags) override this.GetConstructorImpl(_bindingFlags, _binder, _callConvention, types, _modifiers) = - let md = + let md = match types with | null -> inp.Methods.TryFindUniqueByName(".ctor") - | _ -> + | _ -> inp.Methods.FindByNameAndArity(".ctor", types.Length) |> Array.tryFind (fun md -> eqTypesAndILTypes types md.ParameterTypes) - md - |> Option.map (txILConstructorDef this) + md + |> Option.map (txILConstructorDef this) |> Option.toObj override this.GetMethodImpl(name, _bindingFlags, _binder, _callConvention, types, _modifiers) = - let md = + let md = match types with | null -> inp.Methods.TryFindUniqueByName(name) - | _ -> + | _ -> inp.Methods.FindByNameAndArity(name, types.Length) |> Array.tryFind (fun md -> eqTypesAndILTypes types md.ParameterTypes) md |> Option.map (txILMethodDef this) |> Option.toObj @@ -7645,8 +7645,8 @@ namespace ProviderImplementation.ProvidedTypes override _.IsValueTypeImpl() = inp.IsStructOrEnum - override _.IsEnum = - match this.BaseType with + override _.IsEnum = + match this.BaseType with | null -> false | bt -> bt.FullName = "System.Enum" || bt.IsEnum @@ -7717,10 +7717,10 @@ namespace ProviderImplementation.ProvidedTypes let getReader() = match reader with None -> failwith "the reader on the TargetAssembly has not been set" | Some r -> r let txILTypeDef (declTyOpt: Type option) (inp: ILTypeDef) = - txTable.Get inp.Token (fun () -> + txTable.Get inp.Token (fun () -> // We never create target types for the types of primitive values that are accepted by the F# compiler as Expr.Value nodes, // which fortunately also correspond to element types. We just use the design-time types instead. - match inp.Namespace, inp.Name with + match inp.Namespace, inp.Name with | USome "System", "Void"-> typeof (* | USome "System", "Boolean" -> typeof @@ -7738,9 +7738,9 @@ namespace ProviderImplementation.ProvidedTypes | USome "System", "UIntPtr" -> typeof | USome "System", "Double" -> typeof | USome "System", "Single" -> typeof - | USome "System", "Char" -> typeof + | USome "System", "Char" -> typeof *) - | _ -> + | _ -> TargetTypeDefinition(ilGlobals, tryBindAssembly, asm, declTyOpt, inp) :> System.Type) let types = lazy [| for td in getReader().ILModuleDef.TypeDefs.Entries -> txILTypeDef None td |] @@ -7793,8 +7793,8 @@ namespace ProviderImplementation.ProvidedTypes | ILScopeRef.Assembly aref2 -> let ass2opt = tryBindAssembly(aref2) match ass2opt with - | Choice1Of2 ass2 -> - match ass2.GetType(joinILTypeName nsp nm) with + | Choice1Of2 ass2 -> + match ass2.GetType(joinILTypeName nsp nm) with | null -> None | ty -> Some ty | Choice2Of2 _err -> None @@ -7838,7 +7838,7 @@ namespace ProviderImplementation.ProvidedTypes override _.GetTypes () = theTypesArray.Force() - override x.GetType (nm: string) = + override x.GetType (nm: string) = if nm.Contains("+") then let i = nm.LastIndexOf("+") let enc,nm2 = nm.[0..i-1], nm.[i+1..] @@ -7846,29 +7846,29 @@ namespace ProviderImplementation.ProvidedTypes | null -> null | t -> t.GetNestedType(nm2,bindAll) else - theTypesArray.Force() - |> Array.tryPick (fun ty -> if ty.FullName = nm then Some ty else None) + theTypesArray.Force() + |> Array.tryPick (fun ty -> if ty.FullName = nm then Some ty else None) |> Option.toObj - - new () = + + new () = let tmpFile = Path.GetTempFileName() let assemblyFileName = Path.ChangeExtension(tmpFile, "dll") File.Delete(tmpFile) let simpleName = Path.GetFileNameWithoutExtension(assemblyFileName) ProvidedAssembly(AssemblyName(simpleName), assemblyFileName) - new (assemblyName, assemblyFileName) = + new (assemblyName, assemblyFileName) = ProvidedAssembly(false, assemblyName, assemblyFileName) member _.BelongsToTargetModel = isTgt - member _.AddNestedTypes (types, enclosingGeneratedTypeNames) = + member _.AddNestedTypes (types, enclosingGeneratedTypeNames) = addTypes (Array.ofList types, Some enclosingGeneratedTypeNames) - member _.AddTypes (types) = + member _.AddTypes (types) = addTypes (Array.ofList types, None) - member _.AddTheTypes (types, enclosingGeneratedTypeNames) = + member _.AddTheTypes (types, enclosingGeneratedTypeNames) = addTypes (types, enclosingGeneratedTypeNames) member _.GetTheTypes () = theTypes.ToArray() @@ -7930,7 +7930,7 @@ namespace ProviderImplementation.ProvidedTypes type ProvidedTypeBuilder() = - static let tupleNames = + static let tupleNames = [| "System.Tuple`1"; "System.Tuple`2"; "System.Tuple`3"; "System.Tuple`4"; "System.Tuple`5"; "System.Tuple`6"; "System.Tuple`7"; "System.Tuple`8"; "System.Tuple" @@ -7939,15 +7939,15 @@ namespace ProviderImplementation.ProvidedTypes "System.ValueTuple`7"; "System.ValueTuple`8"; "System.ValueTuple" |] - static member MakeGenericType(genericTypeDefinition: Type, genericArguments: Type list) = + static member MakeGenericType(genericTypeDefinition: Type, genericArguments: Type list) = if genericArguments.Length = 0 then genericTypeDefinition else - match genericTypeDefinition with + match genericTypeDefinition with | :? TargetTypeDefinition -> failwithf "unexpected target model in ProvidedTypeBuilder.MakeGenericType, stacktrace = %s " Environment.StackTrace | :? ProvidedTypeDefinition as ptd when ptd.BelongsToTargetModel -> failwithf "unexpected target model ptd in MakeGenericType, stacktrace = %s " Environment.StackTrace | :? ProvidedTypeDefinition -> ProvidedTypeSymbol(ProvidedTypeSymbolKind.Generic genericTypeDefinition, genericArguments) :> Type | _ -> TypeSymbol(TypeSymbolKind.OtherGeneric genericTypeDefinition, List.toArray genericArguments) :> Type - static member MakeGenericMethod(genericMethodDefinition, genericArguments: Type list) = + static member MakeGenericMethod(genericMethodDefinition, genericArguments: Type list) = if genericArguments.Length = 0 then genericMethodDefinition else MethodSymbol2(genericMethodDefinition, Array.ofList genericArguments) :> MethodInfo @@ -7958,7 +7958,7 @@ namespace ProviderImplementation.ProvidedTypes let n = min tys.Length maxTuple let tupleFullName = tupleNames.[n - 1 + (if isStruct then 9 else 0)] let ty = asm.GetType(tupleFullName) - if tys.Length >= maxTuple then + if tys.Length >= maxTuple then let tysA = (Array.ofList tys).[0..maxTuple-2] |> List.ofArray let tysB = (Array.ofList tys).[maxTuple-1..] |> List.ofArray let tyB = mkTupleType isStruct asm tysB @@ -7970,10 +7970,10 @@ namespace ProviderImplementation.ProvidedTypes //-------------------------------------------------------------------------------- // The quotation simplifier // - // This is invoked for each quotation specified by the type provider, as part of the translation to - /// the target model, i.e. before it is handed to the F# compiler (for erasing type providers) or - // the TPSDK IL code generator (for generative type providers). This allows a broader range of quotations - // to be used when authoring type providers than are strictly allowed by those tools. + // This is invoked for each quotation specified by the type provider, as part of the translation to + /// the target model, i.e. before it is handed to the F# compiler (for erasing type providers) or + // the TPSDK IL code generator (for generative type providers). This allows a broader range of quotations + // to be used when authoring type providers than are strictly allowed by those tools. // // Specifically we accept: // @@ -7997,7 +7997,7 @@ namespace ProviderImplementation.ProvidedTypes match q with #if !NO_GENERATIVE - // Convert NewTuple to the call to the constructor of the Tuple type (only for generated types, + // Convert NewTuple to the call to the constructor of the Tuple type (only for generated types, // the F# compile does the job for erased types when it receives the quotation) | NewTuple(items) when isGenerated -> let rec mkCtor args ty = @@ -8155,7 +8155,7 @@ namespace ProviderImplementation.ProvidedTypes // ... // body (body, vars) - ||> List.fold (fun b v -> Expr.LetUnchecked(varDict.[v.Name], init v.Type, b)) + ||> List.fold (fun b v -> Expr.LetUnchecked(varDict.[v.Name], init v.Type, b)) |> simplifyExpr @@ -8220,10 +8220,10 @@ namespace ProviderImplementation.ProvidedTypes yield resultType |] let fastFuncTy = match List.length args with - | 2 -> typedefof>.MakeGenericType(types) - | 3 -> typedefof>.MakeGenericType(types) - | 4 -> typedefof>.MakeGenericType(types) - | 5 -> typedefof>.MakeGenericType(types) + | 2 -> typedefof>.MakeGenericType(types) + | 3 -> typedefof>.MakeGenericType(types) + | 4 -> typedefof>.MakeGenericType(types) + | 5 -> typedefof>.MakeGenericType(types) | _ -> invalidArg "args" "incorrect number of arguments" fastFuncTy.GetMethod("Adapt") @@ -8380,7 +8380,7 @@ namespace ProviderImplementation.ProvidedTypes /// /// The ProvidedTypesContext acts as a way of creating provided objects where the replacement is automatically and /// systematically applied. - + /// Represents the type binding context for the type provider based on the set of assemblies /// referenced by the compilation. @@ -8429,7 +8429,7 @@ namespace ProviderImplementation.ProvidedTypes | None -> typeof.Assembly.GetName().Version // failwith "no reference to FSharp.Core found" | Some r -> r - let ilGlobals = + let ilGlobals = lazy mkILGlobals (systemRuntimeScopeRef.Force()) let mkReader ref = @@ -8440,18 +8440,18 @@ namespace ProviderImplementation.ProvidedTypes let targetAssembliesTable_ = ConcurrentDictionary>() let targetAssemblies_ = ResizeArray() let targetAssembliesQueue = ResizeArray<_>() - do targetAssembliesQueue.Add (fun () -> + do targetAssembliesQueue.Add (fun () -> for ref in referencedAssemblyPaths do - let reader = mkReader ref - let simpleName = Path.GetFileNameWithoutExtension ref + let reader = mkReader ref + let simpleName = Path.GetFileNameWithoutExtension ref targetAssembliesTable_.[simpleName] <- reader - match reader with - | Choice2Of2 _ -> () + match reader with + | Choice2Of2 _ -> () | Choice1Of2 asm -> targetAssemblies_.Add asm) - let flush() = + let flush() = let qs = targetAssembliesQueue.ToArray() targetAssembliesQueue.Clear() - for q in qs do q() + for q in qs do q() let getTargetAssemblies() = flush(); targetAssemblies_ let getTargetAssembliesTable() = flush(); targetAssembliesTable_ @@ -8464,8 +8464,8 @@ namespace ProviderImplementation.ProvidedTypes let sourceAssemblies_ = ResizeArray<_>() let sourceAssembliesQueue = ResizeArray<_>() - let enqueueReferencedAssemblies(asm: Assembly) = - do sourceAssembliesQueue.Add (fun () -> + let enqueueReferencedAssemblies(asm: Assembly) = + do sourceAssembliesQueue.Add (fun () -> [| for referencedAssemblyName in asm.GetReferencedAssemblies() do let referencedAssembly = try Assembly.Load(referencedAssemblyName) with _ -> null if not (isNull referencedAssembly) then @@ -8473,14 +8473,14 @@ namespace ProviderImplementation.ProvidedTypes do sourceAssembliesQueue.Add (fun () -> List.toArray sourceAssemblies) - let getSourceAssemblies() = + let getSourceAssemblies() = while sourceAssembliesQueue.Count > 0 do let qs = sourceAssembliesQueue.ToArray() sourceAssembliesQueue.Clear() - for q in qs do - for asm in q() do + for q in qs do + for asm in q() do let simpleName = asm.GetName().Name - if not (sourceAssembliesTable_.ContainsKey(simpleName)) then + if not (sourceAssembliesTable_.ContainsKey(simpleName)) then sourceAssembliesTable_.[simpleName] <- asm sourceAssemblies_.Add asm // Find the transitive closure of all referenced assemblies @@ -8537,13 +8537,13 @@ namespace ProviderImplementation.ProvidedTypes match table.TryGetValue(t) with | true, newT -> newT | false, _ -> - match t with - | :? ProvidedTypeDefinition as ptd when toTgt (* && ptd.IsErased *) -> + match t with + | :? ProvidedTypeDefinition as ptd when toTgt (* && ptd.IsErased *) -> if ptd.BelongsToTargetModel then failwithf "unexpected erased target ProvidedTypeDefinition '%O'" ptd // recursively get the provided type. convTypeDefToTgt t - - | _ -> + + | _ -> let asms = (if toTgt then getTargetAssemblies() else getSourceAssemblies()) let fullName = fixName t.FullName @@ -8597,7 +8597,7 @@ namespace ProviderImplementation.ProvidedTypes and convPropertyRefToTgt (p: PropertyInfo) = Debug.Assert((match p with :? ProvidedProperty as x -> not x.BelongsToTargetModel | _ -> true), "unexpected target ProvidedProperty") let t = convTypeToTgt p.DeclaringType - let bindingFlags = bindSome p.IsStatic + let bindingFlags = bindSome p.IsStatic let pT = t.GetProperty(p.Name, bindingFlags) if isNull pT then failwithf "Property '%O' of type '%O' not found. This property may be missing in the types available in the target assemblies." p t Debug.Assert((match pT with :? ProvidedProperty as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedProperty") @@ -8628,7 +8628,7 @@ namespace ProviderImplementation.ProvidedTypes declTyT.GetMethod(m.Name, bindSome m.IsStatic, null, parameterTypesT, null) match mT with | null -> failwithf "Method '%O' not found in type '%O'. This method may be missing in the types available in the target assemblies." m mT - | _ -> + | _ -> Debug.Assert((match mT with :? ProvidedMethod as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedMethod") mT @@ -8639,7 +8639,7 @@ namespace ProviderImplementation.ProvidedTypes let consT = declTyT.GetConstructor(parameterTypesT) match consT with | null -> failwithf "Constructor '%O' not found in type '%O'. This constructor may be missing in the types available in the target assemblies." cons declTyT - | _ -> + | _ -> Debug.Assert((match consT with :? ProvidedConstructor as x -> x.BelongsToTargetModel | _ -> true), "expected a target ProvidedConstructor") consT @@ -8737,7 +8737,7 @@ namespace ProviderImplementation.ProvidedTypes convExprToTgt <@@ (%%(tagExpr): int) = tagNumber @@> | Value (obj,ty) -> - match obj with + match obj with | :? Type as vty -> Expr.Value(convTypeToTgt vty, ty) | _ -> Expr.Value(obj, convTypeToTgt ty) @@ -8749,10 +8749,10 @@ namespace ProviderImplementation.ProvidedTypes | ShapeCombinationUnchecked (o, exprs) -> RebuildShapeCombinationUnchecked (o, List.map convExprToTgt exprs) - and convCodeToTgt (codeFun: Expr list -> Expr, isStatic, isCtor, parameters: ProvidedParameter[], isGenerated) = - (fun argsT -> + and convCodeToTgt (codeFun: Expr list -> Expr, isStatic, isCtor, parameters: ProvidedParameter[], isGenerated) = + (fun argsT -> let args = List.map convVarExprToSrc argsT - let paramNames = + let paramNames = // https://github.com/fsprojects/SwaggerProvider/blob/cfb7a665fada77fd0200591f62faba0ba44e172c/src/SwaggerProvider.DesignTime/SwaggerProviderConfig.fs#L79 // "Erased constructors should not pass the instance as the first argument when calling invokeCode!" // "Generated constructors should always pass the instance as the first argument when calling invokeCode!" @@ -8762,8 +8762,8 @@ namespace ProviderImplementation.ProvidedTypes let codeT = convExprToTgt code2 codeT) - and convBaseCallToTgt (codeFun: Expr list -> ConstructorInfo * Expr list, isGenerated) = - (fun argsT -> + and convBaseCallToTgt (codeFun: Expr list -> ConstructorInfo * Expr list, isGenerated) = + (fun argsT -> let args = List.map convVarExprToSrc argsT let ctor, argExprs = codeFun args let argExprs2 = List.map (QuotationSimplifier(isGenerated).TranslateExpression) argExprs @@ -8779,17 +8779,17 @@ namespace ProviderImplementation.ProvidedTypes match typeTableFwd.TryGetValue(x) with | true, newT -> (newT :?> ProvidedTypeDefinition) | false, _ -> - let container = - match x.Container with + let container = + match x.Container with | TypeContainer.Namespace(assemf, nm) -> - TypeContainer.Namespace((fun () -> - match assemf() with + TypeContainer.Namespace((fun () -> + match assemf() with | :? ProvidedAssembly as assembly -> convProvidedAssembly assembly - | assembly -> - assemblyReplacementMap - |> Seq.tryPick (fun (originalName, newName) -> + | assembly -> + assemblyReplacementMap + |> Seq.tryPick (fun (originalName, newName) -> if assembly.GetName().Name = originalName then - match this.TryBindSimpleAssemblyNameToTarget(newName) with + match this.TryBindSimpleAssemblyNameToTarget(newName) with | Choice1Of2 replacementAssembly -> Some replacementAssembly | Choice2Of2 _ -> None else @@ -8801,22 +8801,22 @@ namespace ProviderImplementation.ProvidedTypes // Create the type definition with contents mapped to the target // Use a 'let rec' to allow access to the target as the declaring // type of the contents in a delayed way. - let rec xT : ProvidedTypeDefinition = - ProvidedTypeDefinition(true, container, x.Name, - (x.BaseTypeRaw >> Option.map convTypeToTgt), - x.AttributesRaw, - (x.EnumUnderlyingTypeRaw >> Option.map convTypeToTgt), - x.StaticParams |> List.map convStaticParameterDefToTgt, - x.StaticParamsApply |> Option.map (fun f s p -> - let t = f s p + let rec xT : ProvidedTypeDefinition = + ProvidedTypeDefinition(true, container, x.Name, + (x.BaseTypeRaw >> Option.map convTypeToTgt), + x.AttributesRaw, + (x.EnumUnderlyingTypeRaw >> Option.map convTypeToTgt), + x.StaticParams |> List.map convStaticParameterDefToTgt, + x.StaticParamsApply |> Option.map (fun f s p -> + let t = f s p let tT = convProvidedTypeDefToTgt t tT), - Some ((let mutable idx = 0 in fun () -> let vs, idx2 = x.GetMembersFromCursor(idx) in idx <- idx2; vs |> Array.map (convMemberDefToTgt xT)), - (let mutable idx = 0 in fun () -> let vs, idx2 = x.GetInterfaceImplsFromCursor(idx) in idx <- idx2; vs |> Array.map convTypeToTgt), - (let mutable idx = 0 in fun () -> let vs, idx2 = x.GetMethodOverridesFromCursor(idx) in idx <- idx2; vs |> Array.map (fun (a,b) -> (convMethodRefToTgt a :?> ProvidedMethod), convMethodRefToTgt b))), + Some ((let mutable idx = 0 in fun () -> let vs, idx2 = x.GetMembersFromCursor(idx) in idx <- idx2; vs |> Array.map (convMemberDefToTgt xT)), + (let mutable idx = 0 in fun () -> let vs, idx2 = x.GetInterfaceImplsFromCursor(idx) in idx <- idx2; vs |> Array.map convTypeToTgt), + (let mutable idx = 0 in fun () -> let vs, idx2 = x.GetMethodOverridesFromCursor(idx) in idx <- idx2; vs |> Array.map (fun (a,b) -> (convMethodRefToTgt a :?> ProvidedMethod), convMethodRefToTgt b))), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt), - x.HideObjectMethods, - x.NonNullable) + x.HideObjectMethods, + x.NonNullable) Debug.Assert(not (typeTableFwd.ContainsKey(x))) typeTableFwd.[x] <- xT @@ -8826,63 +8826,63 @@ namespace ProviderImplementation.ProvidedTypes xT and convTypeDefToTgt (x: Type) = - match x with - | :? ProvidedTypeDefinition as x -> convProvidedTypeDefToTgt x :> Type + match x with + | :? ProvidedTypeDefinition as x -> convProvidedTypeDefToTgt x :> Type | _ -> x - and convParameterDefToTgt (x: ProvidedParameter) = + and convParameterDefToTgt (x: ProvidedParameter) = Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedParameter") - ProvidedParameter(true, x.Name, x.Attributes, - x.ParameterType |> convTypeToTgt, - x.OptionalValue, + ProvidedParameter(true, x.Name, x.Attributes, + x.ParameterType |> convTypeToTgt, + x.OptionalValue, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) - and convStaticParameterDefToTgt (x: ProvidedStaticParameter) = + and convStaticParameterDefToTgt (x: ProvidedStaticParameter) = Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedStaticParameter") - ProvidedStaticParameter(x.Name, convTypeToTgt x.ParameterType, ?parameterDefaultValue=x.ParameterDefaultValue) - - and convMemberDefToTgt declTyT (x: MemberInfo) = - let xT : MemberInfo = - match x with - | :? ProvidedField as x -> + ProvidedStaticParameter(x.Name, convTypeToTgt x.ParameterType, ?parameterDefaultValue=x.ParameterDefaultValue) + + and convMemberDefToTgt declTyT (x: MemberInfo) = + let xT : MemberInfo = + match x with + | :? ProvidedField as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedField") - ProvidedField(true, x.Name, x.Attributes, - x.FieldType |> convTypeToTgt, - x.GetRawConstantValue(), + ProvidedField(true, x.Name, x.Attributes, + x.FieldType |> convTypeToTgt, + x.GetRawConstantValue(), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedProperty as x -> + | :? ProvidedProperty as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedProperty") - ProvidedProperty(true, x.Name, x.Attributes, - x.PropertyType |> convTypeToTgt, + ProvidedProperty(true, x.Name, x.Attributes, + x.PropertyType |> convTypeToTgt, x.IsStatic, - x.Getter |> Option.map (fun f -> f >> convMethodRefToTgt), - x.Setter |> Option.map (fun f -> f >> convMethodRefToTgt), - x.IndexParameters |> Array.map convParameterDefToTgt, + x.Getter |> Option.map (fun f -> f >> convMethodRefToTgt), + x.Setter |> Option.map (fun f -> f >> convMethodRefToTgt), + x.IndexParameters |> Array.map convParameterDefToTgt, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedEvent as x -> + | :? ProvidedEvent as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedEvent") - ProvidedEvent(true, x.Name, x.Attributes, - x.EventHandlerType |> convTypeToTgt, + ProvidedEvent(true, x.Name, x.Attributes, + x.EventHandlerType |> convTypeToTgt, x.IsStatic, - (fun () -> convMethodRefToTgt x.Adder), - (fun () -> convMethodRefToTgt x.Remover), + (fun () -> convMethodRefToTgt x.Adder), + (fun () -> convMethodRefToTgt x.Remover), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedConstructor as x -> + | :? ProvidedConstructor as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedConstructor") - ProvidedConstructor(true, x.Attributes, - x.Parameters |> Array.map convParameterDefToTgt, - convCodeToTgt (x.GetInvokeCode, x.IsStatic, true, x.Parameters, not x.IsErased), + ProvidedConstructor(true, x.Attributes, + x.Parameters |> Array.map convParameterDefToTgt, + convCodeToTgt (x.GetInvokeCode, x.IsStatic, true, x.Parameters, not x.IsErased), (match x.BaseCall with None -> None | Some f -> Some (convBaseCallToTgt(f, not x.IsErased))), - x.IsImplicitConstructor, + x.IsImplicitConstructor, (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ - | :? ProvidedMethod as x -> + | :? ProvidedMethod as x -> Debug.Assert (not x.BelongsToTargetModel, "unexpected target ProvidedMethod") - ProvidedMethod(true, x.Name, x.Attributes, - x.Parameters |> Array.map convParameterDefToTgt, - x.ReturnType |> convTypeToTgt, - convCodeToTgt (x.GetInvokeCode, x.IsStatic, false, x.Parameters, not x.IsErased), - x.StaticParams |> List.map convStaticParameterDefToTgt, - x.StaticParamsApply |> Option.map (fun f s p -> f s p |> convProvidedMethodDefToTgt declTyT), + ProvidedMethod(true, x.Name, x.Attributes, + x.Parameters |> Array.map convParameterDefToTgt, + x.ReturnType |> convTypeToTgt, + convCodeToTgt (x.GetInvokeCode, x.IsStatic, false, x.Parameters, not x.IsErased), + x.StaticParams |> List.map convStaticParameterDefToTgt, + x.StaticParamsApply |> Option.map (fun f s p -> f s p |> convProvidedMethodDefToTgt declTyT), (x.GetCustomAttributesData >> convCustomAttributesDataToTgt)) :> _ | :? ProvidedTypeDefinition as x -> convTypeDefToTgt x :> _ | _ -> failwith "unknown member type" @@ -8892,18 +8892,18 @@ namespace ProviderImplementation.ProvidedTypes Debug.Assert((xT.DeclaringType :?> ProvidedTypeDefinition).BelongsToTargetModel) xT - and convProvidedMethodDefToTgt declTyT (x: ProvidedMethod) = + and convProvidedMethodDefToTgt declTyT (x: ProvidedMethod) = convMemberDefToTgt declTyT x :?> ProvidedMethod - and convProvidedAssembly (assembly: ProvidedAssembly) = + and convProvidedAssembly (assembly: ProvidedAssembly) = match assemblyTableFwd.TryGetValue(assembly) with | true, newT -> newT | false, _ -> - let tgtAssembly = ProvidedAssembly(true, assembly.GetName(), assembly.Location) + let tgtAssembly = ProvidedAssembly(true, assembly.GetName(), assembly.Location) - for (types, enclosingGeneratedTypeNames) in assembly.GetTheTypes() do + for (types, enclosingGeneratedTypeNames) in assembly.GetTheTypes() do let typesT = Array.map convProvidedTypeDefToTgt types - tgtAssembly.AddTheTypes (typesT, enclosingGeneratedTypeNames) + tgtAssembly.AddTheTypes (typesT, enclosingGeneratedTypeNames) assemblyTableFwd.Add(assembly, tgtAssembly) this.AddSourceAssembly(assembly) @@ -8930,7 +8930,7 @@ namespace ProviderImplementation.ProvidedTypes member _.TryBindAssemblyNameToTarget(aref: AssemblyName): Choice = tryBindTargetAssemblySimple(aref.Name) - member _.TryBindSimpleAssemblyNameToTarget(assemblyName: string) = tryBindTargetAssemblySimple(assemblyName) + member _.TryBindSimpleAssemblyNameToTarget(assemblyName: string) = tryBindTargetAssemblySimple(assemblyName) member _.ILGlobals = ilGlobals.Value @@ -8942,22 +8942,22 @@ namespace ProviderImplementation.ProvidedTypes member _.FSharpCoreAssemblyVersion = fsharpCoreRefVersion.Force() - member this.ReadRelatedAssembly(fileName) = + member this.ReadRelatedAssembly(fileName) = let ilg = ilGlobals.Force() - let reader = ILModuleReaderAfterReadingAllBytes(fileName, ilg) + let reader = ILModuleReaderAfterReadingAllBytes(fileName, ilg) TargetAssembly(ilg, this.TryBindILAssemblyRefToTgt, Some reader, fileName) :> Assembly - member this.ReadRelatedAssembly(bytes:byte[]) = + member this.ReadRelatedAssembly(bytes:byte[]) = let fileName = "file.dll" let ilg = ilGlobals.Force() let reader = ILModuleReader(fileName, ByteFile(bytes), ilg, true) TargetAssembly(ilg, this.TryBindILAssemblyRefToTgt, Some reader, fileName) :> Assembly - member _.AddSourceAssembly(asm: Assembly) = + member _.AddSourceAssembly(asm: Assembly) = sourceAssembliesQueue.Add (fun () -> [| asm |]) - member _.AddTargetAssembly(asmName: AssemblyName, asm: Assembly) = - targetAssembliesQueue.Add (fun () -> + member _.AddTargetAssembly(asmName: AssemblyName, asm: Assembly) = + targetAssembliesQueue.Add (fun () -> targetAssembliesTable_.[asmName.Name] <- Choice1Of2 asm targetAssemblies_.Add asm) @@ -9069,10 +9069,10 @@ namespace ProviderImplementation.ProvidedTypes let getUncodedToken (tab:ILTableName) idx = ((tab.Index <<< 24) ||| idx) - let markerForUnicodeBytes (b:byte[]) = + let markerForUnicodeBytes (b:byte[]) = let len = b.Length - let rec scan i = - i < len/2 && + let rec scan i = + i < len/2 && (let b1 = Bytes.get b (i*2) let b2 = Bytes.get b (i*2+1) (b2 <> 0) @@ -9086,19 +9086,19 @@ namespace ProviderImplementation.ProvidedTypes marker - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Fixups - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /// Check that the data held at a fixup is some special magic value, as a sanity check /// to ensure the fixup is being placed at a ood location. - let checkFixup32 (data: byte[]) offset exp = + let checkFixup32 (data: byte[]) offset exp = if data.[offset + 3] <> b3 exp then failwith "fixup sanity check failed" if data.[offset + 2] <> b2 exp then failwith "fixup sanity check failed" if data.[offset + 1] <> b1 exp then failwith "fixup sanity check failed" if data.[offset] <> b0 exp then failwith "fixup sanity check failed" - let applyFixup32 (data:byte[]) offset v = + let applyFixup32 (data:byte[]) offset v = data.[offset] <- b0 v data.[offset+1] <- b1 v data.[offset+2] <- b2 v @@ -9108,7 +9108,7 @@ namespace ProviderImplementation.ProvidedTypes // TYPES FOR TABLES //--------------------------------------------------------------------- - module RowElementTags = + module RowElementTags = let [] UShort = 0 let [] ULong = 1 let [] Data = 2 @@ -9173,7 +9173,7 @@ namespace ProviderImplementation.ProvidedTypes let [] ResolutionScopeMax = 178 [] - type RowElement(tag:int32, idx: int32) = + type RowElement(tag:int32, idx: int32) = member _.Tag = tag member _.Val = idx @@ -9182,15 +9182,15 @@ namespace ProviderImplementation.ProvidedTypes let UShort (x:uint16) = RowElement(RowElementTags.UShort, int32 x) let ULong (x:int32) = RowElement(RowElementTags.ULong, x) /// Index into cenv.data or cenv.resources. Gets fixed up later once we known an overall - /// location for the data section. flag indicates if offset is relative to cenv.resources. + /// location for the data section. flag indicates if offset is relative to cenv.resources. let Data (x:int, k:bool) = RowElement((if k then RowElementTags.DataResources else RowElementTags.Data ), x) - /// pos. in guid array + /// pos. in guid array let Guid (x:int) = RowElement(RowElementTags.Guid, x) - /// pos. in blob array + /// pos. in blob array let Blob (x:int) = RowElement(RowElementTags.Blob, x) - /// pos. in string array + /// pos. in string array let StringE (x:int) = RowElement(RowElementTags.String, x) - /// pos. in some table + /// pos. in some table let SimpleIndex (t, x:int) = RowElement(RowElementTags.SimpleIndex t, x) let TypeDefOrRefOrSpec (t, x:int) = RowElement(RowElementTags.TypeDefOrRefOrSpec t, x) let TypeOrMethodDef (t, x:int) = RowElement(RowElementTags.TypeOrMethodDef t, x) @@ -9214,18 +9214,18 @@ namespace ProviderImplementation.ProvidedTypes let inline combineHash x2 acc = 37 * acc + x2 // (acc <<< 6 + acc >>> 2 + x2 + 0x9e3779b9) - let hashRow (elems:RowElement[]) = + let hashRow (elems:RowElement[]) = let mutable acc = 0 - for i in 0 .. elems.Length - 1 do - acc <- (acc <<< 1) + elems.[i].Tag + elems.[i].Val + 631 + for i in 0 .. elems.Length - 1 do + acc <- (acc <<< 1) + elems.[i].Tag + elems.[i].Val + 631 acc - let equalRows (elems:RowElement[]) (elems2:RowElement[]) = + let equalRows (elems:RowElement[]) (elems2:RowElement[]) = if elems.Length <> elems2.Length then false else let mutable ok = true let n = elems.Length - let mutable i = 0 - while ok && i < n do + let mutable i = 0 + while ok && i < n do if elems.[i].Tag <> elems2.[i].Tag || elems.[i].Val <> elems2.[i].Val then ok <- false i <- i + 1 ok @@ -9240,37 +9240,37 @@ namespace ProviderImplementation.ProvidedTypes type SharedRow(elems: RowElement[], hashCode: int) = member _.GenericRow = elems override _.GetHashCode() = hashCode - override _.Equals(obj:obj) = - match obj with + override _.Equals(obj:obj) = + match obj with | :? SharedRow as y -> equalRows elems y.GenericRow | _ -> false let SharedRow(elems: RowElement[]) = new SharedRow(elems, hashRow elems) /// Special representation: Note, only hashing by name - let AssemblyRefRow(s1, s2, s3, s4, l1, b1, nameIdx, str2, b2) = + let AssemblyRefRow(s1, s2, s3, s4, l1, b1, nameIdx, str2, b2) = let hashCode = hash nameIdx let genericRow = [| UShort s1; UShort s2; UShort s3; UShort s4; ULong l1; Blob b1; StringE nameIdx; StringE str2; Blob b2 |] new SharedRow(genericRow, hashCode) /// Special representation the computes the hash more efficiently - let MemberRefRow(mrp:RowElement, nmIdx:StringIndex, blobIdx:BlobIndex) = + let MemberRefRow(mrp:RowElement, nmIdx:StringIndex, blobIdx:BlobIndex) = let hashCode = combineHash (hash blobIdx) (combineHash (hash nmIdx) (hash mrp)) let genericRow = [| mrp; StringE nmIdx; Blob blobIdx |] new SharedRow(genericRow, hashCode) /// Unshared rows are used for definitional tables where elements do not need to be made unique - /// e.g. ILMethodDef and ILTypeDef. Most tables are like this. We don't precompute a + /// e.g. ILMethodDef and ILTypeDef. Most tables are like this. We don't precompute a /// hash code for these rows, and indeed the GetHashCode and Equals should not be needed. [] type UnsharedRow(elems: RowElement[]) = member _.GenericRow = elems override _.GetHashCode() = hashRow elems - override _.Equals(obj:obj) = - match obj with + override _.Equals(obj:obj) = + match obj with | :? UnsharedRow as y -> equalRows elems y.GenericRow | _ -> false - + //===================================================================== //===================================================================== @@ -9278,8 +9278,8 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== //===================================================================== - // This environment keeps track of how many generic parameters are in scope. - // This lets us translate AbsIL type variable number to IL type variable numbering + // This environment keeps track of how many generic parameters are in scope. + // This lets us translate AbsIL type variable number to IL type variable numbering type ILTypeWriterEnv = { EnclosingTyparCount: int } let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length } let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) } @@ -9292,21 +9292,21 @@ namespace ProviderImplementation.ProvidedTypes //--------------------------------------------------------------------- [] - type MetadataTable<'T> = + type MetadataTable<'T> = { name: string dict: Dictionary<'T, int> // given a row, find its entry number mutable rows: ResizeArray<'T> } member x.Count = x.rows.Count - static member New(nm, hashEq) = + static member New(nm, hashEq) = { name=nm dict = new Dictionary<_, _>(100, hashEq) rows= new ResizeArray<_>() } - member tbl.EntriesAsArray = + member tbl.EntriesAsArray = tbl.rows.ToArray() - member tbl.Entries = + member tbl.Entries = tbl.rows.ToArray() |> Array.toList member tbl.AddSharedEntry x = @@ -9327,9 +9327,9 @@ namespace ProviderImplementation.ProvidedTypes else tbl.AddSharedEntry x - /// This is only used in one special place - see further below. - member tbl.SetRowsOfTable (t: _[]) = - tbl.rows <- ResizeArray(t) + /// This is only used in one special place - see further below. + member tbl.SetRowsOfTable (t: _[]) = + tbl.rows <- ResizeArray(t) let h = tbl.dict h.Clear() t |> Array.iteri (fun i x -> h.[x] <- (i+1)) @@ -9338,22 +9338,22 @@ namespace ProviderImplementation.ProvidedTypes if tbl.dict.ContainsKey x then failwith ("duplicate entry '"+geterr x+"' in "+nm+" table") else tbl.AddSharedEntry x - member tbl.GetTableEntry x = tbl.dict.[x] + member tbl.GetTableEntry x = tbl.dict.[x] member tbl.GetTableKeys() = tbl.dict.Keys |> Seq.toArray //--------------------------------------------------------------------- // Keys into some of the tables //--------------------------------------------------------------------- - /// We use this key type to help find ILMethodDefs for MethodRefs + /// We use this key type to help find ILMethodDefs for MethodRefs type MethodDefKey(tidx:int, garity:int, nm:string, rty:ILType, argtys:ILTypes, isStatic:bool) = - // Precompute the hash. The hash doesn't include the return type or + // Precompute the hash. The hash doesn't include the return type or // argument types (only argument type count). This is very important, since // hashing these is way too expensive - let hashCode = - hash tidx - |> combineHash (hash garity) - |> combineHash (hash nm) + let hashCode = + hash tidx + |> combineHash (hash garity) + |> combineHash (hash nm) |> combineHash (hash argtys.Length) |> combineHash (hash isStatic) member _.TypeIdx = tidx @@ -9364,37 +9364,37 @@ namespace ProviderImplementation.ProvidedTypes member _.IsStatic = isStatic override _.ToString() = sprintf "%A" (tidx, garity, nm, rty, argtys, isStatic) override _.GetHashCode() = hashCode - override _.Equals(obj:obj) = - match obj with - | :? MethodDefKey as y -> - tidx = y.TypeIdx && - garity = y.GenericArity && - nm = y.Name && + override _.Equals(obj:obj) = + match obj with + | :? MethodDefKey as y -> + tidx = y.TypeIdx && + garity = y.GenericArity && + nm = y.Name && // note: these next two use structural equality on AbstractIL ILType values - rty = y.ReturnType && + rty = y.ReturnType && argtys = y.ArgTypes && isStatic = y.IsStatic | _ -> false /// We use this key type to help find ILFieldDefs for FieldRefs - type FieldDefKey(tidx:int, nm:string, ty:ILType) = - // precompute the hash. hash doesn't include the type - let hashCode = hash tidx |> combineHash (hash nm) + type FieldDefKey(tidx:int, nm:string, ty:ILType) = + // precompute the hash. hash doesn't include the type + let hashCode = hash tidx |> combineHash (hash nm) member _.TypeIdx = tidx member _.Name = nm member _.Type = ty override _.GetHashCode() = hashCode - override _.Equals(obj:obj) = - match obj with - | :? FieldDefKey as y -> - tidx = y.TypeIdx && - nm = y.Name && - ty = y.Type + override _.Equals(obj:obj) = + match obj with + | :? FieldDefKey as y -> + tidx = y.TypeIdx && + nm = y.Name && + ty = y.Type | _ -> false type PropertyTableKey = PropKey of int (* type. def. idx. *) * string * ILType * ILTypes type EventTableKey = EventKey of int (* type. def. idx. *) * string - type TypeDefTableKey = TdKey of string list * string uoption * string + type TypeDefTableKey = TdKey of string list * string uoption * string //--------------------------------------------------------------------- // The Writer Target @@ -9407,37 +9407,37 @@ namespace ProviderImplementation.ProvidedTypes member t.FindOrAddSharedEntry(x) = match t with Shared u -> u.FindOrAddSharedEntry(x) | Unshared u -> failwithf "FindOrAddSharedEntry: incorrect table kind, u.name = %s" u.name member t.AddSharedEntry(x) = match t with | Shared u -> u.AddSharedEntry(x) | Unshared u -> failwithf "AddSharedEntry: incorrect table kind, u.name = %s" u.name member t.AddUnsharedEntry(x) = match t with Unshared u -> u.AddUnsharedEntry(x) | Shared u -> failwithf "AddUnsharedEntry: incorrect table kind, u.name = %s" u.name - member t.GenericRowsOfTable = match t with Unshared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) | Shared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) + member t.GenericRowsOfTable = match t with Unshared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) | Shared u -> u.EntriesAsArray |> Array.map (fun x -> x.GenericRow) member t.SetRowsOfSharedTable rows = match t with Shared u -> u.SetRowsOfTable (Array.map SharedRow rows) | Unshared u -> failwithf "SetRowsOfSharedTable: incorrect table kind, u.name = %s" u.name - member t.Count = match t with Unshared u -> u.Count | Shared u -> u.Count + member t.Count = match t with Unshared u -> u.Count | Shared u -> u.Count [] - type cenv = + type cenv = { ilg: ILGlobals emitTailcalls: bool deterministic: bool showTimes: bool desiredMetadataVersion: Version requiredDataFixups: ResizeArray<(int32 * (int * bool))> - /// References to strings in codestreams: offset of code and a (fixup-location , string token) list) + /// References to strings in codestreams: offset of code and a (fixup-location , string token) list) mutable requiredStringFixups: ResizeArray<(int32 * (int * int)[])> - codeChunks: ByteBuffer + codeChunks: ByteBuffer mutable nextCodeAddr: int32 - + // Collected debug information mutable moduleGuid: byte[] generatePdb: bool - /// Raw data, to go into the data section - data: ByteBuffer - /// Raw resource data, to go into the data section - resources: ByteBuffer - mutable entrypoint: (bool * int) option + /// Raw data, to go into the data section + data: ByteBuffer + /// Raw resource data, to go into the data section + resources: ByteBuffer + mutable entrypoint: (bool * int) option /// Caches trefCache: Dictionary - /// The following are all used to generate unique items in the output + /// The following are all used to generate unique items in the output tables: MetadataTable[] AssemblyRefs: MetadataTable fieldDefs: MetadataTable @@ -9445,16 +9445,16 @@ namespace ProviderImplementation.ProvidedTypes methodDefIdxs: Dictionary propertyDefs: MetadataTable eventDefs: MetadataTable - typeDefs: MetadataTable - guids: MetadataTable - blobs: MetadataTable - strings: MetadataTable + typeDefs: MetadataTable + guids: MetadataTable + blobs: MetadataTable + strings: MetadataTable userStrings: MetadataTable } member cenv.GetTable (tab:ILTableName) = cenv.tables.[tab.Index] - member cenv.AddCode ((reqdStringFixupsOffset, requiredStringFixups), code) = + member cenv.AddCode ((reqdStringFixupsOffset, requiredStringFixups), code) = cenv.requiredStringFixups.Add ((cenv.nextCodeAddr + reqdStringFixupsOffset, requiredStringFixups)) cenv.codeChunks.EmitBytes code cenv.nextCodeAddr <- cenv.nextCodeAddr + code.Length @@ -9471,24 +9471,24 @@ namespace ProviderImplementation.ProvidedTypes let AddUnsharedRow (cenv:cenv) tbl (x:UnsharedRow) = cenv.GetTable(tbl).AddUnsharedEntry x let metadataSchemaVersionSupportedByCLRVersion v = 2, 0 - - let headerVersionSupportedByCLRVersion v = - // The COM20HEADER version number - // Whidbey version numbers are 2.5 - // Earlier are 2.0 - // From an email from jeffschw: "Be built with a compiler that marks the COM20HEADER with Major >=2 and Minor >= 5. The V2.0 compilers produce images with 2.5, V1.x produces images with 2.0." + + let headerVersionSupportedByCLRVersion v = + // The COM20HEADER version number + // Whidbey version numbers are 2.5 + // Earlier are 2.0 + // From an email from jeffschw: "Be built with a compiler that marks the COM20HEADER with Major >=2 and Minor >= 5. The V2.0 compilers produce images with 2.5, V1.x produces images with 2.0." 2, 5 - let peOptionalHeaderByteByCLRVersion v = - // A flag in the PE file optional header seems to depend on CLI version - // Whidbey version numbers are 8 - // Earlier are 6 - // Tools are meant to ignore this, but the VS Profiler wants it to have the right value + let peOptionalHeaderByteByCLRVersion v = + // A flag in the PE file optional header seems to depend on CLI version + // Whidbey version numbers are 8 + // Earlier are 6 + // Tools are meant to ignore this, but the VS Profiler wants it to have the right value 8 - - // returned by writeBinaryAndReportMappings + + // returned by writeBinaryAndReportMappings [] - type ILTokenMappings = + type ILTokenMappings = { TypeDefTokenMap: ILTypeDef list * ILTypeDef -> int32 FieldDefTokenMap: ILTypeDef list * ILTypeDef -> ILFieldDef -> int32 MethodDefTokenMap: ILTypeDef list * ILTypeDef -> ILMethodDef -> int32 @@ -9496,295 +9496,295 @@ namespace ProviderImplementation.ProvidedTypes EventTokenMap: ILTypeDef list * ILTypeDef -> ILEventDef -> int32 } let recordRequiredDataFixup (requiredDataFixups: ResizeArray<_>) (buf: ByteBuffer) pos lab = - requiredDataFixups.Add((pos, lab)) - // Write a special value in that we check later when applying the fixup + requiredDataFixups.Add((pos, lab)) + // Write a special value in that we check later when applying the fixup buf.EmitInt32 0xdeaddddd //--------------------------------------------------------------------- // The UserString, BlobHeap, GuidHeap tables //--------------------------------------------------------------------- - let GetUserStringHeapIdx cenv s = + let GetUserStringHeapIdx cenv s = cenv.userStrings.FindOrAddSharedEntry s - let GetBytesAsBlobIdx cenv (bytes:byte[]) = - if bytes.Length = 0 then 0 + let GetBytesAsBlobIdx cenv (bytes:byte[]) = + if bytes.Length = 0 then 0 else cenv.blobs.FindOrAddSharedEntry bytes - let GetStringHeapIdx cenv s = - if s = "" then 0 + let GetStringHeapIdx cenv s = + if s = "" then 0 else cenv.strings.FindOrAddSharedEntry s let GetGuidIdx cenv info = cenv.guids.FindOrAddSharedEntry info let GetStringHeapIdxOption cenv sopt = - match sopt with + match sopt with | USome ns -> GetStringHeapIdx cenv ns | UNone -> 0 - let splitNameAt (nm:string) idx = + let splitNameAt (nm:string) idx = if idx < 0 then failwith "splitNameAt: idx < 0"; - let last = nm.Length - 1 + let last = nm.Length - 1 if idx > last then failwith "splitNameAt: idx > last"; (nm.Substring(0,idx)), (if idx < last then nm.Substring (idx+1,last - idx) else "") - module String = + module String = let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index for the character was not found in the string")) - let index (s:string) (c:char) = - let r = s.IndexOf(c) + let index (s:string) (c:char) = + let r = s.IndexOf(c) if r = -1 then indexNotFound() else r let rindex (s:string) (c:char) = - let r = s.LastIndexOf(c) + let r = s.LastIndexOf(c) if r = -1 then indexNotFound() else r - let contains (s:string) (c:char) = + let contains (s:string) (c:char) = s.IndexOf(c,0,String.length s) <> -1 - let splitTypeNameRightAux nm = - if String.contains nm '.' then + let splitTypeNameRightAux nm = + if String.contains nm '.' then let idx = String.rindex nm '.' let s1,s2 = splitNameAt nm idx - Some s1,s2 + Some s1,s2 else None, nm let splitTypeNameRight nm = splitTypeNameRightAux nm let GetTypeNameAsElemPair cenv (n1,n2) = - StringE (GetStringHeapIdxOption cenv n1), + StringE (GetStringHeapIdxOption cenv n1), StringE (GetStringHeapIdx cenv n2) //===================================================================== - // Pass 1 - allocate indexes for types + // Pass 1 - allocate indexes for types //===================================================================== let addILTypeName enc (td: ILTypeDef) = enc@[(if td.IsNested then td.Name else joinILTypeName td.Namespace td.Name)] - let rec GenTypeDefPass1 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass1 enc cenv (td:ILTypeDef) = ignore (cenv.typeDefs.AddUniqueEntry "type index" (fun (TdKey (_, _, n)) -> n) (TdKey (enc, td.Namespace, td.Name))) GenTypeDefsPass1 (addILTypeName enc td) cenv td.NestedTypes.Entries and GenTypeDefsPass1 enc cenv tds = Array.iter (GenTypeDefPass1 enc cenv) tds //===================================================================== - // Pass 2 - allocate indexes for methods and fields and write rows for types + // Pass 2 - allocate indexes for methods and fields and write rows for types //===================================================================== - let rec GetIdxForTypeDef cenv key = + let rec GetIdxForTypeDef cenv key = try cenv.typeDefs.GetTableEntry key - with - :? KeyNotFoundException -> + with + :? KeyNotFoundException -> let (TdKey (enc, nsp, n) ) = key failwithf "One of your modules expects the type '%s' to be defined within the module being emitted. keys = %A" (String.concat "." (enc@[joinILTypeName nsp n])) (cenv.typeDefs.GetTableKeys()) 0 - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Assembly and module references - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let rec GetAssemblyRefAsRow cenv (aref:ILAssemblyRef) = - AssemblyRefRow - ((match aref.Version with UNone -> 0us | USome v -> uint16 v.Major), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Minor), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Build), - (match aref.Version with UNone -> 0us | USome v -> uint16 v.Revision), + AssemblyRefRow + ((match aref.Version with UNone -> 0us | USome v -> uint16 v.Major), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Minor), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Build), + (match aref.Version with UNone -> 0us | USome v -> uint16 v.Revision), ((match aref.PublicKey with USome (PublicKey _) -> 0x0001 | _ -> 0x0000) - ||| (if aref.Retargetable then 0x0100 else 0x0000)), - BlobIndex (match aref.PublicKey with - | UNone -> 0 - | USome (PublicKey b | PublicKeyToken b) -> GetBytesAsBlobIdx cenv b), - StringIndex (GetStringHeapIdx cenv aref.Name), - StringIndex (match aref.Locale with UNone -> 0 | USome s -> GetStringHeapIdx cenv s), + ||| (if aref.Retargetable then 0x0100 else 0x0000)), + BlobIndex (match aref.PublicKey with + | UNone -> 0 + | USome (PublicKey b | PublicKeyToken b) -> GetBytesAsBlobIdx cenv b), + StringIndex (GetStringHeapIdx cenv aref.Name), + StringIndex (match aref.Locale with UNone -> 0 | USome s -> GetStringHeapIdx cenv s), BlobIndex (match aref.Hash with UNone -> 0 | USome s -> GetBytesAsBlobIdx cenv s)) - - and GetAssemblyRefAsIdx cenv aref = + + and GetAssemblyRefAsIdx cenv aref = FindOrAddSharedRow cenv ILTableNames.AssemblyRef (GetAssemblyRefAsRow cenv aref) and GetModuleRefAsRow cenv (mref:ILModuleRef) = - SharedRow + SharedRow [| StringE (GetStringHeapIdx cenv mref.Name) |] and GetModuleRefAsFileRow cenv (mref:ILModuleRef) = - SharedRow + SharedRow [| ULong (if mref.HasMetadata then 0x0000 else 0x0001) StringE (GetStringHeapIdx cenv mref.Name) (match mref.Hash with UNone -> Blob 0 | USome s -> Blob (GetBytesAsBlobIdx cenv s)) |] - and GetModuleRefAsIdx cenv mref = + and GetModuleRefAsIdx cenv mref = FindOrAddSharedRow cenv ILTableNames.ModuleRef (GetModuleRefAsRow cenv mref) - and GetModuleRefAsFileIdx cenv mref = + and GetModuleRefAsFileIdx cenv mref = FindOrAddSharedRow cenv ILTableNames.File (GetModuleRefAsFileRow cenv mref) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Does a ILScopeRef point to this module? - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let isScopeRefLocal scoref = (scoref = ILScopeRef.Local) + let isScopeRefLocal scoref = (scoref = ILScopeRef.Local) let rec isTypeRefLocal (tref:ILTypeRef) = - isILTypeScopeRefLocal tref.Scope + isILTypeScopeRefLocal tref.Scope and isILTypeScopeRefLocal (scoref:ILTypeRefScope) = - match scoref with + match scoref with | ILTypeRefScope.Top t -> isScopeRefLocal t | ILTypeRefScope.Nested tref -> isTypeRefLocal tref let rec enclosing (scoref:ILTypeRefScope) = - match scoref with + match scoref with | ILTypeRefScope.Top _ -> [] | ILTypeRefScope.Nested tref -> enclosing tref.Scope @ [joinILTypeName tref.Namespace tref.Name] let isTypeLocal (typ:ILType) = typ.IsNominal && isEmpty typ.GenericArgs && isTypeRefLocal typ.TypeRef - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Scopes to Implementation elements. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetScopeRefAsImplementationElem cenv scoref = - match scoref with + let GetScopeRefAsImplementationElem cenv scoref = + match scoref with | ILScopeRef.Local -> (ImplementationTag.AssemblyRef, 0) | ILScopeRef.Assembly aref -> (ImplementationTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) | ILScopeRef.Module mref -> (ImplementationTag.File, GetModuleRefAsFileIdx cenv mref) - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Type references, types etc. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetTypeRefAsTypeRefRow cenv (tref:ILTypeRef) = + let rec GetTypeRefAsTypeRefRow cenv (tref:ILTypeRef) = let nselem, nelem = GetTypeNameAsElemPair cenv (tref.Namespace, tref.Name) let rs1, rs2 = GetResolutionScopeAsElem cenv tref.Scope SharedRow [| ResolutionScope (rs1, rs2); nelem; nselem |] - and GetTypeRefAsTypeRefIdx cenv tref = + and GetTypeRefAsTypeRefIdx cenv tref = let mutable res = 0 - if cenv.trefCache.TryGetValue(tref, &res) then res else + if cenv.trefCache.TryGetValue(tref, &res) then res else let res = FindOrAddSharedRow cenv ILTableNames.TypeRef (GetTypeRefAsTypeRefRow cenv tref) cenv.trefCache.[tref] <- res res - and GetTypeDescAsTypeRefIdx cenv (enc, nsp, n) = + and GetTypeDescAsTypeRefIdx cenv (enc, nsp, n) = GetTypeRefAsTypeRefIdx cenv (ILTypeRef (enc, nsp, n)) - and GetResolutionScopeAsElem cenv scoref = - match scoref with - | ILTypeRefScope.Top s -> - match s with - | ILScopeRef.Local -> (ResolutionScopeTag.Module, 1) + and GetResolutionScopeAsElem cenv scoref = + match scoref with + | ILTypeRefScope.Top s -> + match s with + | ILScopeRef.Local -> (ResolutionScopeTag.Module, 1) | ILScopeRef.Assembly aref -> (ResolutionScopeTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) | ILScopeRef.Module mref -> (ResolutionScopeTag.ModuleRef, GetModuleRefAsIdx cenv mref) - - | ILTypeRefScope.Nested tref -> + + | ILTypeRefScope.Nested tref -> (ResolutionScopeTag.TypeRef, GetTypeRefAsTypeRefIdx cenv tref) - - let emitTypeInfoAsTypeDefOrRefEncoded cenv (bb: ByteBuffer) (scoref, nsp, nm) = - if isILTypeScopeRefLocal scoref then + + let emitTypeInfoAsTypeDefOrRefEncoded cenv (bb: ByteBuffer) (scoref, nsp, nm) = + if isILTypeScopeRefLocal scoref then let idx = GetIdxForTypeDef cenv (TdKey(enclosing scoref, nsp, nm)) - bb.EmitZ32 (idx <<< 2) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeDef - else + bb.EmitZ32 (idx <<< 2) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeDef + else let idx = GetTypeDescAsTypeRefIdx cenv (scoref, nsp, nm) - bb.EmitZ32 ((idx <<< 2) ||| 0x01) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeRef + bb.EmitZ32 ((idx <<< 2) ||| 0x01) // ECMA 22.2.8 TypeDefOrRefEncoded - ILTypeRef let getTypeDefOrRefAsUncodedToken (tag, idx) = - let tab = - if tag = TypeDefOrRefOrSpecTag.TypeDef then ILTableNames.TypeDef - elif tag = TypeDefOrRefOrSpecTag.TypeRef then ILTableNames.TypeRef + let tab = + if tag = TypeDefOrRefOrSpecTag.TypeDef then ILTableNames.TypeDef + elif tag = TypeDefOrRefOrSpecTag.TypeRef then ILTableNames.TypeRef elif tag = TypeDefOrRefOrSpecTag.TypeSpec then ILTableNames.TypeSpec else failwith "getTypeDefOrRefAsUncodedToken" getUncodedToken tab idx // REVIEW: write into an accumulating buffer - let EmitArrayShape (bb: ByteBuffer) (ILArrayShape shape) = + let EmitArrayShape (bb: ByteBuffer) (ILArrayShape shape) = let sized = Array.filter (function (_, Some _) -> true | _ -> false) shape let lobounded = Array.filter (function (Some _, _) -> true | _ -> false) shape bb.EmitZ32 shape.Length bb.EmitZ32 sized.Length sized |> Array.iter (function (_, Some sz) -> bb.EmitZ32 sz | _ -> failwith "?") bb.EmitZ32 lobounded.Length - lobounded |> Array.iter (function (Some low, _) -> bb.EmitZ32 low | _ -> failwith "?") - + lobounded |> Array.iter (function (Some low, _) -> bb.EmitZ32 low | _ -> failwith "?") + let hasthisToByte hasthis = - match hasthis with + match hasthis with | ILThisConvention.Instance -> e_IMAGE_CEE_CS_CALLCONV_INSTANCE | ILThisConvention.InstanceExplicit -> e_IMAGE_CEE_CS_CALLCONV_INSTANCE_EXPLICIT | ILThisConvention.Static -> 0x00uy - let callconvToByte ntypars (Callconv (hasthis, bcc)) = + let callconvToByte ntypars (Callconv (hasthis, bcc)) = hasthisToByte hasthis ||| (if ntypars > 0 then e_IMAGE_CEE_CS_CALLCONV_GENERIC else 0x00uy) ||| - (match bcc with + (match bcc with | ILArgConvention.FastCall -> e_IMAGE_CEE_CS_CALLCONV_FASTCALL | ILArgConvention.StdCall -> e_IMAGE_CEE_CS_CALLCONV_STDCALL | ILArgConvention.ThisCall -> e_IMAGE_CEE_CS_CALLCONV_THISCALL | ILArgConvention.CDecl -> e_IMAGE_CEE_CS_CALLCONV_CDECL | ILArgConvention.Default -> 0x00uy | ILArgConvention.VarArg -> e_IMAGE_CEE_CS_CALLCONV_VARARG) - + // REVIEW: write into an accumulating buffer - let rec EmitTypeSpec cenv env (bb: ByteBuffer) (et, tspec:ILTypeSpec) = - if isEmpty tspec.GenericArgs then + let rec EmitTypeSpec cenv env (bb: ByteBuffer) (et, tspec:ILTypeSpec) = + if isEmpty tspec.GenericArgs then bb.EmitByte et emitTypeInfoAsTypeDefOrRefEncoded cenv bb (tspec.Scope, tspec.Namespace, tspec.Name) - else + else bb.EmitByte et_WITH bb.EmitByte et emitTypeInfoAsTypeDefOrRefEncoded cenv bb (tspec.Scope, tspec.Namespace, tspec.Name) bb.EmitZ32 tspec.GenericArgs.Length EmitTypes cenv env bb tspec.GenericArgs - and GetTypeAsTypeDefOrRef cenv env (ty:ILType) = - if isTypeLocal ty then + and GetTypeAsTypeDefOrRef cenv env (ty:ILType) = + if isTypeLocal ty then let tref = ty.TypeRef (TypeDefOrRefOrSpecTag.TypeDef, GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name))) elif ty.IsNominal && isEmpty ty.GenericArgs then (TypeDefOrRefOrSpecTag.TypeRef, GetTypeRefAsTypeRefIdx cenv ty.TypeRef) - else + else (TypeDefOrRefOrSpecTag.TypeSpec, GetTypeAsTypeSpecIdx cenv env ty) and GetTypeAsBytes cenv env ty = emitBytesViaBuffer (fun bb -> EmitType cenv env bb ty) - and GetTypeOfLocalAsBytes cenv env (l: ILLocal) = + and GetTypeOfLocalAsBytes cenv env (l: ILLocal) = emitBytesViaBuffer (fun bb -> EmitLocalInfo cenv env bb l) - and GetTypeAsBlobIdx cenv env (ty:ILType) = + and GetTypeAsBlobIdx cenv env (ty:ILType) = GetBytesAsBlobIdx cenv (GetTypeAsBytes cenv env ty) - and GetTypeAsTypeSpecRow cenv env (ty:ILType) = + and GetTypeAsTypeSpecRow cenv env (ty:ILType) = SharedRow [| Blob (GetTypeAsBlobIdx cenv env ty) |] - and GetTypeAsTypeSpecIdx cenv env ty = + and GetTypeAsTypeSpecIdx cenv env ty = FindOrAddSharedRow cenv ILTableNames.TypeSpec (GetTypeAsTypeSpecRow cenv env ty) and EmitType cenv env bb ty = - match ty with + match ty with | ElementType et -> bb.EmitByte et | ILType.Boxed tspec -> EmitTypeSpec cenv env bb (et_CLASS, tspec) | ILType.Value tspec -> EmitTypeSpec cenv env bb (et_VALUETYPE, tspec) - | ILType.Array (shape, ty) -> + | ILType.Array (shape, ty) -> if shape = ILArrayShape.SingleDimensional then (bb.EmitByte et_SZARRAY ; EmitType cenv env bb ty) else (bb.EmitByte et_ARRAY; EmitType cenv env bb ty; EmitArrayShape bb shape) - | ILType.Var tv -> + | ILType.Var tv -> let cgparams = env.EnclosingTyparCount - if int32 tv < cgparams then + if int32 tv < cgparams then bb.EmitByte et_VAR bb.EmitZ32 (int32 tv) else bb.EmitByte et_MVAR bb.EmitZ32 (int32 tv - cgparams) - | ILType.Byref typ -> + | ILType.Byref typ -> bb.EmitByte et_BYREF EmitType cenv env bb typ - | ILType.Ptr typ -> + | ILType.Ptr typ -> bb.EmitByte et_PTR EmitType cenv env bb typ - | ILType.Void -> - bb.EmitByte et_VOID + | ILType.Void -> + bb.EmitByte et_VOID | ILType.FunctionPointer x -> bb.EmitByte et_FNPTR EmitCallsig cenv env bb (x.CallingConv, x.ArgTypes, x.ReturnType, None, 0) @@ -9794,31 +9794,31 @@ namespace ProviderImplementation.ProvidedTypes EmitType cenv env bb ty and EmitLocalInfo cenv env (bb:ByteBuffer) (l:ILLocal) = - if l.IsPinned then + if l.IsPinned then bb.EmitByte et_PINNED EmitType cenv env bb l.Type - and EmitCallsig cenv env (bb:ByteBuffer) (callconv, args:ILTypes, ret, varargs:ILVarArgs, genarity) = + and EmitCallsig cenv env (bb:ByteBuffer) (callconv, args:ILTypes, ret, varargs:ILVarArgs, genarity) = bb.EmitByte (callconvToByte genarity callconv) if genarity > 0 then bb.EmitZ32 genarity bb.EmitZ32 ((args.Length + (match varargs with None -> 0 | Some l -> l.Length))) EmitType cenv env bb ret args |> Array.iter (EmitType cenv env bb) - match varargs with - | None -> ()// no extra arg = no sentinel - | Some tys -> - if isEmpty tys then () // no extra arg = no sentinel - else + match varargs with + | None -> ()// no extra arg = no sentinel + | Some tys -> + if isEmpty tys then () // no extra arg = no sentinel + else bb.EmitByte et_SENTINEL Array.iter (EmitType cenv env bb) tys and GetCallsigAsBytes cenv env x = emitBytesViaBuffer (fun bb -> EmitCallsig cenv env bb x) - and EmitTypes cenv env bb (inst: ILTypes) = - inst |> Array.iter (EmitType cenv env bb) + and EmitTypes cenv env bb (inst: ILTypes) = + inst |> Array.iter (EmitType cenv env bb) let GetTypeAsMemberRefParent cenv env ty = - match GetTypeAsTypeDefOrRef cenv env ty with + match GetTypeAsTypeDefOrRef cenv env ty with | (tag, _) when tag = TypeDefOrRefOrSpecTag.TypeDef -> printfn "GetTypeAsMemberRefParent: mspec should have been encoded as mdtMethodDef?"; MemberRefParent (MemberRefParentTag.TypeRef, 1) | (tag, tok) when tag = TypeDefOrRefOrSpecTag.TypeRef -> MemberRefParent (MemberRefParentTag.TypeRef, tok) | (tag, tok) when tag = TypeDefOrRefOrSpecTag.TypeSpec -> MemberRefParent (MemberRefParentTag.TypeSpec, tok) @@ -9827,16 +9827,16 @@ namespace ProviderImplementation.ProvidedTypes - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Native types - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldInitAsBlobIdx cenv (x:ILFieldInit) = + let rec GetFieldInitAsBlobIdx cenv (x:ILFieldInit) = GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> GetFieldInit bb x)) // REVIEW: write into an accumulating buffer - and GetFieldInit (bb: ByteBuffer) x = - match x with + and GetFieldInit (bb: ByteBuffer) x = + match x with | :? string as b -> bb.EmitBytes (Encoding.Unicode.GetBytes b) | :? bool as b -> bb.EmitByte (if b then 0x01uy else 0x00uy) | :? char as x -> bb.EmitUInt16 (uint16 x) @@ -9852,10 +9852,10 @@ namespace ProviderImplementation.ProvidedTypes | :? double as x -> bb.EmitInt64 (bitsOfDouble x) | _ -> bb.EmitInt32 0 - and GetFieldInitFlags (i: ILFieldInit) = - UShort + and GetFieldInitFlags (i: ILFieldInit) = + UShort (uint16 - (match i with + (match i with | :? string -> et_STRING | :? bool -> et_BOOLEAN | :? char -> et_CHAR @@ -9870,13 +9870,13 @@ namespace ProviderImplementation.ProvidedTypes | :? single -> et_R4 | :? double -> et_R8 | _ -> et_CLASS)) - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Type definitions - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetMemberAccessFlags access = - match access with + let GetMemberAccessFlags access = + match access with | ILMemberAccess.CompilerControlled -> 0x00000000 | ILMemberAccess.Public -> 0x00000006 | ILMemberAccess.Private -> 0x00000001 @@ -9885,8 +9885,8 @@ namespace ProviderImplementation.ProvidedTypes | ILMemberAccess.FamilyOrAssembly -> 0x00000005 | ILMemberAccess.Assembly -> 0x00000003 - let GetTypeAccessFlags access = - match access with + let GetTypeAccessFlags access = + match access with | ILTypeDefAccess.Public -> 0x00000001 | ILTypeDefAccess.Private -> 0x00000000 | ILTypeDefAccess.Nested ILMemberAccess.Public -> 0x00000002 @@ -9897,20 +9897,20 @@ namespace ProviderImplementation.ProvidedTypes | ILTypeDefAccess.Nested ILMemberAccess.Assembly -> 0x00000005 | ILTypeDefAccess.Nested ILMemberAccess.CompilerControlled -> failwith "bad type access" - let rec GetTypeDefAsRow cenv env _enc (td:ILTypeDef) = + let rec GetTypeDefAsRow cenv env _enc (td:ILTypeDef) = let nselem, nelem = GetTypeNameAsElemPair cenv (td.Namespace, td.Name) - let flags = + let flags = if td.Name = "" then 0x00000000 else - + int td.Attributes ||| - begin - match td.Layout with + begin + match td.Layout with | ILTypeDefLayout.Auto -> 0x00000000 | ILTypeDefLayout.Sequential _ -> 0x00000008 | ILTypeDefLayout.Explicit _ -> 0x00000010 end ||| - begin + begin match td.Kind with | ILTypeDefKind.Interface -> 0x00000020 | _ -> 0x00000000 @@ -9922,98 +9922,98 @@ namespace ProviderImplementation.ProvidedTypes 0x0 let tdorTag, tdorRow = GetTypeOptionAsTypeDefOrRef cenv env td.Extends - UnsharedRow - [| ULong flags - nelem - nselem - TypeDefOrRefOrSpec (tdorTag, tdorRow) - SimpleIndex (ILTableNames.Field, cenv.fieldDefs.Count + 1) - SimpleIndex (ILTableNames.Method, cenv.methodDefIdxsByKey.Count + 1) |] - - and GetTypeOptionAsTypeDefOrRef cenv env tyOpt = + UnsharedRow + [| ULong flags + nelem + nselem + TypeDefOrRefOrSpec (tdorTag, tdorRow) + SimpleIndex (ILTableNames.Field, cenv.fieldDefs.Count + 1) + SimpleIndex (ILTableNames.Method, cenv.methodDefIdxsByKey.Count + 1) |] + + and GetTypeOptionAsTypeDefOrRef cenv env tyOpt = match tyOpt with | None -> (TypeDefOrRefOrSpecTag.TypeDef, 0) | Some ty -> (GetTypeAsTypeDefOrRef cenv env ty) - and GetTypeDefAsPropertyMapRow cenv tidx = + and GetTypeDefAsPropertyMapRow cenv tidx = UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) - SimpleIndex (ILTableNames.Property, cenv.propertyDefs.Count + 1) |] + SimpleIndex (ILTableNames.Property, cenv.propertyDefs.Count + 1) |] - and GetTypeDefAsEventMapRow cenv tidx = + and GetTypeDefAsEventMapRow cenv tidx = UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) - SimpleIndex (ILTableNames.Event, cenv.eventDefs.Count + 1) |] - - and GetKeyForFieldDef tidx (fd: ILFieldDef) = + SimpleIndex (ILTableNames.Event, cenv.eventDefs.Count + 1) |] + + and GetKeyForFieldDef tidx (fd: ILFieldDef) = FieldDefKey (tidx, fd.Name, fd.FieldType) - and GenFieldDefPass2 cenv tidx fd = + and GenFieldDefPass2 cenv tidx fd = ignore (cenv.fieldDefs.AddUniqueEntry "field" (fun (fdkey:FieldDefKey) -> fdkey.Name) (GetKeyForFieldDef tidx fd)) - and GetKeyForMethodDef tidx (md: ILMethodDef) = + and GetKeyForMethodDef tidx (md: ILMethodDef) = MethodDefKey (tidx, md.GenericParams.Length, md.Name, md.Return.Type, md.ParameterTypes, md.CallingConv.IsStatic) - and GenMethodDefPass2 cenv tidx md = - let idx = + and GenMethodDefPass2 cenv tidx md = + let idx = cenv.methodDefIdxsByKey.AddUniqueEntry - "method" - (fun (key:MethodDefKey) -> + "method" + (fun (key:MethodDefKey) -> printfn "Duplicate in method table is:" printfn "%s" (" Type index: "+string key.TypeIdx) printfn "%s" (" Method name: "+key.Name) printfn "%s" (" Method arity (num generic params): "+string key.GenericArity) key.Name ) - (GetKeyForMethodDef tidx md) - + (GetKeyForMethodDef tidx md) + cenv.methodDefIdxs.[md] <- idx - and GetKeyForPropertyDef tidx (x: ILPropertyDef) = + and GetKeyForPropertyDef tidx (x: ILPropertyDef) = PropKey (tidx, x.Name, x.PropertyType, x.IndexParameterTypes) - and GenPropertyDefPass2 cenv tidx x = + and GenPropertyDefPass2 cenv tidx x = ignore (cenv.propertyDefs.AddUniqueEntry "property" (fun (PropKey (_, n, _, _)) -> n) (GetKeyForPropertyDef tidx x)) and GetTypeAsImplementsRow cenv env tidx ty = let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env ty - UnsharedRow - [| SimpleIndex (ILTableNames.TypeDef, tidx) + UnsharedRow + [| SimpleIndex (ILTableNames.TypeDef, tidx) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] and GenImplementsPass2 cenv env tidx ty = AddUnsharedRow cenv ILTableNames.InterfaceImpl (GetTypeAsImplementsRow cenv env tidx ty) |> ignore - - and GetKeyForEvent tidx (x: ILEventDef) = + + and GetKeyForEvent tidx (x: ILEventDef) = EventKey (tidx, x.Name) - and GenEventDefPass2 cenv tidx x = + and GenEventDefPass2 cenv tidx x = ignore (cenv.eventDefs.AddUniqueEntry "event" (fun (EventKey(_, b)) -> b) (GetKeyForEvent tidx x)) and GenTypeDefPass2 pidx enc cenv (td:ILTypeDef) = - try + try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) let tidx2 = AddUnsharedRow cenv ILTableNames.TypeDef (GetTypeDefAsRow cenv env enc td) if tidx <> tidx2 then failwith "index of typedef on second pass does not match index on first pass" - // Add entries to auxiliary mapping tables, e.g. Nested, PropertyMap etc. - // Note Nested is organised differently to the others... + // Add entries to auxiliary mapping tables, e.g. Nested, PropertyMap etc. + // Note Nested is organised differently to the others... if not (isNil enc) then - AddUnsharedRow cenv ILTableNames.Nested - (UnsharedRow - [| SimpleIndex (ILTableNames.TypeDef, tidx) + AddUnsharedRow cenv ILTableNames.Nested + (UnsharedRow + [| SimpleIndex (ILTableNames.TypeDef, tidx) SimpleIndex (ILTableNames.TypeDef, pidx) |]) |> ignore let props = td.Properties.Entries - if not (isEmpty props) then - AddUnsharedRow cenv ILTableNames.PropertyMap (GetTypeDefAsPropertyMapRow cenv tidx) |> ignore + if not (isEmpty props) then + AddUnsharedRow cenv ILTableNames.PropertyMap (GetTypeDefAsPropertyMapRow cenv tidx) |> ignore let events = td.Events.Entries - if not (isEmpty events) then + if not (isEmpty events) then AddUnsharedRow cenv ILTableNames.EventMap (GetTypeDefAsEventMapRow cenv tidx) |> ignore - // 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. + // 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. td.Implements |> Array.iter (GenImplementsPass2 cenv env tidx) props |> Array.iter (GenPropertyDefPass2 cenv tidx) events |> Array.iter (GenEventDefPass2 cenv tidx) @@ -10031,56 +10031,56 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== exception MethodDefNotFound - let FindMethodDefIdx cenv mdkey = + let FindMethodDefIdx cenv mdkey = try cenv.methodDefIdxsByKey.GetTableEntry mdkey - with :? KeyNotFoundException -> - let typeNameOfIdx i = - match - (cenv.typeDefs.dict - |> Seq.fold (fun sofar kvp -> - let tkey2 = kvp.Key - let tidx2 = kvp.Value - if i = tidx2 then - if sofar = None then - Some tkey2 - else failwith "multiple type names map to index" - else sofar) None) with + with :? KeyNotFoundException -> + let typeNameOfIdx i = + match + (cenv.typeDefs.dict + |> Seq.fold (fun sofar kvp -> + let tkey2 = kvp.Key + let tidx2 = kvp.Value + if i = tidx2 then + if sofar = None then + Some tkey2 + else failwith "multiple type names map to index" + else sofar) None) with | Some x -> x - | None -> raise MethodDefNotFound + | None -> raise MethodDefNotFound let (TdKey (tenc, tnsp, tname)) = typeNameOfIdx mdkey.TypeIdx printfn "%s" ("The local method '"+(String.concat "." (tenc@[tname]))+"'::'"+mdkey.Name+"' was referenced but not declared") printfn "generic arity: %s " (string mdkey.GenericArity) - cenv.methodDefIdxsByKey.dict |> Seq.iter (fun (KeyValue(mdkey2, _)) -> - if mdkey2.TypeIdx = mdkey.TypeIdx && mdkey.Name = mdkey2.Name then + cenv.methodDefIdxsByKey.dict |> Seq.iter (fun (KeyValue(mdkey2, _)) -> + if mdkey2.TypeIdx = mdkey.TypeIdx && mdkey.Name = mdkey2.Name then let (TdKey (tenc2, tnsp2, tname2)) = typeNameOfIdx mdkey2.TypeIdx printfn "%s" ("A method in '"+(String.concat "." (tenc2@[tname2]))+"' had the right name but the wrong signature:") - printfn "%s" ("generic arity: "+string mdkey2.GenericArity) + printfn "%s" ("generic arity: "+string mdkey2.GenericArity) printfn "mdkey2 = %s" (mdkey2.ToString())) raise MethodDefNotFound - let rec GetMethodDefIdx cenv md = + let rec GetMethodDefIdx cenv md = cenv.methodDefIdxs.[md] - and FindFieldDefIdx cenv fdkey = - try cenv.fieldDefs.GetTableEntry fdkey - with :? KeyNotFoundException -> + and FindFieldDefIdx cenv fdkey = + try cenv.fieldDefs.GetTableEntry fdkey + with :? KeyNotFoundException -> failwith ("The local field "+fdkey.Name+" was referenced but not declared") 1 - and GetFieldDefAsFieldDefIdx cenv tidx fd = - FindFieldDefIdx cenv (GetKeyForFieldDef tidx fd) + and GetFieldDefAsFieldDefIdx cenv tidx fd = + FindFieldDefIdx cenv (GetKeyForFieldDef tidx fd) - // -------------------------------------------------------------------- - // ILMethodRef --> ILMethodDef. - // - // Only successfully converts ILMethodRef's referring to + // -------------------------------------------------------------------- + // ILMethodRef --> ILMethodDef. + // + // Only successfully converts ILMethodRef's referring to // methods in the module being emitted. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let GetMethodRefAsMethodDefIdx cenv (mref:ILMethodRef) = let tref = mref.EnclosingTypeRef - try + try if not (isTypeRefLocal tref) then failwithf "method referred to by method impl, event or property is not in a type defined in this module, method ref is %A" mref let tidx = GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name)) @@ -10090,14 +10090,14 @@ namespace ProviderImplementation.ProvidedTypes failwithf "Error in GetMethodRefAsMethodDefIdx for mref = %A, error: %s" (mref.Name, tref.Name) e.Message let rec MethodRefInfoAsMemberRefRow cenv env fenv (nm, typ, callconv, args, ret, varargs, genarity) = - MemberRefRow(GetTypeAsMemberRefParent cenv env typ, - GetStringHeapIdx cenv nm, + MemberRefRow(GetTypeAsMemberRefParent cenv env typ, + GetStringHeapIdx cenv nm, GetMethodRefInfoAsBlobIdx cenv fenv (callconv, args, ret, varargs, genarity)) - and GetMethodRefInfoAsBlobIdx cenv env info = + and GetMethodRefInfoAsBlobIdx cenv env info = GetBytesAsBlobIdx cenv (GetCallsigAsBytes cenv env info) - let GetMethodRefInfoAsMemberRefIdx cenv env ((_, typ, _, _, _, _, _) as minfo) = + let GetMethodRefInfoAsMemberRefIdx cenv env ((_, typ, _, _, _, _, _) as minfo) = let fenv = envForMethodRef env typ FindOrAddSharedRow cenv ILTableNames.MemberRef (MethodRefInfoAsMemberRefRow cenv env fenv minfo) @@ -10109,39 +10109,39 @@ namespace ProviderImplementation.ProvidedTypes else (MethodDefOrRefTag.MemberRef, GetMethodRefInfoAsMemberRefIdx cenv env minfo) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodSpec --> ILMethodRef/ILMethodDef/ILMethodSpec - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetMethodSpecInfoAsMethodSpecIdx cenv env (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = + let rec GetMethodSpecInfoAsMethodSpecIdx cenv env (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = let mdorTag, mdorRow = GetMethodRefInfoAsMethodRefOrDef false cenv env (nm, typ, cc, args, ret, varargs, minst.Length) - let blob = - emitBytesViaBuffer (fun bb -> + let blob = + emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_GENERICINST bb.EmitZ32 minst.Length minst |> Array.iter (EmitType cenv env bb)) - FindOrAddSharedRow cenv ILTableNames.MethodSpec - (SharedRow + FindOrAddSharedRow cenv ILTableNames.MethodSpec + (SharedRow [| MethodDefOrRef (mdorTag, mdorRow) Blob (GetBytesAsBlobIdx cenv blob) |]) and GetMethodDefOrRefAsUncodedToken (tag, idx) = - let tab = + let tab = if tag = MethodDefOrRefTag.MethodDef then ILTableNames.Method - elif tag = MethodDefOrRefTag.MemberRef then ILTableNames.MemberRef + elif tag = MethodDefOrRefTag.MemberRef then ILTableNames.MemberRef else failwith "GetMethodDefOrRefAsUncodedToken" getUncodedToken tab idx and GetMethodSpecInfoAsUncodedToken cenv env ((_, _, _, _, _, _, minst:ILGenericArgs) as minfo) = - if minst.Length > 0 then + if minst.Length > 0 then getUncodedToken ILTableNames.MethodSpec (GetMethodSpecInfoAsMethodSpecIdx cenv env minfo) - else + else GetMethodDefOrRefAsUncodedToken (GetMethodRefInfoAsMethodRefOrDef false cenv env (GetMethodRefInfoOfMethodSpecInfo minfo)) - and GetMethodSpecAsUncodedToken cenv env mspec = + and GetMethodSpecAsUncodedToken cenv env mspec = GetMethodSpecInfoAsUncodedToken cenv env (InfoOfMethodSpec mspec) - and GetMethodRefInfoOfMethodSpecInfo (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = + and GetMethodRefInfoOfMethodSpecInfo (nm, typ, cc, args, ret, varargs, minst:ILGenericArgs) = (nm, typ, cc, args, ret, varargs, minst.Length) and GetMethodSpecAsMethodDefOrRef cenv env (mspec, varargs) = @@ -10150,42 +10150,42 @@ namespace ProviderImplementation.ProvidedTypes and GetMethodSpecAsMethodDef cenv env (mspec, varargs) = GetMethodRefInfoAsMethodRefOrDef true cenv env (GetMethodRefInfoOfMethodSpecInfo (InfoOfMethodSpec (mspec, varargs))) - and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) = - (mspec.Name, - mspec.EnclosingType, - mspec.CallingConv, - mspec.MethodRef.ArgTypes, - mspec.FormalReturnType, - varargs, + and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) = + (mspec.Name, + mspec.EnclosingType, + mspec.CallingConv, + mspec.MethodRef.ArgTypes, + mspec.FormalReturnType, + varargs, mspec.GenericArgs) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // method_in_parent --> ILMethodRef/ILMethodDef - // + // // Used for MethodImpls. // -------------------------------------------------------------------- - let rec GetOverridesSpecAsMemberRefIdx cenv env ospec = + let rec GetOverridesSpecAsMemberRefIdx cenv env ospec = let fenv = envForOverrideSpec ospec let row = MethodRefInfoAsMemberRefRow cenv env fenv (ospec.MethodRef.Name, ospec.EnclosingType, ospec.MethodRef.CallingConv, ospec.MethodRef.ArgTypes, ospec.MethodRef.ReturnType, None, ospec.MethodRef.GenericArity) FindOrAddSharedRow cenv ILTableNames.MemberRef row - + and GetOverridesSpecAsMethodDefOrRef cenv env (ospec:ILOverridesSpec) = let typ = ospec.EnclosingType - if isTypeLocal typ then - if not typ.IsNominal then failwith "GetOverridesSpecAsMethodDefOrRef: unexpected local tref-typ" + if isTypeLocal typ then + if not typ.IsNominal then failwith "GetOverridesSpecAsMethodDefOrRef: unexpected local tref-typ" try (MethodDefOrRefTag.MethodDef, GetMethodRefAsMethodDefIdx cenv ospec.MethodRef) - with MethodDefNotFound -> (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) - else - (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) + with MethodDefNotFound -> (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) + else + (MethodDefOrRefTag.MemberRef, GetOverridesSpecAsMemberRefIdx cenv env ospec) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodRef --> ILMethodRef/ILMethodDef - // + // // Used for Custom Attrs. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref:ILMethodRef) = + let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref:ILMethodRef) = let row = MethodRefInfoAsMemberRefRow cenv env fenv (mref.Name, ILType.Boxed (ILTypeSpec (mref.EnclosingTypeRef, [| |])), mref.CallingConv, mref.ArgTypes, mref.ReturnType, None, mref.GenericArity) FindOrAddSharedRow cenv ILTableNames.MemberRef row @@ -10198,14 +10198,14 @@ namespace ProviderImplementation.ProvidedTypes else (CustomAttributeTypeTag.MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mref) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILCustomAttrs --> CustomAttribute rows - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetCustomAttrDataAsBlobIdx cenv (data:byte[]) = + let rec GetCustomAttrDataAsBlobIdx cenv (data:byte[]) = if data.Length = 0 then 0 else GetBytesAsBlobIdx cenv data - and GetCustomAttrRow cenv hca attr = + and GetCustomAttrRow cenv hca attr = let cat = GetMethodRefAsCustomAttribType cenv attr.Method.MethodRef for element in attr.Elements do match element with @@ -10218,13 +10218,13 @@ namespace ProviderImplementation.ProvidedTypes Blob (GetCustomAttrDataAsBlobIdx cenv attr.Data) |] - and GenCustomAttrPass3Or4 cenv hca attr = + and GenCustomAttrPass3Or4 cenv hca attr = AddUnsharedRow cenv ILTableNames.CustomAttribute (GetCustomAttrRow cenv hca attr) |> ignore - and GenCustomAttrsPass3Or4 cenv hca (attrs: ILCustomAttrs) = - attrs.Entries |> Array.iter (GenCustomAttrPass3Or4 cenv hca) + and GenCustomAttrsPass3Or4 cenv hca (attrs: ILCustomAttrs) = + attrs.Entries |> Array.iter (GenCustomAttrPass3Or4 cenv hca) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILPermissionSet --> DeclSecurity rows // -------------------------------------------------------------------- *) @@ -10242,28 +10242,28 @@ namespace ProviderImplementation.ProvidedTypes List.iter (GenSecurityDeclPass3 cenv hds) attrs #endif - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILFieldSpec --> FieldRef or ILFieldDef row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldSpecAsMemberRefRow cenv env fenv (fspec:ILFieldSpec) = - MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.EnclosingType, - GetStringHeapIdx cenv fspec.Name, + let rec GetFieldSpecAsMemberRefRow cenv env fenv (fspec:ILFieldSpec) = + MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.EnclosingType, + GetStringHeapIdx cenv fspec.Name, GetFieldSpecSigAsBlobIdx cenv fenv fspec) - and GetFieldSpecAsMemberRefIdx cenv env fspec = + and GetFieldSpecAsMemberRefIdx cenv env fspec = let fenv = envForFieldSpec fspec FindOrAddSharedRow cenv ILTableNames.MemberRef (GetFieldSpecAsMemberRefRow cenv env fenv fspec) // REVIEW: write into an accumulating buffer - and EmitFieldSpecSig cenv env (bb: ByteBuffer) (fspec:ILFieldSpec) = + and EmitFieldSpecSig cenv env (bb: ByteBuffer) (fspec:ILFieldSpec) = bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD EmitType cenv env bb fspec.FormalType - and GetFieldSpecSigAsBytes cenv env x = - emitBytesViaBuffer (fun bb -> EmitFieldSpecSig cenv env bb x) + and GetFieldSpecSigAsBytes cenv env x = + emitBytesViaBuffer (fun bb -> EmitFieldSpecSig cenv env bb x) - and GetFieldSpecSigAsBlobIdx cenv env x = + and GetFieldSpecSigAsBlobIdx cenv env x = GetBytesAsBlobIdx cenv (GetFieldSpecSigAsBytes cenv env x) and GetFieldSpecAsFieldDefOrRef cenv env (fspec:ILFieldSpec) = @@ -10274,82 +10274,82 @@ namespace ProviderImplementation.ProvidedTypes let tidx = GetIdxForTypeDef cenv (TdKey(enclosing tref.Scope, tref.Namespace, tref.Name)) let fdkey = FieldDefKey (tidx, fspec.Name, fspec.FormalType) (true, FindFieldDefIdx cenv fdkey) - else + else (false, GetFieldSpecAsMemberRefIdx cenv env fspec) and GetFieldDefOrRefAsUncodedToken (tag, idx) = let tab = if tag then ILTableNames.Field else ILTableNames.MemberRef getUncodedToken tab idx - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // callsig --> StandAloneSig - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetCallsigAsBlobIdx cenv env (callsig:ILCallingSignature, varargs) = - GetBytesAsBlobIdx cenv - (GetCallsigAsBytes cenv env (callsig.CallingConv, - callsig.ArgTypes, + let GetCallsigAsBlobIdx cenv env (callsig:ILCallingSignature, varargs) = + GetBytesAsBlobIdx cenv + (GetCallsigAsBytes cenv env (callsig.CallingConv, + callsig.ArgTypes, callsig.ReturnType, varargs, 0)) - - let GetCallsigAsStandAloneSigRow cenv env x = + + let GetCallsigAsStandAloneSigRow cenv env x = SharedRow [| Blob (GetCallsigAsBlobIdx cenv env x) |] - let GetCallsigAsStandAloneSigIdx cenv env info = + let GetCallsigAsStandAloneSigIdx cenv env info = FindOrAddSharedRow cenv ILTableNames.StandAloneSig (GetCallsigAsStandAloneSigRow cenv env info) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // local signatures --> BlobHeap idx - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let EmitLocalSig cenv env (bb: ByteBuffer) (locals: ILLocals) = + let EmitLocalSig cenv env (bb: ByteBuffer) (locals: ILLocals) = bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_LOCAL_SIG bb.EmitZ32 locals.Length locals |> Array.iter (EmitLocalInfo cenv env bb) - let GetLocalSigAsBlobHeapIdx cenv env locals = + let GetLocalSigAsBlobHeapIdx cenv env locals = GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> EmitLocalSig cenv env bb locals)) - let GetLocalSigAsStandAloneSigIdx cenv env locals = + let GetLocalSigAsStandAloneSigIdx cenv env locals = SharedRow [| Blob (GetLocalSigAsBlobHeapIdx cenv env locals) |] - type ExceptionClauseKind = - | FinallyClause - | FaultClause - | TypeFilterClause of int32 + type ExceptionClauseKind = + | FinallyClause + | FaultClause + | TypeFilterClause of int32 | FilterClause of int type ExceptionClauseSpec = (int * int * int * int * ExceptionClauseKind) - type CodeBuffer = + type CodeBuffer = - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Buffer to write results of emitting code into. Also record: // - branch sources (where fixups will occur) // - possible branch destinations // - locations of embedded handles into the string table // - the exception table - // -------------------------------------------------------------------- - { code: ByteBuffer - /// (instruction; optional short form); start of instr in code buffer; code loc for the end of the instruction the fixup resides in ; where is the destination of the fixup + // -------------------------------------------------------------------- + { code: ByteBuffer + /// (instruction; optional short form); start of instr in code buffer; code loc for the end of the instruction the fixup resides in ; where is the destination of the fixup mutable reqdBrFixups: ResizeArray<((int * int option) * int * ILCodeLabel list)> - availBrFixups: Dictionary - /// code loc to fixup in code buffer + availBrFixups: Dictionary + /// code loc to fixup in code buffer mutable reqdStringFixupsInMethod: ResizeArray<(int * int)> - /// data for exception handling clauses + /// data for exception handling clauses mutable seh: ResizeArray #if DEBUG_INFO seqpoints: ResizeArray #endif } - static member Create _nm = + static member Create _nm = { seh = ResizeArray() code= ByteBuffer.Create 200 reqdBrFixups= ResizeArray() reqdStringFixupsInMethod=ResizeArray() - availBrFixups = Dictionary<_, _>(10, HashIdentity.Structural) + availBrFixups = Dictionary<_, _>(10, HashIdentity.Structural) #if DEBUG_INFO seqpoints = new ResizeArray<_>(10) #endif @@ -10378,51 +10378,51 @@ namespace ProviderImplementation.ProvidedTypes member codebuf.EmitUncodedToken u = codebuf.EmitInt32 u - member codebuf.RecordReqdStringFixup stringidx = + member codebuf.RecordReqdStringFixup stringidx = codebuf.reqdStringFixupsInMethod.Add((codebuf.code.Position, stringidx)) - // Write a special value in that we check later when applying the fixup + // Write a special value in that we check later when applying the fixup codebuf.EmitInt32 0xdeadbeef - member codebuf.RecordReqdBrFixups i tgs = + member codebuf.RecordReqdBrFixups i tgs = codebuf.reqdBrFixups.Add ((i, codebuf.code.Position, tgs)) - // Write a special value in that we check later when applying the fixup - // Value is 0x11 {deadbbbb}* where 11 is for the instruction and deadbbbb is for each target - codebuf.EmitByte 0x11 // for the instruction - (if fst i = i_switch then + // Write a special value in that we check later when applying the fixup + // Value is 0x11 {deadbbbb}* where 11 is for the instruction and deadbbbb is for each target + codebuf.EmitByte 0x11 // for the instruction + (if fst i = i_switch then codebuf.EmitInt32 tgs.Length) List.iter (fun _ -> codebuf.EmitInt32 0xdeadbbbb) tgs member codebuf.RecordReqdBrFixup i tg = codebuf.RecordReqdBrFixups i [tg] - member codebuf.RecordAvailBrFixup tg = + member codebuf.RecordAvailBrFixup tg = codebuf.availBrFixups.[tg] <- codebuf.code.Position - module Codebuf = - // -------------------------------------------------------------------- + module Codebuf = + // -------------------------------------------------------------------- // Applying branch fixups. Use short versions of instructions // wherever possible. Sadly we can only determine if we can use a short - // version after we've layed out the code for all other instructions. - // This in turn means that using a short version may change + // version after we've layed out the code for all other instructions. + // This in turn means that using a short version may change // the various offsets into the code. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let binaryChop p (arr: 'T[]) = + let binaryChop p (arr: 'T[]) = let rec go n m = if n > m then raise (KeyNotFoundException("binary chop did not find element")) - else + else let i = (n+m)/2 - let c = p arr.[i] + let c = p arr.[i] if c = 0 then i elif c < 0 then go n (i-1) else go (i+1) m go 0 (Array.length arr) - let applyBrFixups (origCode :byte[]) origExnClauses origReqdStringFixups (origAvailBrFixups: Dictionary) origReqdBrFixups = + let applyBrFixups (origCode :byte[]) origExnClauses origReqdStringFixups (origAvailBrFixups: Dictionary) origReqdBrFixups = let orderedOrigReqdBrFixups = origReqdBrFixups |> Array.sortBy (fun (_, fixuploc, _) -> fixuploc) let newCode = ByteBuffer.Create origCode.Length - // Copy over all the code, working out whether the branches will be short - // or long and adjusting the branch destinations. Record an adjust function to adjust all the other - // gumpf that refers to fixed offsets in the code stream. - let newCode, newReqdBrFixups, adjuster = + // Copy over all the code, working out whether the branches will be short + // or long and adjusting the branch destinations. Record an adjust function to adjust all the other + // gumpf that refers to fixed offsets in the code stream. + let newCode, newReqdBrFixups, adjuster = let remainingReqdFixups = ref (Array.toList orderedOrigReqdBrFixups) let origWhere = ref 0 let newWhere = ref 0 @@ -10432,32 +10432,32 @@ namespace ProviderImplementation.ProvidedTypes let adjustments = ref [] while (not (isNil !remainingReqdFixups) || not !doneLast) do - let doingLast = isNil !remainingReqdFixups + let doingLast = isNil !remainingReqdFixups let origStartOfNoBranchBlock = !origWhere let newStartOfNoBranchBlock = !newWhere - let origEndOfNoBranchBlock = + let origEndOfNoBranchBlock = if doingLast then origCode.Length - else + else let (_, origStartOfInstr, _) = List.head !remainingReqdFixups origStartOfInstr - // Copy over a chunk of non-branching code + // Copy over a chunk of non-branching code let nobranch_len = origEndOfNoBranchBlock - origStartOfNoBranchBlock newCode.EmitBytes origCode.[origStartOfNoBranchBlock..origStartOfNoBranchBlock+nobranch_len-1] - - // Record how to adjust addresses in this range, including the branch instruction - // we write below, or the end of the method if we're doing the last bblock + + // Record how to adjust addresses in this range, including the branch instruction + // we write below, or the end of the method if we're doing the last bblock adjustments := (origStartOfNoBranchBlock, origEndOfNoBranchBlock, newStartOfNoBranchBlock) :: !adjustments - - // Increment locations to the branch instruction we're really interested in + + // Increment locations to the branch instruction we're really interested in origWhere := origEndOfNoBranchBlock newWhere := !newWhere + nobranch_len - - // Now do the branch instruction. Decide whether the fixup will be short or long in the new code - if doingLast then + + // Now do the branch instruction. Decide whether the fixup will be short or long in the new code + if doingLast then doneLast := true - else + else let (i, origStartOfInstr, tgs:ILCodeLabel list) = List.head !remainingReqdFixups remainingReqdFixups := List.tail !remainingReqdFixups if origCode.[origStartOfInstr] <> 0x11uy then failwith "br fixup sanity check failed (1)" @@ -10467,84 +10467,84 @@ namespace ProviderImplementation.ProvidedTypes let origEndOfInstr = origStartOfInstr + i_length + 4 * tgs.Length let newEndOfInstrIfSmall = !newWhere + i_length + 1 let newEndOfInstrIfBig = !newWhere + i_length + 4 * tgs.Length - - let short = - match i, tgs with - | (_, Some i_short), [tg] + + let short = + match i, tgs with + | (_, Some i_short), [tg] when - begin - // Use the original offsets to compute if the branch is small or large. This is - // a safe approximation because code only gets smaller. - if not (origAvailBrFixups.ContainsKey tg) then + begin + // Use the original offsets to compute if the branch is small or large. This is + // a safe approximation because code only gets smaller. + if not (origAvailBrFixups.ContainsKey tg) then printfn "%s" ("branch target " + formatCodeLabel tg + " not found in code") - let origDest = + let origDest = if origAvailBrFixups.ContainsKey tg then origAvailBrFixups.[tg] else 666666 let origRelOffset = origDest - origEndOfInstr -128 <= origRelOffset && origRelOffset <= 127 - end + end -> newCode.EmitIntAsByte i_short true | (i_long, _), _ -> newCode.EmitIntAsByte i_long - (if i_long = i_switch then + (if i_long = i_switch then newCode.EmitInt32 tgs.Length) false - + newWhere := !newWhere + i_length if !newWhere <> newCode.Position then printfn "mismatch between newWhere and newCode" tgs |> List.iter (fun tg -> let origFixupLoc = !origWhere checkFixup32 origCode origFixupLoc 0xdeadbbbb - - if short then + + if short then newReqdBrFixups := (!newWhere, newEndOfInstrIfSmall, tg, true) :: !newReqdBrFixups newCode.EmitIntAsByte 0x98 (* sanity check *) newWhere := !newWhere + 1 - else + else newReqdBrFixups := (!newWhere, newEndOfInstrIfBig, tg, false) :: !newReqdBrFixups newCode.EmitInt32 0xf00dd00f (* sanity check *) newWhere := !newWhere + 4 if !newWhere <> newCode.Position then printfn "mismatch between newWhere and newCode" origWhere := !origWhere + 4) - + if !origWhere <> origEndOfInstr then printfn "mismatch between origWhere and origEndOfInstr" - let adjuster = + let adjuster = let arr = Array.ofList (List.rev !adjustments) - fun addr -> - let i = - try binaryChop (fun (a1, a2, _) -> if addr < a1 then -1 elif addr > a2 then 1 else 0) arr - with - :? KeyNotFoundException -> + fun addr -> + let i = + try binaryChop (fun (a1, a2, _) -> if addr < a1 then -1 elif addr > a2 then 1 else 0) arr + with + :? KeyNotFoundException -> failwith ("adjuster: address "+string addr+" is out of range") let (origStartOfNoBranchBlock, _, newStartOfNoBranchBlock) = arr.[i] - addr - (origStartOfNoBranchBlock - newStartOfNoBranchBlock) + addr - (origStartOfNoBranchBlock - newStartOfNoBranchBlock) - newCode.Close(), - List.toArray !newReqdBrFixups, + newCode.Close(), + List.toArray !newReqdBrFixups, adjuster - // Now adjust everything - let newAvailBrFixups = - let tab = Dictionary<_, _>(10, HashIdentity.Structural) - for (KeyValue(tglab, origBrDest)) in origAvailBrFixups do + // Now adjust everything + let newAvailBrFixups = + let tab = Dictionary<_, _>(10, HashIdentity.Structural) + for (KeyValue(tglab, origBrDest)) in origAvailBrFixups do tab.[tglab] <- adjuster origBrDest tab let newReqdStringFixups = Array.map (fun (origFixupLoc, stok) -> adjuster origFixupLoc, stok) origReqdStringFixups #if EMIT_DEBUG_INFO let newSeqPoints = Array.map (fun (sp:PdbSequencePoint) -> {sp with Offset=adjuster sp.Offset}) origSeqPoints #endif - let newExnClauses = + let newExnClauses = origExnClauses |> Array.map (fun (st1, sz1, st2, sz2, kind) -> - (adjuster st1, (adjuster (st1 + sz1) - adjuster st1), - adjuster st2, (adjuster (st2 + sz2) - adjuster st2), - (match kind with + (adjuster st1, (adjuster (st1 + sz1) - adjuster st1), + adjuster st2, (adjuster (st2 + sz2) - adjuster st2), + (match kind with | FinallyClause | FaultClause | TypeFilterClause _ -> kind | FilterClause n -> FilterClause (adjuster n)))) - + #if EMIT_DEBUG_INFO let newScopes = let rec remap scope = @@ -10554,17 +10554,17 @@ namespace ProviderImplementation.ProvidedTypes Array.map remap origScopes #endif - // Now apply the adjusted fixups in the new code + // Now apply the adjusted fixups in the new code newReqdBrFixups |> Array.iter (fun (newFixupLoc, endOfInstr, tg, small) -> - if not (newAvailBrFixups.ContainsKey tg) then + if not (newAvailBrFixups.ContainsKey tg) then failwith ("target "+formatCodeLabel tg+" not found in new fixups") - try + try let n = newAvailBrFixups.[tg] let relOffset = (n - endOfInstr) - if small then + if small then if Bytes.get newCode newFixupLoc <> 0x98 then failwith "br fixupsanity check failed" newCode.[newFixupLoc] <- b0 relOffset - else + else checkFixup32 newCode newFixupLoc 0xf00dd00fl applyFixup32 newCode newFixupLoc relOffset with :? KeyNotFoundException -> ()) @@ -10572,91 +10572,91 @@ namespace ProviderImplementation.ProvidedTypes newCode, newReqdStringFixups, newExnClauses - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Structured residue of emitting instructions: SEH exception handling // and scopes for local variables. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - // Emitting instructions generates a tree of seh specifications - // We then emit the exception handling specs separately. - // nb. ECMA spec says the SEH blocks must be returned inside-out - type SEHTree = + // Emitting instructions generates a tree of seh specifications + // We then emit the exception handling specs separately. + // nb. ECMA spec says the SEH blocks must be returned inside-out + type SEHTree = | Node of ExceptionClauseSpec option * SEHTree[] - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // Table of encodings for instructions without arguments, also indexes // for all instructions. - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- let encodingsForNoArgInstrs = Dictionary<_, _>(300, HashIdentity.Structural) - let _ = - List.iter + let _ = + List.iter (fun (x, mk) -> encodingsForNoArgInstrs.[mk] <- x) (noArgInstrs.Force()) let encodingsOfNoArgInstr si = encodingsForNoArgInstrs.[si] - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // Emit instructions - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /// Emit the code for an instruction - let emitInstrCode (codebuf: CodeBuffer) i = - if i > 0xFF then - assert (i >>> 8 = 0xFE) - codebuf.EmitByte ((i >>> 8) &&& 0xFF) - codebuf.EmitByte (i &&& 0xFF) - else + let emitInstrCode (codebuf: CodeBuffer) i = + if i > 0xFF then + assert (i >>> 8 = 0xFE) + codebuf.EmitByte ((i >>> 8) &&& 0xFF) + codebuf.EmitByte (i &&& 0xFF) + else codebuf.EmitByte i - let emitTypeInstr cenv codebuf env i ty = - emitInstrCode codebuf i + let emitTypeInstr cenv codebuf env i ty = + emitInstrCode codebuf i codebuf.EmitUncodedToken (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env ty)) - let emitMethodSpecInfoInstr cenv codebuf env i mspecinfo = - emitInstrCode codebuf i + let emitMethodSpecInfoInstr cenv codebuf env i mspecinfo = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetMethodSpecInfoAsUncodedToken cenv env mspecinfo) - let emitMethodSpecInstr cenv codebuf env i mspec = - emitInstrCode codebuf i + let emitMethodSpecInstr cenv codebuf env i mspec = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetMethodSpecAsUncodedToken cenv env mspec) - let emitFieldSpecInstr cenv codebuf env i fspec = - emitInstrCode codebuf i + let emitFieldSpecInstr cenv codebuf env i fspec = + emitInstrCode codebuf i codebuf.EmitUncodedToken (GetFieldDefOrRefAsUncodedToken (GetFieldSpecAsFieldDefOrRef cenv env fspec)) - let emitShortUInt16Instr codebuf (i_short, i) x = + let emitShortUInt16Instr codebuf (i_short, i) x = let n = int32 x - if n <= 255 then - emitInstrCode codebuf i_short + if n <= 255 then + emitInstrCode codebuf i_short codebuf.EmitByte n - else - emitInstrCode codebuf i + else + emitInstrCode codebuf i codebuf.EmitUInt16 x - let emitShortInt32Instr codebuf (i_short, i) x = - if x >= (-128) && x <= 127 then - emitInstrCode codebuf i_short + let emitShortInt32Instr codebuf (i_short, i) x = + if x >= (-128) && x <= 127 then + emitInstrCode codebuf i_short codebuf.EmitByte (if x < 0x0 then x + 256 else x) - else - emitInstrCode codebuf i + else + emitInstrCode codebuf i codebuf.EmitInt32 x - let emitTailness (cenv: cenv) codebuf tl = + let emitTailness (cenv: cenv) codebuf tl = if tl = Tailcall && cenv.emitTailcalls then emitInstrCode codebuf i_tail //let emitAfterTailcall codebuf tl = // if tl = Tailcall then emitInstrCode codebuf i_ret - let emitVolatility codebuf tl = + let emitVolatility codebuf tl = if tl = Volatile then emitInstrCode codebuf i_volatile - let emitConstrained cenv codebuf env ty = + let emitConstrained cenv codebuf env ty = emitInstrCode codebuf i_constrained codebuf.EmitUncodedToken (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env ty)) - let emitAlignment codebuf tl = - match tl with + let emitAlignment codebuf tl = + match tl with | Aligned -> () | Unaligned1 -> emitInstrCode codebuf i_unaligned; codebuf.EmitByte 0x1 | Unaligned2 -> emitInstrCode codebuf i_unaligned; codebuf.EmitByte 0x2 @@ -10666,36 +10666,36 @@ namespace ProviderImplementation.ProvidedTypes match instr with | si when isNoArgInstr si -> emitInstrCode codebuf (encodingsOfNoArgInstr si) - | I_brcmp (cmp, tg1) -> + | I_brcmp (cmp, tg1) -> codebuf.RecordReqdBrFixup (ILCmpInstrMap.Value.[cmp], Some ILCmpInstrRevMap.Value.[cmp]) tg1 | I_br tg -> codebuf.RecordReqdBrFixup (i_br, Some i_br_s) tg #if EMIT_DEBUG_INFO | I_seqpoint s -> codebuf.EmitSeqPoint cenv s #endif | I_leave tg -> codebuf.RecordReqdBrFixup (i_leave, Some i_leave_s) tg - | I_call (tl, mspec, varargs) -> + | I_call (tl, mspec, varargs) -> emitTailness cenv codebuf tl emitMethodSpecInstr cenv codebuf env i_call (mspec, varargs) //emitAfterTailcall codebuf tl - | I_callvirt (tl, mspec, varargs) -> + | I_callvirt (tl, mspec, varargs) -> emitTailness cenv codebuf tl emitMethodSpecInstr cenv codebuf env i_callvirt (mspec, varargs) //emitAfterTailcall codebuf tl - | I_callconstraint (tl, ty, mspec, varargs) -> + | I_callconstraint (tl, ty, mspec, varargs) -> emitTailness cenv codebuf tl emitConstrained cenv codebuf env ty emitMethodSpecInstr cenv codebuf env i_callvirt (mspec, varargs) //emitAfterTailcall codebuf tl - | I_newobj (mspec, varargs) -> + | I_newobj (mspec, varargs) -> emitMethodSpecInstr cenv codebuf env i_newobj (mspec, varargs) - | I_ldftn mspec -> + | I_ldftn mspec -> emitMethodSpecInstr cenv codebuf env i_ldftn (mspec, None) - | I_ldvirtftn mspec -> + | I_ldvirtftn mspec -> emitMethodSpecInstr cenv codebuf env i_ldvirtftn (mspec, None) - | I_calli (tl, callsig, varargs) -> + | I_calli (tl, callsig, varargs) -> emitTailness cenv codebuf tl - emitInstrCode codebuf i_calli + emitInstrCode codebuf i_calli codebuf.EmitUncodedToken (getUncodedToken ILTableNames.StandAloneSig (GetCallsigAsStandAloneSigIdx cenv env (callsig, varargs))) //emitAfterTailcall codebuf tl @@ -10706,165 +10706,165 @@ namespace ProviderImplementation.ProvidedTypes | I_stloc x -> emitShortUInt16Instr codebuf (i_stloc_s, i_stloc) (uint16 x) | I_ldloca x -> emitShortUInt16Instr codebuf (i_ldloca_s, i_ldloca) (uint16 x) - | I_cpblk (al, vol) -> - emitAlignment codebuf al + | I_cpblk (al, vol) -> + emitAlignment codebuf al emitVolatility codebuf vol emitInstrCode codebuf i_cpblk - | I_initblk (al, vol) -> - emitAlignment codebuf al + | I_initblk (al, vol) -> + emitAlignment codebuf al emitVolatility codebuf vol emitInstrCode codebuf i_initblk - | (I_ldc (DT_I4, ILConst.I4 x)) -> + | (I_ldc (DT_I4, ILConst.I4 x)) -> emitShortInt32Instr codebuf (i_ldc_i4_s, i_ldc_i4) x - | (I_ldc (DT_I8, ILConst.I8 x)) -> - emitInstrCode codebuf i_ldc_i8 + | (I_ldc (DT_I8, ILConst.I8 x)) -> + emitInstrCode codebuf i_ldc_i8 codebuf.EmitInt64 x - | (I_ldc (_, ILConst.R4 x)) -> - emitInstrCode codebuf i_ldc_r4 + | (I_ldc (_, ILConst.R4 x)) -> + emitInstrCode codebuf i_ldc_r4 codebuf.EmitInt32 (bitsOfSingle x) - | (I_ldc (_, ILConst.R8 x)) -> - emitInstrCode codebuf i_ldc_r8 + | (I_ldc (_, ILConst.R8 x)) -> + emitInstrCode codebuf i_ldc_r8 codebuf.EmitInt64 (bitsOfDouble x) - | I_ldind (al, vol, dt) -> - emitAlignment codebuf al + | I_ldind (al, vol, dt) -> + emitAlignment codebuf al emitVolatility codebuf vol - emitInstrCode codebuf - (match dt with + emitInstrCode codebuf + (match dt with | DT_I -> i_ldind_i - | DT_I1 -> i_ldind_i1 - | DT_I2 -> i_ldind_i2 - | DT_I4 -> i_ldind_i4 - | DT_U1 -> i_ldind_u1 - | DT_U2 -> i_ldind_u2 - | DT_U4 -> i_ldind_u4 - | DT_I8 -> i_ldind_i8 - | DT_R4 -> i_ldind_r4 - | DT_R8 -> i_ldind_r8 + | DT_I1 -> i_ldind_i1 + | DT_I2 -> i_ldind_i2 + | DT_I4 -> i_ldind_i4 + | DT_U1 -> i_ldind_u1 + | DT_U2 -> i_ldind_u2 + | DT_U4 -> i_ldind_u4 + | DT_I8 -> i_ldind_i8 + | DT_R4 -> i_ldind_r4 + | DT_R8 -> i_ldind_r8 | DT_REF -> i_ldind_ref | _ -> failwith "ldind") - | I_stelem dt -> - emitInstrCode codebuf - (match dt with + | I_stelem dt -> + emitInstrCode codebuf + (match dt with | DT_I | DT_U -> i_stelem_i - | DT_U1 | DT_I1 -> i_stelem_i1 - | DT_I2 | DT_U2 -> i_stelem_i2 - | DT_I4 | DT_U4 -> i_stelem_i4 - | DT_I8 | DT_U8 -> i_stelem_i8 - | DT_R4 -> i_stelem_r4 - | DT_R8 -> i_stelem_r8 + | DT_U1 | DT_I1 -> i_stelem_i1 + | DT_I2 | DT_U2 -> i_stelem_i2 + | DT_I4 | DT_U4 -> i_stelem_i4 + | DT_I8 | DT_U8 -> i_stelem_i8 + | DT_R4 -> i_stelem_r4 + | DT_R8 -> i_stelem_r8 | DT_REF -> i_stelem_ref | _ -> failwith "stelem") - | I_ldelem dt -> - emitInstrCode codebuf - (match dt with + | I_ldelem dt -> + emitInstrCode codebuf + (match dt with | DT_I -> i_ldelem_i - | DT_I1 -> i_ldelem_i1 - | DT_I2 -> i_ldelem_i2 - | DT_I4 -> i_ldelem_i4 - | DT_I8 -> i_ldelem_i8 - | DT_U1 -> i_ldelem_u1 - | DT_U2 -> i_ldelem_u2 - | DT_U4 -> i_ldelem_u4 - | DT_R4 -> i_ldelem_r4 - | DT_R8 -> i_ldelem_r8 + | DT_I1 -> i_ldelem_i1 + | DT_I2 -> i_ldelem_i2 + | DT_I4 -> i_ldelem_i4 + | DT_I8 -> i_ldelem_i8 + | DT_U1 -> i_ldelem_u1 + | DT_U2 -> i_ldelem_u2 + | DT_U4 -> i_ldelem_u4 + | DT_R4 -> i_ldelem_r4 + | DT_R8 -> i_ldelem_r8 | DT_REF -> i_ldelem_ref | _ -> failwith "ldelem") - | I_stind (al, vol, dt) -> - emitAlignment codebuf al + | I_stind (al, vol, dt) -> + emitAlignment codebuf al emitVolatility codebuf vol - emitInstrCode codebuf - (match dt with + emitInstrCode codebuf + (match dt with | DT_U | DT_I -> i_stind_i - | DT_U1 | DT_I1 -> i_stind_i1 - | DT_U2 | DT_I2 -> i_stind_i2 - | DT_U4 | DT_I4 -> i_stind_i4 - | DT_U8 | DT_I8 -> i_stind_i8 - | DT_R4 -> i_stind_r4 - | DT_R8 -> i_stind_r8 + | DT_U1 | DT_I1 -> i_stind_i1 + | DT_U2 | DT_I2 -> i_stind_i2 + | DT_U4 | DT_I4 -> i_stind_i4 + | DT_U8 | DT_I8 -> i_stind_i8 + | DT_R4 -> i_stind_r4 + | DT_R8 -> i_stind_r8 | DT_REF -> i_stind_ref | _ -> failwith "stelem") | I_switch labs -> codebuf.RecordReqdBrFixups (i_switch, None) labs - | I_ldfld (al, vol, fspec) -> - emitAlignment codebuf al + | I_ldfld (al, vol, fspec) -> + emitAlignment codebuf al emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_ldfld fspec - | I_ldflda fspec -> + | I_ldflda fspec -> emitFieldSpecInstr cenv codebuf env i_ldflda fspec - | I_ldsfld (vol, fspec) -> + | I_ldsfld (vol, fspec) -> emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_ldsfld fspec - | I_ldsflda fspec -> + | I_ldsflda fspec -> emitFieldSpecInstr cenv codebuf env i_ldsflda fspec - | I_stfld (al, vol, fspec) -> - emitAlignment codebuf al + | I_stfld (al, vol, fspec) -> + emitAlignment codebuf al emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_stfld fspec - | I_stsfld (vol, fspec) -> + | I_stsfld (vol, fspec) -> emitVolatility codebuf vol emitFieldSpecInstr cenv codebuf env i_stsfld fspec - | I_ldtoken tok -> + | I_ldtoken tok -> emitInstrCode codebuf i_ldtoken - codebuf.EmitUncodedToken - (match tok with - | ILToken.ILType typ -> - match GetTypeAsTypeDefOrRef cenv env typ with + codebuf.EmitUncodedToken + (match tok with + | ILToken.ILType typ -> + match GetTypeAsTypeDefOrRef cenv env typ with | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeDef -> getUncodedToken ILTableNames.TypeDef idx | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeRef -> getUncodedToken ILTableNames.TypeRef idx | (tag, idx) when tag = TypeDefOrRefOrSpecTag.TypeSpec -> getUncodedToken ILTableNames.TypeSpec idx | _ -> failwith "?" | ILToken.ILMethod mspec -> - match GetMethodSpecAsMethodDefOrRef cenv env (mspec, None) with + match GetMethodSpecAsMethodDefOrRef cenv env (mspec, None) with | (tag, idx) when tag = MethodDefOrRefTag.MethodDef -> getUncodedToken ILTableNames.Method idx | (tag, idx) when tag = MethodDefOrRefTag.MemberRef -> getUncodedToken ILTableNames.MemberRef idx | _ -> failwith "?" | ILToken.ILField fspec -> - match GetFieldSpecAsFieldDefOrRef cenv env fspec with + match GetFieldSpecAsFieldDefOrRef cenv env fspec with | (true, idx) -> getUncodedToken ILTableNames.Field idx | (false, idx) -> getUncodedToken ILTableNames.MemberRef idx) - | I_ldstr s -> + | I_ldstr s -> emitInstrCode codebuf i_ldstr codebuf.RecordReqdStringFixup (GetUserStringHeapIdx cenv s) | I_box ty -> emitTypeInstr cenv codebuf env i_box ty | I_unbox ty -> emitTypeInstr cenv codebuf env i_unbox ty - | I_unbox_any ty -> emitTypeInstr cenv codebuf env i_unbox_any ty + | I_unbox_any ty -> emitTypeInstr cenv codebuf env i_unbox_any ty - | I_newarr (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then + | I_newarr (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then emitTypeInstr cenv codebuf env i_newarr ty else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_newobj (".ctor", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Void, None, [| |]) - | I_stelem_any (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then - emitTypeInstr cenv codebuf env i_stelem_any ty - else + | I_stelem_any (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then + emitTypeInstr cenv codebuf env i_stelem_any ty + else let args = Array.init (shape.Rank+1) (fun i -> if i < shape.Rank then cenv.ilg.typ_Int32 else ty) emitMethodSpecInfoInstr cenv codebuf env i_call ("Set", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Void, None, [| |]) - | I_ldelem_any (shape, ty) -> - if (shape = ILArrayShape.SingleDimensional) then - emitTypeInstr cenv codebuf env i_ldelem_any ty - else + | I_ldelem_any (shape, ty) -> + if (shape = ILArrayShape.SingleDimensional) then + emitTypeInstr cenv codebuf env i_ldelem_any ty + else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_call ("Get", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ty, None, [| |]) - | I_ldelema (ro, shape, ty) -> + | I_ldelema (ro, shape, ty) -> if (ro = ReadonlyAddress) then emitInstrCode codebuf i_readonly - if (shape = ILArrayShape.SingleDimensional) then + if (shape = ILArrayShape.SingleDimensional) then emitTypeInstr cenv codebuf env i_ldelema ty - else + else let args = Array.init shape.Rank (fun _ -> cenv.ilg.typ_Int32) emitMethodSpecInfoInstr cenv codebuf env i_call ("Address", mkILArrTy(ty, shape), ILCallingConv.Instance, args, ILType.Byref ty, None, [| |]) @@ -10873,17 +10873,17 @@ namespace ProviderImplementation.ProvidedTypes | I_refanyval ty -> emitTypeInstr cenv codebuf env i_refanyval ty | I_mkrefany ty -> emitTypeInstr cenv codebuf env i_mkrefany ty | I_initobj ty -> emitTypeInstr cenv codebuf env i_initobj ty - | I_ldobj (al, vol, ty) -> - emitAlignment codebuf al + | I_ldobj (al, vol, ty) -> + emitAlignment codebuf al emitVolatility codebuf vol emitTypeInstr cenv codebuf env i_ldobj ty - | I_stobj (al, vol, ty) -> - emitAlignment codebuf al + | I_stobj (al, vol, ty) -> + emitAlignment codebuf al emitVolatility codebuf vol emitTypeInstr cenv codebuf env i_stobj ty | I_cpobj ty -> emitTypeInstr cenv codebuf env i_cpobj ty | I_sizeof ty -> emitTypeInstr cenv codebuf env i_sizeof ty - | EI_ldlen_multi (_, m) -> + | EI_ldlen_multi (_, m) -> emitShortInt32Instr codebuf (i_ldc_i4_s, i_ldc_i4) m let mspec = mkILMethSpecInTyRaw(cenv.ilg.typ_Array, ILCallingConv.Instance, "GetLength", [|cenv.ilg.typ_Int32|], cenv.ilg.typ_Int32, [| |]) emitInstr cenv codebuf env (mkNormalCall mspec) @@ -10894,20 +10894,20 @@ namespace ProviderImplementation.ProvidedTypes // Used to put local debug scopes and exception handlers into a tree form let rangeInsideRange (start_pc1, end_pc1) (start_pc2, end_pc2) = (start_pc1:int) >= start_pc2 && start_pc1 < end_pc2 && - (end_pc1:int) > start_pc2 && end_pc1 <= end_pc2 + (end_pc1:int) > start_pc2 && end_pc1 <= end_pc2 - let lranges_of_clause cl = - match cl with + let lranges_of_clause cl = + match cl with | ILExceptionClause.Finally r1 -> [r1] | ILExceptionClause.Fault r1 -> [r1] | ILExceptionClause.FilterCatch (r1, r2) -> [r1;r2] - | ILExceptionClause.TypeCatch (_ty, r1) -> [r1] + | ILExceptionClause.TypeCatch (_ty, r1) -> [r1] let labelsToRange (lab2pc: Dictionary) p = let (l1, l2) = p in lab2pc.[l1], lab2pc.[l2] - let labelRangeInsideLabelRange lab2pc ls1 ls2 = - rangeInsideRange (labelsToRange lab2pc ls1) (labelsToRange lab2pc ls2) + let labelRangeInsideLabelRange lab2pc ls1 ls2 = + rangeInsideRange (labelsToRange lab2pc ls1) (labelsToRange lab2pc ls2) // This file still gets used when targeting FSharp.Core 3.1.0.0, e.g. in FSharp.Data #if !ABOVE_FSCORE_4_0_0_0 @@ -10924,59 +10924,59 @@ namespace ProviderImplementation.ProvidedTypes acc <- s' res, acc #endif - let findRoots contains vs = + let findRoots contains vs = // For each item, either make it a root or make it a child of an existing root - let addToRoot roots x = + let addToRoot roots x = // Look to see if 'x' is inside one of the roots - let roots, found = - (false, roots) ||> mapFold (fun found (r, children) -> + let roots, found = + (false, roots) ||> mapFold (fun found (r, children) -> if found then ((r, children), true) - elif contains x r then ((r, Array.append [| x |] children), true) + elif contains x r then ((r, Array.append [| x |] children), true) else ((r, children), false)) - if found then roots - else + if found then roots + else // Find the ones that 'x' encompasses and collapse them let yes, others = roots |> Array.partition (fun (r, _) -> contains r x) let yesChild = yes |> Array.collect (fun (r, ch) -> Array.append [| r |] ch) Array.append [| (x, yesChild) |] others - + ([| |], vs) ||> Array.fold addToRoot - let rec makeSEHTree cenv env (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILExceptionSpec[]) = + let rec makeSEHTree cenv env (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILExceptionSpec[]) = let clause_inside_lrange cl lr = - List.forall (fun lr1 -> labelRangeInsideLabelRange lab2pc lr1 lr) (lranges_of_clause cl) + List.forall (fun lr1 -> labelRangeInsideLabelRange lab2pc lr1 lr) (lranges_of_clause cl) let tryspec_inside_lrange (tryspec1: ILExceptionSpec) lr = - (labelRangeInsideLabelRange lab2pc tryspec1.Range lr && clause_inside_lrange tryspec1.Clause lr) + (labelRangeInsideLabelRange lab2pc tryspec1.Range lr && clause_inside_lrange tryspec1.Clause lr) let tryspec_inside_clause tryspec1 cl = - List.exists (fun lr -> tryspec_inside_lrange tryspec1 lr) (lranges_of_clause cl) + List.exists (fun lr -> tryspec_inside_lrange tryspec1 lr) (lranges_of_clause cl) let tryspec_inside_tryspec tryspec1 (tryspec2: ILExceptionSpec) = tryspec_inside_lrange tryspec1 tryspec2.Range || tryspec_inside_clause tryspec1 tryspec2.Clause let roots = findRoots tryspec_inside_tryspec exs - let trees = - roots |> Array.map (fun (cl, ch) -> + let trees = + roots |> Array.map (fun (cl, ch) -> let r1 = labelsToRange lab2pc cl.Range let conv ((s1, e1), (s2, e2)) x = pc2pos.[s1], pc2pos.[e1] - pc2pos.[s1], pc2pos.[s2], pc2pos.[e2] - pc2pos.[s2], x let children = makeSEHTree cenv env pc2pos lab2pc ch - let n = - match cl.Clause with - | ILExceptionClause.Finally r2 -> + let n = + match cl.Clause with + | ILExceptionClause.Finally r2 -> conv (r1, labelsToRange lab2pc r2) ExceptionClauseKind.FinallyClause - | ILExceptionClause.Fault r2 -> + | ILExceptionClause.Fault r2 -> conv (r1, labelsToRange lab2pc r2) ExceptionClauseKind.FaultClause - | ILExceptionClause.FilterCatch ((filterStart, _), r3) -> + | ILExceptionClause.FilterCatch ((filterStart, _), r3) -> conv (r1, labelsToRange lab2pc r3) (ExceptionClauseKind.FilterClause (pc2pos.[lab2pc.[filterStart]])) - | ILExceptionClause.TypeCatch (typ, r2) -> + | ILExceptionClause.TypeCatch (typ, r2) -> conv (r1, labelsToRange lab2pc r2) (TypeFilterClause (getTypeDefOrRefAsUncodedToken (GetTypeAsTypeDefOrRef cenv env typ))) SEHTree.Node (Some n, children) ) - trees + trees #if EMIT_DEBUG_INFO let rec makeLocalsTree cenv localSigs (pc2pos: int[]) (lab2pc: Dictionary) (exs: ILLocalDebugInfo[]) = @@ -10995,14 +10995,14 @@ namespace ProviderImplementation.ProvidedTypes #endif - // Emit the SEH tree - let rec emitExceptionHandlerTree (codebuf: CodeBuffer) (Node (x, childSEH)) = - childSEH |> Array.iter (emitExceptionHandlerTree codebuf) // internal first - x |> Option.iter codebuf.EmitExceptionClause + // Emit the SEH tree + let rec emitExceptionHandlerTree (codebuf: CodeBuffer) (Node (x, childSEH)) = + childSEH |> Array.iter (emitExceptionHandlerTree codebuf) // internal first + x |> Option.iter codebuf.EmitExceptionClause - let emitCode cenv localSigs (codebuf: CodeBuffer) env (code: ILCode) = + let emitCode cenv localSigs (codebuf: CodeBuffer) env (code: ILCode) = let instrs = code.Instrs - + // Build a table mapping Abstract IL pcs to positions in the generated code buffer let pc2pos = Array.zeroCreate (instrs.Length+1) let pc2labs = Dictionary() @@ -11011,12 +11011,12 @@ namespace ProviderImplementation.ProvidedTypes // Emit the instructions for pc = 0 to instrs.Length do - if pc2labs.ContainsKey pc then + if pc2labs.ContainsKey pc then for lab in pc2labs.[pc] do codebuf.RecordAvailBrFixup lab pc2pos.[pc] <- codebuf.code.Position - if pc < instrs.Length then - match instrs.[pc] with + if pc < instrs.Length then + match instrs.[pc] with | I_br l when code.Labels.[l] = pc + 1 -> () // compress I_br to next instruction | i -> emitInstr cenv codebuf env i @@ -11030,7 +11030,7 @@ namespace ProviderImplementation.ProvidedTypes localsTree #endif - let EmitTopCode cenv localSigs env nm code = + let EmitTopCode cenv localSigs env nm code = let codebuf = CodeBuffer.Create nm let origScopes = emitCode cenv localSigs codebuf env code let origCode = codebuf.code.Close() @@ -11042,8 +11042,8 @@ namespace ProviderImplementation.ProvidedTypes let origSeqPoints = codebuf.seqpoints.ToArray() #endif - let newCode, newReqdStringFixups, newExnClauses = - applyBrFixups origCode origExnClauses origReqdStringFixups origAvailBrFixups origReqdBrFixups + let newCode, newReqdStringFixups, newExnClauses = + applyBrFixups origCode origExnClauses origReqdStringFixups origAvailBrFixups origReqdBrFixups #if EMIT_DEBUG_INFO let rootScope = @@ -11055,31 +11055,31 @@ namespace ProviderImplementation.ProvidedTypes (newReqdStringFixups, newExnClauses, newCode) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodBody --> bytes - // -------------------------------------------------------------------- - let GetFieldDefTypeAsBlobIdx cenv env ty = - let bytes = emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD + // -------------------------------------------------------------------- + let GetFieldDefTypeAsBlobIdx cenv env ty = + let bytes = emitBytesViaBuffer (fun bb -> bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD EmitType cenv env bb ty) GetBytesAsBlobIdx cenv bytes let GenILMethodBody mname cenv env (il: ILMethodBody) = - let localSigs = - if cenv.generatePdb then - il.Locals |> Array.map (fun l -> + let localSigs = + if cenv.generatePdb then + il.Locals |> Array.map (fun l -> // Write a fake entry for the local signature headed by e_IMAGE_CEE_CS_CALLCONV_FIELD. This is referenced by the PDB file ignore (FindOrAddSharedRow cenv ILTableNames.StandAloneSig (SharedRow [| Blob (GetFieldDefTypeAsBlobIdx cenv env l.Type) |])) // Now write the type - GetTypeOfLocalAsBytes cenv env l) - else + GetTypeOfLocalAsBytes cenv env l) + else [| |] let requiredStringFixups, seh, code (* , seqpoints, scopes *) = Codebuf.EmitTopCode cenv localSigs env mname il.Code let codeSize = code.Length let methbuf = ByteBuffer.Create (codeSize * 3) - // Do we use the tiny format? + // Do we use the tiny format? if isEmpty il.Locals && il.MaxStack <= 8 && isEmpty seh && codeSize < 64 then - // Use Tiny format + // Use Tiny format let alignedCodeSize = align 4 (codeSize + 1) let codePadding = (alignedCodeSize - (codeSize + 1)) let requiredStringFixups' = (1, requiredStringFixups) @@ -11088,68 +11088,68 @@ namespace ProviderImplementation.ProvidedTypes methbuf.EmitPadding codePadding 0x0, (requiredStringFixups', methbuf.Close()) // , seqpoints, scopes else - // Use Fat format - let flags = + // Use Fat format + let flags = e_CorILMethod_FatFormat ||| - (if not (isEmpty seh) then e_CorILMethod_MoreSects else 0x0uy) ||| + (if not (isEmpty seh) then e_CorILMethod_MoreSects else 0x0uy) ||| (if il.IsZeroInit then e_CorILMethod_InitLocals else 0x0uy) - let localToken = - if isEmpty il.Locals then 0x0 else + let localToken = + if isEmpty il.Locals then 0x0 else getUncodedToken ILTableNames.StandAloneSig (FindOrAddSharedRow cenv ILTableNames.StandAloneSig (GetLocalSigAsStandAloneSigIdx cenv env il.Locals)) let alignedCodeSize = align 0x4 codeSize let codePadding = (alignedCodeSize - codeSize) - - methbuf.EmitByte flags - methbuf.EmitByte 0x30uy // last four bits record size of fat header in 4 byte chunks - this is always 12 bytes = 3 four word chunks + + methbuf.EmitByte flags + methbuf.EmitByte 0x30uy // last four bits record size of fat header in 4 byte chunks - this is always 12 bytes = 3 four word chunks methbuf.EmitUInt16 (uint16 il.MaxStack) methbuf.EmitInt32 codeSize methbuf.EmitInt32 localToken methbuf.EmitBytes code methbuf.EmitPadding codePadding - if not (isEmpty seh) then - // Can we use the small exception handling table format? + if not (isEmpty seh) then + // Can we use the small exception handling table format? let smallSize = (seh.Length * 12 + 4) - let canUseSmall = + let canUseSmall = smallSize <= 0xFF && - seh |> Array.forall (fun (st1, sz1, st2, sz2, _) -> - st1 <= 0xFFFF && st2 <= 0xFFFF && sz1 <= 0xFF && sz2 <= 0xFF) - - let kindAsInt32 k = - match k with + seh |> Array.forall (fun (st1, sz1, st2, sz2, _) -> + st1 <= 0xFFFF && st2 <= 0xFFFF && sz1 <= 0xFF && sz2 <= 0xFF) + + let kindAsInt32 k = + match k with | FinallyClause -> e_COR_ILEXCEPTION_CLAUSE_FINALLY | FaultClause -> e_COR_ILEXCEPTION_CLAUSE_FAULT | FilterClause _ -> e_COR_ILEXCEPTION_CLAUSE_FILTER | TypeFilterClause _ -> e_COR_ILEXCEPTION_CLAUSE_EXCEPTION - let kindAsExtraInt32 k = - match k with + let kindAsExtraInt32 k = + match k with | FinallyClause | FaultClause -> 0x0 | FilterClause i -> i | TypeFilterClause uncoded -> uncoded - - if canUseSmall then + + if canUseSmall then methbuf.EmitByte e_CorILMethod_Sect_EHTable - methbuf.EmitByte (b0 smallSize |> byte) - methbuf.EmitByte 0x00uy + methbuf.EmitByte (b0 smallSize |> byte) methbuf.EmitByte 0x00uy - seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> + methbuf.EmitByte 0x00uy + seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> let k32 = kindAsInt32 kind - methbuf.EmitInt32AsUInt16 k32 - methbuf.EmitInt32AsUInt16 st1 - methbuf.EmitByte (b0 sz1 |> byte) - methbuf.EmitInt32AsUInt16 st2 + methbuf.EmitInt32AsUInt16 k32 + methbuf.EmitInt32AsUInt16 st1 + methbuf.EmitByte (b0 sz1 |> byte) + methbuf.EmitInt32AsUInt16 st2 methbuf.EmitByte (b0 sz2 |> byte) methbuf.EmitInt32 (kindAsExtraInt32 kind)) - else + else let bigSize = (seh.Length * 24 + 4) methbuf.EmitByte (e_CorILMethod_Sect_EHTable ||| e_CorILMethod_Sect_FatFormat) methbuf.EmitByte (b0 bigSize |> byte) methbuf.EmitByte (b1 bigSize |> byte) methbuf.EmitByte (b2 bigSize |> byte) - seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> + seh |> Array.iter (fun (st1, sz1, st2, sz2, kind) -> let k32 = kindAsInt32 kind methbuf.EmitInt32 k32 methbuf.EmitInt32 st1 @@ -11157,27 +11157,27 @@ namespace ProviderImplementation.ProvidedTypes methbuf.EmitInt32 st2 methbuf.EmitInt32 sz2 methbuf.EmitInt32 (kindAsExtraInt32 kind)) - + let requiredStringFixups' = (12, requiredStringFixups) localToken, (requiredStringFixups', methbuf.Close()) //, seqpoints, scopes - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILFieldDef --> FieldDef Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetFieldDefAsFieldDefRow cenv env (fd: ILFieldDef) = + let rec GetFieldDefAsFieldDefRow cenv env (fd: ILFieldDef) = let flags = int fd.Attributes ||| (if (fd.LiteralValue <> None) then 0x8000 else 0x0) //||| //(if (fd.Marshal <> None) then 0x1000 else 0x0) ||| //(if (fd.Data <> None) then 0x0100 else 0x0) - UnsharedRow - [| UShort (uint16 flags) + UnsharedRow + [| UShort (uint16 flags) StringE (GetStringHeapIdx cenv fd.Name) Blob (GetFieldDefSigAsBlobIdx cenv env fd ) |] and GetFieldDefSigAsBlobIdx cenv env fd = GetFieldDefTypeAsBlobIdx cenv env fd.FieldType - and GenFieldDefPass3 cenv env fd = + and GenFieldDefPass3 cenv env fd = let fidx = AddUnsharedRow cenv ILTableNames.Field (GetFieldDefAsFieldDefRow cenv env fd) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.FieldDef, fidx) fd.CustomAttrs #if EMIT_FIELD_DATA @@ -11197,29 +11197,29 @@ namespace ProviderImplementation.ProvidedTypes (UnsharedRow [| HasFieldMarshal (hfm_FieldDef, fidx) Blob (GetNativeTypeAsBlobIdx cenv ntyp) |]) |> ignore #endif - // Write Content table - match fd.LiteralValue with + // Write Content table + match fd.LiteralValue with | None -> () - | Some i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | Some i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.FieldDef, fidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore - // Write FieldLayout table - match fd.Offset with + // Write FieldLayout table + match fd.Offset with | None -> () - | Some offset -> - AddUnsharedRow cenv ILTableNames.FieldLayout + | Some offset -> + AddUnsharedRow cenv ILTableNames.FieldLayout (UnsharedRow [| ULong offset; SimpleIndex (ILTableNames.Field, fidx) |]) |> ignore - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // ILGenericParameterDef --> GenericParam Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetGenericParamAsGenericParamRow cenv _env idx owner (gp: ILGenericParameterDef) = - let flags = + let rec GetGenericParamAsGenericParamRow cenv _env idx owner (gp: ILGenericParameterDef) = + let flags = (if gp.IsCovariant then 0x0001 else 0x0000) ||| (if gp.IsContravariant then 0x0002 else 0x0000) ||| (if gp.HasReferenceTypeConstraint then 0x0004 else 0x0000) ||| @@ -11227,62 +11227,62 @@ namespace ProviderImplementation.ProvidedTypes (if gp.HasDefaultConstructorConstraint then 0x0010 else 0x0000) let mdVersionMajor, _ = metadataSchemaVersionSupportedByCLRVersion cenv.desiredMetadataVersion - if (mdVersionMajor = 1) then - SharedRow - [| UShort (uint16 idx) - UShort (uint16 flags) + if (mdVersionMajor = 1) then + SharedRow + [| UShort (uint16 idx) + UShort (uint16 flags) TypeOrMethodDef (fst owner, snd owner) StringE (GetStringHeapIdx cenv gp.Name) TypeDefOrRefOrSpec (TypeDefOrRefOrSpecTag.TypeDef, 0) (* empty kind field in deprecated metadata *) |] else - SharedRow - [| UShort (uint16 idx) - UShort (uint16 flags) + SharedRow + [| UShort (uint16 idx) + UShort (uint16 flags) TypeOrMethodDef (fst owner, snd owner) StringE (GetStringHeapIdx cenv gp.Name) |] - and GenTypeAsGenericParamConstraintRow cenv env gpidx ty = + and GenTypeAsGenericParamConstraintRow cenv env gpidx ty = let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env ty - UnsharedRow + UnsharedRow [| SimpleIndex (ILTableNames.GenericParam, gpidx) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] and GenGenericParamConstraintPass4 cenv env gpidx ty = AddUnsharedRow cenv ILTableNames.GenericParamConstraint (GenTypeAsGenericParamConstraintRow cenv env gpidx ty) |> ignore - and GenGenericParamPass3 cenv env idx owner gp = + and GenGenericParamPass3 cenv env idx owner gp = // here we just collect generic params, its constraints\custom attributes will be processed on pass4 // shared since we look it up again below in GenGenericParamPass4 - AddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) + AddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) |> ignore - and GenGenericParamPass4 cenv env idx owner (gp: ILGenericParameterDef) = + and GenGenericParamPass4 cenv env idx owner (gp: ILGenericParameterDef) = let gpidx = FindOrAddSharedRow cenv ILTableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.GenericParam, gpidx) gp.CustomAttrs - gp.Constraints |> Array.iter (GenGenericParamConstraintPass4 cenv env gpidx) + gp.Constraints |> Array.iter (GenGenericParamConstraintPass4 cenv env gpidx) - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // param and return --> Param Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetParamAsParamRow cenv _env seq (param: ILParameter) = - let flags = + let rec GetParamAsParamRow cenv _env seq (param: ILParameter) = + let flags = (if param.IsIn then 0x0001 else 0x0000) ||| (if param.IsOut then 0x0002 else 0x0000) ||| (if param.IsOptional then 0x0010 else 0x0000) ||| (if param.Default.HasValue then 0x1000 else 0x0000) //||| //(if param.Marshal <> None then 0x2000 else 0x0000) - - UnsharedRow - [| UShort (uint16 flags) - UShort (uint16 seq) - StringE (GetStringHeapIdxOption cenv param.Name) |] - and GenParamPass3 cenv env seq (param: ILParameter) = - if not param.IsIn && not param.IsOut && not param.IsOptional && param.Default.IsNone && param.Name.IsNone // && Option.isNone param.Marshal + UnsharedRow + [| UShort (uint16 flags) + UShort (uint16 seq) + StringE (GetStringHeapIdxOption cenv param.Name) |] + + and GenParamPass3 cenv env seq (param: ILParameter) = + if not param.IsIn && not param.IsOut && not param.IsOptional && param.Default.IsNone && param.Name.IsNone // && Option.isNone param.Marshal then () - else + else let pidx = AddUnsharedRow cenv ILTableNames.Param (GetParamAsParamRow cenv env seq param) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ParamDef, pidx) param.CustomAttrs #if EMIT_FIELD_MARSHAL @@ -11296,21 +11296,21 @@ namespace ProviderImplementation.ProvidedTypes #endif match param.Default with | UNone -> () - | USome i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | USome i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.ParamDef, pidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore - let GenReturnAsParamRow (returnv: ILReturn) = + let GenReturnAsParamRow (returnv: ILReturn) = let flags = 0x0000 // || (if returnv.Marshal <> None then 0x2000 else 0x0000) - UnsharedRow - [| UShort (uint16 flags) + UnsharedRow + [| UShort (uint16 flags) UShort 0us (* sequence num. *) - StringE 0 |] + StringE 0 |] - let GenReturnPass3 cenv (returnv: ILReturn) = + let GenReturnPass3 cenv (returnv: ILReturn) = if (* Option.isSome returnv.Marshal || *) not (isEmpty returnv.CustomAttrs.Entries) then let pidx = AddUnsharedRow cenv ILTableNames.Param (GenReturnAsParamRow returnv) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ParamDef, pidx) returnv.CustomAttrs @@ -11324,31 +11324,31 @@ namespace ProviderImplementation.ProvidedTypes Blob (GetNativeTypeAsBlobIdx cenv ntyp) |]) |> ignore #endif - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILMethodDef --> ILMethodDef Row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let GetMethodDefSigAsBytes cenv env (mdef: ILMethodDef) = - emitBytesViaBuffer (fun bb -> + let GetMethodDefSigAsBytes cenv env (mdef: ILMethodDef) = + emitBytesViaBuffer (fun bb -> bb.EmitByte (callconvToByte mdef.GenericParams.Length mdef.CallingConv) if mdef.GenericParams.Length > 0 then bb.EmitZ32 mdef.GenericParams.Length bb.EmitZ32 mdef.Parameters.Length EmitType cenv env bb mdef.Return.Type mdef.ParameterTypes |> Array.iter (EmitType cenv env bb)) - let GenMethodDefSigAsBlobIdx cenv env mdef = + let GenMethodDefSigAsBlobIdx cenv env mdef = GetBytesAsBlobIdx cenv (GetMethodDefSigAsBytes cenv env mdef) - let GenMethodDefAsRow cenv env midx (md: ILMethodDef) = + let GenMethodDefAsRow cenv env midx (md: ILMethodDef) = let flags = int md.Attributes let implflags = int md.ImplAttributes - if md.IsEntryPoint then + if md.IsEntryPoint then if cenv.entrypoint <> None then failwith "duplicate entrypoint" else cenv.entrypoint <- Some (true, midx) - let codeAddr = - (match md.Body with - | Some ilmbody -> + let codeAddr = + (match md.Body with + | Some ilmbody -> let addr = cenv.nextCodeAddr let (localToken, code (* , seqpoints, rootScope *) ) = GenILMethodBody md.Name cenv env ilmbody @@ -11397,34 +11397,34 @@ namespace ProviderImplementation.ProvidedTypes #endif | _ -> 0x0000) - UnsharedRow - [| ULong codeAddr - UShort (uint16 implflags) - UShort (uint16 flags) - StringE (GetStringHeapIdx cenv md.Name) - Blob (GenMethodDefSigAsBlobIdx cenv env md) - SimpleIndex(ILTableNames.Param, cenv.GetTable(ILTableNames.Param).Count + 1) |] + UnsharedRow + [| ULong codeAddr + UShort (uint16 implflags) + UShort (uint16 flags) + StringE (GetStringHeapIdx cenv md.Name) + Blob (GenMethodDefSigAsBlobIdx cenv env md) + SimpleIndex(ILTableNames.Param, cenv.GetTable(ILTableNames.Param).Count + 1) |] let GenMethodImplPass3 cenv env _tgparams tidx mimpl = let midxTag, midxRow = GetMethodSpecAsMethodDef cenv env (mimpl.OverrideBy, None) let midx2Tag, midx2Row = GetOverridesSpecAsMethodDefOrRef cenv env mimpl.Overrides AddUnsharedRow cenv ILTableNames.MethodImpl - (UnsharedRow + (UnsharedRow [| SimpleIndex (ILTableNames.TypeDef, tidx) MethodDefOrRef (midxTag, midxRow) MethodDefOrRef (midx2Tag, midx2Row) |]) |> ignore - - let GenMethodDefPass3 cenv env (md:ILMethodDef) = + + let GenMethodDefPass3 cenv env (md:ILMethodDef) = let midx = GetMethodDefIdx cenv md let idx2 = AddUnsharedRow cenv ILTableNames.Method (GenMethodDefAsRow cenv env midx md) if midx <> idx2 then failwith "index of method def on pass 3 does not match index on pass 2" - GenReturnPass3 cenv md.Return - md.Parameters |> Array.iteri (fun n param -> GenParamPass3 cenv env (n+1) param) - md.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.MethodDef, midx) + GenReturnPass3 cenv md.Return + md.Parameters |> Array.iteri (fun n param -> GenParamPass3 cenv env (n+1) param) + md.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.MethodDef, midx) #if EMIT_SECURITY_DECLS md.SecurityDecls.Entries |> GenSecurityDeclsPass3 cenv (hds_MethodDef, midx) #endif - md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) + md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) #if EMIT_PINVOKE match md.Body.Contents with | MethodBody.PInvoke attr -> @@ -11464,51 +11464,51 @@ namespace ProviderImplementation.ProvidedTypes | _ -> () #endif - let GenMethodDefPass4 cenv env md = + let GenMethodDefPass4 cenv env md = let midx = GetMethodDefIdx cenv md - md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) + md.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.MethodDef, midx) gp) let GenPropertyMethodSemanticsPass3 cenv pidx kind mref = // REVIEW: why are we catching exceptions here? let midx = try GetMethodRefAsMethodDefIdx cenv mref with MethodDefNotFound -> 1 AddUnsharedRow cenv ILTableNames.MethodSemantics - (UnsharedRow + (UnsharedRow [| UShort (uint16 kind) SimpleIndex (ILTableNames.Method, midx) HasSemantics (HasSemanticsTag.Property, pidx) |]) |> ignore - - let rec GetPropertySigAsBlobIdx cenv env prop = + + let rec GetPropertySigAsBlobIdx cenv env prop = GetBytesAsBlobIdx cenv (GetPropertySigAsBytes cenv env prop) - and GetPropertySigAsBytes cenv env prop = - emitBytesViaBuffer (fun bb -> + and GetPropertySigAsBytes cenv env prop = + emitBytesViaBuffer (fun bb -> let b = ((hasthisToByte prop.CallingConv) ||| e_IMAGE_CEE_CS_CALLCONV_PROPERTY) bb.EmitByte b bb.EmitZ32 prop.IndexParameterTypes.Length EmitType cenv env bb prop.PropertyType prop.IndexParameterTypes |> Array.iter (EmitType cenv env bb)) - and GetPropertyAsPropertyRow cenv env (prop:ILPropertyDef) = - let flags = - (if prop.IsSpecialName then 0x0200 else 0x0) ||| - (if prop.IsRTSpecialName then 0x0400 else 0x0) ||| + and GetPropertyAsPropertyRow cenv env (prop:ILPropertyDef) = + let flags = + (if prop.IsSpecialName then 0x0200 else 0x0) ||| + (if prop.IsRTSpecialName then 0x0400 else 0x0) ||| (if prop.Init <> None then 0x1000 else 0x0) - UnsharedRow - [| UShort (uint16 flags) - StringE (GetStringHeapIdx cenv prop.Name) - Blob (GetPropertySigAsBlobIdx cenv env prop) |] + UnsharedRow + [| UShort (uint16 flags) + StringE (GetStringHeapIdx cenv prop.Name) + Blob (GetPropertySigAsBlobIdx cenv env prop) |] /// ILPropertyDef --> Property Row + MethodSemantics entries - and GenPropertyPass3 cenv env prop = + and GenPropertyPass3 cenv env prop = let pidx = AddUnsharedRow cenv ILTableNames.Property (GetPropertyAsPropertyRow cenv env prop) - prop.SetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0001) - prop.GetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0002) - // Write Constant table - match prop.Init with + prop.SetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0001) + prop.GetMethod |> Option.iter (GenPropertyMethodSemanticsPass3 cenv pidx 0x0002) + // Write Constant table + match prop.Init with | None -> () - | Some i -> - AddUnsharedRow cenv ILTableNames.Constant - (UnsharedRow + | Some i -> + AddUnsharedRow cenv ILTableNames.Constant + (UnsharedRow [| GetFieldInitFlags i HasConstant (HasConstantTag.Property, pidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore @@ -11517,42 +11517,42 @@ namespace ProviderImplementation.ProvidedTypes let rec GenEventMethodSemanticsPass3 cenv eidx kind mref = let addIdx = try GetMethodRefAsMethodDefIdx cenv mref with MethodDefNotFound -> 1 AddUnsharedRow cenv ILTableNames.MethodSemantics - (UnsharedRow + (UnsharedRow [| UShort (uint16 kind) SimpleIndex (ILTableNames.Method, addIdx) HasSemantics (HasSemanticsTag.Event, eidx) |]) |> ignore /// ILEventDef --> Event Row + MethodSemantics entries - and GenEventAsEventRow cenv env (md: ILEventDef) = - let flags = - (if md.IsSpecialName then 0x0200 else 0x0) ||| + and GenEventAsEventRow cenv env (md: ILEventDef) = + let flags = + (if md.IsSpecialName then 0x0200 else 0x0) ||| (if md.IsRTSpecialName then 0x0400 else 0x0) let tdorTag, tdorRow = GetTypeAsTypeDefOrRef cenv env md.EventHandlerType - UnsharedRow - [| UShort (uint16 flags) - StringE (GetStringHeapIdx cenv md.Name) + UnsharedRow + [| UShort (uint16 flags) + StringE (GetStringHeapIdx cenv md.Name) TypeDefOrRefOrSpec (tdorTag, tdorRow) |] - and GenEventPass3 cenv env (md: ILEventDef) = + and GenEventPass3 cenv env (md: ILEventDef) = let eidx = AddUnsharedRow cenv ILTableNames.Event (GenEventAsEventRow cenv env md) - md.AddMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0008 - md.RemoveMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0010 - //Option.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0020) md.FireMethod + md.AddMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0008 + md.RemoveMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0010 + //Option.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0020) md.FireMethod //List.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0004) md.OtherMethods GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Event, eidx) md.CustomAttrs - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // resource --> generate ... - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GetResourceAsManifestResourceRow cenv r = - let data, impl = + let rec GetResourceAsManifestResourceRow cenv r = + let data, impl = match r.Location with | ILResourceLocation.Local bf -> let b = bf() - // Embedded managed resources must be word-aligned. However resource format is - // not specified in ECMA. Some mscorlib resources appear to be non-aligned - it seems it doesn't matter.. + // Embedded managed resources must be word-aligned. However resource format is + // not specified in ECMA. Some mscorlib resources appear to be non-aligned - it seems it doesn't matter.. let offset = cenv.resources.Position let alignedOffset = (align 0x8 offset) let pad = alignedOffset - offset @@ -11560,24 +11560,24 @@ namespace ProviderImplementation.ProvidedTypes cenv.resources.EmitPadding pad cenv.resources.EmitInt32 resourceSize cenv.resources.EmitBytes b - Data (alignedOffset, true), (ImplementationTag.File, 0) + Data (alignedOffset, true), (ImplementationTag.File, 0) | ILResourceLocation.File (mref, offset) -> ULong offset, (ImplementationTag.File, GetModuleRefAsFileIdx cenv mref) | ILResourceLocation.Assembly aref -> ULong 0x0, (ImplementationTag.AssemblyRef, GetAssemblyRefAsIdx cenv aref) - UnsharedRow - [| data + UnsharedRow + [| data ULong (match r.Access with ILResourceAccess.Public -> 0x01 | ILResourceAccess.Private -> 0x02) - StringE (GetStringHeapIdx cenv r.Name) + StringE (GetStringHeapIdx cenv r.Name) Implementation (fst impl, snd impl) |] - and GenResourcePass3 cenv r = + and GenResourcePass3 cenv r = let idx = AddUnsharedRow cenv ILTableNames.ManifestResource (GetResourceAsManifestResourceRow cenv r) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ManifestResource, idx) r.CustomAttrs - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- // ILTypeDef --> generate ILFieldDef, ILMethodDef, ILPropertyDef etc. rows - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - let rec GenTypeDefPass3 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass3 enc cenv (td:ILTypeDef) = try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) @@ -11586,22 +11586,22 @@ namespace ProviderImplementation.ProvidedTypes td.Fields.Entries |> Array.iter (GenFieldDefPass3 cenv env) td.Methods.Entries |> Array.iter (GenMethodDefPass3 cenv env) td.MethodImpls.Entries |> Array.iter (GenMethodImplPass3 cenv env td.GenericParams.Length tidx) - // ClassLayout entry if needed - match td.Layout with + // ClassLayout entry if needed + match td.Layout with | ILTypeDefLayout.Auto -> () - | ILTypeDefLayout.Sequential layout | ILTypeDefLayout.Explicit layout -> - if Option.isSome layout.Pack || Option.isSome layout.Size then + | ILTypeDefLayout.Sequential layout | ILTypeDefLayout.Explicit layout -> + if Option.isSome layout.Pack || Option.isSome layout.Size then AddUnsharedRow cenv ILTableNames.ClassLayout - (UnsharedRow + (UnsharedRow [| UShort (defaultArg layout.Pack (uint16 0x0)) ULong (defaultArg layout.Size 0x0) SimpleIndex (ILTableNames.TypeDef, tidx) |]) |> ignore - + #if EMIT_SECURITY_DECLS td.SecurityDecls.Entries |> GenSecurityDeclsPass3 cenv (hds_TypeDef, tidx) #endif td.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.TypeDef, tidx) - td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) + td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass3 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) td.NestedTypes.Entries |> GenTypeDefsPass3 (addILTypeName enc td) cenv with e -> failwith ("Error in pass3 for type "+td.Name+", error: "+e.Message) @@ -11614,12 +11614,12 @@ namespace ProviderImplementation.ProvidedTypes /// ILTypeDef --> generate generic params on ILMethodDef: ensures /// GenericParam table is built sorted by owner. - let rec GenTypeDefPass4 enc cenv (td:ILTypeDef) = + let rec GenTypeDefPass4 enc cenv (td:ILTypeDef) = try let env = envForTypeDef td let tidx = GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) - td.Methods.Entries |> Array.iter (GenMethodDefPass4 cenv env) - td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) + td.Methods.Entries |> Array.iter (GenMethodDefPass4 cenv env) + td.GenericParams |> Array.iteri (fun n gp -> GenGenericParamPass4 cenv env n (TypeOrMethodDefTag.TypeDef, tidx) gp) GenTypeDefsPass4 (addILTypeName enc td) cenv td.NestedTypes.Entries with e -> failwith ("Error in pass4 for type "+td.Name+", error: "+e.Message) @@ -11633,19 +11633,19 @@ namespace ProviderImplementation.ProvidedTypes let DateTime1970Jan01 = new System.DateTime(1970,1,1,0,0,0,System.DateTimeKind.Utc) (* ECMA Spec (Oct2002), Part II, 24.2.2 PE File Header. *) let timestamp = (System.DateTime.UtcNow - DateTime1970Jan01).TotalSeconds |> int - // -------------------------------------------------------------------- - // ILExportedTypesAndForwarders --> ILExportedTypeOrForwarder table - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- + // ILExportedTypesAndForwarders --> ILExportedTypeOrForwarder table + // -------------------------------------------------------------------- - let rec GenNestedExportedTypePass3 cenv cidx (ce: ILNestedExportedType) = + let rec GenNestedExportedTypePass3 cenv cidx (ce: ILNestedExportedType) = let flags = GetMemberAccessFlags ce.Access - let nidx = - AddUnsharedRow cenv ILTableNames.ExportedType - (UnsharedRow - [| ULong flags + let nidx = + AddUnsharedRow cenv ILTableNames.ExportedType + (UnsharedRow + [| ULong flags ULong 0x0 - StringE (GetStringHeapIdx cenv ce.Name) - StringE 0 + StringE (GetStringHeapIdx cenv ce.Name) + StringE 0 Implementation (ImplementationTag.ExportedType, cidx) |]) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ExportedType, nidx) ce.CustomAttrs GenNestedExportedTypesPass3 cenv nidx ce.Nested @@ -11653,39 +11653,39 @@ namespace ProviderImplementation.ProvidedTypes and GenNestedExportedTypesPass3 cenv nidx (nce: ILNestedExportedTypesAndForwarders) = nce.Entries |> Array.iter (GenNestedExportedTypePass3 cenv nidx) - and GenExportedTypePass3 cenv (ce: ILExportedTypeOrForwarder) = + and GenExportedTypePass3 cenv (ce: ILExportedTypeOrForwarder) = let nselem, nelem = GetTypeNameAsElemPair cenv (ce.Namespace, ce.Name) let flags = GetTypeAccessFlags ce.Access let flags = if ce.IsForwarder then 0x00200000 ||| flags else flags let impl = GetScopeRefAsImplementationElem cenv ce.ScopeRef - let cidx = - AddUnsharedRow cenv ILTableNames.ExportedType - (UnsharedRow - [| ULong flags + let cidx = + AddUnsharedRow cenv ILTableNames.ExportedType + (UnsharedRow + [| ULong flags ULong 0x0 - nelem - nselem + nelem + nselem Implementation (fst impl, snd impl) |]) GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.ExportedType, cidx) ce.CustomAttrs GenNestedExportedTypesPass3 cenv cidx ce.Nested - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- // manifest --> generate Assembly row - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- - and GetManifestAsAssemblyRow cenv m = - UnsharedRow + and GetManifestAsAssemblyRow cenv m = + UnsharedRow [|ULong m.AuxModuleHashAlgorithm UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Major) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Minor) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Build) UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Revision) - ULong - ( //(match m.AssemblyLongevity with + ULong + ( //(match m.AssemblyLongevity with //| ILAssemblyLongevity.Unspecified -> 0x0000 - //| ILAssemblyLongevity.Library -> 0x0002 + //| ILAssemblyLongevity.Library -> 0x0002 //| ILAssemblyLongevity.PlatformAppDomain -> 0x0004 // | ILAssemblyLongevity.PlatformProcess -> 0x0006 // | ILAssemblyLongevity.PlatformSystem -> 0x0008) ||| @@ -11693,27 +11693,27 @@ namespace ProviderImplementation.ProvidedTypes // Setting these causes peverify errors. Hence both ilread and ilwrite ignore them and refuse to set them. // Any debugging customattributes will automatically propagate // REVIEW: No longer appears to be the case - (if m.JitTracking then 0x8000 else 0x0) ||| + (if m.JitTracking then 0x8000 else 0x0) ||| (match m.PublicKey with UNone -> 0x0000 | USome _ -> 0x0001) ||| 0x0000) (match m.PublicKey with UNone -> Blob 0 | USome x -> Blob (GetBytesAsBlobIdx cenv x)) StringE (GetStringHeapIdx cenv m.Name) (match m.Locale with UNone -> StringE 0 | USome x -> StringE (GetStringHeapIdx cenv x)) |] - and GenManifestPass3 cenv m = + and GenManifestPass3 cenv m = let aidx = AddUnsharedRow cenv ILTableNames.Assembly (GetManifestAsAssemblyRow cenv m) #if EMIT_SECURITY_DECLS GenSecurityDeclsPass3 cenv (hds_Assembly, aidx) m.SecurityDecls.Entries #endif GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Assembly, aidx) m.CustomAttrs - m.ExportedTypes.Entries |> Array.iter (GenExportedTypePass3 cenv) - // Record the entrypoint decl if needed. + m.ExportedTypes.Entries |> Array.iter (GenExportedTypePass3 cenv) + // Record the entrypoint decl if needed. match m.EntrypointElsewhere with - | Some mref -> + | Some mref -> if cenv.entrypoint <> None then failwith "duplicate entrypoint" else cenv.entrypoint <- Some (false, GetModuleRefAsIdx cenv mref) | None -> () - and newGuid (modul: ILModuleDef) = + and newGuid (modul: ILModuleDef) = let n = timestamp let m = hash n let m2 = hash modul.Name @@ -11725,44 +11725,44 @@ namespace ProviderImplementation.ProvidedTypes let m2 = hash modul.Name [| b0 m; b1 m; b2 m; b3 m; b0 m2; b1 m2; b2 m2; b3 m2; 0xa7uy; 0x45uy; 0x03uy; 0x83uy; b0 n; b1 n; b2 n; b3 n |] - and GetModuleAsRow (cenv:cenv) (modul: ILModuleDef) = + and GetModuleAsRow (cenv:cenv) (modul: ILModuleDef) = // Store the generated MVID in the environment (needed for generating debug information) let modulGuid = if cenv.deterministic then deterministicGuid modul else newGuid modul cenv.moduleGuid <- modulGuid - UnsharedRow - [| UShort (uint16 0x0) - StringE (GetStringHeapIdx cenv modul.Name) - Guid (GetGuidIdx cenv modulGuid) - Guid 0 + UnsharedRow + [| UShort (uint16 0x0) + StringE (GetStringHeapIdx cenv modul.Name) + Guid (GetGuidIdx cenv modulGuid) + Guid 0 Guid 0 |] - let rowElemCompare (e1: RowElement) (e2: RowElement) = - let c = compare e1.Val e2.Val - if c <> 0 then c else + let rowElemCompare (e1: RowElement) (e2: RowElement) = + let c = compare e1.Val e2.Val + if c <> 0 then c else compare e1.Tag e2.Tag - module List = - let rec assoc x l = - match l with + module List = + let rec assoc x l = + match l with | [] -> failwith "index not found" | ((h,r)::t) -> if x = h then r else assoc x t - let rec memAssoc x l = - match l with + let rec memAssoc x l = + match l with | [] -> false | ((h,_)::t) -> x = h || memAssoc x t - let TableRequiresSorting tab = - List.memAssoc tab ILTableNames.sortedTableInfo + let TableRequiresSorting tab = + List.memAssoc tab ILTableNames.sortedTableInfo - let SortTableRows tab (rows:GenericRow[]) = + let SortTableRows tab (rows:GenericRow[]) = assert (TableRequiresSorting tab) let col = List.assoc tab ILTableNames.sortedTableInfo - rows + rows // This needs to be a stable sort, so we use List.sortWith |> Array.toList - |> List.sortWith (fun r1 r2 -> rowElemCompare r1.[col] r2.[col]) + |> List.sortWith (fun r1 r2 -> rowElemCompare r1.[col] r2.[col]) |> Array.ofList //|> Array.map SharedRow @@ -11783,38 +11783,38 @@ namespace ProviderImplementation.ProvidedTypes Properties=props Events=events Token=0 - //SecurityDecls=emptyILSecurityDecls; + //SecurityDecls=emptyILSecurityDecls; //HasSecurity=false; - } - let mkILTypeDefForGlobalFunctions ilg (methods,fields) = + } + let mkILTypeDefForGlobalFunctions ilg (methods,fields) = mkILSimpleClass ilg (UNone, typeNameForGlobalFunctions, methods, fields, emptyILTypeDefs, emptyILProperties, emptyILEvents, emptyILCustomAttrs) - let destTypeDefsWithGlobalFunctionsFirst ilg (tdefs: ILTypeDefs) = + let destTypeDefsWithGlobalFunctionsFirst ilg (tdefs: ILTypeDefs) = let l = tdefs.Entries let top,nontop = l |> Array.partition (fun td -> td.Name = typeNameForGlobalFunctions) let top2 = if isEmpty top then [| mkILTypeDefForGlobalFunctions ilg (emptyILMethods, emptyILFields) |] else top Array.append top2 nontop - let GenModule (cenv: cenv) (modul: ILModuleDef) = + let GenModule (cenv: cenv) (modul: ILModuleDef) = let midx = AddUnsharedRow cenv ILTableNames.Module (GetModuleAsRow cenv modul) - Array.iter (GenResourcePass3 cenv) modul.Resources.Entries + Array.iter (GenResourcePass3 cenv) modul.Resources.Entries let tds = destTypeDefsWithGlobalFunctionsFirst cenv.ilg modul.TypeDefs GenTypeDefsPass1 [] cenv tds GenTypeDefsPass2 0 [] cenv tds (match modul.Manifest with None -> () | Some m -> GenManifestPass3 cenv m) GenTypeDefsPass3 [] cenv tds GenCustomAttrsPass3Or4 cenv (HasCustomAttributeTag.Module, midx) modul.CustomAttrs - // GenericParam is the only sorted table indexed by Columns in other tables (GenericParamConstraint\CustomAttributes). - // Hence we need to sort it before we emit any entries in GenericParamConstraint\CustomAttributes that are attached to generic params. - // Note this mutates the rows in a table. 'SetRowsOfTable' clears - // the key --> index map since it is no longer valid + // GenericParam is the only sorted table indexed by Columns in other tables (GenericParamConstraint\CustomAttributes). + // Hence we need to sort it before we emit any entries in GenericParamConstraint\CustomAttributes that are attached to generic params. + // Note this mutates the rows in a table. 'SetRowsOfTable' clears + // the key --> index map since it is no longer valid cenv.GetTable(ILTableNames.GenericParam).SetRowsOfSharedTable (SortTableRows ILTableNames.GenericParam (cenv.GetTable(ILTableNames.GenericParam).GenericRowsOfTable)) GenTypeDefsPass4 [] cenv tds let generateIL requiredDataFixups (desiredMetadataVersion, generatePdb, ilg: ILGlobals, emitTailcalls, deterministic, showTimes) (m: ILModuleDef) cilStartAddress = let isDll = m.IsDLL - let cenv = + let cenv = { emitTailcalls=emitTailcalls deterministic = deterministic showTimes=showTimes @@ -11826,8 +11826,8 @@ namespace ProviderImplementation.ProvidedTypes nextCodeAddr = cilStartAddress data = ByteBuffer.Create 200 resources = ByteBuffer.Create 200 - tables= - Array.init 64 (fun i -> + tables= + Array.init 64 (fun i -> if (i = ILTableNames.AssemblyRef.Index || i = ILTableNames.MemberRef.Index || i = ILTableNames.ModuleRef.Index || @@ -11836,7 +11836,7 @@ namespace ProviderImplementation.ProvidedTypes i = ILTableNames.TypeSpec.Index || i = ILTableNames.MethodSpec.Index || i = ILTableNames.StandAloneSig.Index || - i = ILTableNames.GenericParam.Index) then + i = ILTableNames.GenericParam.Index) then MetadataTable.Shared (MetadataTable.New ("row table "+string i, EqualityComparer.Default)) else MetadataTable.Unshared (MetadataTable.New ("row table "+string i, EqualityComparer.Default))) @@ -11860,19 +11860,19 @@ namespace ProviderImplementation.ProvidedTypes // These must use structural comparison since they are keyed by arrays guids=MetadataTable<_>.New("guids", HashIdentity.Structural) blobs= MetadataTable<_>.New("blobs", HashIdentity.Structural) - strings= MetadataTable<_>.New("strings", EqualityComparer.Default) + strings= MetadataTable<_>.New("strings", EqualityComparer.Default) userStrings= MetadataTable<_>.New("user strings", EqualityComparer.Default) } - // Now the main compilation step + // Now the main compilation step GenModule cenv m // .exe files have a .entrypoint instruction. Do not write it to the entrypoint when writing dll. - let entryPointToken = - match cenv.entrypoint with - | Some (epHere, tok) -> + let entryPointToken = + match cenv.entrypoint with + | Some (epHere, tok) -> if isDll then 0x0 - else getUncodedToken (if epHere then ILTableNames.Method else ILTableNames.File) tok - | None -> + else getUncodedToken (if epHere then ILTableNames.Method else ILTableNames.File) tok + | None -> if not isDll then printfn "warning: no entrypoint specified in executable binary" 0x0 @@ -11896,9 +11896,9 @@ namespace ProviderImplementation.ProvidedTypes let userStrings = cenv.userStrings.EntriesAsArray |> Array.map Encoding.Unicode.GetBytes let blobs = cenv.blobs.EntriesAsArray let guids = cenv.guids.EntriesAsArray - let tables = cenv.tables - let code = cenv.GetCode() - // turn idx tbls into token maps + let tables = cenv.tables + let code = cenv.GetCode() + // turn idx tbls into token maps let mappings = { TypeDefTokenMap = (fun t -> getUncodedToken ILTableNames.TypeDef (idxForNestedTypeDef t)) @@ -11914,7 +11914,7 @@ namespace ProviderImplementation.ProvidedTypes EventTokenMap = (fun t ed -> let tidx = idxForNestedTypeDef t getUncodedToken ILTableNames.Event (cenv.eventDefs.GetTableEntry (EventKey (tidx, ed.Name)))) } - // New return the results + // New return the results let data = cenv.data.Close() let resources = cenv.resources.Close() (strings, userStrings, blobs, guids, tables, entryPointToken, code, cenv.requiredStringFixups, data, resources, pdbData, mappings) @@ -11923,47 +11923,47 @@ namespace ProviderImplementation.ProvidedTypes //===================================================================== // TABLES+BLOBS --> PHYSICAL METADATA+BLOBS //===================================================================== - let chunk sz next = ({addr=next; size=sz}, next + sz) + let chunk sz next = ({addr=next; size=sz}, next + sz) let nochunk next = ({addr= 0x0;size= 0x0; } , next) - let count f arr = - Array.fold (fun x y -> x + f y) 0x0 arr + let count f arr = + Array.fold (fun x y -> x + f y) 0x0 arr let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailcalls, deterministic, showTimes) modul cilStartAddress = - // When we know the real RVAs of the data section we fixup the references for the FieldRVA table. - // These references are stored as offsets into the metadata we return from this function + // When we know the real RVAs of the data section we fixup the references for the FieldRVA table. + // These references are stored as offsets into the metadata we return from this function let requiredDataFixups = ResizeArray() let next = cilStartAddress - let strings, userStrings, blobs, guids, tables, entryPointToken, code, requiredStringFixups, data, resources, pdbData, mappings = + let strings, userStrings, blobs, guids, tables, entryPointToken, code, requiredStringFixups, data, resources, pdbData, mappings = generateIL requiredDataFixups (desiredMetadataVersion, generatePdb, ilg, emitTailcalls, deterministic, showTimes) modul cilStartAddress let tableSize (tab: ILTableName) = tables.[tab.Index].Count - // Now place the code + // Now place the code let codeSize = code.Length let alignedCodeSize = align 0x4 codeSize let codep, next = chunk codeSize next let codePadding = Array.create (alignedCodeSize - codeSize) 0x0uy let _codePaddingChunk, next = chunk codePadding.Length next - // Now layout the chunks of metadata and IL + // Now layout the chunks of metadata and IL let metadataHeaderStartChunk, _next = chunk 0x10 next let numStreams = 0x05 let (mdtableVersionMajor, mdtableVersionMinor) = metadataSchemaVersionSupportedByCLRVersion desiredMetadataVersion - let version = + let version = Encoding.UTF8.GetBytes (sprintf "v%d.%d.%d" desiredMetadataVersion.Major desiredMetadataVersion.Minor desiredMetadataVersion.Build) let paddedVersionLength = align 0x4 (Array.length version) - // Most addresses after this point are measured from the MD root - // Switch to md-rooted addresses + // Most addresses after this point are measured from the MD root + // Switch to md-rooted addresses let next = metadataHeaderStartChunk.size let _metadataHeaderVersionChunk, next = chunk paddedVersionLength next let _metadataHeaderEndChunk, next = chunk 0x04 next @@ -11977,13 +11977,13 @@ namespace ProviderImplementation.ProvidedTypes let stringsStreamUnpaddedSize = count (fun (s:byte[]) -> s.Length) strings + 1 let stringsStreamPaddedSize = align 4 stringsStreamUnpaddedSize - + let userStringsStreamUnpaddedSize = count (fun (s:byte[]) -> let n = s.Length + 1 in n + ByteBuffer.Z32Size n) userStrings + 1 let userStringsStreamPaddedSize = align 4 userStringsStreamUnpaddedSize - + let guidsStreamUnpaddedSize = (Array.length guids) * 0x10 let guidsStreamPaddedSize = align 4 guidsStreamUnpaddedSize - + let blobsStreamUnpaddedSize = count (fun (blob:byte[]) -> let n = blob.Length in n + ByteBuffer.Z32Size n) blobs + 1 let blobsStreamPaddedSize = align 4 blobsStreamUnpaddedSize @@ -11991,30 +11991,30 @@ namespace ProviderImplementation.ProvidedTypes let stringsBig = stringsStreamPaddedSize >= 0x10000 let blobsBig = blobsStreamPaddedSize >= 0x10000 - // 64bit bitvector indicating which tables are in the metadata. - let (valid1, valid2), _ = - (((0, 0), 0), tables) ||> Array.fold (fun ((valid1, valid2) as valid, n) rows -> - let valid = + // 64bit bitvector indicating which tables are in the metadata. + let (valid1, valid2), _ = + (((0, 0), 0), tables) ||> Array.fold (fun ((valid1, valid2) as valid, n) rows -> + let valid = if rows.Count = 0 then valid else - ( (if n < 32 then valid1 ||| (1 <<< n ) else valid1), + ( (if n < 32 then valid1 ||| (1 <<< n ) else valid1), (if n >= 32 then valid2 ||| (1 <<< (n-32)) else valid2) ) (valid, n+1)) - // 64bit bitvector indicating which tables are sorted. - // Constant - REVIEW: make symbolic! compute from sorted table info! + // 64bit bitvector indicating which tables are sorted. + // Constant - REVIEW: make symbolic! compute from sorted table info! let sorted1 = 0x3301fa00 - let sorted2 = - // If there are any generic parameters in the binary we're emitting then mark that - // table as sorted, otherwise don't. This maximizes the number of assemblies we emit - // which have an ECMA-v.1. compliant set of sorted tables. - (if tableSize (ILTableNames.GenericParam) > 0 then 0x00000400 else 0x00000000) ||| - (if tableSize (ILTableNames.GenericParamConstraint) > 0 then 0x00001000 else 0x00000000) ||| + let sorted2 = + // If there are any generic parameters in the binary we're emitting then mark that + // table as sorted, otherwise don't. This maximizes the number of assemblies we emit + // which have an ECMA-v.1. compliant set of sorted tables. + (if tableSize (ILTableNames.GenericParam) > 0 then 0x00000400 else 0x00000000) ||| + (if tableSize (ILTableNames.GenericParamConstraint) > 0 then 0x00001000 else 0x00000000) ||| 0x00000200 - + let guidAddress n = (if n = 0 then 0 else (n - 1) * 0x10 + 0x01) - let stringAddressTable = + let stringAddressTable = let tab = Array.create (strings.Length + 1) 0 let pos = ref 1 for i = 1 to strings.Length do @@ -12023,11 +12023,11 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + s.Length tab - let stringAddress n = + let stringAddress n = if n >= Array.length stringAddressTable then failwith ("string index "+string n+" out of range") stringAddressTable.[n] - - let userStringAddressTable = + + let userStringAddressTable = let tab = Array.create (Array.length userStrings + 1) 0 let pos = ref 1 for i = 1 to Array.length userStrings do @@ -12037,11 +12037,11 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + n + ByteBuffer.Z32Size n tab - let userStringAddress n = + let userStringAddress n = if n >= Array.length userStringAddressTable then failwith "userString index out of range" userStringAddressTable.[n] - - let blobAddressTable = + + let blobAddressTable = let tab = Array.create (blobs.Length + 1) 0 let pos = ref 1 for i = 1 to blobs.Length do @@ -12050,42 +12050,42 @@ namespace ProviderImplementation.ProvidedTypes pos := !pos + blob.Length + ByteBuffer.Z32Size blob.Length tab - let blobAddress n = + let blobAddress n = if n >= blobAddressTable.Length then failwith "blob index out of range" blobAddressTable.[n] - - let sortedTables = - Array.init 64 (fun i -> + + let sortedTables = + Array.init 64 (fun i -> let tab = tables.[i] let tabName = ILTableName.FromIndex i let rows = tab.GenericRowsOfTable if TableRequiresSorting tabName then SortTableRows tabName rows else rows) - - let codedTables = - + + let codedTables = + let bignessTable = Array.map (fun rows -> Array.length rows >= 0x10000) sortedTables let bigness (tab:int32) = bignessTable.[tab] - + let codedBigness nbits tab = (tableSize tab) >= (0x10000 >>> nbits) - - let tdorBigness = - codedBigness 2 ILTableNames.TypeDef || - codedBigness 2 ILTableNames.TypeRef || + + let tdorBigness = + codedBigness 2 ILTableNames.TypeDef || + codedBigness 2 ILTableNames.TypeRef || codedBigness 2 ILTableNames.TypeSpec - - let tomdBigness = - codedBigness 1 ILTableNames.TypeDef || + + let tomdBigness = + codedBigness 1 ILTableNames.TypeDef || codedBigness 1 ILTableNames.Method - - let hcBigness = + + let hcBigness = codedBigness 2 ILTableNames.Field || codedBigness 2 ILTableNames.Param || codedBigness 2 ILTableNames.Property - - let hcaBigness = + + let hcaBigness = codedBigness 5 ILTableNames.Method || codedBigness 5 ILTableNames.Field || codedBigness 5 ILTableNames.TypeRef || @@ -12109,82 +12109,82 @@ namespace ProviderImplementation.ProvidedTypes codedBigness 5 ILTableNames.GenericParamConstraint || codedBigness 5 ILTableNames.MethodSpec - - let hfmBigness = - codedBigness 1 ILTableNames.Field || + + let hfmBigness = + codedBigness 1 ILTableNames.Field || codedBigness 1 ILTableNames.Param - - let hdsBigness = - codedBigness 2 ILTableNames.TypeDef || + + let hdsBigness = + codedBigness 2 ILTableNames.TypeDef || codedBigness 2 ILTableNames.Method || codedBigness 2 ILTableNames.Assembly - - let mrpBigness = + + let mrpBigness = codedBigness 3 ILTableNames.TypeRef || codedBigness 3 ILTableNames.ModuleRef || codedBigness 3 ILTableNames.Method || codedBigness 3 ILTableNames.TypeSpec - - let hsBigness = - codedBigness 1 ILTableNames.Event || - codedBigness 1 ILTableNames.Property - + + let hsBigness = + codedBigness 1 ILTableNames.Event || + codedBigness 1 ILTableNames.Property + let mdorBigness = - codedBigness 1 ILTableNames.Method || - codedBigness 1 ILTableNames.MemberRef - + codedBigness 1 ILTableNames.Method || + codedBigness 1 ILTableNames.MemberRef + let mfBigness = codedBigness 1 ILTableNames.Field || - codedBigness 1 ILTableNames.Method - + codedBigness 1 ILTableNames.Method + let iBigness = - codedBigness 2 ILTableNames.File || - codedBigness 2 ILTableNames.AssemblyRef || - codedBigness 2 ILTableNames.ExportedType - - let catBigness = - codedBigness 3 ILTableNames.Method || - codedBigness 3 ILTableNames.MemberRef - - let rsBigness = - codedBigness 2 ILTableNames.Module || - codedBigness 2 ILTableNames.ModuleRef || + codedBigness 2 ILTableNames.File || + codedBigness 2 ILTableNames.AssemblyRef || + codedBigness 2 ILTableNames.ExportedType + + let catBigness = + codedBigness 3 ILTableNames.Method || + codedBigness 3 ILTableNames.MemberRef + + let rsBigness = + codedBigness 2 ILTableNames.Module || + codedBigness 2 ILTableNames.ModuleRef || codedBigness 2 ILTableNames.AssemblyRef || codedBigness 2 ILTableNames.TypeRef let tablesBuf = ByteBuffer.Create 20000 - // Now the coded tables themselves - first the schemata header - tablesBuf.EmitIntsAsBytes - [| 0x00; 0x00; 0x00; 0x00; - mdtableVersionMajor // major version of table schemata - mdtableVersionMinor // minor version of table schemata - - ((if stringsBig then 0x01 else 0x00) ||| // bit vector for heap size - (if guidsBig then 0x02 else 0x00) ||| + // Now the coded tables themselves - first the schemata header + tablesBuf.EmitIntsAsBytes + [| 0x00; 0x00; 0x00; 0x00; + mdtableVersionMajor // major version of table schemata + mdtableVersionMinor // minor version of table schemata + + ((if stringsBig then 0x01 else 0x00) ||| // bit vector for heap size + (if guidsBig then 0x02 else 0x00) ||| (if blobsBig then 0x04 else 0x00)) 0x01 (* reserved, always 1 *) |] - + tablesBuf.EmitInt32 valid1 tablesBuf.EmitInt32 valid2 tablesBuf.EmitInt32 sorted1 tablesBuf.EmitInt32 sorted2 - - // Numbers of rows in various tables - for rows in sortedTables do - if rows.Length <> 0 then - tablesBuf.EmitInt32 rows.Length - - - - // The tables themselves + + // Numbers of rows in various tables + for rows in sortedTables do + if rows.Length <> 0 then + tablesBuf.EmitInt32 rows.Length + + + + // The tables themselves for rows in sortedTables do - for row in rows do - for x in row do - // Emit the coded token for the array element + for row in rows do + for x in row do + // Emit the coded token for the array element let t = x.Tag let n = x.Val - match t with + match t with | _ when t = RowElementTags.UShort -> tablesBuf.EmitUInt16 (uint16 n) | _ when t = RowElementTags.ULong -> tablesBuf.EmitInt32 n | _ when t = RowElementTags.Data -> recordRequiredDataFixup requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, false) @@ -12199,8 +12199,8 @@ namespace ProviderImplementation.ProvidedTypes | _ when t <= RowElementTags.HasCustomAttributeMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasCustomAttributeMin) 5 hcaBigness n | _ when t <= RowElementTags.HasFieldMarshalMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasFieldMarshalMin) 1 hfmBigness n | _ when t <= RowElementTags.HasDeclSecurityMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasDeclSecurityMin) 2 hdsBigness n - | _ when t <= RowElementTags.MemberRefParentMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberRefParentMin) 3 mrpBigness n - | _ when t <= RowElementTags.HasSemanticsMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasSemanticsMin) 1 hsBigness n + | _ when t <= RowElementTags.MemberRefParentMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberRefParentMin) 3 mrpBigness n + | _ when t <= RowElementTags.HasSemanticsMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasSemanticsMin) 1 hsBigness n | _ when t <= RowElementTags.MethodDefOrRefMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MethodDefOrRefMin) 1 mdorBigness n | _ when t <= RowElementTags.MemberForwardedMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.MemberForwardedMin) 1 mfBigness n | _ when t <= RowElementTags.ImplementationMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.ImplementationMin) 2 iBigness n @@ -12212,8 +12212,8 @@ namespace ProviderImplementation.ProvidedTypes let tablesStreamUnpaddedSize = codedTables.Length - // QUERY: extra 4 empty bytes in array.exe - why? Include some extra padding after - // the tables just in case there is a mistake in the ECMA spec. + // QUERY: extra 4 empty bytes in array.exe - why? Include some extra padding after + // the tables just in case there is a mistake in the ECMA spec. let tablesStreamPaddedSize = align 4 (tablesStreamUnpaddedSize + 4) let tablesChunk, next = chunk tablesStreamPaddedSize next let tablesStreamPadding = tablesChunk.size - tablesStreamUnpaddedSize @@ -12225,24 +12225,24 @@ namespace ProviderImplementation.ProvidedTypes let guidsChunk, next = chunk (0x10 * guids.Length) next let blobsChunk, _next = chunk blobsStreamPaddedSize next let blobsStreamPadding = blobsChunk.size - blobsStreamUnpaddedSize - + let metadata, guidStart = - let mdbuf = ByteBuffer.Create 500000 - mdbuf.EmitIntsAsBytes - [| 0x42; 0x53; 0x4a; 0x42; // Magic signature - 0x01; 0x00; // Major version - 0x01; 0x00; // Minor version + let mdbuf = ByteBuffer.Create 500000 + mdbuf.EmitIntsAsBytes + [| 0x42; 0x53; 0x4a; 0x42; // Magic signature + 0x01; 0x00; // Major version + 0x01; 0x00; // Minor version |]; - mdbuf.EmitInt32 0x0; // Reserved + mdbuf.EmitInt32 0x0; // Reserved mdbuf.EmitInt32 paddedVersionLength; mdbuf.EmitBytes version; - for i = 1 to (paddedVersionLength - Array.length version) do + for i = 1 to (paddedVersionLength - Array.length version) do mdbuf.EmitIntAsByte 0x00; - mdbuf.EmitBytes - [| 0x00uy; 0x00uy; // flags, reserved + mdbuf.EmitBytes + [| 0x00uy; 0x00uy; // flags, reserved b0 numStreams; b1 numStreams; |]; mdbuf.EmitInt32 tablesChunk.addr; mdbuf.EmitInt32 tablesChunk.size; @@ -12259,46 +12259,46 @@ namespace ProviderImplementation.ProvidedTypes mdbuf.EmitInt32 blobsChunk.addr; mdbuf.EmitInt32 blobsChunk.size; mdbuf.EmitIntsAsBytes [| 0x23; 0x42; 0x6c; 0x6f; 0x62; 0x00; 0x00; 0x00; (* #Blob000 *)|]; - - // Now the coded tables themselves - mdbuf.EmitBytes codedTables; - for i = 1 to tablesStreamPadding do + + // Now the coded tables themselves + mdbuf.EmitBytes codedTables; + for i = 1 to tablesStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The string stream + // The string stream mdbuf.EmitByte 0x00uy; for s in strings do mdbuf.EmitBytes s; - for i = 1 to stringsStreamPadding do + for i = 1 to stringsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The user string stream + // The user string stream mdbuf.EmitByte 0x00uy; for s in userStrings do mdbuf.EmitZ32 (s.Length + 1); mdbuf.EmitBytes s; mdbuf.EmitIntAsByte (markerForUnicodeBytes s) - for i = 1 to userStringsStreamPadding do + for i = 1 to userStringsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // The GUID stream + // The GUID stream let guidStart = mdbuf.Position Array.iter mdbuf.EmitBytes guids; - - // The blob stream + + // The blob stream mdbuf.EmitByte 0x00uy; - for s in blobs do + for s in blobs do mdbuf.EmitZ32 s.Length; mdbuf.EmitBytes s - for i = 1 to blobsStreamPadding do + for i = 1 to blobsStreamPadding do mdbuf.EmitIntAsByte 0x00; - // Done - close the buffer and return the result. + // Done - close the buffer and return the result. mdbuf.Close(), guidStart - - // Now we know the user string tables etc. we can fixup the - // uses of strings in the code + + // Now we know the user string tables etc. we can fixup the + // uses of strings in the code for (codeStartAddr, l) in requiredStringFixups do - for (codeOffset, userStringIndex) in l do + for (codeOffset, userStringIndex) in l do if codeStartAddr < codep.addr || codeStartAddr >= codep.addr + codep.size then failwith "strings-in-code fixup: a group of fixups is located outside the code array"; let locInCode = ((codeStartAddr + codeOffset) - codep.addr) checkFixup32 code locInCode 0xdeadbeef; @@ -12312,17 +12312,17 @@ namespace ProviderImplementation.ProvidedTypes // PHYSICAL METADATA+BLOBS --> PHYSICAL PE FORMAT //--------------------------------------------------------------------- - // THIS LAYS OUT A 2-SECTION .NET PE BINARY - // SECTIONS + // THIS LAYS OUT A 2-SECTION .NET PE BINARY + // SECTIONS // TEXT: physical 0x0200 --> RVA 0x00020000 - // e.g. raw size 0x9600, + // e.g. raw size 0x9600, // e.g. virt size 0x9584 // RELOC: physical 0x9800 --> RVA 0x0000c000 // i.e. physbase --> rvabase // where physbase = textbase + text raw size // phsrva = roundup(0x2000, 0x0002000 + text virt size) - let msdosHeader: byte[] = + let msdosHeader: byte[] = [| 0x4duy; 0x5auy; 0x90uy; 0x00uy; 0x03uy; 0x00uy; 0x00uy; 0x00uy 0x04uy; 0x00uy; 0x00uy; 0x00uy; 0xFFuy; 0xFFuy; 0x00uy; 0x00uy 0xb8uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy @@ -12350,97 +12350,97 @@ namespace ProviderImplementation.ProvidedTypes os.Write (dw6 x); os.Write (dw7 x) - let writeInt32 (os: BinaryWriter) x = + let writeInt32 (os: BinaryWriter) x = os.Write (b0 x) os.Write (b1 x) os.Write (b2 x) - os.Write (b3 x) + os.Write (b3 x) - let writeInt32AsUInt16 (os: BinaryWriter) x = + let writeInt32AsUInt16 (os: BinaryWriter) x = os.Write (b0 x) os.Write (b1 x) - + let writeDirectory os dict = writeInt32 os (if dict.size = 0x0 then 0x0 else dict.addr); writeInt32 os dict.size - let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk, 0, chunk.Length) + let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk, 0, chunk.Length) let writeBinaryAndReportMappings (outfile: string, - ilg: ILGlobals, pdbfile: string option, (* signer: ILStrongNameSigner option, *) portablePDB, embeddedPDB, + ilg: ILGlobals, pdbfile: string option, (* signer: ILStrongNameSigner option, *) portablePDB, embeddedPDB, embedAllSource, embedSourceList, sourceLink, emitTailcalls, deterministic, showTimes, dumpDebugInfo ) modul = let isDll = modul.IsDLL - - let os = + + let os = try // Ensure the output directory exists otherwise it will fail let dir = Path.GetDirectoryName(outfile) if not (Directory.Exists(dir)) then Directory.CreateDirectory(dir) |>ignore new BinaryWriter(System.IO.File.OpenWrite(outfile)) - with e -> - failwith ("Could not open file for writing (binary mode): " + outfile + "\n" + e.ToString()) + with e -> + failwith ("Could not open file for writing (binary mode): " + outfile + "\n" + e.ToString()) let pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings = - try + try let imageBaseReal = modul.ImageBase // FIXED CHOICE let alignVirt = modul.VirtualAlignment // FIXED CHOICE let alignPhys = modul.PhysicalAlignment // FIXED CHOICE - + let isItanium = modul.Platform = Some(IA64) - - let numSections = 3 // .text, .sdata, .reloc + let numSections = 3 // .text, .sdata, .reloc - // HEADERS + + // HEADERS let next = 0x0 let headerSectionPhysLoc = 0x0 let headerAddr = next let next = headerAddr - + let msdosHeaderSize = 0x80 let msdosHeaderChunk, next = chunk msdosHeaderSize next - + let peSignatureSize = 0x04 let peSignatureChunk, next = chunk peSignatureSize next - + let peFileHeaderSize = 0x14 let peFileHeaderChunk, next = chunk peFileHeaderSize next - + let peOptionalHeaderSize = if modul.Is64Bit then 0xf0 else 0xe0 let peOptionalHeaderChunk, next = chunk peOptionalHeaderSize next - + let textSectionHeaderSize = 0x28 let textSectionHeaderChunk, next = chunk textSectionHeaderSize next - + let dataSectionHeaderSize = 0x28 let dataSectionHeaderChunk, next = chunk dataSectionHeaderSize next - + let relocSectionHeaderSize = 0x28 let relocSectionHeaderChunk, next = chunk relocSectionHeaderSize next - + let headerSize = next - headerAddr let nextPhys = align alignPhys (headerSectionPhysLoc + headerSize) let headerSectionPhysSize = nextPhys - headerSectionPhysLoc let next = align alignVirt (headerAddr + headerSize) - - // TEXT SECTION: 8 bytes IAT table 72 bytes CLI header + + // TEXT SECTION: 8 bytes IAT table 72 bytes CLI header let textSectionPhysLoc = nextPhys let textSectionAddr = next let next = textSectionAddr - + let importAddrTableChunk, next = chunk 0x08 next let cliHeaderPadding = (if isItanium then (align 16 next) else next) - next let next = next + cliHeaderPadding let cliHeaderChunk, next = chunk 0x48 next - - let desiredMetadataVersion = + + let desiredMetadataVersion = if modul.MetadataVersion <> "" then Version.Parse modul.MetadataVersion else - match ilg.systemRuntimeScopeRef with - | ILScopeRef.Local -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Local" + match ilg.systemRuntimeScopeRef with + | ILScopeRef.Local -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Local" | ILScopeRef.Module(_) -> failwith "Expected mscorlib to be ILScopeRef.Assembly was ILScopeRef.Module" | ILScopeRef.Assembly(aref) -> match aref.Version with @@ -12452,9 +12452,9 @@ namespace ProviderImplementation.ProvidedTypes let _codeChunk, next = chunk code.Length next let _codePaddingChunk, next = chunk codePadding.Length next - + let metadataChunk, next = chunk metadata.Length next - + #if EMIT_STRONG_NAME let strongnameChunk, next = match signer with @@ -12465,7 +12465,7 @@ namespace ProviderImplementation.ProvidedTypes #endif let resourcesChunk, next = chunk resources.Length next - + let rawdataChunk, next = chunk data.Length next let vtfixupsChunk, next = nochunk next // Note: only needed for mixed mode assemblies @@ -12479,7 +12479,7 @@ namespace ProviderImplementation.ProvidedTypes let next = align 0x10 (next + 0x05) - 0x05 let importTableChunk = { addr=importTableChunk.addr; size = next - importTableChunk.addr} let importTableChunkPadding = importTableChunk.size - (0x28 + 0x14 + 0x0e + 0x0c) - + let next = next + 0x03 let entrypointCodeChunk, next = chunk 0x06 next let globalpointerCodeChunk, next = chunk (if isItanium then 0x8 else 0x0) next @@ -12534,13 +12534,13 @@ namespace ProviderImplementation.ProvidedTypes let nextPhys = align alignPhys (textSectionPhysLoc + textSectionSize) let textSectionPhysSize = nextPhys - textSectionPhysLoc let next = align alignVirt (textSectionAddr + textSectionSize) - - // .RSRC SECTION (DATA) + + // .RSRC SECTION (DATA) let dataSectionPhysLoc = nextPhys let dataSectionAddr = next let dataSectionVirtToPhys v = v - dataSectionAddr + dataSectionPhysLoc - - + + #if EMIT_NATIVE_RESOURCES let resourceFormat = if modul.Is64Bit then Support.X64 else Support.X86 let nativeResources = @@ -12561,15 +12561,15 @@ namespace ProviderImplementation.ProvidedTypes let nativeResourcesChunk, next = chunk 0x0 next #endif - + let dummydatap, next = chunk (if next = dataSectionAddr then 0x01 else 0x0) next - + let dataSectionSize = next - dataSectionAddr let nextPhys = align alignPhys (dataSectionPhysLoc + dataSectionSize) let dataSectionPhysSize = nextPhys - dataSectionPhysLoc let next = align alignVirt (dataSectionAddr + dataSectionSize) - - // .RELOC SECTION base reloc table: 0x0c size + + // .RELOC SECTION base reloc table: 0x0c size let relocSectionPhysLoc = nextPhys let relocSectionAddr = next let baseRelocTableChunk, next = chunk 0x0c next @@ -12579,64 +12579,64 @@ namespace ProviderImplementation.ProvidedTypes let relocSectionPhysSize = nextPhys - relocSectionPhysLoc let next = align alignVirt (relocSectionAddr + relocSectionSize) - // Now we know where the data section lies we can fix up the - // references into the data section from the metadata tables. - begin + // Now we know where the data section lies we can fix up the + // references into the data section from the metadata tables. + begin requiredDataFixups |> Array.iter - (fun (metadataOffset32, (dataOffset, kind)) -> + (fun (metadataOffset32, (dataOffset, kind)) -> let metadataOffset = metadataOffset32 if metadataOffset < 0 || metadataOffset >= metadata.Length - 4 then failwith "data RVA fixup: fixup located outside metadata"; checkFixup32 metadata metadataOffset 0xdeaddddd; - let dataRva = + let dataRva = if kind then let res = dataOffset if res >= resourcesChunk.size then printfn ("resource offset bigger than resource data section"); res - else + else let res = rawdataChunk.addr + dataOffset if res < rawdataChunk.addr then printfn ("data rva before data section"); if res >= rawdataChunk.addr + rawdataChunk.size then printfn "%s" ("data rva after end of data section, dataRva = "+string res+", rawdataChunk.addr = "+string rawdataChunk.addr+", rawdataChunk.size = "+string rawdataChunk.size); res applyFixup32 metadata metadataOffset dataRva); end; - - // IMAGE TOTAL SIZE + + // IMAGE TOTAL SIZE let imageEndSectionPhysLoc = nextPhys let imageEndAddr = next - let write p (os: BinaryWriter) chunkName chunk = - match p with - | None -> () - | Some pExpected -> - os.Flush(); + let write p (os: BinaryWriter) chunkName chunk = + match p with + | None -> () + | Some pExpected -> + os.Flush(); let pCurrent = int32 os.BaseStream.Position - if pCurrent <> pExpected then - failwith ("warning: "+chunkName+" not where expected, pCurrent = "+string pCurrent+", p.addr = "+string pExpected) - writeBytes os chunk - + if pCurrent <> pExpected then + failwith ("warning: "+chunkName+" not where expected, pCurrent = "+string pCurrent+", p.addr = "+string pExpected) + writeBytes os chunk + let writePadding (os: BinaryWriter) _comment sz = if sz < 0 then failwith "writePadding: size < 0"; - for i = 0 to sz - 1 do + for i = 0 to sz - 1 do os.Write 0uy - - // Now we've computed all the offsets, write the image - + + // Now we've computed all the offsets, write the image + write (Some msdosHeaderChunk.addr) os "msdos header" msdosHeader; - + write (Some peSignatureChunk.addr) os "pe signature" [| |]; - + writeInt32 os 0x4550; - + write (Some peFileHeaderChunk.addr) os "pe file header" [| |]; - + if (modul.Platform = Some(AMD64)) then - writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 + writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 elif isItanium then writeInt32AsUInt16 os 0x200 else - writeInt32AsUInt16 os 0x014c; // Machine - IMAGE_FILE_MACHINE_I386 - + writeInt32AsUInt16 os 0x014c; // Machine - IMAGE_FILE_MACHINE_I386 + writeInt32AsUInt16 os numSections; #if EMIT_DEBUG_INFO @@ -12669,193 +12669,193 @@ namespace ProviderImplementation.ProvidedTypes writeInt32 os timestamp // date since 1970 #endif - writeInt32 os 0x00; // Pointer to Symbol Table Always 0 - // 00000090 - writeInt32 os 0x00; // Number of Symbols Always 0 - writeInt32AsUInt16 os peOptionalHeaderSize; // Size of the optional header, the format is described below. - + writeInt32 os 0x00; // Pointer to Symbol Table Always 0 + // 00000090 + writeInt32 os 0x00; // Number of Symbols Always 0 + writeInt32AsUInt16 os peOptionalHeaderSize; // Size of the optional header, the format is described below. + // 64bit: IMAGE_FILE_32BIT_MACHINE ||| IMAGE_FILE_LARGE_ADDRESS_AWARE // 32bit: IMAGE_FILE_32BIT_MACHINE // Yes, 32BIT_MACHINE is set for AMD64... let iMachineCharacteristic = match modul.Platform with | Some IA64 -> 0x20 | Some AMD64 -> 0x0120 | _ -> 0x0100 - + writeInt32AsUInt16 os ((if isDll then 0x2000 else 0x0000) ||| 0x0002 ||| 0x0004 ||| 0x0008 ||| iMachineCharacteristic); - - // Now comes optional header + + // Now comes optional header let peOptionalHeaderByte = peOptionalHeaderByteByCLRVersion desiredMetadataVersion write (Some peOptionalHeaderChunk.addr) os "pe optional header" [| |]; if modul.Is64Bit then - writeInt32AsUInt16 os 0x020B // Magic number is 0x020B for 64-bit + writeInt32AsUInt16 os 0x020B // Magic number is 0x020B for 64-bit else - writeInt32AsUInt16 os 0x010b; // Always 0x10B (see Section 23.1). - writeInt32AsUInt16 os peOptionalHeaderByte; // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8 - writeInt32 os textSectionPhysSize; // Size of the code (text) section, or the sum of all code sections if there are multiple sections. - // 000000a0 - writeInt32 os dataSectionPhysSize; // Size of the initialized data section, or the sum of all such sections if there are multiple data sections. - writeInt32 os 0x00; // Size of the uninitialized data section, or the sum of all such sections if there are multiple uninitialized data sections. - writeInt32 os entrypointCodeChunk.addr; // RVA of entry point , needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 in a section marked execute/read for EXEs or 0 for DLLs e.g. 0x0000b57e - writeInt32 os textSectionAddr; // e.g. 0x0002000 - // 000000b0 + writeInt32AsUInt16 os 0x010b; // Always 0x10B (see Section 23.1). + writeInt32AsUInt16 os peOptionalHeaderByte; // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8 + writeInt32 os textSectionPhysSize; // Size of the code (text) section, or the sum of all code sections if there are multiple sections. + // 000000a0 + writeInt32 os dataSectionPhysSize; // Size of the initialized data section, or the sum of all such sections if there are multiple data sections. + writeInt32 os 0x00; // Size of the uninitialized data section, or the sum of all such sections if there are multiple uninitialized data sections. + writeInt32 os entrypointCodeChunk.addr; // RVA of entry point , needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 in a section marked execute/read for EXEs or 0 for DLLs e.g. 0x0000b57e + writeInt32 os textSectionAddr; // e.g. 0x0002000 + // 000000b0 if modul.Is64Bit then - writeInt64 os ((int64)imageBaseReal) // REVIEW: For 64-bit, we should use a 64-bit image base - else - writeInt32 os dataSectionAddr; // e.g. 0x0000c000 - writeInt32 os imageBaseReal; // Image Base Always 0x400000 (see Section 23.1). - QUERY: no it's not always 0x400000, e.g. 0x034f0000 - - writeInt32 os alignVirt; // Section Alignment Always 0x2000 (see Section 23.1). - writeInt32 os alignPhys; // File Alignment Either 0x200 or 0x1000. - // 000000c0 - writeInt32AsUInt16 os 0x04; // OS Major Always 4 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // OS Minor Always 0 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // User Major Always 0 (see Section 23.1). - writeInt32AsUInt16 os 0x00; // User Minor Always 0 (see Section 23.1). + writeInt64 os ((int64)imageBaseReal) // REVIEW: For 64-bit, we should use a 64-bit image base + else + writeInt32 os dataSectionAddr; // e.g. 0x0000c000 + writeInt32 os imageBaseReal; // Image Base Always 0x400000 (see Section 23.1). - QUERY: no it's not always 0x400000, e.g. 0x034f0000 + + writeInt32 os alignVirt; // Section Alignment Always 0x2000 (see Section 23.1). + writeInt32 os alignPhys; // File Alignment Either 0x200 or 0x1000. + // 000000c0 + writeInt32AsUInt16 os 0x04; // OS Major Always 4 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // OS Minor Always 0 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // User Major Always 0 (see Section 23.1). + writeInt32AsUInt16 os 0x00; // User Minor Always 0 (see Section 23.1). do let (major, minor) = modul.SubsystemVersion writeInt32AsUInt16 os major; writeInt32AsUInt16 os minor; - writeInt32 os 0x00; // Reserved Always 0 (see Section 23.1). - // 000000d0 - writeInt32 os imageEndAddr; // Image Size: Size, in bytes, of image, including all headers and padding; shall be a multiple of Section Alignment. e.g. 0x0000e000 - writeInt32 os headerSectionPhysSize; // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding; shall be a multiple of the file alignment. - writeInt32 os 0x00; // File Checksum Always 0 (see Section 23.1). QUERY: NOT ALWAYS ZERO - writeInt32AsUInt16 os modul.SubSystemFlags; // SubSystem Subsystem required to run this image. Shall be either IMAGE_SUBSYSTEM_WINDOWS_CE_GUI (0x3) or IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2). QUERY: Why is this 3 on the images ILASM produces + writeInt32 os 0x00; // Reserved Always 0 (see Section 23.1). + // 000000d0 + writeInt32 os imageEndAddr; // Image Size: Size, in bytes, of image, including all headers and padding; shall be a multiple of Section Alignment. e.g. 0x0000e000 + writeInt32 os headerSectionPhysSize; // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding; shall be a multiple of the file alignment. + writeInt32 os 0x00; // File Checksum Always 0 (see Section 23.1). QUERY: NOT ALWAYS ZERO + writeInt32AsUInt16 os modul.SubSystemFlags; // SubSystem Subsystem required to run this image. Shall be either IMAGE_SUBSYSTEM_WINDOWS_CE_GUI (0x3) or IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2). QUERY: Why is this 3 on the images ILASM produces // DLL Flags Always 0x400 (no unmanaged windows exception handling - see Section 23.1). - // Itanium: see notes at end of file - // IMAGE_DLLCHARACTERISTICS_NX_COMPAT: See FSharp 1.0 bug 5019 and http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx + // Itanium: see notes at end of file + // IMAGE_DLLCHARACTERISTICS_NX_COMPAT: See FSharp 1.0 bug 5019 and http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx // Itanium: IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE | IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT // x86: IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT // x64: IMAGE_DLLCHARACTERISTICS_ NO_SEH | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT - let dllCharacteristics = - let flags = + let dllCharacteristics = + let flags = if modul.Is64Bit then (if isItanium then 0x8540 else 0x540) else 0x540 if modul.UseHighEntropyVA then flags ||| 0x20 // IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA else flags writeInt32AsUInt16 os dllCharacteristics - // 000000e0 + // 000000e0 // Note that the defaults differ between x86 and x64 if modul.Is64Bit then let size = defaultArg modul.StackReserveSize 0x400000 |> int64 - writeInt64 os size // Stack Reserve Size Always 0x400000 (4Mb) (see Section 23.1). - writeInt64 os 0x4000L // Stack Commit Size Always 0x4000 (16Kb) (see Section 23.1). - writeInt64 os 0x100000L // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt64 os 0x2000L // Heap Commit Size Always 0x800 (8Kb) (see Section 23.1). + writeInt64 os size // Stack Reserve Size Always 0x400000 (4Mb) (see Section 23.1). + writeInt64 os 0x4000L // Stack Commit Size Always 0x4000 (16Kb) (see Section 23.1). + writeInt64 os 0x100000L // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt64 os 0x2000L // Heap Commit Size Always 0x800 (8Kb) (see Section 23.1). else let size = defaultArg modul.StackReserveSize 0x100000 - writeInt32 os size // Stack Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt32 os 0x1000 // Stack Commit Size Always 0x1000 (4Kb) (see Section 23.1). - writeInt32 os 0x100000 // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). - writeInt32 os 0x1000 // Heap Commit Size Always 0x1000 (4Kb) (see Section 23.1). - // 000000f0 - x86 location, moving on, for x64, add 0x10 - writeInt32 os 0x00 // Loader Flags Always 0 (see Section 23.1) - writeInt32 os 0x10 // Number of Data Directories: Always 0x10 (see Section 23.1). - writeInt32 os 0x00 - writeInt32 os 0x00 // Export Table Always 0 (see Section 23.1). - // 00000100 - writeDirectory os importTableChunk // Import Table RVA of Import Table, (see clause 24.3.1). e.g. 0000b530 - // Native Resource Table: ECMA says Always 0 (see Section 23.1), but mscorlib and other files with resources bound into executable do not. For the moment assume the resources table is always the first resource in the file. + writeInt32 os size // Stack Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt32 os 0x1000 // Stack Commit Size Always 0x1000 (4Kb) (see Section 23.1). + writeInt32 os 0x100000 // Heap Reserve Size Always 0x100000 (1Mb) (see Section 23.1). + writeInt32 os 0x1000 // Heap Commit Size Always 0x1000 (4Kb) (see Section 23.1). + // 000000f0 - x86 location, moving on, for x64, add 0x10 + writeInt32 os 0x00 // Loader Flags Always 0 (see Section 23.1) + writeInt32 os 0x10 // Number of Data Directories: Always 0x10 (see Section 23.1). + writeInt32 os 0x00 + writeInt32 os 0x00 // Export Table Always 0 (see Section 23.1). + // 00000100 + writeDirectory os importTableChunk // Import Table RVA of Import Table, (see clause 24.3.1). e.g. 0000b530 + // Native Resource Table: ECMA says Always 0 (see Section 23.1), but mscorlib and other files with resources bound into executable do not. For the moment assume the resources table is always the first resource in the file. writeDirectory os nativeResourcesChunk - // 00000110 - writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). - // 00000120 - writeDirectory os baseRelocTableChunk - writeDirectory os debugDirectoryChunk // Debug Directory - // 00000130 - writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). - writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). - writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). - writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). - // 00000140 - writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). - writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). - // 00000150 - writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). - writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). - writeDirectory os importAddrTableChunk // Import Addr Table, (see clause 24.3.1). e.g. 0x00002000 - // 00000160 - writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). - writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). + // 00000110 + writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Exception Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Certificate Table Always 0 (see Section 23.1). + // 00000120 + writeDirectory os baseRelocTableChunk + writeDirectory os debugDirectoryChunk // Debug Directory + // 00000130 + writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). + writeInt32 os 0x00 // Copyright Always 0 (see Section 23.1). + writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). + writeInt32 os 0x00 // Global Ptr Always 0 (see Section 23.1). + // 00000140 + writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // Load Config Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). + writeInt32 os 0x00 // TLS Table Always 0 (see Section 23.1). + // 00000150 + writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). + writeInt32 os 0x00 // Bound Import Always 0 (see Section 23.1). + writeDirectory os importAddrTableChunk // Import Addr Table, (see clause 24.3.1). e.g. 0x00002000 + // 00000160 + writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). + writeInt32 os 0x00 // Delay Import Descriptor Always 0 (see Section 23.1). writeDirectory os cliHeaderChunk - // 00000170 - writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). - writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). - + // 00000170 + writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). + writeInt32 os 0x00 // Reserved Always 0 (see Section 23.1). + write (Some textSectionHeaderChunk.addr) os "text section header" [| |] - - // 00000178 - writeBytes os [| 0x2euy; 0x74uy; 0x65uy; 0x78uy; 0x74uy; 0x00uy; 0x00uy; 0x00uy; |] // ".text\000\000\000" - // 00000180 - writeInt32 os textSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x00009584 - writeInt32 os textSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x00020000 - writeInt32 os textSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. 0x00009600 - writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200 - // 00000190 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 00000198 - writeInt32AsUInt16 os 0x00// NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section's characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ - + + // 00000178 + writeBytes os [| 0x2euy; 0x74uy; 0x65uy; 0x78uy; 0x74uy; 0x00uy; 0x00uy; 0x00uy; |] // ".text\000\000\000" + // 00000180 + writeInt32 os textSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x00009584 + writeInt32 os textSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x00020000 + writeInt32 os textSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. 0x00009600 + writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200 + // 00000190 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 00000198 + writeInt32AsUInt16 os 0x00// NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section's characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ + write (Some dataSectionHeaderChunk.addr) os "data section header" [| |] - - // 000001a0 - writeBytes os [| 0x2euy; 0x72uy; 0x73uy; 0x72uy; 0x63uy; 0x00uy; 0x00uy; 0x00uy; |] // ".rsrc\000\000\000" - // writeBytes os [| 0x2e; 0x73; 0x64; 0x61; 0x74; 0x61; 0x00; 0x00; |] // ".sdata\000\000" - writeInt32 os dataSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c + + // 000001a0 + writeBytes os [| 0x2euy; 0x72uy; 0x73uy; 0x72uy; 0x63uy; 0x00uy; 0x00uy; 0x00uy; |] // ".rsrc\000\000\000" + // writeBytes os [| 0x2e; 0x73; 0x64; 0x61; 0x74; 0x61; 0x00; 0x00; |] // ".sdata\000\000" + writeInt32 os dataSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c writeInt32 os dataSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000 - // 000001b0 - writeInt32 os dataSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. e.g. 0x00000200 - writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800 - // 000001b8 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 000001c0 - writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x40uy |] // Characteristics Flags: IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA - + // 000001b0 + writeInt32 os dataSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. e.g. 0x00000200 + writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800 + // 000001b8 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 000001c0 + writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x40uy |] // Characteristics Flags: IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA + write (Some relocSectionHeaderChunk.addr) os "reloc section header" [| |] - // 000001a0 - writeBytes os [| 0x2euy; 0x72uy; 0x65uy; 0x6cuy; 0x6fuy; 0x63uy; 0x00uy; 0x00uy; |] // ".reloc\000\000" - writeInt32 os relocSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c + // 000001a0 + writeBytes os [| 0x2euy; 0x72uy; 0x65uy; 0x6cuy; 0x6fuy; 0x63uy; 0x00uy; 0x00uy; |] // ".reloc\000\000" + writeInt32 os relocSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x0000000c writeInt32 os relocSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000 - // 000001b0 - writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00000200 - writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800 - // 000001b8 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). - // 000001c0 - writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x42uy |] // Characteristics Flags: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | - + // 000001b0 + writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00000200 + writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800 + // 000001b8 + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + // 000001c0 + writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x42uy |] // Characteristics Flags: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | + writePadding os "pad to text begin" (textSectionPhysLoc - headerSize) - - // TEXT SECTION: e.g. 0x200 - + + // TEXT SECTION: e.g. 0x200 + let textV2P v = v - textSectionAddr + textSectionPhysLoc - - // e.g. 0x0200 + + // e.g. 0x0200 write (Some (textV2P importAddrTableChunk.addr)) os "import addr table" [| |] - writeInt32 os importNameHintTableChunk.addr - writeInt32 os 0x00 // QUERY 4 bytes of zeros not 2 like ECMA 24.3.1 says - - // e.g. 0x0208 - - let flags = - (if modul.IsILOnly then 0x01 else 0x00) ||| - (if modul.Is32Bit then 0x02 else 0x00) ||| - (if modul.Is32BitPreferred then 0x00020003 else 0x00) ||| + writeInt32 os importNameHintTableChunk.addr + writeInt32 os 0x00 // QUERY 4 bytes of zeros not 2 like ECMA 24.3.1 says + + // e.g. 0x0208 + + let flags = + (if modul.IsILOnly then 0x01 else 0x00) ||| + (if modul.Is32Bit then 0x02 else 0x00) ||| + (if modul.Is32BitPreferred then 0x00020003 else 0x00) ||| #if EMIT_STRONG_NAME (if (match signer with None -> false | Some s -> s.IsFullySigned) then 0x08 else 0x00) ||| #endif @@ -12863,36 +12863,36 @@ namespace ProviderImplementation.ProvidedTypes let headerVersionMajor, headerVersionMinor = headerVersionSupportedByCLRVersion desiredMetadataVersion - writePadding os "pad to cli header" cliHeaderPadding + writePadding os "pad to cli header" cliHeaderPadding write (Some (textV2P cliHeaderChunk.addr)) os "cli header" [| |] - writeInt32 os 0x48 // size of header - writeInt32AsUInt16 os headerVersionMajor // Major part of minimum version of CLR reqd. - writeInt32AsUInt16 os headerVersionMinor // Minor part of minimum version of CLR reqd. ... - // e.g. 0x0210 + writeInt32 os 0x48 // size of header + writeInt32AsUInt16 os headerVersionMajor // Major part of minimum version of CLR reqd. + writeInt32AsUInt16 os headerVersionMinor // Minor part of minimum version of CLR reqd. ... + // e.g. 0x0210 writeDirectory os metadataChunk writeInt32 os flags - - writeInt32 os entryPointToken + + writeInt32 os entryPointToken write None os "rest of cli header" [| |] - - // e.g. 0x0220 + + // e.g. 0x0220 writeDirectory os resourcesChunk writeDirectory os strongnameChunk - // e.g. 0x0230 - writeInt32 os 0x00 // code manager table, always 0 - writeInt32 os 0x00 // code manager table, always 0 - writeDirectory os vtfixupsChunk - // e.g. 0x0240 - writeInt32 os 0x00 // export addr table jumps, always 0 - writeInt32 os 0x00 // export addr table jumps, always 0 - writeInt32 os 0x00 // managed native header, always 0 - writeInt32 os 0x00 // managed native header, always 0 - + // e.g. 0x0230 + writeInt32 os 0x00 // code manager table, always 0 + writeInt32 os 0x00 // code manager table, always 0 + writeDirectory os vtfixupsChunk + // e.g. 0x0240 + writeInt32 os 0x00 // export addr table jumps, always 0 + writeInt32 os 0x00 // export addr table jumps, always 0 + writeInt32 os 0x00 // managed native header, always 0 + writeInt32 os 0x00 // managed native header, always 0 + writeBytes os code write None os "code padding" codePadding - + writeBytes os metadata - + #if EMIT_STRONG_NAME // write 0x80 bytes of empty space for encrypted SHA1 hash, written by SN.EXE or call to signing API if signer <> None then @@ -12906,9 +12906,9 @@ namespace ProviderImplementation.ProvidedTypes writePadding os "start of import table" importTableChunkPrePadding - // vtfixups would go here + // vtfixups would go here write (Some (textV2P importTableChunk.addr)) os "import table" [| |] - + writeInt32 os importLookupTableChunk.addr writeInt32 os 0x00 writeInt32 os 0x00 @@ -12918,38 +12918,38 @@ namespace ProviderImplementation.ProvidedTypes writeInt32 os 0x00 writeInt32 os 0x00 writeInt32 os 0x00 - writeInt32 os 0x00 - + writeInt32 os 0x00 + write (Some (textV2P importLookupTableChunk.addr)) os "import lookup table" [| |] - writeInt32 os importNameHintTableChunk.addr - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - + writeInt32 os importNameHintTableChunk.addr + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + write (Some (textV2P importNameHintTableChunk.addr)) os "import name hint table" [| |] - // Two zero bytes of hint, then Case sensitive, null-terminated ASCII string containing name to import. + // Two zero bytes of hint, then Case sensitive, null-terminated ASCII string containing name to import. // Shall _CorExeMain a .exe file _CorDllMain for a .dll file. - if isDll then + if isDll then writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy ; 0x6fuy; 0x72uy; 0x44uy; 0x6cuy; 0x6cuy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] - else + else writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy; 0x6fuy; 0x72uy; 0x45uy; 0x78uy; 0x65uy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] - + write (Some (textV2P mscoreeStringChunk.addr)) os "mscoree string" [| 0x6duy; 0x73uy; 0x63uy; 0x6fuy ; 0x72uy; 0x65uy ; 0x65uy; 0x2euy ; 0x64uy; 0x6cuy ; 0x6cuy; 0x00uy ; |] - + writePadding os "end of import tab" importTableChunkPadding - + writePadding os "head of entrypoint" 0x03 let ep = (imageBaseReal + textSectionAddr) write (Some (textV2P entrypointCodeChunk.addr)) os " entrypoint code" [| 0xFFuy; 0x25uy; (* x86 Instructions for entry *) b0 ep; b1 ep; b2 ep; b3 ep |] - if isItanium then + if isItanium then write (Some (textV2P globalpointerCodeChunk.addr)) os " itanium global pointer" [| 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy |] - if pdbfile.IsSome then + if pdbfile.IsSome then write (Some (textV2P debugDirectoryChunk.addr)) os "debug directory" (Array.create debugDirectoryChunk.size 0x0uy) write (Some (textV2P debugDataChunk.addr)) os "debug data" (Array.create debugDataChunk.size 0x0uy) @@ -12957,8 +12957,8 @@ namespace ProviderImplementation.ProvidedTypes write (Some (textV2P debugEmbeddedPdbChunk.addr)) os "debug data" (Array.create debugEmbeddedPdbChunk.size 0x0uy) writePadding os "end of .text" (dataSectionPhysLoc - textSectionPhysLoc - textSectionSize) - - // DATA SECTION + + // DATA SECTION #if EMIT_NATIVE_RESOURCES match nativeResources with | [||] -> () @@ -12970,41 +12970,41 @@ namespace ProviderImplementation.ProvidedTypes if dummydatap.size <> 0x0 then write (Some (dataSectionVirtToPhys dummydatap.addr)) os "dummy data" [| 0x0uy |] - writePadding os "end of .rsrc" (relocSectionPhysLoc - dataSectionPhysLoc - dataSectionSize) - - // RELOC SECTION + writePadding os "end of .rsrc" (relocSectionPhysLoc - dataSectionPhysLoc - dataSectionSize) + + // RELOC SECTION - // See ECMA 24.3.2 + // See ECMA 24.3.2 let relocV2P v = v - relocSectionAddr + relocSectionPhysLoc - + let entrypointFixupAddr = entrypointCodeChunk.addr + 0x02 let entrypointFixupBlock = (entrypointFixupAddr / 4096) * 4096 let entrypointFixupOffset = entrypointFixupAddr - entrypointFixupBlock let reloc = (if modul.Is64Bit then 0xA000 (* IMAGE_REL_BASED_DIR64 *) else 0x3000 (* IMAGE_REL_BASED_HIGHLOW *)) ||| entrypointFixupOffset // For the itanium, you need to set a relocation entry for the global pointer - let reloc2 = - if not isItanium then + let reloc2 = + if not isItanium then 0x0 else 0xA000 ||| (globalpointerCodeChunk.addr - ((globalpointerCodeChunk.addr / 4096) * 4096)) - - write (Some (relocV2P baseRelocTableChunk.addr)) os "base reloc table" + + write (Some (relocV2P baseRelocTableChunk.addr)) os "base reloc table" [| b0 entrypointFixupBlock; b1 entrypointFixupBlock; b2 entrypointFixupBlock; b3 entrypointFixupBlock; 0x0cuy; 0x00uy; 0x00uy; 0x00uy; - b0 reloc; b1 reloc; + b0 reloc; b1 reloc; b0 reloc2; b1 reloc2; |] writePadding os "end of .reloc" (imageEndSectionPhysLoc - relocSectionPhysLoc - relocSectionSize) os.Dispose() - + pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings // Looks like a finally - with e -> - (try + with e -> + (try os.Dispose() - File.Delete outfile - with _ -> ()) + File.Delete outfile + with _ -> ()) reraise() //Finished writing and signing the binary and debug info... @@ -13027,8 +13027,8 @@ namespace ProviderImplementation.ProvidedTypes dumpDebugInfo:bool } let WriteILBinaryFile (outfile, (args: options), modul) = - writeBinaryAndReportMappings (outfile, - args.ilg, args.pdbfile, (* args.signer, *) args.portablePDB, args.embeddedPDB, args.embedAllSource, + writeBinaryAndReportMappings (outfile, + args.ilg, args.pdbfile, (* args.signer, *) args.portablePDB, args.embeddedPDB, args.embedAllSource, args.embedSourceList, args.sourceLink, args.emitTailcalls, args.deterministic, args.showTimes, args.dumpDebugInfo) modul |> ignore @@ -13055,7 +13055,7 @@ namespace ProviderImplementation.ProvidedTypes open ProviderImplementation.ProvidedTypes open ProviderImplementation.ProvidedTypes.AssemblyReader open ProviderImplementation.ProvidedTypes.UncheckedQuotations - + type ILLocalBuilder(i: int) = member _.LocalIndex = i @@ -13066,18 +13066,18 @@ namespace ProviderImplementation.ProvidedTypes let mutable labelCount = 0 let mutable labels = Dictionary() - member _.Content = + member _.Content = { IsZeroInit = true MaxStack = instrs.Count Locals = locals.ToArray() - Code = + Code = { Labels=labels Instrs=instrs.ToArray() Exceptions = [| |] // TODO Locals = [| |] (* TODO ILLocalDebugInfo *) } } - member _.DeclareLocal(ty: ILType) = + member _.DeclareLocal(ty: ILType) = let idx = locals.Count let local = { Type = ty; IsPinned = false; DebugInfo = None } locals.Add(local) @@ -13106,7 +13106,7 @@ namespace ProviderImplementation.ProvidedTypes LiteralValue = lit Attributes = attrs Offset = None - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken() } override _.ToString() = "builder for " + nm @@ -13121,7 +13121,7 @@ namespace ProviderImplementation.ProvidedTypes member _.Content = { Name=nm Constraints= constraints.ToArray() - Attributes = attrs + Attributes = attrs CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken() } override _.ToString() = "builder for " + nm @@ -13137,7 +13137,7 @@ namespace ProviderImplementation.ProvidedTypes member _.SetConstant(obj) = dflt <- USome obj member _.SetCustomAttribute(ca) = cattrs.Add(ca) - member _.Content = + member _.Content = { Name=nm ParameterType=ty Default=dflt @@ -13156,19 +13156,19 @@ namespace ProviderImplementation.ProvidedTypes member _.DefineParameter(i, attrs, parameterName) = ilParams.[i].SetData(attrs, parameterName) ; ilParams.[i] member _.SetCustomAttribute(ca) = cattrs.Add(ca) member _.GetILGenerator() = let ilg = ILGenerator(methodName) in body <- Some ilg; ilg - member _.FormalMethodRef = + member _.FormalMethodRef = let cc = (if ILMethodDef.ComputeIsStatic attrs then ILCallingConv.Static else ILCallingConv.Instance) ILMethodRef (enclosing.TypeRef, cc, gparams.Count, methodName, argtys, retty) - member this.FormalMethodSpec = + member this.FormalMethodSpec = ILMethodSpec(this.FormalMethodRef, enclosing, mkILFormalGenericArgs enclosing.TypeSpec.GenericArgs.Length gparams.Count) - member _.Content = + member _.Content = { Token = genToken() Name = methodName Attributes = attrs ImplAttributes = implflags - GenericParams = [| for x in gparams -> x.Content |] - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + GenericParams = [| for x in gparams -> x.Content |] + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Parameters = [| for p in ilParams.[1..] -> p.Content |] CallingConv = (if attrs &&& MethodAttributes.Static <> enum<_>(0) then ILCallingConv.Static else ILCallingConv.Instance) Return = (let p = ilParams.[0].Content in { Type = p.ParameterType; CustomAttrs = p.CustomAttrs }) @@ -13181,24 +13181,24 @@ namespace ProviderImplementation.ProvidedTypes let mutable setMethod = None let mutable getMethod = None let cattrs = ResizeArray() - + member _.SetGetMethod(mb: ILMethodBuilder) = getMethod <- Some mb member _.SetSetMethod(mb: ILMethodBuilder) = setMethod <- Some mb member _.SetCustomAttribute(ca) = cattrs.Add(ca) - member _.Content = + member _.Content = { Name=nm - CallingConv = - (if (getMethod.IsSome && getMethod.Value.Content.IsStatic) || - (setMethod.IsSome && setMethod.Value.Content.IsStatic) then - ILThisConvention.Static + CallingConv = + (if (getMethod.IsSome && getMethod.Value.Content.IsStatic) || + (setMethod.IsSome && setMethod.Value.Content.IsStatic) then + ILThisConvention.Static else ILThisConvention.Instance) Attributes = attrs GetMethod = (getMethod |> Option.map (fun mb -> mb.FormalMethodRef)) SetMethod = (setMethod |> Option.map (fun mb -> mb.FormalMethodRef)) - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) PropertyType=retty - Init= None // TODO if (attrs &&& PropertyAttributes.HasDefault) = 0 then None else + Init= None // TODO if (attrs &&& PropertyAttributes.HasDefault) = 0 then None else IndexParameterTypes=argtys Token = genToken() } override _.ToString() = "builder for " + nm @@ -13212,12 +13212,12 @@ namespace ProviderImplementation.ProvidedTypes member _.SetAddOnMethod(mb: ILMethodBuilder) = addMethod <- Some mb member _.SetRemoveOnMethod(mb: ILMethodBuilder) = removeMethod <- Some mb member _.SetCustomAttribute(ca) = cattrs.Add(ca) - member _.Content = + member _.Content = { Name = nm Attributes = attrs AddMethod = addMethod.Value.FormalMethodRef RemoveMethod = removeMethod.Value.FormalMethodRef - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) Token = genToken()} override _.ToString() = "builder for " + nm @@ -13236,7 +13236,7 @@ namespace ProviderImplementation.ProvidedTypes member _.ILTypeRef = ILTypeRef(scoref, nsp, nm) member this.ILTypeSpec = ILTypeSpec(this.ILTypeRef, mkILFormalGenericArgs 0 gparams.Count) - member this.ILType = + member this.ILType = match ILTypeDef.ComputeKind (int attrs) extends nsp nm with | ILTypeDefKind.ValueType | ILTypeDefKind.Enum -> ILType.Value this.ILTypeSpec | _ -> ILType.Boxed this.ILTypeSpec @@ -13254,8 +13254,8 @@ namespace ProviderImplementation.ProvidedTypes member _.AddInterfaceImplementation(ty) = implements.Add(ty) member this.DefineTypeInitializer () = let mb = ILMethodBuilder(this.ILType, ".cctor", MethodAttributes.Static ||| MethodAttributes.SpecialName, ILType.Void, [| |]) in methods.Add mb; mb member _.SetParent ty = (extends <- Some ty) - member this.DefineDefaultConstructor(attrs, baseCtor: ILMethodSpec) = - let ctor = this.DefineConstructor(attrs, [| |]) + member this.DefineDefaultConstructor(attrs, baseCtor: ILMethodSpec) = + let ctor = this.DefineConstructor(attrs, [| |]) let ilg = ctor.GetILGenerator() ilg.Emit(I_ldarg 0) ilg.Emit(I_call (Normalcall, baseCtor, None)) @@ -13263,24 +13263,24 @@ namespace ProviderImplementation.ProvidedTypes ctor - member _.Content = + member _.Content = { Namespace=nsp Name=nm - GenericParams= [| for x in gparams -> x.Content |] + GenericParams= [| for x in gparams -> x.Content |] Implements = implements.ToArray() Attributes = attrs Layout=ILTypeDefLayout.Auto Extends=extends Token=genToken() - //SecurityDecls=emptyILSecurityDecls; + //SecurityDecls=emptyILSecurityDecls; //HasSecurity=false; - NestedTypes = ILTypeDefs( lazy [| for x in nestedTypes -> let td = x.Content in td.Namespace, td.Name, lazy td |] ) - Fields = { new ILFieldDefs with member _.Entries = [| for x in fields -> x.Content |] } - Properties = { new ILPropertyDefs with member _.Entries = [| for x in props -> x.Content |] } - Events = { new ILEventDefs with member _.Entries = [| for x in events -> x.Content |] } + NestedTypes = ILTypeDefs( lazy [| for x in nestedTypes -> let td = x.Content in td.Namespace, td.Name, lazy td |] ) + Fields = { new ILFieldDefs with member _.Entries = [| for x in fields -> x.Content |] } + Properties = { new ILPropertyDefs with member _.Entries = [| for x in props -> x.Content |] } + Events = { new ILEventDefs with member _.Entries = [| for x in events -> x.Content |] } Methods = ILMethodDefs (lazy [| for x in methods -> x.Content |]) - MethodImpls = { new ILMethodImplDefs with member _.Entries = methodImpls.ToArray() } - CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) + MethodImpls = { new ILMethodImplDefs with member _.Entries = methodImpls.ToArray() } + CustomAttrs = mkILCustomAttrs (cattrs.ToArray()) } override _.ToString() = "builder for " + joinILTypeName nsp nm @@ -13291,7 +13291,7 @@ namespace ProviderImplementation.ProvidedTypes member _.DefineType(nsp, name, attrs) = let tb = ILTypeBuilder(ILTypeRefScope.Top scoref, nsp, name, attrs) in typeDefs.Add tb; tb member _.SetCustomAttribute(ca) = cattrs.Add(ca) - member _.Content = + member _.Content = { Manifest=manifest Name=moduleName SubsystemVersion = (4, 0) @@ -13309,13 +13309,13 @@ namespace ProviderImplementation.ProvidedTypes ImageBase=0x034f0000 MetadataVersion="" Resources=ILResources (lazy [| |]) - TypeDefs = ILTypeDefs( lazy [| for x in typeDefs-> let td = x.Content in td.Namespace, td.Name, lazy td |] ) + TypeDefs = ILTypeDefs( lazy [| for x in typeDefs-> let td = x.Content in td.Namespace, td.Name, lazy td |] ) CustomAttrs = { new ILCustomAttrs with member _.Entries = cattrs.ToArray() } - } + } override _.ToString() = "builder for " + moduleName type ILAssemblyBuilder(assemblyName: AssemblyName, fileName, ilg) = - let manifest = + let manifest = { Name = assemblyName.Name AuxModuleHashAlgorithm = 0x8004 // SHA1 PublicKey = UNone @@ -13331,19 +13331,19 @@ namespace ProviderImplementation.ProvidedTypes EntrypointElsewhere=None } let mb = ILModuleBuilder(ILScopeRef.Local, "MainModule", Some manifest) member _.MainModule = mb - member _.Save() = + member _.Save() = let il = mb.Content let options: BinaryWriter.options = { ilg = ilg; pdbfile = None; portablePDB = false; embeddedPDB = false; embedAllSource = false; embedSourceList = []; sourceLink = ""; emitTailcalls = true; deterministic = false; showTimes = false; dumpDebugInfo = false } BinaryWriter.WriteILBinaryFile (fileName, options, il) override _.ToString() = "builder for " + (assemblyName.ToString()) - + type ExpectedStackState = | Empty = 1 | Address = 2 | Value = 3 - type CodeGenerator(assemblyMainModule: ILModuleBuilder, + type CodeGenerator(assemblyMainModule: ILModuleBuilder, genUniqueTypeName: (unit -> string), implicitCtorArgsAsFields: ILFieldBuilder list, convTypeToTgt: Type -> Type, @@ -13352,8 +13352,8 @@ namespace ProviderImplementation.ProvidedTypes transMeth: MethodInfo -> ILMethodSpec, transMethRef: MethodInfo -> ILMethodRef, transCtorSpec: ConstructorInfo -> ILMethodSpec, - ilg: ILGenerator, - localsMap:Dictionary, + ilg: ILGenerator, + localsMap:Dictionary, parameterVars) = // TODO: this works over FSharp.Core 4.4.0.0 types and methods. These types need to be retargeted to the target runtime. @@ -13599,9 +13599,9 @@ namespace ProviderImplementation.ProvidedTypes match objOpt with | Some obj when meth.IsAbstract || meth.IsVirtual -> - if obj.Type.IsValueType then + if obj.Type.IsValueType then ilg.Emit(I_callconstraint (Normalcall, transType obj.Type, mappedMeth, None)) - else + else ilg.Emit(I_callvirt (Normalcall, mappedMeth, None)) | _ -> ilg.Emit(mkNormalCall mappedMeth) @@ -13748,7 +13748,7 @@ namespace ProviderImplementation.ProvidedTypes //------------------------------------------------------------------------------------------------- // AssemblyCompiler: the assembly compiler for generative type providers. - /// Implements System.Reflection.Assembly backed by ILModuleReader over generated bytes + /// Implements System.Reflection.Assembly backed by ILModuleReader over generated bytes type AssemblyCompiler(targetAssembly: ProvidedAssembly, context: ProvidedTypesContext) = @@ -13773,7 +13773,7 @@ namespace ProviderImplementation.ProvidedTypes if pntd.IsErased then failwith ("The nested provided type "+pntd.Name+" is marked as erased and cannot be converted to a generated type. Set 'IsErased=false' on the ProvidedTypeDefinition") Debug.Assert(pntd.BelongsToTargetModel, "expected a target ProvidedTypeDefinition in nested type") // Adjust the attributes - we're codegen'ing this type as nested - let attributes = adjustTypeAttributes true ntd.Attributes + let attributes = adjustTypeAttributes true ntd.Attributes let ntb = tb.DefineNestedType(pntd.Name,attributes) typeMap.[pntd] <- ntb defineNestedTypes ntb pntd @@ -13796,51 +13796,51 @@ namespace ProviderImplementation.ProvidedTypes else ILType.Boxed (transTypeSpec ty) and transTypeSpec (ty: Type) = - if ty.IsGenericType then + if ty.IsGenericType then ILTypeSpec(transTypeRef (ty.GetGenericTypeDefinition()), Array.map transType (ty.GetGenericArguments())) - else + else ILTypeSpec(transTypeRef ty, [| |]) - and transTypeRef (ty: Type) = + and transTypeRef (ty: Type) = let ty = if ty.IsGenericType then ty.GetGenericTypeDefinition() else ty ILTypeRef(transTypeRefScope ty, StructOption.ofObj (if ty.IsNested then null else ty.Namespace), ty.Name) - and transTypeRefScope (ty: Type): ILTypeRefScope = - match ty.DeclaringType with - | null -> + and transTypeRefScope (ty: Type): ILTypeRefScope = + match ty.DeclaringType with + | null -> if ty.Assembly = null then failwithf "null assembly for type %s" ty.FullName ILTypeRefScope.Top (transScopeRef ty.Assembly) | dt -> ILTypeRefScope.Nested (transTypeRef dt) - and transScopeRef (assem: Assembly): ILScopeRef = - // Note: this simple equality check on assembly objects doesn't work on Mono, there must be some small difference in the + and transScopeRef (assem: Assembly): ILScopeRef = + // Note: this simple equality check on assembly objects doesn't work on Mono, there must be some small difference in the // implementation of equality on System.Assembly objects // if assem = (targetAssembly :> Assembly) then ILScopeRef.Local if assem.GetName().Name = targetAssembly.GetName().Name then ILScopeRef.Local else ILScopeRef.Assembly (ILAssemblyRef.FromAssemblyName (assem.GetName())) - let transCtorRef (m:ConstructorInfo) = + let transCtorRef (m:ConstructorInfo) = // Remove the generic instantiations to get the uninstantiated identity of the method let m2 = m.GetDefinition() let cc = (if m2.IsStatic then ILCallingConv.Static else ILCallingConv.Instance) let ptys = [| for p in m2.GetParameters() -> transType p.ParameterType |] ILMethodRef (transTypeRef m2.DeclaringType, cc, 0, m2.Name, ptys, ILType.Void) - let transCtorSpec (f:ConstructorInfo) = + let transCtorSpec (f:ConstructorInfo) = if (match f with :? ProvidedConstructor as f -> not f.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" f - match f with + match f with | :? ProvidedConstructor as pc when ctorMap.ContainsKey pc -> ctorMap.[pc].FormalMethodSpec | m -> ILMethodSpec(transCtorRef f, transType m.DeclaringType, [| |]) - let transFieldSpec (f:FieldInfo) = + let transFieldSpec (f:FieldInfo) = if (match f with :? ProvidedField as f -> not f.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" f - match f with + match f with | :? ProvidedField as pf when fieldMap.ContainsKey pf -> fieldMap.[pf].FormalFieldSpec - | f -> + | f -> let f2 = f.GetDefinition() ILFieldSpec(ILFieldRef (transTypeRef f2.DeclaringType, f2.Name, transType f2.FieldType), transType f.DeclaringType) - let transMethRef (m:MethodInfo) = + let transMethRef (m:MethodInfo) = if (match m with :? ProvidedMethod as m -> not m.BelongsToTargetModel | _ -> false) then failwithf "expected '%O' to belong to the target model" m // Remove the generic instantiations to get the uninstantiated identity of the method let m2 = m.GetDefinition() @@ -13849,10 +13849,10 @@ namespace ProviderImplementation.ProvidedTypes let cc = (if m2.IsStatic then ILCallingConv.Static else ILCallingConv.Instance) ILMethodRef (transTypeRef m2.DeclaringType, cc, genarity, m2.Name, ptys, transType m2.ReturnType) - let transMeth (m:MethodInfo): ILMethodSpec = - match m with + let transMeth (m:MethodInfo): ILMethodSpec = + match m with | :? ProvidedMethod as pm when methMap.ContainsKey pm -> methMap.[pm].FormalMethodSpec - | m -> + | m -> //Debug.Assert (m.Name <> "get_Item1" || m.DeclaringType.Name <> "Tuple`2") let mref = transMethRef m let minst = (if m.IsGenericMethod then Array.map transType (m.GetGenericArguments()) else [| |]) @@ -13885,12 +13885,12 @@ namespace ProviderImplementation.ProvidedTypes let defineCustomAttrs f (cattrs: IList) = for attr in cattrs do let constructorArgs = [ for x in attr.ConstructorArguments -> x.Value ] - let transValue (o:obj) = - match o with + let transValue (o:obj) = + match o with | :? Type as t -> box (transType t) | v -> v - let namedProps = [ for x in attr.NamedArguments do match x.MemberInfo with :? PropertyInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] - let namedFields = [ for x in attr.NamedArguments do match x.MemberInfo with :? FieldInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] + let namedProps = [ for x in attr.NamedArguments do match x.MemberInfo with :? PropertyInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] + let namedFields = [ for x in attr.NamedArguments do match x.MemberInfo with :? FieldInfo as pi -> yield ILCustomAttrNamedArg(pi.Name, transType x.TypedValue.ArgumentType, x.TypedValue.Value) | _ -> () ] let ca = mkILCustomAttribMethRef (transCtorSpec attr.Constructor, constructorArgs, namedProps, namedFields) f ca @@ -13934,10 +13934,10 @@ namespace ProviderImplementation.ProvidedTypes let attributes = adjustTypeAttributes otb.IsSome attributes let tb = match otb with - | None -> + | None -> let nsp, n = splitILTypeName n assemblyMainModule.DefineType(nsp, n,attributes) - | Some (otb:ILTypeBuilder) -> + | Some (otb:ILTypeBuilder) -> otb.DefineNestedType(n,attributes) typeMapExtra.[fullName] <- tb tb @@ -13950,8 +13950,8 @@ namespace ProviderImplementation.ProvidedTypes match ptdT with | None -> () | Some ptdT -> - match ptdT.BaseType with - | null -> () + match ptdT.BaseType with + | null -> () | bt -> tb.SetParent(transType bt)) // phase 2 - emit member definitions @@ -13983,7 +13983,7 @@ namespace ProviderImplementation.ProvidedTypes | :? ProvidedField as pinfo -> let fb = tb.DefineField(finfo.Name, transType finfo.FieldType, finfo.Attributes) - if finfo.IsLiteral then + if finfo.IsLiteral then fb.SetConstant (pinfo.GetRawConstantValue()) defineCustomAttrs fb.SetCustomAttribute (pinfo.GetCustomAttributesData()) @@ -14164,7 +14164,7 @@ namespace ProviderImplementation.ProvidedTypes let bytes = reader.Bytes // Use a real Reflection Load when running in F# Interactive - if isHostedExecution then + if isHostedExecution then let realTargetAssembly = Assembly.Load(bytes) for (ptdT,_) in providedTypeDefinitionsT do ptdT.SetAssemblyInternal (K realTargetAssembly) @@ -14204,12 +14204,12 @@ namespace ProviderImplementation.ProvidedTypes #if !NO_GENERATIVE let theTable = ConcurrentDictionary() - // When using hosted execution (i.e. in F# Interactive), ensure the generated assembly for a generated type is + // When using hosted execution (i.e. in F# Interactive), ensure the generated assembly for a generated type is // actually fully compiled and loaded as a reflection-load assembly before handing the type back to the API. let ensureCompiled (t: Type) = - match t with + match t with | :? ProvidedTypeDefinition as pt when pt.IsErased || pt.GetStaticParametersInternal().Length > 0 || not config.IsHostedExecution -> t - | _ -> + | _ -> let origAssembly = t.Assembly // We expect the results reported by t.Assembly to actually change after this call, because the act of compilation @@ -14225,11 +14225,11 @@ namespace ProviderImplementation.ProvidedTypes let newAssemblyName = newAssembly.GetName().Name let origAssemblyName = origAssembly.GetName().Name // check the assembly was generated with the correct name - if newAssemblyName <> origAssemblyName then + if newAssemblyName <> origAssemblyName then failwithf "expected identical assembly name keys '%s' and '%s'" origAssemblyName newAssemblyName // check the type really exists - if t.Assembly.GetType(tyName) = null then + if t.Assembly.GetType(tyName) = null then failwithf "couldn't find type '%s' in assembly '%O'" tyName t.Assembly t @@ -14240,7 +14240,7 @@ namespace ProviderImplementation.ProvidedTypes let makeProvidedNamespace (namespaceName:string) (typesSrc:ProvidedTypeDefinition list) = let typesSrc = [| for ty in typesSrc -> ty :> Type |] - let nsSrc = + let nsSrc = { new IProvidedNamespace with member _.GetNestedNamespaces() = [| |] member _.NamespaceName = namespaceName @@ -14251,7 +14251,7 @@ namespace ProviderImplementation.ProvidedTypes let namespacesT = ResizeArray() - do for (namespaceName,types) in namespacesAndTypes do + do for (namespaceName,types) in namespacesAndTypes do namespacesT.Add (makeProvidedNamespace namespaceName types) let invalidateE = new Event() @@ -14265,12 +14265,12 @@ namespace ProviderImplementation.ProvidedTypes do AppDomain.CurrentDomain.add_AssemblyResolve handler #endif - new (config, namespaceName, types, ?sourceAssemblies, ?assemblyReplacementMap) = + new (config, namespaceName, types, ?sourceAssemblies, ?assemblyReplacementMap) = let sourceAssemblies = defaultArg sourceAssemblies [ Assembly.GetCallingAssembly() ] let assemblyReplacementMap = defaultArg assemblyReplacementMap [] new TypeProviderForNamespaces(config, [(namespaceName,types)], assemblyReplacementMap=assemblyReplacementMap, sourceAssemblies=sourceAssemblies) - new (config, ?sourceAssemblies, ?assemblyReplacementMap) = + new (config, ?sourceAssemblies, ?assemblyReplacementMap) = let sourceAssemblies = defaultArg sourceAssemblies [ Assembly.GetCallingAssembly() ] let assemblyReplacementMap = defaultArg assemblyReplacementMap [] new TypeProviderForNamespaces(config, [], assemblyReplacementMap=assemblyReplacementMap, sourceAssemblies=sourceAssemblies) @@ -14344,7 +14344,7 @@ namespace ProviderImplementation.ProvidedTypes /// This checks that the GetInvokeCodeInternal doesn't return things containing calls to other provided methods or constructors. let rec check expr = match expr with - | NewObject((:? ProvidedConstructor), _) + | NewObject((:? ProvidedConstructor), _) | Call(_, :? ProvidedMethod, _) -> failwithf "The invokeCode for a ProvidedConstructor or ProvidedMethod included a use or another ProvidedConstructor or ProvidedMethod '%A'. This is not allowed. Instead, the invokeCode should be the compiled representation without invoking other provided objects" expr | ShapeCombinationUnchecked(shape, args) -> RebuildShapeCombinationUnchecked(shape, List.map check args) | ShapeVarUnchecked v -> Expr.Var v @@ -14383,7 +14383,7 @@ namespace ProviderImplementation.ProvidedTypes member _.ApplyStaticArguments(ty, typePathAfterArguments:string[], objs) = let typePathAfterArguments = typePathAfterArguments.[typePathAfterArguments.Length-1] match ty with - | :? ProvidedTypeDefinition as t -> + | :? ProvidedTypeDefinition as t -> let ty = (t.ApplyStaticArguments(typePathAfterArguments, objs) :> Type) ensureCompiled ty @@ -14398,8 +14398,8 @@ namespace ProviderImplementation.ProvidedTypes match theTable.TryGetValue key with | true,bytes -> bytes | _ -> - let bytes = - match assembly with + let bytes = + match assembly with | :? ProvidedAssembly as targetAssembly -> AssemblyCompiler(targetAssembly, ctxt).Compile(config.IsHostedExecution) | _ -> File.ReadAllBytes assembly.ManifestModule.FullyQualifiedName theTable.[key] <- bytes @@ -14409,8 +14409,8 @@ namespace ProviderImplementation.ProvidedTypes member _.RegisterGeneratedTargetAssembly (fileName:string) = let assemblyBytes = File.ReadAllBytes fileName //printfn "registering assembly in '%s'" fileName - let assembly = - if config.IsHostedExecution then + let assembly = + if config.IsHostedExecution then Assembly.Load(assemblyBytes) // we need a real on-disk assembly else ctxt.ReadRelatedAssembly(fileName) @@ -14419,11 +14419,11 @@ namespace ProviderImplementation.ProvidedTypes theTable.[key] <- assemblyBytes assembly -#endif +#endif #endif // Used by unit testing to check that invalidation handlers are being disconnected - module GlobalCountersForInvalidation = + module GlobalCountersForInvalidation = let mutable invalidationHandlersAdded = 0 let mutable invalidationHandlersRemoved = 0 let GetInvalidationHandlersAdded() = invalidationHandlersAdded diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fsi b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fsi index 0eed6f4e325..1287752a16e 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fsi +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fsi @@ -341,13 +341,13 @@ namespace ProviderImplementation.ProvidedTypes member AddDefinitionLocation: line:int * column:int * filePath:string -> unit /// Suppress Object entries in intellisense menus in instances of this provided type - member HideObjectMethods: bool + member HideObjectMethods: bool /// Disallows the use of the null literal. member NonNullable: bool /// Get a flag indicating if the ProvidedTypeDefinition is erased - member IsErased: bool + member IsErased: bool /// Get or set a flag indicating if the ProvidedTypeDefinition has type-relocation suppressed [] @@ -404,13 +404,13 @@ namespace ProviderImplementation.ProvidedTypes [] /// Represents the context for which code is to be generated. Normally you should not need to use this directly. - type ProvidedTypesContext = - + type ProvidedTypesContext = + /// Try to find the given target assembly in the context - member TryBindAssemblyNameToTarget: aref: AssemblyName -> Choice + member TryBindAssemblyNameToTarget: aref: AssemblyName -> Choice /// Try to find the given target assembly in the context - member TryBindSimpleAssemblyNameToTarget: assemblyName: string -> Choice + member TryBindSimpleAssemblyNameToTarget: assemblyName: string -> Choice /// Get the list of referenced assemblies determined by the type provider configuration member ReferencedAssemblyPaths: string list @@ -454,7 +454,7 @@ namespace ProviderImplementation.ProvidedTypes /// The transitive dependencies of these assemblies are also included. By default /// Assembly.GetCallingAssembly() and its transitive dependencies are used. /// - /// + /// /// /// Optionally specify a map of assembly names from source model to referenced assemblies. /// @@ -466,7 +466,7 @@ namespace ProviderImplementation.ProvidedTypes /// The transitive dependencies of these assemblies are also included. By default /// Assembly.GetCallingAssembly() and its transitive dependencies are used. /// - /// + /// /// /// Optionally specify a map of assembly names from source model to referenced assemblies. /// @@ -511,7 +511,7 @@ namespace ProviderImplementation.ProvidedTypes member Disposing: IEvent /// The context for which code is eventually to be generated. You should not normally - /// need to use this property directly, as translation from the compiler-hosted context to + /// need to use this property directly, as translation from the compiler-hosted context to /// the design-time context will normally be performed automatically. member TargetContext: ProvidedTypesContext @@ -544,6 +544,6 @@ namespace ProviderImplementation.ProvidedTypes // Used by unit testing to check that invalidation handlers are being disconnected - module GlobalCountersForInvalidation = + module GlobalCountersForInvalidation = val GetInvalidationHandlersAdded : unit -> int val GetInvalidationHandlersRemoved : unit -> int diff --git a/vsintegration/tests/Salsa/FSharpLanguageServiceTestable.fs b/vsintegration/tests/Salsa/FSharpLanguageServiceTestable.fs index 51632a44676..87f225ef8d4 100644 --- a/vsintegration/tests/Salsa/FSharpLanguageServiceTestable.fs +++ b/vsintegration/tests/Salsa/FSharpLanguageServiceTestable.fs @@ -10,8 +10,8 @@ open System.Globalization open System.Runtime.InteropServices open Microsoft.VisualStudio open Microsoft.VisualStudio.Shell -open Microsoft.VisualStudio.Shell.Interop -open Microsoft.VisualStudio.TextManager.Interop +open Microsoft.VisualStudio.Shell.Interop +open Microsoft.VisualStudio.TextManager.Interop open Microsoft.VisualStudio.Text open Microsoft.VisualStudio.OLE.Interop open FSharp.Compiler @@ -32,43 +32,43 @@ type internal FSharpLanguageServiceTestable() as this = let mutable dirtyForTypeCheckFiles : Set = Set.empty let mutable isInitialized = false let mutable unhooked = false - let getColorizer (view:IVsTextView) = + let getColorizer (view:IVsTextView) = let buffer = Com.ThrowOnFailure1(view.GetBuffer()) - this.GetColorizer(buffer) + this.GetColorizer(buffer) let bgRequests = new FSharpLanguageServiceBackgroundRequests_DEPRECATED(getColorizer,(fun () -> this.FSharpChecker),(fun () -> this.ProjectSitesAndFiles),(fun () -> this.ServiceProvider),(fun () -> this.DocumentationBuilder)) - - member this.FSharpChecker = + + member this.FSharpChecker = if this.Unhooked then raise Error.UseOfUnhookedLanguageServiceState if not this.IsInitialized then raise Error.UseOfUninitializedLanguageServiceState checkerContainerOpt.Value - member this.ServiceProvider = + member this.ServiceProvider = if this.Unhooked then raise Error.UseOfUnhookedLanguageServiceState if not this.IsInitialized then raise Error.UseOfUninitializedLanguageServiceState - serviceProvider.Value + serviceProvider.Value - member this.ProjectSitesAndFiles = + member this.ProjectSitesAndFiles = if not this.IsInitialized then raise Error.UseOfUninitializedLanguageServiceState artifacts.Value - - member this.Preferences = + + member this.Preferences = if this.Unhooked then raise Error.UseOfUnhookedLanguageServiceState if not this.IsInitialized then raise Error.UseOfUninitializedLanguageServiceState preferences.Value - - member this.SourceFactory = + + member this.SourceFactory = if this.Unhooked then raise Error.UseOfUnhookedLanguageServiceState if not this.IsInitialized then raise Error.UseOfUninitializedLanguageServiceState sourceFactory.Value - + member this.IsInitialized = isInitialized member this.Unhooked = unhooked member this.DocumentationBuilder = documentationBuilder.Value - + /// Handle late initialization pieces - member this.Initialize (sp, dp, prefs, sourceFact) = - if this.Unhooked then raise Error.UseOfUnhookedLanguageServiceState + member this.Initialize (sp, dp, prefs, sourceFact) = + if this.Unhooked then raise Error.UseOfUnhookedLanguageServiceState artifacts <- Some (ProjectSitesAndFiles()) let checker = FSharpChecker.Create(legacyReferenceResolver=LegacyMSBuildReferenceResolver.getResolver()) checker.BeforeBackgroundFileCheck.Add (fun (fileName,_) -> UIThread.Run(fun () -> this.NotifyFileTypeCheckStateIsDirty(fileName))) @@ -80,12 +80,12 @@ type internal FSharpLanguageServiceTestable() as this = preferences <- Some prefs sourceFactory <- Some sourceFact - - member this.NotifyFileTypeCheckStateIsDirty(fileName) = + + member this.NotifyFileTypeCheckStateIsDirty(fileName) = dirtyForTypeCheckFiles <- dirtyForTypeCheckFiles.Add fileName /// Clear all language service caches and finalize all transient references to compiler objects - member this.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() = + member this.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() = if this.Unhooked then raise Error.UseOfUnhookedLanguageServiceState if this.IsInitialized then this.FSharpChecker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() @@ -99,34 +99,34 @@ type internal FSharpLanguageServiceTestable() as this = // Stop the background compile. // here we refer to checkerContainerOpt directly to avoid triggering its creation match checkerContainerOpt with - | Some container -> + | Some container -> let checker = container checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() | None -> () - - checkerContainerOpt <- None + + checkerContainerOpt <- None artifacts <- None preferences <- None documentationBuilder <- None unhooked <- true sourceFactory <- None serviceProvider <- None - + /// Respond to project settings changes - member this.OnProjectSettingsChanged(site:IProjectSite) = + member this.OnProjectSettingsChanged(site:IProjectSite) = // The project may have changed its references. These would be represented as 'dependency files' of each source file. Each source file will eventually start listening // for changes to those dependencies, at which point we'll get OnDependencyFileCreateOrDelete notifications. Until then, though, we just 'make a note' that this project is out of date. - bgRequests.AddOutOfDateProjectFileName(site.ProjectFileName) + bgRequests.AddOutOfDateProjectFileName(site.ProjectFileName) for fileName in site.CompilationSourceFiles do let rdt = this.ServiceProvider.RunningDocumentTable match this.ProjectSitesAndFiles.TryGetSourceOfFile_DEPRECATED(rdt,fileName) with - | Some source -> + | Some source -> source.RecolorizeWholeFile() source.RecordChangeToView() | None -> () /// Respond to project being cleaned/rebuilt (any live type providers in the project should be refreshed) - member this.OnProjectCleaned(projectSite:IProjectSite) = + member this.OnProjectCleaned(projectSite:IProjectSite) = let enableInMemoryCrossProjectReferences = true let _, checkOptions = ProjectSitesAndFiles.GetProjectOptionsForProjectSite(enableInMemoryCrossProjectReferences, (fun _ -> None), projectSite, serviceProvider.Value, "" , false) this.FSharpChecker.NotifyProjectCleaned(checkOptions) |> Async.RunSynchronouslyImmediate @@ -135,75 +135,75 @@ type internal FSharpLanguageServiceTestable() as this = bgRequests.OnActiveViewChanged(textView) member this.BackgroundRequests = bgRequests - + /// Unittestable complement to LanguageService.CreateSource_DEPRECATED member this.CreateSource_DEPRECATED(buffer:IVsTextLines) : IFSharpSource_DEPRECATED = - + // Each time a source is created, also verify that the IProjectSite has been initialized to listen to changes to the project. // We can't listen to OnProjectLoaded because the language service is not guaranteed to be loaded when this is called. let fileName = VsTextLines.GetFilename buffer let rdt = this.ServiceProvider.RunningDocumentTable let result = VsRunningDocumentTable.FindDocumentWithoutLocking(rdt,fileName) - match result with - | Some(hier,_) -> - match hier with + match result with + | Some(hier,_) -> + match hier with | :? IProvideProjectSite as siteProvider -> let site = siteProvider.GetProjectSite() - site.AdviseProjectSiteChanges(LanguageServiceConstants.FSharpLanguageServiceCallbackName, - new AdviseProjectSiteChanges(fun () -> this.OnProjectSettingsChanged(site))) - site.AdviseProjectSiteCleaned(LanguageServiceConstants.FSharpLanguageServiceCallbackName, - new AdviseProjectSiteChanges(fun () -> this.OnProjectCleaned(site))) - | _ -> + site.AdviseProjectSiteChanges(LanguageServiceConstants.FSharpLanguageServiceCallbackName, + new AdviseProjectSiteChanges(fun () -> this.OnProjectSettingsChanged(site))) + site.AdviseProjectSiteCleaned(LanguageServiceConstants.FSharpLanguageServiceCallbackName, + new AdviseProjectSiteChanges(fun () -> this.OnProjectCleaned(site))) + | _ -> // This can happen when the file is in a solution folder or in, say, a C# project. () | _ -> // This can happen when renaming a file from a different language service into .fs or fsx. // This naturally won't have an associated project. () - - // Create the source and register file change callbacks there. + + // Create the source and register file change callbacks there. let source = this.SourceFactory(buffer) this.ProjectSitesAndFiles.SetSource_DEPRECATED(buffer, source) source - + // For each change in dependency files, notify the language service of the change and propagate the update interface IDependencyFileChangeNotify_DEPRECATED with - member this.DependencyFileCreated projectSite = + member this.DependencyFileCreated projectSite = let enableInMemoryCrossProjectReferences = true - // Invalidate the configuration if we notice any add for any DependencyFiles + // Invalidate the configuration if we notice any add for any DependencyFiles let _, checkOptions = ProjectSitesAndFiles.GetProjectOptionsForProjectSite(enableInMemoryCrossProjectReferences, (fun _ -> None), projectSite, serviceProvider.Value, "" , false) this.FSharpChecker.InvalidateConfiguration(checkOptions) - member this.DependencyFileChanged (fileName) = + member this.DependencyFileChanged (fileName) = this.NotifyFileTypeCheckStateIsDirty fileName - /// Do OnIdle processing for the whole language service. dirtyForTypeCheckFiles can be set by events - /// raised on the background compilation thread. - member this.OnIdle() = + /// Do OnIdle processing for the whole language service. dirtyForTypeCheckFiles can be set by events + /// raised on the background compilation thread. + member this.OnIdle() = for file in dirtyForTypeCheckFiles do let rdt = this.ServiceProvider.RunningDocumentTable match this.ProjectSitesAndFiles.TryGetSourceOfFile_DEPRECATED(rdt, file) with | Some source -> source.RecordChangeToView() | None -> () dirtyForTypeCheckFiles <- Set.empty - + /// Remove a colorizer. - member this.CloseColorizer(colorizer:FSharpColorizer_DEPRECATED) = + member this.CloseColorizer(colorizer:FSharpColorizer_DEPRECATED) = let buffer = colorizer.Buffer let mutable guid = colorizerGuid (buffer :?> IVsUserData).SetData(&guid, null) |> ErrorHandler.ThrowOnFailure |> ignore /// Get a colorizer for a particular buffer. - member this.GetColorizer(buffer:IVsTextLines) : FSharpColorizer_DEPRECATED = + member this.GetColorizer(buffer:IVsTextLines) : FSharpColorizer_DEPRECATED = let mutable guid = colorizerGuid let mutable colorizerObj = null - + (buffer :?> IVsUserData).GetData(&guid, &colorizerObj) |> ignore match colorizerObj with | null -> - let scanner = + let scanner = new FSharpScanner_DEPRECATED(fun source -> // Note: in theory, the next few lines do not need to be recomputed every line. Instead we could just cache the tokenizer // and only update it when e.g. the project system notifies us there is an important change (e.g. a file rename, etc). @@ -215,11 +215,11 @@ type internal FSharpLanguageServiceTestable() as this = let sourceTokenizer = FSharpSourceTokenizer(defines,Some(fileName), None) sourceTokenizer.CreateLineTokenizer(source)) - let colorizer = new FSharpColorizer_DEPRECATED(this.CloseColorizer, buffer, scanner) + let colorizer = new FSharpColorizer_DEPRECATED(this.CloseColorizer, buffer, scanner) (buffer :?> IVsUserData).SetData(&guid, colorizer) |> ErrorHandler.ThrowOnFailure |> ignore colorizer | _ -> colorizerObj :?> FSharpColorizer_DEPRECATED - + /// Block until the background compile finishes. // // This is for unit testing only diff --git a/vsintegration/tests/Salsa/SalsaUtils.fs b/vsintegration/tests/Salsa/SalsaUtils.fs index 4b00dcc6b89..39b494da398 100644 --- a/vsintegration/tests/Salsa/SalsaUtils.fs +++ b/vsintegration/tests/Salsa/SalsaUtils.fs @@ -19,129 +19,129 @@ module internal VsOpsUtils = // ------------------------------------------------------------------------ let opsOfProj (p : OpenProject) = p.VS.VsOps let opsOfFile (f : OpenFile) = f.VS.VsOps - let DefaultBuildActionOfFilename(filename) = - match Path.GetExtension(filename) with + let DefaultBuildActionOfFilename(filename) = + match Path.GetExtension(filename) with | ".fsx" -> BuildAction.None | ".resx" | ".resources" -> BuildAction.EmbeddedResource | _ -> BuildAction.Compile - + let CreateSolution(vs : VisualStudio) = vs.VsOps.CreateSolution(vs) let ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(vs : VisualStudio) = vs.VsOps.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(vs) let GetOutputWindowPaneLines(vs : VisualStudio) = vs.VsOps.GetOutputWindowPaneLines(vs) let CloseSolution(soln : OpenSolution) = soln.VS.VsOps.CloseSolution(soln) - let CreateProject(solution : OpenSolution, projectname) = + let CreateProject(solution : OpenSolution, projectname) = solution.VS.VsOps.CreateProject(solution,projectname) - let NewFile(vs : VisualStudio, filename,lines) = + let NewFile(vs : VisualStudio, filename,lines) = vs.VsOps.NewFile(vs,filename,DefaultBuildActionOfFilename filename,lines) - let DeleteFileFromDisk(vs : VisualStudio, file) = + let DeleteFileFromDisk(vs : VisualStudio, file) = vs.VsOps.DeleteFileFromDisk(file) - let AddFileFromText(project, filename, lines) = + let AddFileFromText(project, filename, lines) = (opsOfProj project).AddFileFromText(project,filename,filename,DefaultBuildActionOfFilename filename,lines) - let AddFileFromTextBlob(project : OpenProject, filename, lines : string) = + let AddFileFromTextBlob(project : OpenProject, filename, lines : string) = (opsOfProj project).AddFileFromText(project,filename,filename,DefaultBuildActionOfFilename filename, Array.toList (lines.Split( [| "\r\n" |], StringSplitOptions.None))) - let AddFileFromTextEx(project : OpenProject,filenameOnDisk,filenameInProject,buildAction,lines) = + let AddFileFromTextEx(project : OpenProject,filenameOnDisk,filenameInProject,buildAction,lines) = (opsOfProj project).AddFileFromText(project,filenameOnDisk,filenameInProject,buildAction,lines) - let AddLinkedFileFromTextEx(project : OpenProject,filenameOnDisk,includeFilenameInProject,linkFilenameInProject,lines) = + let AddLinkedFileFromTextEx(project : OpenProject,filenameOnDisk,includeFilenameInProject,linkFilenameInProject,lines) = (opsOfProj project).AddLinkedFileFromText(project,filenameOnDisk,includeFilenameInProject,linkFilenameInProject,DefaultBuildActionOfFilename filenameOnDisk,lines) - let AddAssemblyReference(project : OpenProject,reference) = + let AddAssemblyReference(project : OpenProject,reference) = (opsOfProj project).AddAssemblyReference(project,reference,false) - let AddAssemblyReferenceEx(project : OpenProject,reference,specificVersion) = + let AddAssemblyReferenceEx(project : OpenProject,reference,specificVersion) = (opsOfProj project).AddAssemblyReference(project,reference,specificVersion) - let AddProjectReference(project1,project2) = + let AddProjectReference(project1,project2) = (opsOfProj project1).AddProjectReference(project1,project2) - let PlaceIntoProjectFileBeforeImport(project,xml) = + let PlaceIntoProjectFileBeforeImport(project,xml) = (opsOfProj project).PlaceIntoProjectFileBeforeImport(project,xml) - let ProjectDirectory(project) = + let ProjectDirectory(project) = (opsOfProj project).ProjectDirectory(project) - let ProjectFile(project) = + let ProjectFile(project) = (opsOfProj project).ProjectFile(project) - let SetVersionFile(project,file) = + let SetVersionFile(project,file) = (opsOfProj project).SetVersionFile(project,file) - let SetConfigurationAndPlatform(project,configAndPlatform) = + let SetConfigurationAndPlatform(project,configAndPlatform) = (opsOfProj project).SetConfigurationAndPlatform(project,configAndPlatform) - let SetOtherFlags(project,flags) = + let SetOtherFlags(project,flags) = (opsOfProj project).SetOtherFlags(project,flags) - let GetErrors(project) = + let GetErrors(project) = (opsOfProj project).GetErrors(project) - let SetProjectDefines(project,defines) = + let SetProjectDefines(project,defines) = (opsOfProj project).SetProjectDefines(project,defines) - let AddDisabledWarning(project,code) = + let AddDisabledWarning(project,code) = (opsOfProj project).AddDisabledWarning(project,code) - let Build(project) = + let Build(project) = (opsOfProj project).BuildProject(project,null) - let BuildTarget(project,target) = + let BuildTarget(project,target) = (opsOfProj project).BuildProject(project,target) - let GetMainOutputAssembly(project) = + let GetMainOutputAssembly(project) = (opsOfProj project).GetMainOutputAssembly(project) - let Save(project) = + let Save(project) = (opsOfProj project).SaveProject(project) - let OpenFileViaOpenFile(vs : VisualStudio, filename) = + let OpenFileViaOpenFile(vs : VisualStudio, filename) = vs.VsOps.OpenFileViaOpenFile(vs,filename) - let OpenFile(project,filename) = + let OpenFile(project,filename) = (opsOfProj project).OpenFile(project,filename) - let GetOpenFiles(project) = + let GetOpenFiles(project) = (opsOfProj project).GetOpenFiles(project) - let OpenExistingProject(vs :VisualStudio, dir,projname) = + let OpenExistingProject(vs :VisualStudio, dir,projname) = vs.VsOps.OpenExistingProject(vs,dir,projname) - let MoveCursorTo(file,line,col) = + let MoveCursorTo(file,line,col) = (opsOfFile file).MoveCursorTo(file,line,col) - let GetCursorLocation(file) = + let GetCursorLocation(file) = (opsOfFile file).GetCursorLocation(file) - let MoveCursorToEndOfMarker(file,marker) = + let MoveCursorToEndOfMarker(file,marker) = (opsOfFile file).MoveCursorToEndOfMarker(file, marker) - let GetMatchingBracesForPositionAtCursor(file) = + let GetMatchingBracesForPositionAtCursor(file) = (opsOfFile file).GetMatchingBracesForPositionAtCursor(file) - let MoveCursorToStartOfMarker(file,marker) = + let MoveCursorToStartOfMarker(file,marker) = (opsOfFile file).MoveCursorToStartOfMarker(file,marker) - let GetQuickInfoAtCursor(file) = + let GetQuickInfoAtCursor(file) = (opsOfFile file).GetQuickInfoAtCursor(file) - let GetQuickInfoAndSpanAtCursor(file) = + let GetQuickInfoAndSpanAtCursor(file) = (opsOfFile file).GetQuickInfoAndSpanAtCursor(file) - let GetNameOfOpenFile(file) = + let GetNameOfOpenFile(file) = (opsOfFile file).GetNameOfOpenFile(file) - let GetProjectOptionsOfScript(file) = + let GetProjectOptionsOfScript(file) = (opsOfFile file).GetProjectOptionsOfScript(file) - let GetParameterInfoAtCursor(file) = + let GetParameterInfoAtCursor(file) = (opsOfFile file).GetParameterInfoAtCursor(file) - let GetTokenTypeAtCursor(file) = + let GetTokenTypeAtCursor(file) = (opsOfFile file).GetTokenTypeAtCursor(file) - let GetSquiggleAtCursor(file) = + let GetSquiggleAtCursor(file) = (opsOfFile file).GetSquiggleAtCursor(file) - let GetSquigglesAtCursor(file) = + let GetSquigglesAtCursor(file) = (opsOfFile file).GetSquigglesAtCursor(file) - let AutoCompleteAtCursor(file) = + let AutoCompleteAtCursor(file) = (opsOfFile file).AutoCompleteAtCursor(file) - let CtrlSpaceCompleteAtCursor(file) = + let CtrlSpaceCompleteAtCursor(file) = (opsOfFile file).CompleteAtCursorForReason(file,Microsoft.VisualStudio.FSharp.LanguageService.BackgroundRequestReason.CompleteWord) - let CompleteAtCursorForReason(file,reason) = + let CompleteAtCursorForReason(file,reason) = (opsOfFile file).CompleteAtCursorForReason(file,reason) - let CompletionBestMatchAtCursorFor(file, value, filterText) = + let CompletionBestMatchAtCursorFor(file, value, filterText) = (opsOfFile file).CompletionBestMatchAtCursorFor(file, value, filterText) - let GotoDefinitionAtCursor file = + let GotoDefinitionAtCursor file = (opsOfFile file).GotoDefinitionAtCursor (file, false) - let GotoDefinitionAtCursorForceGeneration file = + let GotoDefinitionAtCursorForceGeneration file = (opsOfFile file).GotoDefinitionAtCursor (file, true) - let GetIdentifierAtCursor file = + let GetIdentifierAtCursor file = (opsOfFile file).GetIdentifierAtCursor file - let GetF1KeywordAtCursor file = + let GetF1KeywordAtCursor file = (opsOfFile file).GetF1KeywordAtCursor file - let GetLineNumber file n = + let GetLineNumber file n = (opsOfFile file).GetLineNumber (file, n) - let GetAllLines file= + let GetAllLines file= (opsOfFile file).GetAllLines file - let SwitchToFile (vs : VisualStudio) file = + let SwitchToFile (vs : VisualStudio) file = vs.VsOps.SwitchToFile(vs,file) let OnIdle(vs : VisualStudio) = vs.VsOps.OnIdle(vs) let ShiftKeyDown(vs : VisualStudio) = vs.VsOps.ShiftKeyDown(vs) - let ShiftKeyUp(vs : VisualStudio) = vs.VsOps.ShiftKeyUp(vs) + let ShiftKeyUp(vs : VisualStudio) = vs.VsOps.ShiftKeyUp(vs) let TakeCoffeeBreak(vs : VisualStudio) = vs.VsOps.TakeCoffeeBreak(vs) let ReplaceFileInMemory(file :OpenFile) lines = (opsOfFile file).ReplaceFileInMemory(file,lines,true) let ReplaceFileInMemoryWithoutCoffeeBreak(file :OpenFile) lines = (opsOfFile file).ReplaceFileInMemory(file,lines,false) let SaveFileToDisk(file :OpenFile) = (opsOfFile file).SaveFileToDisk(file) let AutoCompleteMemberDataTipsThrowsScope(vs : VisualStudio, message) = vs.VsOps.AutoCompleteMemberDataTipsThrowsScope(message) - let Cleanup(vs : VisualStudio) = vs.VsOps.CleanUp(vs) + let Cleanup(vs : VisualStudio) = vs.VsOps.CleanUp(vs) let OutOfConeFilesAreAddedAsLinks(vs : VisualStudio) = vs.VsOps.OutOfConeFilesAreAddedAsLinks let SupportsOutputWindowPane(vs : VisualStudio) = vs.VsOps.SupportsOutputWindowPane @@ -173,22 +173,22 @@ module internal VsOpsUtils = /// Verify that items obtained from the navigation bar contain the specified item let AssertRegionListContains(expected:list<(int*int)*(int*int)>, regions:list) = - for (sl,sc), (el,ec) in expected do - match regions |> List.tryFind (fun reg -> + for (sl,sc), (el,ec) in expected do + match regions |> List.tryFind (fun reg -> let span = reg.tsHiddenText - (span.iStartIndex = sc) && (span.iEndIndex = ec) && + (span.iStartIndex = sc) && (span.iEndIndex = ec) && (span.iStartLine = sl) && (span.iEndLine = el) ) with - | None -> - printfn "Regions found: %A" (regions |> List.map (fun itm -> + | None -> + printfn "Regions found: %A" (regions |> List.map (fun itm -> ((itm.tsHiddenText.iStartIndex, itm.tsHiddenText.iStartLine), (itm.tsHiddenText.iEndIndex, itm.tsHiddenText.iEndLine)) )) Assert.Fail(sprintf "Couldn't find region (%d, %d) - (%d, %d)" sl sc el ec) | _ -> () - + /// Verify that items obtained from the navigation bar contain the specified item let AssertNavigationContains (items:DropDownMember[], expected) = match items |> Array.tryFind (fun itm -> itm.Label = expected) with - | None -> + | None -> printfn "Navigation bar items: %A" (items |> Array.map (fun itm -> itm.Label)) Assert.Fail(sprintf "Couldn't find '%s' in drop down bar." expected) | _ -> () @@ -197,15 +197,15 @@ module internal VsOpsUtils = let AssertNavigationContainsAll (items:DropDownMember[], allExpected) = for expected in allExpected do match items |> Array.tryFind (fun itm -> itm.Label = expected) with - | None -> + | None -> printfn "Navigation bar items: %A" (items |> Array.map (fun itm -> itm.Label)) Assert.Fail(sprintf "Couldn't find '%s' in drop down bar." expected) | _ -> () - + // ------------------------------------------------------------------------ - + /// Verify the completion list is empty, typically for negative tests - let AssertCompListIsEmpty (completions : CompletionItem[]) = + let AssertCompListIsEmpty (completions : CompletionItem[]) = if not (Array.isEmpty completions) then printfn "Expected empty completion list but got: %A" (completions |> Array.map (fun (CompletionItem(nm, _, _, _, _)) -> nm)) Assert.True(Array.isEmpty completions, "Expected empty completion list but got some items") @@ -226,7 +226,7 @@ module internal VsOpsUtils = printfn "Value %s should have been absent from " membername printfn "Completion list = %A" completions Assert.Fail(sprintf "Found unexpected '%s' in completion list" membername) - + // Verify the completion list contains every member in the list let rec AssertCompListContainsAll(completions : CompletionItem[], expectedCompletions) = match expectedCompletions with @@ -256,37 +256,37 @@ module internal VsOpsUtils = /// Simulates pressing '.' at the mark and returns the completion list let DotCompletionAtMarker markerDirection (file : OpenFile) marker = - + // Simulate pressing '.' let orgFileContents = GetAllLines file - + // Check that the marker is unique, otherwise we can't determine where to put the '.' - let markerLines = orgFileContents |> Seq.filter (fun line -> line.Contains(marker)) |> Seq.length + let markerLines = orgFileContents |> Seq.filter (fun line -> line.Contains(marker)) |> Seq.length if markerLines = 0 then Assert.Fail("Unable to find marker in source code.") if markerLines > 1 then Assert.Fail(sprintf "Found marker [%s] multiple times in source file." marker) - + // Replace marker with "." let replaceMarker = - match markerDirection with + match markerDirection with | StartOfMarker -> (fun (line : string) -> line.Replace(marker, "." + marker)) | EndOfMarker -> (fun (line : string) -> line.Replace(marker, marker + ".")) - + let newFileContents = orgFileContents |> List.map replaceMarker - + // Now apply our change & get the comp list ReplaceFileInMemory file newFileContents - - match markerDirection with + + match markerDirection with | StartOfMarker -> MoveCursorToStartOfMarker(file, marker) | EndOfMarker -> MoveCursorToEndOfMarker(file, marker + ".") let compList = AutoCompleteAtCursor(file) - + // Now restore the original file contents ReplaceFileInMemory file orgFileContents - + compList - + /// Gets the completion list as if you pressed '.' at the START of the marker. let DotCompletionAtStartOfMarker : (OpenFile -> string -> CompletionItem[]) = DotCompletionAtMarker StartOfMarker @@ -294,19 +294,19 @@ module internal VsOpsUtils = let DotCompletionAtEndOfMarker : (OpenFile -> string -> CompletionItem[]) = DotCompletionAtMarker EndOfMarker // ------------------------------------------------------------------------ - + /// Abbreviation for 'None', to indicate a GotoDefn failure let GotoDefnFailure = None : (string * string) option /// Abbreviation for 'Some(ident, lineOfCode)' let GotoDefnSuccess x y = Some (x, y) : (string * string) option - + /// Checks that a goto definition result matches the expected value. /// Expected = Some(identifierAtCursor, lineOfCodeAtCursor) let CheckGotoDefnResult (expected : (string * string) option) (file : OpenFile) (actual : GotoDefnResult) : unit = match (expected, actual.ToOption()) with // Success cases // GotoDefn retrieved a result and we expected to find something - | (Some (toFind, expLine), Some (span, actFile)) + | (Some (toFind, expLine), Some (span, actFile)) -> match GetIdentifierAtCursor file with | None -> Assert.Fail ("No identifier at cursor. This indicates a bug in GotoDefinition.") | Some (id, _) -> // Are we on the identifier we expect? @@ -315,20 +315,20 @@ module internal VsOpsUtils = // - Eliminate white space to eliminate trivial errors // - +1 to adjust for 1-index line numbers Assert.Equal ( - expLine.Trim(), + expLine.Trim(), (span.iStartLine |> (+) 1 |> GetLineNumber (OpenFileViaOpenFile(file.VS, actFile))).Trim () - ) + ) // Looks like it's legit! () - // We expected Goto Definition to fail and it did. + // We expected Goto Definition to fail and it did. // (Such as Goto Definition on keyword or symbol.) - | (None, None) + | (None, None) -> () - + // Error cases - | (Some (x,_), None) + | (Some (x,_), None) -> Assert.Fail(sprintf "Expected to find the definition of '%s' but GotoDefn failed." x) - | (None, Some (_,file)) + | (None, Some (_,file)) -> Assert.Fail(sprintf "Expected GotoDefn to fail, but it went to a definition in file %s" file) diff --git a/vsintegration/tests/Salsa/SalsaUtils.fsi b/vsintegration/tests/Salsa/SalsaUtils.fsi index 69acd34bd9d..36d5f8ef502 100644 --- a/vsintegration/tests/Salsa/SalsaUtils.fsi +++ b/vsintegration/tests/Salsa/SalsaUtils.fsi @@ -17,7 +17,7 @@ open Salsa module internal VsOpsUtils = // ------------------------------------------------------------------------ - + // Wrappers on top of VSOps functions, these make it easier to interact with // VSOps as well as enabling us to change VsOps slightly without breaking the world @@ -33,9 +33,9 @@ module internal VsOpsUtils = val AddFileFromTextBlob : OpenProject * string * string -> File val AddFileFromTextEx : OpenProject * string * string * Salsa.Salsa.BuildAction * string list -> File val AddLinkedFileFromTextEx : OpenProject * string * string * string * string list -> File - val AddAssemblyReference : OpenProject * string -> unit - val AddAssemblyReferenceEx : OpenProject * string * bool -> unit - val AddProjectReference : OpenProject * OpenProject -> unit + val AddAssemblyReference : OpenProject * string -> unit + val AddAssemblyReferenceEx : OpenProject * string * bool -> unit + val AddProjectReference : OpenProject * OpenProject -> unit val ProjectDirectory : OpenProject -> string val ProjectFile : OpenProject -> string val SetVersionFile : OpenProject * string -> unit @@ -46,10 +46,10 @@ module internal VsOpsUtils = val BuildTarget : OpenProject * string -> BuildResult val GetMainOutputAssembly : OpenProject -> string val Save : OpenProject -> unit - val GetErrors : OpenProject -> Error list - /// Open a file outside of any project as if from File\Open\File... menu item. + val GetErrors : OpenProject -> Error list + /// Open a file outside of any project as if from File\Open\File... menu item. val OpenFileViaOpenFile : VisualStudio * string -> OpenFile - val OpenFile : OpenProject * string -> OpenFile + val OpenFile : OpenProject * string -> OpenFile val GetOpenFiles : OpenProject -> OpenFile list val SetProjectDefines : OpenProject * string list -> unit val PlaceIntoProjectFileBeforeImport : OpenProject * string -> unit @@ -63,7 +63,7 @@ module internal VsOpsUtils = val ShiftKeyDown : VisualStudio -> unit val ShiftKeyUp : VisualStudio -> unit val ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients : VisualStudio -> unit - val TakeCoffeeBreak : VisualStudio -> unit + val TakeCoffeeBreak : VisualStudio -> unit val ReplaceFileInMemory : OpenFile -> string list -> unit val ReplaceFileInMemoryWithoutCoffeeBreak : OpenFile -> string list -> unit val SaveFileToDisk : OpenFile -> unit @@ -75,10 +75,10 @@ module internal VsOpsUtils = val CtrlSpaceCompleteAtCursor : OpenFile -> CompletionItem array /// like AutoCompleteAtCursor, but can pass e.g. BackgroundRequestReason.CompleteWord to do Ctrl-space rather than auto-dot-popup-completion val CompleteAtCursorForReason : OpenFile * Microsoft.VisualStudio.FSharp.LanguageService.BackgroundRequestReason -> CompletionItem array - val CompletionBestMatchAtCursorFor : OpenFile * string * string option -> (string * bool * bool) option + val CompletionBestMatchAtCursorFor : OpenFile * string * string option -> (string * bool * bool) option val MoveCursorToEndOfMarker : OpenFile * string -> unit val MoveCursorToStartOfMarker : OpenFile * string -> unit - val GetQuickInfoAtCursor : OpenFile -> string + val GetQuickInfoAtCursor : OpenFile -> string val GetQuickInfoAndSpanAtCursor : OpenFile -> string*TextSpan val GetNameOfOpenFile : OpenFile -> string val GetProjectOptionsOfScript : OpenFile -> FSharpProjectOptions @@ -99,11 +99,11 @@ module internal VsOpsUtils = /// True if files outside of the project cone are added as links. val AutoCompleteMemberDataTipsThrowsScope : VisualStudio * string -> System.IDisposable - + val CreateSingleFileProject : VisualStudio * string -> (OpenSolution * OpenProject * OpenFile) val CreateNamedSingleFileProject : VisualStudio * (string * string) -> (OpenSolution * OpenProject * OpenFile) val GetMatchingBracesForPositionAtCursor : OpenFile -> (TextSpan * TextSpan) array - + // ------------------------------------------------------------------------ // Methods to simplify testing of specific features @@ -116,7 +116,7 @@ module internal VsOpsUtils = val AssertRegionListContains : list<(int*int)*(int*int)> * list -> unit val AssertNavigationContains : DropDownMember[] * string -> unit val AssertNavigationContainsAll : DropDownMember[] * seq -> unit - + // Completion list val AssertCompListIsEmpty : CompletionItem[] -> unit val AssertCompListContains : CompletionItem[] * string -> unit @@ -129,10 +129,10 @@ module internal VsOpsUtils = val DotCompletionAtMarker : SetMarkerPoint -> OpenFile -> string -> CompletionItem[] val DotCompletionAtStartOfMarker : (OpenFile -> string -> CompletionItem[]) val DotCompletionAtEndOfMarker : (OpenFile -> string -> CompletionItem[]) - - + + // Goto Definition val GotoDefnFailure : (string * string) option val GotoDefnSuccess : string -> string -> (string * string) option - + val CheckGotoDefnResult : (string * string) option -> OpenFile -> GotoDefnResult -> unit diff --git a/vsintegration/tests/Salsa/VsMocks.fs b/vsintegration/tests/Salsa/VsMocks.fs index 54fe8b906de..4031837a2ea 100644 --- a/vsintegration/tests/Salsa/VsMocks.fs +++ b/vsintegration/tests/Salsa/VsMocks.fs @@ -21,34 +21,34 @@ open System.Runtime.InteropServices open System open System.Collections.Generic -module internal VsMocks = +module internal VsMocks = let private notimpl() = raise (new System.Exception("Not implemented")) let private ok = VSConstants.S_OK let private fail = VSConstants.E_FAIL let private impl1 fo next a = - match fo with - Some(f) -> + match fo with + Some(f) -> match f a with | Some(r) -> r | _ -> next a | _ -> next a let private impl2 fo next a b = - match fo with - Some(f) -> + match fo with + Some(f) -> match f a b with | Some(r) -> r | _ -> next a b | _ -> next a b let private impl3 fo next a b c= - match fo with - Some(f) -> + match fo with + Some(f) -> match f a b c with | Some(r) -> r | _ -> next a b c | _ -> next a b c let private impl4 fo next a b c d= - match fo with - Some(f) -> + match fo with + Some(f) -> match f a b c d with | Some(r) -> r | _ -> next a b c d | _ -> next a b c d - let private uimpl fo next = - match fo with - Some(f) -> - match f() with + let private uimpl fo next = + match fo with + Some(f) -> + match f() with Some(r)->r | None -> next() | _ -> next() @@ -58,13 +58,13 @@ module internal VsMocks = abstract GetInner: unit->'a end - type VSITEMID=int32 + type VSITEMID=int32 - type VsFileChangeEx() = + type VsFileChangeEx() = let fileToEvents = new Dictionary() let Canonicalize (fileName:string) = System.IO.Path.GetFullPath(fileName) - + member c.AddedFile(file) = // printfn "VsMocks.VsFileChangeEx: Added file %s " file c.SomehowModifiedFile(file, uint32 _VSFILECHANGEFLAGS.VSFILECHG_Add) @@ -79,13 +79,13 @@ module internal VsMocks = let CallFilesChanged(fce:IVsFileChangeEvents) = // printfn "VsMocks.VsFileChangeEx: Calling FilesChanged callback for %s, how = %A " file how fce.FilesChanged(1u,[|file|],[|how|])|>ignore - + match fileToEvents.TryGetValue(file) with | true, events -> events |> List.iter CallFilesChanged | false, _ -> () - + interface IVsFileChangeEx with - member fc.AdviseFileChange(pszMkDocument,grfFilter,pFCE,vsCookie) = + member fc.AdviseFileChange(pszMkDocument,grfFilter,pFCE,vsCookie) = let pszMkDocument = Canonicalize pszMkDocument // printfn "VsMocks.VsFileChangeEx: Advise %s " pszMkDocument match fileToEvents.TryGetValue(pszMkDocument) with @@ -93,20 +93,20 @@ module internal VsMocks = | false, _ -> fileToEvents.Add(pszMkDocument, [pFCE]) vsCookie <- 0u ok - member fc.UnadviseFileChange(vsCookie) = + member fc.UnadviseFileChange(vsCookie) = // printfn "VsMocks.VsFileChangeEx: Unadvise %d " vsCookie ok member fc.SyncFile(pszMkDocument) = notimpl() member fc.IgnoreFile(vsCookie, pszMkDocument, fIgnore) = notimpl() member fc.AdviseDirChange(pszDir, fWatchSubDir, pFCE,vsCookie) = notimpl() member fc.UnadviseDirChange(vsCookie) = notimpl() - + /// Mockable versions of various VS interfaces. Use optional function parameters - /// so that we don't have to specify all of them. - type Vs() = + /// so that we don't have to specify all of them. + type Vs() = static let FSharpProjectGuid = new Guid(Microsoft.VisualStudio.FSharp.ProjectSystem.GuidList.guidFSharpProjectFactoryString) - - static member MakeTextView() = + + static member MakeTextView() = let userData = new Dictionary() {new IVsTextView with member tv.Initialize(pBuffer, hwndParent, initFlags, pInitView) = notimpl() @@ -159,14 +159,14 @@ module internal VsMocks = | _ -> userData.Add(guid,obj) |> ignore VSConstants.S_OK member x.GetData(guid,obj) = - if userData.ContainsKey(guid) then + if userData.ContainsKey(guid) then obj <- userData.[guid] else obj <- null VSConstants.S_OK } - - + + static member VsUserContext(?addAttribute) = { new IVsUserContext with member this.AddAttribute (usage,key,value) = @@ -191,8 +191,8 @@ module internal VsMocks = member this.RemoveAttributeIncludeChildren(_,_) = notimpl() member this.GetAttributePri(_,_,_,_,_,_) = notimpl() } - - static member DelegateTextView(oldtv:IVsTextView, ?getBuffer, ?getScrollInfo, ?getTopmostLayer) = + + static member DelegateTextView(oldtv:IVsTextView, ?getBuffer, ?getScrollInfo, ?getTopmostLayer) = let inner:Ref = ref oldtv {new IVsTextView with member tv.Initialize(pBuffer, hwndParent, initFlags, pInitView) = (!inner).Initialize(pBuffer, hwndParent, initFlags, pInitView) @@ -211,7 +211,7 @@ module internal VsMocks = member tv.GetTextStream(iTopLine, iTopCol, iBottomLine, iBottomCol, pbstrText) = (!inner).GetTextStream(iTopLine, iTopCol, iBottomLine, iBottomCol, ref pbstrText) member tv.SetBuffer(pBuffer) = (!inner).SetBuffer(pBuffer) member tv.GetWindowHandle() = (!inner).GetWindowHandle() - member tv.GetScrollInfo(iBar, piMinUnit, piMaxUnit, piVisibleUnits, piFirstVisibleUnit) = + member tv.GetScrollInfo(iBar, piMinUnit, piMaxUnit, piVisibleUnits, piFirstVisibleUnit) = let next bar = (!inner).GetScrollInfo(bar) let hr,minu,maxu,visu,firstvis= impl1 getScrollInfo next iBar piMinUnit<-minu @@ -238,7 +238,7 @@ module internal VsMocks = member tv.HighlightMatchingBrace(dwFlags, cSpans, rgBaseSpans) = (!inner).HighlightMatchingBrace(dwFlags, cSpans, rgBaseSpans) member tv.SendExplicitFocus() = (!inner).SendExplicitFocus() member tv.SetTopLine(iBaseLine) = (!inner).SetTopLine(iBaseLine) - member tv.GetBuffer(ppbuffer) = + member tv.GetBuffer(ppbuffer) = let next() = (!inner).GetBuffer() let hr,buf = uimpl getBuffer next ppbuffer<-buf @@ -247,7 +247,7 @@ module internal VsMocks = member ltv.GetSelectedAtom(dwFlags, ppunkAtom) = notimpl() member ltv.GetRelativeSelectionState(dwFlags, pReferenceLayer, pSelState) = notimpl() member ltv.SetRelativeSelectionState(dwFlags, pReferenceLayer, pSelState) = notimpl() - member ltv.GetTopmostLayer(ppLayer) = + member ltv.GetTopmostLayer(ppLayer) = let next() = ((box (!inner)):?>IVsLayeredTextView).GetTopmostLayer() let hr,l = uimpl getTopmostLayer next ppLayer<-l @@ -258,8 +258,8 @@ module internal VsMocks = interface IVsUserData with member ud.GetData(guid,o) = ((!inner) :?> IVsUserData).GetData(&guid,&o) member ud.SetData(guid,o) = ((!inner) :?> IVsUserData).SetData(&guid,o) - } - + } + static member MakeTextLayer() = {new IVsTextLayer with member tl.LocalLineIndexToBase(iLocalLine, iLocalIndex, piBaseLine, piBaseIndex) = notimpl() @@ -285,17 +285,17 @@ module internal VsMocks = member tl.ReplaceLinesEx(dwFlags, iStartLine, iStartIndex, iEndLine, iEndIndex, pszText, iNewLen, pChangedSpan) = notimpl() member tl.MapLocalSpansToTextOriginatingLayer(dwFlags, pLocalSpanEnum, ppTargetLayer, ppTargetSpanEnum) = notimpl() } - static member DelegateTextLayer(oldtl:IVsTextLayer, ?localLineIndexToBase) = + static member DelegateTextLayer(oldtl:IVsTextLayer, ?localLineIndexToBase) = let inner = ref oldtl {new IVsTextLayer with - member tl.LocalLineIndexToBase(iLocalLine, iLocalIndex, piBaseLine, piBaseIndex) = + member tl.LocalLineIndexToBase(iLocalLine, iLocalIndex, piBaseLine, piBaseIndex) = let next ll li = (!inner).LocalLineIndexToBase(ll,li) let hr,bl,bi = impl2 localLineIndexToBase next iLocalLine iLocalIndex piBaseLine<-bl piBaseIndex<-bi hr member tl.BaseLineIndexToLocal(iBaseLine, iBaseIndex, piLocalLine, piLocalIndex) = notimpl() - member tl.LocalLineIndexToDeeperLayer(pTargetLayer, iLocalLine, iLocalIndex, piTargetLine, piTargetIndex) = notimpl() + member tl.LocalLineIndexToDeeperLayer(pTargetLayer, iLocalLine, iLocalIndex, piTargetLine, piTargetIndex) = notimpl() member tl.DeeperLayerLineIndexToLocal(dwFlags, pTargetLayer, iLayerLine, iLayerIndex, piLocalLine, piLocalIndex) = notimpl() member tl.GetBaseBuffer(ppiBuf) = notimpl() member tl.LockBufferEx(dwFlags) = notimpl() @@ -314,12 +314,12 @@ module internal VsMocks = member tl.CreateTrackingPoint(iLine, iIndex, ppMarker) = notimpl() member tl.EnumLayerMarkers(iStartLine, iStartIndex, iEndLine, iEndIndex, iMarkerType, dwFlags, ppEnum) = notimpl() member tl.ReplaceLinesEx(dwFlags, iStartLine, iStartIndex, iEndLine, iEndIndex, pszText, iNewLen, pChangedSpan) = notimpl() - member tl.MapLocalSpansToTextOriginatingLayer(dwFlags, pLocalSpanEnum, ppTargetLayer, ppTargetSpanEnum) = notimpl() + member tl.MapLocalSpansToTextOriginatingLayer(dwFlags, pLocalSpanEnum, ppTargetLayer, ppTargetSpanEnum) = notimpl() interface IDelegable with member id.GetInner() = !inner member id.SetInner(i) = inner:=i } - + static member MakeTextLineMarker() = let mutable markerSpan = new TextSpan(iStartLine = 0, iEndLine = 0, iStartIndex = 0, iEndIndex = 0) {new IVsTextLineMarker with @@ -334,14 +334,14 @@ module internal VsMocks = member tl.GetType(piMarkerType) = notimpl() member tl.GetVisualStyle(pdwFlags) = notimpl() member tl.Invalidate() = 0 - member tl.ResetSpan(iSL, iSI, iEL, iEI) = - markerSpan <- new TextSpan(iStartLine = iSL, iEndLine = iEL, iStartIndex = iSI, iEndIndex = iEI) ; + member tl.ResetSpan(iSL, iSI, iEL, iEI) = + markerSpan <- new TextSpan(iStartLine = iSL, iEndLine = iEL, iStartIndex = iSI, iEndIndex = iEI) ; 0 member tl.SetBehavior(dwBehavior) = notimpl() member tl.SetType(iMarkerType) = notimpl() member tl.SetVisualStyle(dwFlags) = notimpl() member tl.UnadviseClient() = 0 - + interface IVsTextMarker with member tl.DrawGlyph(hdc, pRect) = notimpl() member tl.ExecMarkerCommand(iItem) = notimpl() @@ -397,7 +397,7 @@ module internal VsMocks = member tl.CopyLineText(iStartLine, iStartIndex, iEndLine, iEndIndex, pszBuf, pcchBuf)= notimpl() member tl.ReplaceLines(iStartLine, iStartIndex, iEndLine, iEndIndex, pszText, iNewLen, pChangedSpan)= notimpl() member tl.CanReplaceLines(iStartLine, iStartIndex, iEndLine, iEndIndex, iNewLen)= notimpl() - member tl.CreateLineMarker(iMarkerType, iStartLine, iStartIndex, iEndLine, iEndIndex, pClient, ppMarker)= + member tl.CreateLineMarker(iMarkerType, iStartLine, iStartIndex, iEndLine, iEndIndex, pClient, ppMarker)= let textLineMarker = Vs.MakeTextLineMarker() textLineMarker.ResetSpan(iStartLine, iStartIndex, iEndLine, iEndIndex) |> ignore ppMarker.[0] <- textLineMarker ; @@ -415,7 +415,7 @@ module internal VsMocks = member tl.ReplaceLinesEx(udwFlags, iStartLine, iStartIndex, iEndLine, iEndIndex, pszText, iNewLen, pChangedSpan)= notimpl() member tl.CreateTextPoint(iLine, iIndex, ppTextPoint)= notimpl() - interface IVsTextBuffer with + interface IVsTextBuffer with member tl.LockBuffer() = notimpl() member tl.UnlockBuffer() = notimpl() member tl.InitializeContent(pszText, iLength) = notimpl() @@ -446,10 +446,10 @@ module internal VsMocks = member tl.Reserved9() = notimpl() member tl.Reserved10() = notimpl() - interface IVsTextColorState with + interface IVsTextColorState with member tcs.ReColorizeLines(iTopLine, iBottomLine) = notimpl() member tcs.GetColorStateAtStartOfLine(iLine, piState) = notimpl() - + interface IVsUserData with member x.SetData(guid,obj) = if userData.ContainsKey(guid) then userData.Remove(guid) |> ignore @@ -458,13 +458,13 @@ module internal VsMocks = | _ -> userData.Add(guid,obj) |> ignore VSConstants.S_OK member x.GetData(guid,obj) = - if userData.ContainsKey(guid) then + if userData.ContainsKey(guid) then obj <- userData.[guid] else obj <- null VSConstants.S_OK } - static member DelegateTextLines(oldtl:IVsTextLines, ?getLengthOfLine, ?getLineText, ?getLineCount, ?recolorizeLines, ?getColorStateAtStartOfLine, ?getData) = + static member DelegateTextLines(oldtl:IVsTextLines, ?getLengthOfLine, ?getLineText, ?getLineCount, ?recolorizeLines, ?getColorStateAtStartOfLine, ?getData) = let inner:Ref = ref oldtl {new IVsTextLines with member tl.LockBuffer() = (!inner).LockBuffer() @@ -475,18 +475,18 @@ module internal VsMocks = member tl.GetPositionOfLine(line,position) = (!inner).GetPositionOfLine(line, ref position) member tl.GetPositionOfLineIndex(line, index, x) = (!inner).GetPositionOfLineIndex(line, index, ref x) member tl.GetLineIndexOfPosition(position, line, x) = (!inner).GetLineIndexOfPosition(position, ref line, ref x) - member tl.GetLengthOfLine(line, length) = + member tl.GetLengthOfLine(line, length) = let next line = (!inner).GetLengthOfLine(line) let hr,l = impl1 getLengthOfLine next line length<-l - hr - member tl.GetLineCount(count) = + hr + member tl.GetLineCount(count) = let next () = (!inner).GetLineCount() - let hr,c = uimpl getLineCount next + let hr,c = uimpl getLineCount next count<-c - hr + hr member tl.GetSize(x) = (!inner).GetSize(ref x) - member tl.GetLanguageServiceID(pguidLangService:System.Guid byref) = (!inner).GetLanguageServiceID(ref pguidLangService) + member tl.GetLanguageServiceID(pguidLangService:System.Guid byref) = (!inner).GetLanguageServiceID(ref pguidLangService) member tl.SetLanguageServiceID(guidLangServ) = (!inner).SetLanguageServiceID(ref guidLangServ) member tl.GetUndoManager(x) = (!inner).GetUndoManager(ref x) member tl.Reserved1() = (!inner).Reserved1() @@ -507,11 +507,11 @@ module internal VsMocks = member tl.ReleaseMarkerData(pMarkerData) = (!inner).ReleaseMarkerData(pMarkerData) member tl.GetLineData(iLine, pLineData, pMarkerData) = (!inner).GetLineData(iLine, pLineData, pMarkerData) member tl.ReleaseLineData(pLineData)= (!inner).ReleaseLineData(pLineData) - member tl.GetLineText(iStartLine, iStartIndex, iEndLine, iEndIndex, pbstrBuf) = - let next a b c d = (!inner).GetLineText(a,b,c,d) + member tl.GetLineText(iStartLine, iStartIndex, iEndLine, iEndIndex, pbstrBuf) = + let next a b c d = (!inner).GetLineText(a,b,c,d) let hr,b = impl4 getLineText next iStartLine iStartIndex iEndLine iEndIndex pbstrBuf<-b - hr + hr member tl.CopyLineText(iStartLine, iStartIndex, iEndLine, iEndIndex, pszBuf, pcchBuf)= (!inner).CopyLineText(iStartLine, iStartIndex, iEndLine, iEndIndex, pszBuf, ref pcchBuf) member tl.ReplaceLines(iStartLine, iStartIndex, iEndLine, iEndIndex, pszText, iNewLen, pChangedSpan)= (!inner).ReplaceLines(iStartLine, iStartIndex, iEndLine, iEndIndex, pszText, iNewLen, pChangedSpan) member tl.CanReplaceLines(iStartLine, iStartIndex, iEndLine, iEndIndex, iNewLen)= (!inner).CanReplaceLines(iStartLine, iStartIndex, iEndLine, iEndIndex, iNewLen) @@ -529,7 +529,7 @@ module internal VsMocks = member tl.ReplaceLinesEx(udwFlags, iStartLine, iStartIndex, iEndLine, iEndIndex, pszText, iNewLen, pChangedSpan)= (!inner).ReplaceLinesEx(udwFlags, iStartLine, iStartIndex, iEndLine, iEndIndex, pszText, iNewLen, pChangedSpan) member tl.CreateTextPoint(iLine, iIndex, ppTextPoint)= (!inner).CreateTextPoint(iLine, iIndex, ref ppTextPoint) - interface IVsTextBuffer with + interface IVsTextBuffer with member tl.LockBuffer() = (!inner).LockBuffer() member tl.UnlockBuffer() = (!inner).UnlockBuffer() member tl.InitializeContent(pszText, iLength) = (!inner).InitializeContent(pszText, iLength) @@ -538,14 +538,14 @@ module internal VsMocks = member tl.GetPositionOfLine(line,position) = (!inner).GetPositionOfLine(line, ref position) member tl.GetPositionOfLineIndex(line, index, x) = (!inner).GetPositionOfLineIndex(line, index, ref x) member tl.GetLineIndexOfPosition(position, line, x) = (!inner).GetLineIndexOfPosition(position, ref line, ref x) - member tl.GetLengthOfLine(line, length) = + member tl.GetLengthOfLine(line, length) = let next line = (!inner).GetLengthOfLine(line) let hr,l = impl1 getLengthOfLine next line length<-l - hr + hr member tl.GetLineCount(x) = (!inner).GetLineCount(ref x) member tl.GetSize(x) = (!inner).GetSize(ref x) - member tl.GetLanguageServiceID(pguidLangService:System.Guid byref) = (!inner).GetLanguageServiceID(ref pguidLangService) + member tl.GetLanguageServiceID(pguidLangService:System.Guid byref) = (!inner).GetLanguageServiceID(ref pguidLangService) member tl.SetLanguageServiceID(guidLangServ) = (!inner).SetLanguageServiceID(ref guidLangServ) member tl.GetUndoManager(x) = (!inner).GetUndoManager(ref x) member tl.Reserved1() = (!inner).Reserved1() @@ -563,32 +563,32 @@ module internal VsMocks = member tl.Reserved9() = (!inner).Reserved9() member tl.Reserved10() = (!inner).Reserved10() - interface IVsTextColorState with - member tcs.ReColorizeLines(iTopLine, iBottomLine) = + interface IVsTextColorState with + member tcs.ReColorizeLines(iTopLine, iBottomLine) = let next top bottom = ((box (!inner)):?>IVsTextColorState).ReColorizeLines(top, bottom) let hr:int = impl2 recolorizeLines next iTopLine iBottomLine hr - member tcs.GetColorStateAtStartOfLine(iLine, piState) = + member tcs.GetColorStateAtStartOfLine(iLine, piState) = let next iLine = ((box (!inner)):?>IVsTextColorState).GetColorStateAtStartOfLine(iLine) let hr,state = impl1 getColorStateAtStartOfLine next iLine piState<-state hr - + interface IVsUserData with - member ud.GetData(riidKey,pvtData) = + member ud.GetData(riidKey,pvtData) = let next riidKey = ((box (!inner)):?>IVsUserData).GetData(riidKey) let (hr:int),data = impl1 getData next (ref riidKey) pvtData<-data hr - member ud.SetData(riidKey,vtData) = ((box (!inner)):?>IVsUserData).SetData(ref riidKey,vtData) + member ud.SetData(riidKey,vtData) = ((box (!inner)):?>IVsUserData).SetData(ref riidKey,vtData) interface IDelegable with member id.GetInner() = !inner member id.SetInner(i) = inner:=i - } - -// (The RDT is no longer used by the product, but leaving in VsMocks/Salsa in case we need it again in the future - static member MakeRunningDocumentTable() = + } + +// (The RDT is no longer used by the product, but leaving in VsMocks/Salsa in case we need it again in the future + static member MakeRunningDocumentTable() = {new IVsRunningDocumentTable with member rdt.RegisterAndLockDocument(grfRDTLockType, pszMkDocument, pHier, itemid, punkDocData, pdwCookie) = notimpl() member rdt.LockDocument(grfRDTLockType, dwCookie) = notimpl() @@ -606,18 +606,18 @@ module internal VsMocks = member rdt.RegisterDocumentLockHolder(grfRDLH, dwCookie, pLockHolder, pdwLHCookie) = notimpl() member rdt.UnregisterDocumentLockHolder(dwLHCookie) = notimpl() member rdt.ModifyDocumentFlags(docCookie, grfFlags, fSet) = notimpl() } - - static member DelegateRunningDocumentTable(oldrdt:IVsRunningDocumentTable, ?getDocumentInfo, ?unadviseRunningDocTableEvents, ?findAndLockDocument) = + + static member DelegateRunningDocumentTable(oldrdt:IVsRunningDocumentTable, ?getDocumentInfo, ?unadviseRunningDocTableEvents, ?findAndLockDocument) = let inner:Ref = ref oldrdt {new IVsRunningDocumentTable with member rdt.RegisterAndLockDocument(grfRDTLockType, pszMkDocument, pHier, itemid, punkDocData, pdwCookie) = (!inner).RegisterAndLockDocument(grfRDTLockType, pszMkDocument, pHier, itemid, punkDocData, ref pdwCookie) member rdt.LockDocument(grfRDTLockType, dwCookie) = (!inner).LockDocument(grfRDTLockType, dwCookie) member rdt.UnlockDocument(grfRDTLockType, dwCookie) = (!inner).UnlockDocument(grfRDTLockType, dwCookie) - member rdt.FindAndLockDocument(dwRDTLockType, pszMkDocument, ppHier, pitemid, ppunkDocData, pdwCookie) = + member rdt.FindAndLockDocument(dwRDTLockType, pszMkDocument, ppHier, pitemid, ppunkDocData, pdwCookie) = let next() = (!inner).FindAndLockDocument(dwRDTLockType,pszMkDocument) - let (hr:int),hier,itemid,docData,cookie = + let (hr:int),hier,itemid,docData,cookie = match findAndLockDocument with - | Some(f) -> + | Some(f) -> match f dwRDTLockType pszMkDocument with Some(r)-> r | _ -> next() @@ -626,25 +626,25 @@ module internal VsMocks = pitemid<- itemid ppunkDocData<-docData pdwCookie <- cookie - hr - + hr + member rdt.RenameDocument(pszMkDocumentOld, pszMkDocumentNew, pHier, itemidNew) = (!inner).RenameDocument(pszMkDocumentOld, pszMkDocumentNew, pHier, itemidNew) member rdt.AdviseRunningDocTableEvents(pSink, pdwCookie) = (!inner).AdviseRunningDocTableEvents(pSink, ref pdwCookie) - member rdt.UnadviseRunningDocTableEvents(dwCookie) = + member rdt.UnadviseRunningDocTableEvents(dwCookie) = let next() = (!inner).UnadviseRunningDocTableEvents(dwCookie) - let hr = + let hr = match unadviseRunningDocTableEvents with - Some(f) -> + Some(f) -> match f dwCookie with Some(r)-> r | _ -> next() | _ -> next() hr - member rdt.GetDocumentInfo(docCookie, pgrfRDTFlags, pdwReadLocks, pdwEditLocks, pbstrMkDocument, ppHier, pitemid, ppunkDocData) = + member rdt.GetDocumentInfo(docCookie, pgrfRDTFlags, pdwReadLocks, pdwEditLocks, pbstrMkDocument, ppHier, pitemid, ppunkDocData) = let next() = (!inner).GetDocumentInfo(docCookie) - let hr,_,_,_,mkd,hier,itemid,docd = + let hr,_,_,_,mkd,hier,itemid,docd = match getDocumentInfo with - Some(f) -> + Some(f) -> match f docCookie with Some(r)-> r | _ -> next() @@ -654,7 +654,7 @@ module internal VsMocks = pitemid<-itemid ppunkDocData <- docd hr - + member rdt.NotifyDocumentChanged(dwCookie, grfDocChanged) = (!inner).NotifyDocumentChanged(dwCookie, grfDocChanged) member rdt.NotifyOnAfterSave(dwCookie) = (!inner).NotifyOnAfterSave(dwCookie) member rdt.GetRunningDocumentsEnum(ppenum) = (!inner).GetRunningDocumentsEnum(ref ppenum) @@ -662,20 +662,20 @@ module internal VsMocks = member rdt.NotifyOnBeforeSave(dwCookie) = (!inner).NotifyOnBeforeSave(dwCookie) member rdt.RegisterDocumentLockHolder(grfRDLH, dwCookie, pLockHolder, pdwLHCookie) = (!inner).RegisterDocumentLockHolder(grfRDLH, dwCookie, pLockHolder, ref pdwLHCookie) member rdt.UnregisterDocumentLockHolder(dwLHCookie) = (!inner).UnregisterDocumentLockHolder(dwLHCookie) - member rdt.ModifyDocumentFlags(docCookie, grfFlags, fSet) = (!inner).ModifyDocumentFlags(docCookie, grfFlags, fSet) + member rdt.ModifyDocumentFlags(docCookie, grfFlags, fSet) = (!inner).ModifyDocumentFlags(docCookie, grfFlags, fSet) interface IDelegable with member id.GetInner() = !inner member id.SetInner(i) = inner:=i - } -// ) - static member MakeHierarchy(projectSiteFactory:IProvideProjectSite) = + } +// ) + static member MakeHierarchy(projectSiteFactory:IProvideProjectSite) = {new IVsHierarchy with member h.SetSite(psp) = notimpl() member h.GetSite(ppSP) = notimpl() member h.QueryClose(pfCanClose) = notimpl() member h.Close() = notimpl() - member h.GetGuidProperty(itemid, propid, pguid) = - pguid <- FSharpProjectGuid + member h.GetGuidProperty(itemid, propid, pguid) = + pguid <- FSharpProjectGuid VSConstants.S_OK member h.SetGuidProperty(itemid, propid, rguid) = notimpl() member h.GetProperty(itemid, propid, pvar) = notimpl() @@ -693,17 +693,17 @@ module internal VsMocks = interface IProvideProjectSite with member x.GetProjectSite() = projectSiteFactory.GetProjectSite() } - - static member DelegateHierarchy(oldh:IVsHierarchy, ?getCanonicalName, ?getProperty) = + + static member DelegateHierarchy(oldh:IVsHierarchy, ?getCanonicalName, ?getProperty) = let mutable inner = oldh - {new IVsHierarchy with + {new IVsHierarchy with member h.SetSite(psp) = inner.SetSite(psp) member h.GetSite(ppSP) = inner.GetSite(ref ppSP) member h.QueryClose(pfCanClose) = inner.QueryClose(ref pfCanClose) member h.Close() = inner.Close() member h.GetGuidProperty(itemid, propid, pguid) = inner.GetGuidProperty(itemid, propid, ref pguid) member h.SetGuidProperty(itemid, propid, rguid) = inner.SetGuidProperty(itemid, propid, ref rguid) - member h.GetProperty(itemid, propid, pvar) = + member h.GetProperty(itemid, propid, pvar) = let propid:__VSHPROPID = enum propid let next itemid propid = inner.GetProperty(itemid, int32 propid) let hr,var = impl2 getProperty next itemid propid @@ -712,11 +712,11 @@ module internal VsMocks = member h.SetProperty(itemid, propid, var) = inner.SetProperty(itemid, propid, var) member h.GetNestedHierarchy(itemid, iidHierarchyNested, ppHierarchyNested, pitemidNested) = inner.GetNestedHierarchy(itemid,ref iidHierarchyNested, ref ppHierarchyNested, ref pitemidNested) /// For project files, returns the fully qualified path to the file including the fileName itself. - member h.GetCanonicalName(itemid, pbstrName) = + member h.GetCanonicalName(itemid, pbstrName) = let next itemid = inner.GetCanonicalName(itemid) let hr,n = impl1 getCanonicalName next itemid pbstrName<-n - hr + hr member h.ParseCanonicalName(pszName, pitemid) = inner.ParseCanonicalName(pszName, ref pitemid) member h.Unused0() = inner.Unused0() member h.AdviseHierarchyEvents(pEventSink, pdwCookie) = inner.AdviseHierarchyEvents(pEventSink, ref pdwCookie) @@ -728,13 +728,13 @@ module internal VsMocks = interface IDelegable with member id.GetInner() = inner member id.SetInner(i) = inner <- i - + interface IProvideProjectSite with member x.GetProjectSite() = (inner :?> IProvideProjectSite).GetProjectSite() - } - - static member MakeTextManager() = + } + + static member MakeTextManager() = {new IVsTextManager with member tm.RegisterView(pView,pBuffer) = notimpl() member tm.UnregisterView(pView) = notimpl() @@ -766,10 +766,10 @@ module internal VsMocks = member tm.GetBufferSccStatus2(pszFileName,pbNonEditable,piStatusFlags) = notimpl() member tm.AttemptToCheckOutBufferFromScc2(pszFileName,pfCheckoutSucceeded,piStatusFlags) = notimpl() member tm.EnumLanguageServices(ppEnum) = notimpl() - member tm.EnumIndependentViews(pBuffer,ppEnum) = notimpl() + member tm.EnumIndependentViews(pBuffer,ppEnum) = notimpl() } - - static member DelegateTextManager(oldtm:IVsTextManager, ?getActiveView) = + + static member DelegateTextManager(oldtm:IVsTextManager, ?getActiveView) = let inner = ref oldtm {new IVsTextManager with member tm.RegisterView(pView,pBuffer) = notimpl() @@ -780,11 +780,11 @@ module internal VsMocks = member tm.GetRegisteredMarkerTypeID(pguidMarker,piMarkerTypeID) = notimpl() member tm.GetMarkerTypeInterface(iMarkerTypeID, ppMarkerType) = notimpl() member tm.GetMarkerTypeCount(piMarkerTypeCount) = notimpl() - member tm.GetActiveView(fMustHaveFocus,pBuffer,ppView) = + member tm.GetActiveView(fMustHaveFocus,pBuffer,ppView) = let next fMustHaveFocus pBuffer = (!inner).GetActiveView(fMustHaveFocus,pBuffer) let hr,v = impl2 getActiveView next fMustHaveFocus pBuffer ppView<-v - hr + hr member tm.GetUserPreferences(pViewPrefs, pFramePrefs, pLangPrefs, pColorPrefs) = notimpl() member tm.SetUserPreferences(pViewPrefs,pFramePrefs,pLangPrefs,pColorPrefs) = notimpl() member tm.SetFileChangeAdvise(pszFileName,fStart) = notimpl() @@ -806,22 +806,22 @@ module internal VsMocks = member tm.GetBufferSccStatus2(pszFileName,pbNonEditable,piStatusFlags) = notimpl() member tm.AttemptToCheckOutBufferFromScc2(pszFileName,pfCheckoutSucceeded,piStatusFlags) = notimpl() member tm.EnumLanguageServices(ppEnum) = notimpl() - member tm.EnumIndependentViews(pBuffer,ppEnum) = notimpl() + member tm.EnumIndependentViews(pBuffer,ppEnum) = notimpl() interface IDelegable with member id.GetInner() = !inner member id.SetInner(i) = inner := i } - let private getInner (o:'a) = + let private getInner (o:'a) = let d = (box o):?>(IDelegable<'a>) d.GetInner() - - let private setInner (o:'a) i = + + let private setInner (o:'a) i = let d = (box o):?>(IDelegable<'a>) d.SetInner(i) - - // IVsTextLayer --------------------------------------------------------------------------------------------------------- - let createTextLayer() = + + // IVsTextLayer --------------------------------------------------------------------------------------------------------- + let createTextLayer() = let tl = Vs.DelegateTextLayer (Vs.MakeTextLayer()) let inner = getInner tl let localLineIndexToBase (iLocalLine:int) (iLocalIndex:int) = @@ -829,10 +829,10 @@ module internal VsMocks = let inner = Vs.DelegateTextLayer(inner, localLineIndexToBase=localLineIndexToBase) setInner tl inner tl - - // IVsTextView --------------------------------------------------------------------------------------------------------- + + // IVsTextView --------------------------------------------------------------------------------------------------------- let createTextView() : IVsTextView = Vs.DelegateTextView(Vs.MakeTextView()) - let setFileText (fileName:string) (tv:IVsTextView) (lines:string array) (recolorizeLines:int->int->unit) (getColorStateAtStartOfLine:int->int) = + let setFileText (fileName:string) (tv:IVsTextView) (lines:string array) (recolorizeLines:int->int->unit) (getColorStateAtStartOfLine:int->int) = let fileName = System.IO.Path.GetFullPath(fileName) let inner = getInner tv let lineCount = lines.Length @@ -841,31 +841,31 @@ module internal VsMocks = let getLengthOfLine line = Some(ok, lines.[line].Length) // It looks like VS has GetLineText taking zero-relative values. // The actually cursor position is 1-relative though - let getLineText iStartLine iStartIndex iEndLine iEndIndex = - let slice = [iStartLine..iEndLine] + let getLineText iStartLine iStartIndex iEndLine iEndIndex = + let slice = [iStartLine..iEndLine] |>List.map(fun i->(lines.[i].Substring(iStartIndex, iEndIndex-iStartIndex))) Some(ok, System.String.Join("\r\n",Array.ofList slice)) - let recolorizeLines (top:int) (bottom:int) = + let recolorizeLines (top:int) (bottom:int) = recolorizeLines top bottom Some(ok) - let getColorStateAtStartOfLine (line:int) = + let getColorStateAtStartOfLine (line:int) = Some(ok,getColorStateAtStartOfLine line) - + let vsBufferMoniker = Guid("978A8E17-4DF8-432A-9623-D530A26452BC") - - let getData (riidKey:Guid ref) = + + let getData (riidKey:Guid ref) = if !riidKey = vsBufferMoniker then Some(ok, box fileName) else None - + let tl = Vs.DelegateTextLines(Vs.MakeTextLines(), getLineCount=getLineCount, - getLengthOfLine=getLengthOfLine, + getLengthOfLine=getLengthOfLine, getLineText=getLineText, recolorizeLines=recolorizeLines, getColorStateAtStartOfLine=getColorStateAtStartOfLine, getData=getData ) - + // Maybe overly simplistic: Make the whole file visible in one page let getScrollInfo _iBar = Some(ok,0,lineCount-1,lineCount-1,0) @@ -875,14 +875,14 @@ module internal VsMocks = let inner = Vs.DelegateTextView(inner, getBuffer=getBuffer, getScrollInfo=getScrollInfo, getTopmostLayer=getTopmostLayer) setInner tv inner - -// (The RDT is no longer used by the product, but leaving in VsMocks/Salsa in case we need it again in the future - // IVsRunningDocumentTable --------------------------------------------------------------------------------------------------------- - let createRdt() = + +// (The RDT is no longer used by the product, but leaving in VsMocks/Salsa in case we need it again in the future + // IVsRunningDocumentTable --------------------------------------------------------------------------------------------------------- + let createRdt() = let unadviseRunningDocTableEvents _ = Some(ok) Vs.DelegateRunningDocumentTable (Vs.MakeRunningDocumentTable(),unadviseRunningDocTableEvents=unadviseRunningDocTableEvents) - let openDocumentInRdt rdt cookie fileName (textview:IVsTextView) hier = - let fileName = System.IO.Path.GetFullPath(fileName) + let openDocumentInRdt rdt cookie fileName (textview:IVsTextView) hier = + let fileName = System.IO.Path.GetFullPath(fileName) let inner = getInner rdt let _hr, textlines = textview.GetBuffer() let getDocumentInfoResult = (Some(ok,0u,0u,0u,fileName,hier,cookie,Marshal.GetIUnknownForObject(textlines))) @@ -892,7 +892,7 @@ module internal VsMocks = else None let findAndLockDocumentResult = (Some(ok,hier,0u,Marshal.GetIUnknownForObject(textlines),0u)) let refFindAndLockDocumentResult = ref findAndLockDocumentResult - let findAndLockDocument _dwRDTLockType pszMkDocument = + let findAndLockDocument _dwRDTLockType pszMkDocument = if pszMkDocument = fileName then !refFindAndLockDocumentResult else None let inner = Vs.DelegateRunningDocumentTable(inner,getDocumentInfo=getDocumentInfo,findAndLockDocument=findAndLockDocument) @@ -900,16 +900,16 @@ module internal VsMocks = // ) let createLanguagePreferences() = null:>LanguagePreferences - - // IVsHierarchy --------------------------------------------------------------------------------------------------------- - let createHier(projectSiteFactory) = + + // IVsHierarchy --------------------------------------------------------------------------------------------------------- + let createHier(projectSiteFactory) = let getProperty _id _prop = Some(VSConstants.E_FAIL,null) let hier = Vs.DelegateHierarchy(Vs.MakeHierarchy(projectSiteFactory), getProperty=getProperty) hier - let setHierRoot hier projectdir projectname = + let setHierRoot hier projectdir projectname = let guid = System.Guid.NewGuid().ToString() let inner = getInner hier - let getCanonicalName itemid = + let getCanonicalName itemid = if itemid = VSConstants.VSITEMID_ROOT then Some(ok,projectdir) else None let getProperty id prop = @@ -924,24 +924,24 @@ module internal VsMocks = setInner hier inner let rec getLastSiblingId (hier:IVsHierarchy) (last:uint32) = let hr,next = hier.GetProperty(last, int32 __VSHPROPID.VSHPROPID_NextSibling) - if hr = VSConstants.S_OK then + if hr = VSConstants.S_OK then let nid:int32 = downcast next getLastSiblingId hier (uint32 nid) else last - + let addChild (hier:IVsHierarchy) parentItemId childItemId fileName = let hr, child = hier.GetProperty(parentItemId, int32 __VSHPROPID.VSHPROPID_FirstChild) let inner = getInner hier let cid = (int32)childItemId // VS is confused about whether it wants item IDs to be signed or unsigned. - let getCanonicalName id = + let getCanonicalName id = if id = childItemId then Some(ok,fileName) - else None + else None if hr = VSConstants.S_OK then // There's already a first child, add as a sibling let childi32:int32 = downcast child let lastSiblingId = getLastSiblingId hier (uint32 childi32) - let getProperty id prop = - if id = lastSiblingId then + let getProperty id prop = + if id = lastSiblingId then match prop with | __VSHPROPID.VSHPROPID_NextSibling -> Some(ok, box cid) | _ -> None @@ -953,10 +953,10 @@ module internal VsMocks = else None let inner = Vs.DelegateHierarchy(inner, getProperty=getProperty, getCanonicalName=getCanonicalName) setInner hier inner - else + else let getProperty id prop = - if id = parentItemId then - match prop with + if id = parentItemId then + match prop with | __VSHPROPID.VSHPROPID_FirstChild -> Some(ok, box cid) | _ -> None else if id = childItemId then @@ -967,22 +967,22 @@ module internal VsMocks = else None let inner = Vs.DelegateHierarchy(inner, getProperty=getProperty, getCanonicalName=getCanonicalName) setInner hier inner - - let addRootChild hier childItemId fileName = - addChild hier VSConstants.VSITEMID_ROOT childItemId fileName - - // IVsTextManager --------------------------------------------------------------------------------------------------------- + + let addRootChild hier childItemId fileName = + addChild hier VSConstants.VSITEMID_ROOT childItemId fileName + + // IVsTextManager --------------------------------------------------------------------------------------------------------- let createTextManager() = Vs.DelegateTextManager (Vs.MakeTextManager()) let setActiveView tm (view:IVsTextView) = let inner = getInner tm let getActiveView (_mustHaveFocus:int) (_buffer:IVsTextBuffer) = Some(ok,view) let inner = Vs.DelegateTextManager(inner, getActiveView=getActiveView) setInner tm inner - + type MuxLogger() = let mutable innerLoggers = [] let mutable iEventSource = null - member x.Add(logger : ILogger) = + member x.Add(logger : ILogger) = innerLoggers <- logger :: innerLoggers if iEventSource <> null then logger.Initialize(iEventSource) // hacky, but works well enough for unit tests, unfortunately 'register' calls can come after 'initialize' call @@ -1000,18 +1000,18 @@ module internal VsMocks = ///////////////////////////////// // mocks - let err(line) : int = - printfn "err() called on line %s with %s" line System.Environment.StackTrace + let err(line) : int = + printfn "err() called on line %s with %s" line System.Environment.StackTrace failwith "not implemented" let nothing() = 0 - + let vsShell() = let dict = new Dictionary() let shell = { new IVsShell with member this.AdviseBroadcastMessages(sink, cookie) = err(__LINE__) member this.AdviseShellPropertyChanges(sink, cookie) = err(__LINE__) member this.GetPackageEnum e = err(__LINE__) - member this.GetProperty (propId : int, result : byref) = + member this.GetProperty (propId : int, result : byref) = let value = ref (null : Object) let ok = dict.TryGetValue(propId, value) if ok then @@ -1034,7 +1034,7 @@ module internal VsMocks = shell.SetProperty(int __VSSPROPID.VSSPROPID_IsInCommandLineMode, box false) |> ignore shell.SetProperty(int __VSSPROPID.VSSPROPID_InstallDirectory, box "") |> ignore shell - + let vsUIHierarchyWindow = { new IVsUIHierarchyWindow with @@ -1044,7 +1044,7 @@ module internal VsMocks = member this.AddUIHierarchy( pUIH, grfAddOptions) = err(__LINE__) member this.RemoveUIHierarchy( pUIH) = err(__LINE__) member this.SetWindowHelpTopic( lpszHelpFile, dwContext) = err(__LINE__) - member this.GetItemState( pHier, itemid, dwStateMask, pdwState) = + member this.GetItemState( pHier, itemid, dwStateMask, pdwState) = 0 member this.FindCommonSelectedHierarchy( grfOpt, lppCommonUIH) = err(__LINE__) member this.SetCursor( hNewCursor, phOldCursor) = err(__LINE__) @@ -1060,7 +1060,7 @@ module internal VsMocks = member this.CloseFrame( grfSaveOptions) = err(__LINE__) member this.SetFramePos( dwSFP, rguidRelativeTo, x, y, cx, cy) = err(__LINE__) member this.GetFramePos( pdwSFP, pguidRelativeTo, px, py, pcx, pcy) = err(__LINE__) - member this.GetProperty( propid, pvar : byref) = + member this.GetProperty( propid, pvar : byref) = pvar <- vsUIHierarchyWindow 0 member this.SetProperty( propid, var) = err(__LINE__) @@ -1071,7 +1071,7 @@ module internal VsMocks = } let mutable vsUIShellShowMessageBoxResult = None - + let vsUIShell = { new IVsUIShell with member this.GetToolWindowEnum( ppenum) = err(__LINE__) @@ -1102,10 +1102,10 @@ module internal VsMocks = member this.SetWaitCursor() = err(__LINE__) member this.PostExecCommand( pCmdGroup, nCmdID, nCmdexecopt, pvaIn) = err(__LINE__) member this.ShowContextMenu( dwCompRole, rclsidActive, nMenuId, pos, pCmdTrgtActive) = err(__LINE__) - member this.ShowMessageBox( dwCompRole, rclsidComp, pszTitle, pszText, pszHelpFile, dwHelpContextID, msgbtn, msgdefbtn, msgicon, fSysAlert, pnResult) = + member this.ShowMessageBox( dwCompRole, rclsidComp, pszTitle, pszText, pszHelpFile, dwHelpContextID, msgbtn, msgdefbtn, msgicon, fSysAlert, pnResult) = match vsUIShellShowMessageBoxResult with | None -> err(__LINE__) - | Some(result) -> pnResult <- result; VSConstants.S_OK + | Some(result) -> pnResult <- result; VSConstants.S_OK member this.SetMRUComboText( pCmdGroup, dwCmdID, lpszText, fAddToList) = err(__LINE__) member this.SetToolbarVisibleInFullScreen( pCmdGroup, dwToolbarId, fVisibleInFullScreen) = err(__LINE__) member this.FindToolWindowEx( grfFTW, rPersistenceSlot, dwToolWinId, ppWindowFrame : byref ) = err(__LINE__) @@ -1129,27 +1129,27 @@ module internal VsMocks = } // peekhole to IVsTrackProjectDocuments2 - allows to receive notifications about removed files - type public IVsTrackProjectDocuments2Listener = + type public IVsTrackProjectDocuments2Listener = abstract member OnAfterRemoveFiles: IEvent - let vsTrackProjectDocuments2 = + let vsTrackProjectDocuments2 = let onAfterRemoveFiles = Event<_>() - let track = { - new IVsTrackProjectDocuments2 with + let track = { + new IVsTrackProjectDocuments2 with member this.BeginBatch() = err(__LINE__) member this.EndBatch() = err(__LINE__) member this.Flush() = err(__LINE__) member this.OnQueryAddFiles(pProject, cFiles, rgpszMkDocuments, rgFlags, pSummaryResult, rgResults) = pSummaryResult.[0] <- VSQUERYADDFILERESULTS.VSQUERYADDFILERESULTS_AddOK 0 - member this.OnAfterAddFilesEx( pProject, cFiles, rgpszMkDocuments, rgFlags) = + member this.OnAfterAddFilesEx( pProject, cFiles, rgpszMkDocuments, rgFlags) = let proj = (pProject :?> FSharpProjectNode) :> IVsTrackProjectDocumentsEvents2 proj.OnAfterAddFilesEx(1, cFiles, [|pProject|], Array.create cFiles 0, rgpszMkDocuments, rgFlags) member this.OnAfterAddFiles( pProject, cFiles, rgpszMkDocuments) = nothing() member this.OnAfterAddDirectoriesEx( pProject, cDirectories, rgpszMkDocuments, rgFlags) = err(__LINE__) member this.OnAfterAddDirectories( pProject, cDirectories, rgpszMkDocuments) = err(__LINE__) - member this.OnAfterRemoveFiles( pProject, cFiles, rgpszMkDocuments, rgFlags) = + member this.OnAfterRemoveFiles( pProject, cFiles, rgpszMkDocuments, rgFlags) = onAfterRemoveFiles.Trigger(pProject, cFiles, rgpszMkDocuments, rgFlags) 0 member this.OnAfterRemoveDirectories( pProject, cDirectories, rgpszMkDocuments, rgFlags) = err(__LINE__) @@ -1165,7 +1165,7 @@ module internal VsMocks = member this.AdviseTrackProjectDocumentsEvents( pEventSink, pdwCookie) = nothing() member this.UnadviseTrackProjectDocumentsEvents( dwCookie) = nothing() member this.OnQueryAddDirectories( pProject, cDirectories, rgpszMkDocuments, rgFlags, pSummaryResult, rgResults) = err(__LINE__) - member this.OnQueryRemoveFiles( pProject, cFiles, rgpszMkDocuments, rgFlags, pSummaryResult, rgResults) = + member this.OnQueryRemoveFiles( pProject, cFiles, rgpszMkDocuments, rgFlags, pSummaryResult, rgResults) = if rgResults <> null then for i = 0 to rgResults.Length-1 do rgResults.[i] <- VSQUERYREMOVEFILERESULTS.VSQUERYREMOVEFILERESULTS_RemoveOK @@ -1177,16 +1177,16 @@ module internal VsMocks = interface IVsTrackProjectDocuments2Listener with member this.OnAfterRemoveFiles = onAfterRemoveFiles.Publish } - track - - let vsTaskList() = + track + + let vsTaskList() = { new IVsTaskList with - member this.RegisterTaskProvider( pProvider, pdwProviderCookie : byref) = + member this.RegisterTaskProvider( pProvider, pdwProviderCookie : byref) = pdwProviderCookie <- 0u 0 member this.UnregisterTaskProvider( dwProviderCookie) = 0 - member this.RefreshTasks( dwProviderCookie) = + member this.RefreshTasks( dwProviderCookie) = 0 member this.EnumTaskItems( ppenum : byref ) = err(__LINE__) member this.AutoFilter( cat) = err(__LINE__) @@ -1197,11 +1197,11 @@ module internal VsMocks = member this.UnregisterCustomCategory( catAssigned) = err(__LINE__) member this.AutoFilter2( guidCustomView : byref) = err(__LINE__) } - let vsMonitorSelection = + let vsMonitorSelection = { new IVsMonitorSelection with member this.GetCurrentSelection(ppHier, pitemid, ppMIS, ppSC) = 0 - member this.AdviseSelectionEvents( pSink, pdwCookie) = + member this.AdviseSelectionEvents( pSink, pdwCookie) = 0 member this.UnadviseSelectionEvents( dwCookie) = err(__LINE__) member this.GetCurrentElementValue( elementid, pvarValue) = err(__LINE__) @@ -1209,12 +1209,12 @@ module internal VsMocks = member this.IsCmdUIContextActive( dwCmdUICookie, pfActive) = err(__LINE__) member this.SetCmdUIContext( dwCmdUICookie, fActive) = err(__LINE__) } - + let vsFileChangeManager = { new IVsFileChangeEx with member this.AdviseDirChange(pszDir, fWatchSubDir, pFCE, pvsCookie) = err(__LINE__) member this.AdviseFileChange(pszMkDocument, grfFilter, pFCE, pvsCookie) = nothing() - member this.IgnoreFile(vscookie, pszMkDocument, fIgnore) = + member this.IgnoreFile(vscookie, pszMkDocument, fIgnore) = 0 member this.SyncFile(pszMkDocument) = err(__LINE__) member this.UnadviseDirChange(vscookie) = err(__LINE__) @@ -1228,7 +1228,7 @@ module internal VsMocks = member x.GenerateUniqueProjectName(lpszRoot, outpbstrProjectName) = err(__LINE__) member x.GetProjectOfGuid(rguidProjectID, outppHierarchy) = err(__LINE__) member x.GetGuidOfProject(pHierarchy,pguidProjectID) = err(__LINE__) - member x.GetSolutionInfo( outpbstrSolutionDirectory, outpbstrSolutionFile, outpbstrUserOptsFile) = + member x.GetSolutionInfo( outpbstrSolutionDirectory, outpbstrSolutionFile, outpbstrUserOptsFile) = outpbstrSolutionDirectory <- "" outpbstrSolutionFile <- "" outpbstrUserOptsFile <- "" @@ -1268,16 +1268,16 @@ module internal VsMocks = let dummyEmptyIEnumRunningDocuments = {new IEnumRunningDocuments with member ierd.Clone(ppenum) = err(__LINE__) - member ierd.Next(celt, rgelt, pceltFetched) = + member ierd.Next(celt, rgelt, pceltFetched) = pceltFetched <- 0u - VSConstants.S_FALSE + VSConstants.S_FALSE member ierd.Reset() = 0 member ierd.Skip(celt) = err(__LINE__) } let mutable vsRunningDocumentTableFindAndLockDocumentVsHierarchyMock = null : IVsHierarchy let mutable vsRunningDocumentTableNextRenameDocumentCallThrows = false - + let vsRunningDocumentTable = {new IVsRunningDocumentTable with member rdt.RegisterAndLockDocument(grfRDTLockType, pszMkDocument, pHier, itemid, punkDocData, pdwCookie) = err(__LINE__) @@ -1297,21 +1297,21 @@ module internal VsMocks = member rdt.GetDocumentInfo(docCookie, pgrfRDTFlags, pdwReadLocks, pdwEditLocks, pbstrMkDocument, ppHier, pitemid, ppunkDocData) = err(__LINE__) member rdt.NotifyDocumentChanged(dwCookie, grfDocChanged) = err(__LINE__) member rdt.NotifyOnAfterSave(dwCookie) = err(__LINE__) - member rdt.GetRunningDocumentsEnum(ppenum) = + member rdt.GetRunningDocumentsEnum(ppenum) = ppenum <- dummyEmptyIEnumRunningDocuments // just lie, we don't mock enough of this 0 member rdt.SaveDocuments(grfSaveOpts, pHier, itemid, docCookie) = err(__LINE__) member rdt.NotifyOnBeforeSave(dwCookie) = err(__LINE__) member rdt.RegisterDocumentLockHolder(grfRDLH, dwCookie, pLockHolder, pdwLHCookie) = err(__LINE__) member rdt.UnregisterDocumentLockHolder(dwLHCookie) = err(__LINE__) - member rdt.ModifyDocumentFlags(docCookie, grfFlags, fSet) = err(__LINE__) + member rdt.ModifyDocumentFlags(docCookie, grfFlags, fSet) = err(__LINE__) } let MockVsBuildManagerAccessor() = let muxLogger = ref Unchecked.defaultof { new Microsoft.VisualStudio.Shell.Interop.IVsBuildManagerAccessor with member x.RegisterLogger(submissionId, logger : obj) = - let iLogger = logger :?> ILogger + let iLogger = logger :?> ILogger (!muxLogger).Add(iLogger) 0 member x.ClaimUIThreadForBuild() = 0 @@ -1328,7 +1328,7 @@ module internal VsMocks = BuildManager.DefaultBuildManager.EndBuild() muxLogger := Unchecked.defaultof 0 - member x.GetCurrentBatchBuildId(batchId) = + member x.GetCurrentBatchBuildId(batchId) = batchId <- 0u // in the product, this would be non-zero if there are any in-progress builds, but we are not mocking solution manager, so we just always report no build in progress for unit tests 0 member x.GetSolutionConfiguration(rootProject: obj, xmlFragment: byref) = @@ -1351,7 +1351,7 @@ module internal VsMocks = Debug.Assert((!_cookie = cookie), sprintf "Invalid cookie for advise/unadvise!") 0 member this.AdviseTrackBatchRetargetingEvents(sink, cookie) = 0 - member this.UnadviseTrackBatchRetargetingEvents(cookie) = 0 + member this.UnadviseTrackBatchRetargetingEvents(cookie) = 0 member this.BeginRetargetingBatch() = 0 member this.BatchRetargetProject(hier, newFx, unloadProjectIfErrorOrCancel) = 0 member this.EndRetargetingBatch() = 0 @@ -1376,7 +1376,7 @@ module internal VsMocks = let vsTargetFrameworkAssemblies45 = vsTargetFrameworkAssembliesN 0x40005u let vsTargetFrameworkAssemblies46 = vsTargetFrameworkAssembliesN 0x40006u let vsTargetFrameworkAssemblies472 = vsTargetFrameworkAssembliesN 0x40007u - + let vsFrameworkMultiTargeting = { new IVsFrameworkMultiTargeting with member this.GetInstallableFrameworkForTargetFx(fx, res) = @@ -1395,10 +1395,10 @@ module internal VsMocks = member this.GetDisplayNameForTargetFx(a,b) = notimpl() member this.ResolveAssemblyPathsInTargetFx(a,b,c,d,e) = notimpl() } - + // This provides a mock for LocalRegistry because for the multitargeting // code we use this to create a text buffer - + let vsLocalRegistry f = { new ILocalRegistry3 with member this.CreateInstance(a,b,c,d,e) = @@ -1411,7 +1411,7 @@ module internal VsMocks = 0 member this.CreateManagedInstance(a,b,c,d,e) = notimpl() member this.GetClassObjectOfManagedClass(a,b,c,d,e) = notimpl() - + interface ILocalRegistry2 with member this.CreateInstance(a,b,c,d,e) = notimpl() member this.GetTypeLibOfClsid(a,b) = notimpl() @@ -1419,18 +1419,18 @@ module internal VsMocks = member this.GetLocalRegistryRoot(a) = a <- "" 0 - + interface ILocalRegistry with member this.CreateInstance(a,b,c,d,e) = notimpl() member this.GetTypeLibOfClsid(a,b) = notimpl() - member this.GetClassObjectOfClsid(a,b,c,d,e) = notimpl() + member this.GetClassObjectOfClsid(a,b,c,d,e) = notimpl() } let MakeVsSolutionBuildManagerAndConfigChangeNotifier() = - let mkEventsStorage () = + let mkEventsStorage () = let listeners = Dictionary() let id = ref 0u - let add l = + let add l = let cookie = !id listeners.Add(cookie, l) id := !id + 1u @@ -1444,19 +1444,19 @@ module internal VsMocks = let add2, remove2, _ = mkEventsStorage() let add4, remove4, _ = mkEventsStorage() let configDict = new Dictionary() - let configChangeNotifier(h : IVsHierarchy, s : string) = + let configChangeNotifier(h : IVsHierarchy, s : string) = if configDict.ContainsKey(h) then configDict.[h] <- s else configDict.Add(h,s) for (kvp : IVsUpdateSolutionEvents) in enumerate1() do - kvp.OnActiveProjectCfgChange(h) |> ignore - let vsSolutionBuildManager = + kvp.OnActiveProjectCfgChange(h) |> ignore + let vsSolutionBuildManager = { new IVsSolutionBuildManager with member x.DebugLaunch(grfLaunch) = err(__LINE__) member x.StartSimpleUpdateSolutionConfiguration(dwFlags, dwDefQueryResults, fSuppressUI) = err(__LINE__) member x.AdviseUpdateSolutionEvents( pIVsUpdateSolutionEvents, outpdwCookie : byref ) = - outpdwCookie <- add1 pIVsUpdateSolutionEvents + outpdwCookie <- add1 pIVsUpdateSolutionEvents 0 member x.UnadviseUpdateSolutionEvents(dwCookie) = remove1 dwCookie @@ -1473,8 +1473,8 @@ module internal VsMocks = let (_, vsCfgProvider : IVsCfgProvider) =(pIVsHierarchy_RequestedProject :?> IVsGetCfgProvider).GetCfgProvider() let cfgName = ConfigCanonicalName(s) let (_, cfg : IVsCfg) = (vsCfgProvider :?> IVsCfgProvider2).GetCfgOfName(cfgName.ConfigName, cfgName.Platform) - ppIVsProjectCfg_Active.[0] <- downcast cfg - 0 + ppIVsProjectCfg_Active.[0] <- downcast cfg + 0 member x.get_IsDebug(pfIsDebug) = err(__LINE__) member x.put_IsDebug( fIsDebug) = err(__LINE__) member x.get_CodePage( outpuiCodePage) = err(__LINE__) @@ -1501,7 +1501,7 @@ module internal VsMocks = member x.StartSimpleUpdateSolutionConfiguration(_dwFlags, _dwDefQueryResults, _fSuppressUI) = err(__LINE__) member x.StartUpdateProjectConfigurations(_cProjs, _rgpHierProjs, _dwFlags, _fSuppressUI) = err(__LINE__) member x.StartUpdateSpecificProjectConfigurations(_cProjs, _rgpHier, _rgpcfg, _rgdwCleanFlags, _rgdwBuildFlags, _rgdwDeployFlags, _dwFlags, _fSuppressUI) = err(__LINE__) - member x.UnadviseUpdateSolutionEvents(dwCookie) = + member x.UnadviseUpdateSolutionEvents(dwCookie) = remove2 dwCookie 0 member x.UpdateSolutionConfigurationIsActive(_pfIsActive) = err(__LINE__) @@ -1523,11 +1523,11 @@ module internal VsMocks = member x.AdviseUpdateSolutionEvents4(pIVsUpdateSolutionEvents, pdwCookie) = pdwCookie <- add4 pIVsUpdateSolutionEvents member x.AdviseUpdateSolutionEventsAsync(a,b) = err(__LINE__) |> ignore - member x.FindActiveProjectCfgName(_projectGuid,outCfgString) = + member x.FindActiveProjectCfgName(_projectGuid,outCfgString) = // For now ignore the _projectGuid and just return the last notified configuration - match configDict |> Seq.tryHead with - | None -> err(__LINE__) - | Some (KeyValue(_,v)) -> + match configDict |> Seq.tryHead with + | None -> err(__LINE__) + | Some (KeyValue(_,v)) -> outCfgString <- v 0 @@ -1536,7 +1536,7 @@ module internal VsMocks = remove4 dwCookie } vsSolutionBuildManager, configChangeNotifier - + let vsThreadedWaitDialogFactory = { new IVsThreadedWaitDialogFactory with override x.CreateInstance(vsThreadedWaitDialog) = @@ -1550,7 +1550,7 @@ module internal VsMocks = } 0 } - + let MakeMockServiceProviderAndConfigChangeNotifierNoTargetFrameworkAssembliesService() = let vsSolutionBuildManager, configChangeNotifier = MakeVsSolutionBuildManagerAndConfigChangeNotifier() let sp = new OleServiceProvider() @@ -1561,8 +1561,8 @@ module internal VsMocks = sp.AddService(typeof, box vsTrackProjectDocuments2, false) sp.AddService(typeof, box (vsShell()), false) sp.AddService(typeof, box vsUIShell, false) - sp.AddService(typeof, box(vsTaskList()), false) - sp.AddService(typeof, box vsMonitorSelection, false) + sp.AddService(typeof, box(vsTaskList()), false) + sp.AddService(typeof, box vsMonitorSelection, false) sp.AddService(typeof, box vsFileChangeManager, false) sp.AddService(typeof, box vsSolution, false) sp.AddService(typeof, box vsSolutionBuildManager, false) @@ -1614,11 +1614,11 @@ module internal VsMocks = let MakeMockServiceProviderAndConfigChangeNotifier() = MakeMockServiceProviderAndConfigChangeNotifier40() - let mockServiceProvider = + let mockServiceProvider = let sp, _ = MakeMockServiceProviderAndConfigChangeNotifier() - sp - - let vsOutputWindowPane(owpe : string list ref) = + sp + + let vsOutputWindowPane(owpe : string list ref) = { new IVsOutputWindowPane with member this.Activate () = err(__LINE__) member this.Clear () = owpe := []; 0 @@ -1630,9 +1630,9 @@ module internal VsMocks = member this.OutputTaskItemString(pszOutputString, nPriority, nCategory, pszSubcategory, nBitmap, pszFilename, nLineNum, pszTaskItemText) = err(__LINE__) member this.OutputTaskItemStringEx(pszOutputString, nPriority, nCategory, pszSubcategory, nBitmap, pszFilename, nLineNum, pszTaskItemText, pszLookupKwd) = err(__LINE__) member this.SetName(pszPaneName) = err(__LINE__) - } + } -module internal VsActual = +module internal VsActual = // Since the editor exports MEF components, we can use those components directly from unit tests without having to load too many heavy // VS assemblies. Use editor MEF components directly from the VS product. @@ -1662,7 +1662,7 @@ module internal VsActual = if File.Exists(fullPath) then list.Add(new AssemblyCatalog(fullPath)) else - + failwith <| sprintf "unable to find assembly '%s' in location '%s'" p thisAssemblyDir list.Add(new AssemblyCatalog(thisAssembly)) diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs index 6764da567df..a811a8c6905 100644 --- a/vsintegration/tests/Salsa/salsa.fs +++ b/vsintegration/tests/Salsa/salsa.fs @@ -4,7 +4,7 @@ Simplified abstraction over visual studio. Stand Alone - Language + Language Service Acronym *) @@ -15,7 +15,7 @@ namespace Salsa open System open System.IO open System.Text -open System.Collections.Generic +open System.Collections.Generic open System.Runtime.InteropServices open System.Threading open Microsoft.VisualStudio @@ -30,7 +30,7 @@ open FSharp.Compiler.EditorServices open Microsoft.Build.Evaluation -module internal Salsa = +module internal Salsa = exception MarkerNotFoundException of string @@ -44,44 +44,44 @@ module internal Salsa = member this.Dispose() = actuallyBuild <- true } member th.Results = capturedFlags, capturedSources member th.Compile(compile:System.Func, flags:string[], sources:string[]) = - capturedFlags <- flags + capturedFlags <- flags capturedSources <- sources if actuallyBuild then compile.Invoke() else 0 interface ITaskHost - + type BuildResult = { ExecutableOutput : string BuildSucceeded : bool - } + } - /// Methods for dealing with MSBuild project files. + /// Methods for dealing with MSBuild project files. module (*internal*) MSBuild = let mutable private hasAttachedLogger = false let mutable theAttachedLogger = null /// Use the global build engine if it knows the path to MSBuild.exe /// Otherwise, make a new engine and point it at well-known version of MSBuild - let GlobalEngine() = + let GlobalEngine() = let engine = Utilities.InitializeMsBuildEngine(null) - if not hasAttachedLogger then + if not hasAttachedLogger then hasAttachedLogger<-true let l = new Microsoft.Build.Logging.ConsoleLogger(LoggerVerbosity.Detailed) // For Dev10 build we pass the logger to the Build call on the project object. theAttachedLogger <- l engine - - /// Set a global property on the given project. - let SetGlobalProperty(project:Project, name, value) = + + /// Set a global property on the given project. + let SetGlobalProperty(project:Project, name, value) = let _ = project.SetGlobalProperty(name,value) () - + let hostObjectCachePerFilename = new System.Collections.Generic.Dictionary<_,_>() // REVIEW: this will leak, but hopefully only a small amount (e.g. maybe about 1K per project, and thus maybe just a few megs total for all 2000 unit tests) /// Get the MSBuild project for the given project file. - let GetProject (projectFileName:string, configuration:string, platform:string) = + let GetProject (projectFileName:string, configuration:string, platform:string) = let project, justCreated, theHostObject = try let projects = GlobalEngine().GetLoadedProjects(projectFileName) |> Seq.toList @@ -99,11 +99,11 @@ module internal Salsa = SetGlobalProperty(project, "Platform", platform) let prjColl = project.ProjectCollection let hostSvc = prjColl.HostServices - let theHostObject = HostCompile() + let theHostObject = HostCompile() hostSvc.RegisterHostObject(projectFileName, "CoreCompile", "Fsc", theHostObject) hostObjectCachePerFilename.[projectFileName] <- theHostObject - project, true, theHostObject - | project-> + project, true, theHostObject + | project-> match hostObjectCachePerFilename.TryGetValue(projectFileName) with | true, theHostObject -> project, false, theHostObject @@ -124,45 +124,45 @@ module internal Salsa = let p = project.GetPropertyValue(propertyName) if p = null then "" else p - let items (project:Project) name = + let items (project:Project) name = project.GetItems(name) |> Seq.map (fun i -> i.EvaluatedInclude) |> Seq.toList - let oneItem (project:Project) name = + let oneItem (project:Project) name = match (items project name) with head::tail -> head | _ -> "" let splitProperty (project:Project) propertyName = (prop project propertyName).Split([|';'|])|>Array.toList - + let boolProperty (project:Project) name = let p = prop project name true - - /// Build the given target on the given project. Return the name of the main output assembly. - let Build(projectFileName, target:string, configuration, platform) : BuildResult = + + /// Build the given target on the given project. Return the name of the main output assembly. + let Build(projectFileName, target:string, configuration, platform) : BuildResult = let project,_,_ = GetProject(projectFileName, configuration, platform) let projectInstance = project.CreateProjectInstance() let buildResult = projectInstance.Build(target, Seq.append project.ProjectCollection.Loggers (if theAttachedLogger=null then [] else [theAttachedLogger])) printfn "build succeeded? %A" buildResult - let mainassembly = + let mainassembly = try (projectInstance.GetItems("TargetFileName") |> Seq.head).EvaluatedInclude with e -> "" // TODO it seems like Dev10 "Clean" target does not produce this output, but this result is not consumed by those tests in an interesting way anyway - printfn "mainAssembly: %A" mainassembly + printfn "mainAssembly: %A" mainassembly {ExecutableOutput = mainassembly; BuildSucceeded = buildResult} - + /// Return the name of the main output assembly but don't build - let GetMainOutputAssembly(projectFileName, configuration, platform) : string = + let GetMainOutputAssembly(projectFileName, configuration, platform) : string = let project,_,_ = GetProject(projectFileName, configuration, platform) let baseName = Path.GetFileNameWithoutExtension(projectFileName)+".exe" let projectInstance = project.CreateProjectInstance() let outdir : string = projectInstance.GetProperty("OutDir").EvaluatedValue let mainassembly = Path.Combine(outdir,baseName) printfn "mainAssembly: %A" mainassembly - mainassembly - + mainassembly + let CreateFSharpManifestResourceName(projectFileName,configuration, platform) : (string * string) list= let targetName = "CreateManifestResourceNames" let project,_,_ = GetProject(projectFileName, configuration, platform) @@ -171,7 +171,7 @@ module internal Salsa = let buildResult = projectInstance.Build(targetName, project.ProjectCollection.Loggers) let items = projectInstance.GetItems("EmbeddedResource") |> Seq.map (fun i -> i.EvaluatedInclude, i.GetMetadata("ManifestResourceName").EvaluatedValue) |> Seq.toList items - + /// Fallback for flags and sources. This is to handle the case in which the user has customized /// the MSBuild so much that host compilation doesn't work/ let GetFlagsAndSourcesFallback(project:Project) : BuildFlags = @@ -184,68 +184,68 @@ module internal Salsa = {flags=flags sources = sources} - /// Compute the Flags and Sources - let GetFlagsAndSources(project:Project, host:HostCompile) : BuildFlags = + /// Compute the Flags and Sources + let GetFlagsAndSources(project:Project, host:HostCompile) : BuildFlags = let result = use xx = host.CaptureSourcesAndFlagsWithoutBuildingForABit() project.IsBuildEnabled <- true - + let loggers = seq { yield (new Microsoft.Build.Logging.ConsoleLogger(LoggerVerbosity.Detailed) :> ILogger) } - + let r = project.Build("Compile", loggers) if not(r) then printfn "MSBuild result: %A" r printfn "%s" project.FullPath System.Diagnostics.Debug.Assert(false, "things are about to fail, as MSBuild failed; it would behoove you to turn on MSBuild tracing") let capturedFlags, capturedSources = host.Results - {flags = capturedFlags |> Array.toList + {flags = capturedFlags |> Array.toList sources = capturedSources |> Array.toList } - let Canonicalize (fileName:string) = + let Canonicalize (fileName:string) = if System.IO.Path.IsPathRooted(fileName) then System.IO.Path.GetFullPath(fileName) else System.IO.Path.GetFullPath(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(project.FullPath),fileName)) - { flags = result.flags + { flags = result.flags sources = result.sources |> List.map Canonicalize } - + let CrackProject(projectFileName, configuration, platform) = - + let project,created,host = GetProject(projectFileName, configuration, platform) - try - try + try + try let flagsAndSources = GetFlagsAndSources(project,host) (project, flagsAndSources) - with e -> + with e -> System.Diagnostics.Debug.Assert(false, sprintf "Bug seen in MSBuild CrackProject: %s %s %s\n" (e.GetType().Name) e.Message (e.StackTrace)) reraise() finally if created then MSBuildProject.FullyUnloadProject(GlobalEngine(), project) - + let CreateFSharpManifestResourceName projectFileName configuration platform = MSBuild.CreateFSharpManifestResourceName(projectFileName,configuration,platform) - module Filenames = + module Filenames = /// Compare two file names to each other. - let AreSame f1 f2 = - let result = + let AreSame f1 f2 = + let result = System.String.Compare(f1,f2,StringComparison.CurrentCultureIgnoreCase)=0 || System.String.Compare(System.IO.Path.GetFullPath(f1),System.IO.Path.GetFullPath(f2),StringComparison.CurrentCultureIgnoreCase)=0 - result + result - type MSBuildProjectSite(projectfile,configurationFunc,platformFunc) = + type MSBuildProjectSite(projectfile,configurationFunc,platformFunc) = let projectPath = Path.GetDirectoryName(projectfile) let mutable timestamp = new DateTime() let mutable flags = None let mutable prevConfig = "" let mutable prevPlatform = "" - let GetFlags() = + let GetFlags() = let newtimestamp = File.GetLastWriteTimeUtc(projectfile) let curConfig = configurationFunc() let curPlatform = platformFunc() - if timestamp <> newtimestamp - || flags = None + if timestamp <> newtimestamp + || flags = None || prevConfig <> curConfig || prevPlatform <> curPlatform then timestamp <- newtimestamp @@ -257,23 +257,23 @@ module internal Salsa = | Some flags -> flags | _ -> raise Error.Bug let changeHandlers = new System.Collections.Generic.Dictionary() - member x.TriggerChanges() = - for handler in changeHandlers do + member x.TriggerChanges() = + for handler in changeHandlers do handler.Value.Invoke() override this.ToString() = projectfile interface IProjectSite with - member this.CompilationSourceFiles = - GetFlags().sources |> List.map(fun s->Path.Combine(projectPath, s)) |> List.toArray + member this.CompilationSourceFiles = + GetFlags().sources |> List.map(fun s->Path.Combine(projectPath, s)) |> List.toArray - member this.Description = + member this.Description = let flags = GetFlags() try sprintf "MSBuild Flags:%A" flags - with e -> sprintf "%A" e + with e -> sprintf "%A" e - member this.CompilationOptions = GetFlags().flags |> List.toArray + member this.CompilationOptions = GetFlags().flags |> List.toArray member this.ProjectFileName = projectfile @@ -285,7 +285,7 @@ module internal Salsa = member this.TargetFrameworkMoniker = "" member this.LoadTime = System.DateTime(2000,1,1) - member this.ProjectGuid = + member this.ProjectGuid = let projectObj, projectObjFlags = MSBuild.CrackProject(projectfile, configurationFunc(), platformFunc()) projectObj.GetProperty(ProjectFileConstants.ProjectGuid).EvaluatedValue @@ -294,20 +294,20 @@ module internal Salsa = member this.CompilationBinOutputPath = GetFlags().flags |> List.tryPick (fun s -> if s.StartsWith("-o:") then Some s.[3..] else None) // Attempt to treat as MSBuild project. - let internal NewMSBuildProjectSite(configurationFunc, platformFunc, msBuildProjectName) = + let internal NewMSBuildProjectSite(configurationFunc, platformFunc, msBuildProjectName) = let newProjectSite = new MSBuildProjectSite(msBuildProjectName,configurationFunc,platformFunc) newProjectSite - + /// Token types. type TokenType = - | Text - | Keyword - | Comment - | Identifier - | String - | Number - | InactiveCode - | PreprocessorKeyword + | Text + | Keyword + | Comment + | Identifier + | String + | Number + | InactiveCode + | PreprocessorKeyword | Operator override this.ToString() = match this with @@ -322,7 +322,7 @@ module internal Salsa = | Operator -> "Operator" /// Declaration types. - type DeclarationType = + type DeclarationType = | Class =0 | Constant = 6 | Enum = 18 @@ -334,33 +334,33 @@ module internal Salsa = | Module = 84 | Namespace = 90 | Property = 102 - | ValueType = 108 // Like 'type ValueType=int*int' + | ValueType = 108 // Like 'type ValueType=int*int' | RareType = 120 // Bucket for unusual types like 'type AsmType = (# "!0[]" #)' | DiscriminatedUnion = 132 - + type BuildAction = | Compile = 0 | EmbeddedResource = 1 - | None = 2 + | None = 2 /// A file on disk. type File = interface - end + end /// An error [] - type Error(path: string, subcategory:string, msg: string, context: Microsoft.VisualStudio.TextManager.Interop.TextSpan, sev: Microsoft.VisualStudio.FSharp.LanguageService.Severity) = + type Error(path: string, subcategory:string, msg: string, context: Microsoft.VisualStudio.TextManager.Interop.TextSpan, sev: Microsoft.VisualStudio.FSharp.LanguageService.Severity) = member e.Path = path member e.Subcategory = subcategory member e.Message = msg member e.Context = context member e.Severity = sev - override e.ToString() = + override e.ToString() = sprintf "%s(%d,%d): %s %A : %s\n" path context.iStartLine context.iStartIndex subcategory sev msg - + type ChangeCallBack = IVsHierarchy * string -> unit - + /// Hooks for controlling behaviors - type ProjectBehaviorHooks = + type ProjectBehaviorHooks = /// Create an MSBuild project at the given location with the given files and options. abstract CreateProjectHook: projectFilename:string * files:(string*BuildAction*string option) list * references:(string*bool) list * projReferences: string list * disabledWarnings:string list * defines: string list * versionFile: string * otherFlags:string * preImportXml:string * targetFrameworkVersion: string->unit abstract InitializeProjectHook : OpenProject -> unit @@ -371,19 +371,19 @@ module internal Salsa = abstract SaveHook : unit -> unit abstract DestroyHook : unit->unit abstract ModifyConfigurationAndPlatformHook : string->unit - + /// A file open in VS. - and OpenFile = + and OpenFile = // host VS abstract VS : VisualStudio /// A project open in VS. - and OpenProject = + and OpenProject = // host VS abstract VS : VisualStudio /// Private part of OpenProject - and IOpenProject = + and IOpenProject = /// Add a file to this project. abstract AddFileFromText : string * string * BuildAction * string list -> File /// Add a file to this project as a linked file. @@ -393,8 +393,8 @@ module internal Salsa = /// Errors (task list) associated with this project abstract Errors : Error list with get /// Add an assembly reference to the project - abstract AddAssemblyReference : string * bool -> unit - /// Add a project reference to the project + abstract AddAssemblyReference : string * bool -> unit + /// Add a project reference to the project abstract AddProjectReference : OpenProject -> unit /// Set the version file for this project abstract SetVersionFile : string -> unit @@ -409,7 +409,7 @@ module internal Salsa = /// Build the project. As CTRL+SHIFT+B in VS. Can pass null for default target (build). abstract Build : target:string -> BuildResult /// Get the name to the main output assembly for the current configuration. - abstract GetMainOutputAssembly : unit -> string + abstract GetMainOutputAssembly : unit -> string /// Save the project. abstract Save : unit -> unit /// Close the project. @@ -425,13 +425,13 @@ module internal Salsa = abstract ConfigurationAndPlatform : string with set /// A solution open in VS. - and OpenSolution = + and OpenSolution = // host VS abstract VS : VisualStudio - + // Private half of the OpenSolution interface - and IOpenSolution = - + and IOpenSolution = + /// Create a new project of the given behaviorHooks that is open in VS. abstract CreateProjectFlavor : ProjectBehaviorHooks->string->OpenProject /// Close the solution. @@ -439,10 +439,10 @@ module internal Salsa = /// General purpose methods. Loosely represents running instance of VS. - and VisualStudio = + and VisualStudio = abstract VsOps : VsOps - - /// Private half of the Visual Studio interface + + /// Private half of the Visual Studio interface and IVisualStudio = abstract CreateSolution : unit -> OpenSolution abstract OnIdle : unit->unit @@ -455,23 +455,23 @@ module internal Salsa = /// Open a previously-created project abstract OpenExistingProject : ProjectBehaviorHooks * dir:string * projName:string -> OpenProject*OpenSolution abstract CleanInvisibleProject : unit -> unit - + and TextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan and GotoDefnResult = Microsoft.VisualStudio.FSharp.LanguageService.GotoDefinitionResult_DEPRECATED - + // Result of querying the completion list and CompletionItem = CompletionItem of name: string * displayText: string * nameInCode: string * (unit -> string) * DeclarationType /// Represents the information that is displayed in the navigation bar - and NavigationBarResult = + and NavigationBarResult = { TypesAndModules : DropDownMember[] Members : DropDownMember[] SelectedType : int SelectedMember : int } - - /// Methods for simulating VisualStudio - and [] VsOps = + + /// Methods for simulating VisualStudio + and [] VsOps = abstract BehaviourHooks: ProjectBehaviorHooks abstract CreateVisualStudio: unit -> VisualStudio abstract CreateSolution: VisualStudio -> OpenSolution @@ -483,20 +483,20 @@ module internal Salsa = abstract DeleteFileFromDisk: File -> unit abstract AddFileFromText: OpenProject * string * string * BuildAction * string list -> File abstract AddLinkedFileFromText: OpenProject * string * string * string * BuildAction * string list -> File - abstract AddAssemblyReference: OpenProject * string * bool -> unit - abstract AddProjectReference: OpenProject * OpenProject -> unit + abstract AddAssemblyReference: OpenProject * string * bool -> unit + abstract AddProjectReference: OpenProject * OpenProject -> unit abstract ProjectDirectory: OpenProject -> string abstract ProjectFile: OpenProject -> string abstract SetVersionFile: OpenProject * string -> unit abstract SetOtherFlags: OpenProject * string -> unit abstract SetConfigurationAndPlatform: OpenProject * string -> unit abstract AddDisabledWarning: OpenProject * string -> unit - abstract GetErrors: OpenProject -> Error list - abstract BuildProject: OpenProject * string -> BuildResult + abstract GetErrors: OpenProject -> Error list + abstract BuildProject: OpenProject * string -> BuildResult abstract GetMainOutputAssembly: OpenProject -> string - abstract SaveProject: OpenProject -> unit + abstract SaveProject: OpenProject -> unit abstract OpenFileViaOpenFile: VisualStudio * string -> OpenFile - abstract OpenFile: OpenProject * string -> OpenFile + abstract OpenFile: OpenProject * string -> OpenFile abstract GetOpenFiles: OpenProject -> OpenFile list abstract SetProjectDefines: OpenProject * string list -> unit abstract PlaceIntoProjectFileBeforeImport: OpenProject * string -> unit @@ -509,7 +509,7 @@ module internal Salsa = abstract OnIdle: VisualStudio -> unit abstract ShiftKeyDown: VisualStudio -> unit abstract ShiftKeyUp: VisualStudio -> unit - abstract TakeCoffeeBreak: VisualStudio -> unit + abstract TakeCoffeeBreak: VisualStudio -> unit abstract ReplaceFileInMemory: OpenFile * string list * bool -> unit abstract SaveFileToDisk: OpenFile -> unit abstract CleanUp: VisualStudio -> unit @@ -524,7 +524,7 @@ module internal Salsa = abstract CompletionBestMatchAtCursorFor: OpenFile * string * string option -> (string * bool * bool) option abstract MoveCursorToEndOfMarker: OpenFile * string -> unit abstract MoveCursorToStartOfMarker: OpenFile * string -> unit - abstract GetQuickInfoAtCursor: OpenFile -> string + abstract GetQuickInfoAtCursor: OpenFile -> string abstract GetQuickInfoAndSpanAtCursor: OpenFile -> string*TextSpan abstract GetMatchingBracesForPositionAtCursor: OpenFile -> (TextSpan * TextSpan)[] abstract GetNameOfOpenFile: OpenFile -> string @@ -535,45 +535,45 @@ module internal Salsa = abstract GetF1KeywordAtCursor: OpenFile -> string option abstract GotoDefinitionAtCursor: OpenFile * bool -> GotoDefnResult abstract CreatePhysicalProjectFileInMemory : files:(string*BuildAction*string option) list * references:(string*bool) list * projectReferences:string list * disabledWarnings:string list * defines:string list * versionFile: string * otherFlags:string * otherProjMisc:string * targetFrameworkVersion:string -> string - + /// True if files outside of the project cone are added as links. abstract AutoCompleteMemberDataTipsThrowsScope : string -> System.IDisposable - + // VsOps capabilities. abstract OutOfConeFilesAreAddedAsLinks : bool - abstract SupportsOutputWindowPane : bool + abstract SupportsOutputWindowPane : bool [] - module GotoDefnResultExtensions = + module GotoDefnResultExtensions = type Microsoft.VisualStudio.FSharp.LanguageService.GotoDefinitionResult_DEPRECATED with member this.ToOption() = if this.Success then Some(this.Span, this.Url) else None let maxErrors = 25 - + /// Private implementation details. - module (*private*) Privates = + module (*private*) Privates = let mutable private cookie = 0u; - let private nextRdtID() = + let private nextRdtID() = cookie<-cookie+1u cookie - let private nextItemId() = + let private nextItemId() = cookie<-cookie+1u cookie - + type UndoAction = | DeleteFile of string | RemoveFolder of string - + type Point = {line:int; col:int} - + /// Find the given marker and return the line and column. - let private IsolateMarkerSite (tl:IVsTextLines) (marker:string) : Point= + let private IsolateMarkerSite (tl:IVsTextLines) (marker:string) : Point= let _, linecount = tl.GetLineCount() let mutable returnLine = -1 let mutable returnCol = -1 - let mutable i = 1 + let mutable i = 1 while i <= linecount do let _, len = tl.GetLengthOfLine(i-1) let _, text = tl.GetLineText(i-1,0,i-1,len) @@ -584,36 +584,36 @@ module internal Salsa = i <- linecount () i <- i + 1 - - if returnLine = -1 then + + if returnLine = -1 then raise <| MarkerNotFoundException(marker) else {line = returnLine; col = returnCol} - + /// Colorize a single line of text. - let ColorizeLine (colorizer:FSharpColorizer_DEPRECATED) lineNumber lineText oldState attrs = + let ColorizeLine (colorizer:FSharpColorizer_DEPRECATED) lineNumber lineText oldState attrs = let marshaled = Marshal.StringToCoTaskMemUni(lineText) let newState = colorizer.ColorizeLine(lineNumber, lineText.Length, marshaled, oldState, attrs) Marshal.FreeCoTaskMem(marshaled) newState /// Recolorize a set of lines - let RecolorizeLines (view:IVsTextView) (getColorizer:IVsTextView->FSharpColorizer_DEPRECATED) (lines:string[]) (linestarts:int[]) (top:int) (bottom:int) = + let RecolorizeLines (view:IVsTextView) (getColorizer:IVsTextView->FSharpColorizer_DEPRECATED) (lines:string[]) (linestarts:int[]) (top:int) (bottom:int) = let colorizer = getColorizer(view) - for i in top..bottom do - // let attrs = Array.create fileline.Length 0u - linestarts.[i+1] <- ColorizeLine colorizer i lines.[i] linestarts.[i] null - - /// A constant value needed by the colorizer. + for i in top..bottom do + // let attrs = Array.create fileline.Length 0u + linestarts.[i+1] <- ColorizeLine colorizer i lines.[i] linestarts.[i] null + + /// A constant value needed by the colorizer. let humanTextAttribute = ((uint32) (int32 COLORIZER_ATTRIBUTE.HUMAN_TEXT_ATTR)) - + /// Remove the bits given bits from the original. let Mask orig remove = orig &&& (0xffffffffu-remove) - + /// Create text of an MSBuild project with the given files and options. - let CreateMsBuildProjectText + let CreateMsBuildProjectText (useInstalledTargets : bool) - (files:(string*BuildAction*string option) list, + (files:(string*BuildAction*string option) list, references:(string*bool) list, projectReferences:string list, disabledWarnings:string list, @@ -627,12 +627,12 @@ module internal Salsa = // targets file then we check the registry for F#'s install path. Otherwise // we look in the same directory as the Unit Tests assembly. let targetsFileFolder = - if useInstalledTargets + if useInstalledTargets then Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(None).Value else System.AppDomain.CurrentDomain.BaseDirectory - + let sb = new System.Text.StringBuilder() - let Append (text:string) = + let Append (text:string) = sb.Append(text+"\r\n") |> ignore Append "" Append " " @@ -649,13 +649,13 @@ module internal Salsa = Append(sprintf " %s" "4.7.2") Append " " for disabledWarning in disabledWarnings do - Append (sprintf " %s;" disabledWarning) + Append (sprintf " %s;" disabledWarning) Append " " Append " " for define in defines do - Append (sprintf " %s;" define) - Append " " - + Append (sprintf " %s;" define) + Append " " + Append " " // Append " " // Append " bin\Debug\" @@ -665,37 +665,37 @@ module internal Salsa = // Append " " Append " " - + for (reference,specificVersion) in references do - Append (sprintf " " reference) + Append (sprintf " " reference) if specificVersion then - Append (sprintf " true") - Append (sprintf " ") + Append (sprintf " true") + Append (sprintf " ") for projectReference in projectReferences do - Append (sprintf " " projectReference) - Append " SomeReferencedProject" - Append " {45636601-CA91-4382-B8BB-3DBD03BF3F56}" + Append (sprintf " " projectReference) + Append " SomeReferencedProject" + Append " {45636601-CA91-4382-B8BB-3DBD03BF3F56}" Append " " for (file,buildAction,link) in files do - let operation = + let operation = match buildAction with | BuildAction.None -> "None" | BuildAction.EmbeddedResource -> "EmbeddedResource" | BuildAction.Compile -> "Compile" | _ -> failwith "unexpected" - - - match link with + + + match link with | None -> Append (sprintf " <%s Include='%s'/>" operation file) | Some link -> Append (sprintf " <%s Include='%s'>" operation file) Append (sprintf " %s" link) Append (sprintf " " operation) - + Append " " Append otherProjMisc @@ -704,9 +704,9 @@ module internal Salsa = Append "" sb.ToString() - type MSBuildBehaviorHooks(useInstalledTargets) = + type MSBuildBehaviorHooks(useInstalledTargets) = let mutable openProject : IOpenProject option = None - let ConfPlat() = + let ConfPlat() = let s = openProject.Value.ConfigurationAndPlatform let i = s.IndexOf('|') if i = -1 then @@ -715,20 +715,20 @@ module internal Salsa = s.Substring(0,i), s.Substring(i+1) let Conf() = let c,_ = ConfPlat() in c let Plat() = let _,p = ConfPlat() in p - interface ProjectBehaviorHooks with + interface ProjectBehaviorHooks with member x.CreateProjectHook (projectName, files, references, projectReferences, disabledWarnings, defines, versionFile, otherFlags, preImportXml, targetFrameworkVersion : string) = if File.Exists(projectName) then File.Delete(projectName) let text = CreateMsBuildProjectText useInstalledTargets (files, references, projectReferences, disabledWarnings, defines, versionFile, otherFlags, preImportXml, targetFrameworkVersion) File.WriteAllText(projectName,text+"\r\n") member x.InitializeProjectHook op = openProject <- Some(op:?>IOpenProject) - member x.MakeHierarchyHook (projdir, fullname, projectname, configChangeNotifier, serviceProvider) = + member x.MakeHierarchyHook (projdir, fullname, projectname, configChangeNotifier, serviceProvider) = let projectSite = NewMSBuildProjectSite(Conf, Plat, fullname) let projectSiteFactory = { new IProvideProjectSite with member x.GetProjectSite() = (projectSite :> IProjectSite) } let hier = VsMocks.createHier(projectSiteFactory) VsMocks.setHierRoot hier projdir projectname hier - member x.AddFileToHierarchyHook(fileName, hier) = + member x.AddFileToHierarchyHook(fileName, hier) = let itemid = nextItemId() VsMocks.addRootChild hier itemid fileName member x.BuildHook (baseName, target, outputWindowPane) = MSBuild.Build(baseName, (if target = null then "Build" else target), Conf(), Plat()) @@ -737,7 +737,7 @@ module internal Salsa = member x.DestroyHook() = () member x.ModifyConfigurationAndPlatformHook (_) = () - type SimpleVisualStudio(configChangeNotifier,serviceProvider, ops : VsOps) = + type SimpleVisualStudio(configChangeNotifier,serviceProvider, ops : VsOps) = let mutable shiftKeyDown = false let mutable languageService : FSharpLanguageServiceTestable option = None let mutable undoStack:UndoAction list = [] @@ -752,59 +752,59 @@ module internal Salsa = let mutable serviceProvider : OleServiceProvider = serviceProvider let currentOutputWindowLines = ref [] let outputWindowPane = VsMocks.vsOutputWindowPane(currentOutputWindowLines) - + let vsFileWatch = VsMocks.VsFileChangeEx() - + let ReopenSolution fullname = match prevSolutions.TryFind fullname with | Some(s) -> prevSolutions <- prevSolutions.Remove fullname s | None -> failwith "solution with that project does not exist" - - member vs.FileChangeEx = vsFileWatch - - member vs.ConfigChangeNotifier = configChangeNotifier - member vs.ServiceProvider = serviceProvider - member vs.OutputWindowPane = outputWindowPane - - member private vs.InvisibleSolution() = + + member vs.FileChangeEx = vsFileWatch + + member vs.ConfigChangeNotifier = configChangeNotifier + member vs.ServiceProvider = serviceProvider + member vs.OutputWindowPane = outputWindowPane + + member private vs.InvisibleSolution() = match invisibleSolution with | None -> let s = SimpleOpenSolution(vs) invisibleSolution <- Some(s) s | Some(s) -> s - - member private vs.InvisibleProject(behaviorHooks:ProjectBehaviorHooks) = + + member private vs.InvisibleProject(behaviorHooks:ProjectBehaviorHooks) = match invisibleProject with | None -> let projdir = NewTempDirectory "salsa-invis" invisibleProjectFolder <- projdir vs.PushUndo(RemoveFolder(projdir)) - + let p = SimpleOpenProject(vs.InvisibleSolution(),null,projdir,"invisible.fsproj",behaviorHooks) invisibleProject <- Some(p) p | Some(p) -> p - + member vs.NewFile(fileName:string,buildAction:BuildAction,lines:string list,behaviorHooks:ProjectBehaviorHooks) = let p : IOpenProject = upcast vs.InvisibleProject(behaviorHooks) p.AddFileFromText(fileName,fileName,buildAction,lines) - + member vs.OpenFileViaOpenFile(fileName:string,behaviorHooks:ProjectBehaviorHooks) = let p : IOpenProject = upcast vs.InvisibleProject(behaviorHooks) p.OpenFile(fileName) - - member vs.LanguageService - with get() = + + member vs.LanguageService + with get() = match languageService with | Some(languageService) -> languageService - | None -> failwith "No salsa language service available." + | None -> failwith "No salsa language service available." and set(value) = languageService <- Some(value) - + member vs.IsShiftKeyDown = shiftKeyDown - member vs.PushUndo(u) = + member vs.PushUndo(u) = undoStack<-u::undoStack member vs.GetColorizer(view:IVsTextView) = let _,buffer = view.GetBuffer() @@ -817,33 +817,33 @@ module internal Salsa = prevSolutions <- prevSolutions.Add(fullname, s) solution <- None | None -> failwith "there is no open solution" - + member vs.AddSourceForBuffer(buffer:IVsTextBuffer,source:IFSharpSource_DEPRECATED) = bufferToSource.Add(buffer,source) member vs.GetSourceForBuffer(buffer:IVsTextBuffer) = bufferToSource.[buffer] - - member vs.GetOutputWindowPaneLines() = + + member vs.GetOutputWindowPaneLines() = List.rev !currentOutputWindowLines - + // --------------------------------------------------------- - + interface VisualStudio with member vs.VsOps = ops - + // --------------------------------------------------------- - - interface IVisualStudio with - member vs.CleanInvisibleProject() = + + interface IVisualStudio with + member vs.CleanInvisibleProject() = if invisibleProjectFolder <> null then try Directory.Delete(invisibleProjectFolder, true) with _ -> () invisibleProject <- None - member vs.CreateSolution() = + member vs.CreateSolution() = match solution with | Some solution -> (solution :> IOpenSolution).Close() | None -> () - let s = SimpleOpenSolution(vs) + let s = SimpleOpenSolution(vs) solution <- Some(s) s :> OpenSolution member solution.OpenExistingProject (behaviorHooks, projdir, projectname) = @@ -851,24 +851,24 @@ module internal Salsa = let soln = ReopenSolution fullname let proj = soln.OpenExistingProject behaviorHooks projdir projectname ((proj:>OpenProject),(soln:>OpenSolution)) - member vs.OnIdle() = + member vs.OnIdle() = vs.LanguageService.OnIdle() match focusFile with | Some(focusFile) -> focusFile.OnIdle() | None -> () member vs.ShiftKeyDown() = shiftKeyDown <- true member vs.ShiftKeyUp() = shiftKeyDown <- false - member vs.TakeCoffeeBreak() = + member vs.TakeCoffeeBreak() = vs.LanguageService.WaitForBackgroundCompile() (vs :> IVisualStudio).OnIdle() vs.LanguageService.WaitForBackgroundCompile() (vs :> IVisualStudio).OnIdle() vs.LanguageService.WaitForBackgroundCompile() (vs :> IVisualStudio).OnIdle() - + member vs.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() = vs.LanguageService.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() - member vs.CleanUp() = + member vs.CleanUp() = vs.LanguageService.Unhook() match solution with | Some(s) -> s.CleanUp() @@ -879,25 +879,25 @@ module internal Salsa = undoStack<-[] undoActions |> List.iter(function - DeleteFile f -> + DeleteFile f -> try File.Delete(f) with e-> printf "Failed to Delete file '%s'" f raise e - | RemoveFolder f -> - try + | RemoveFolder f -> + try if Directory.Exists(f) then Directory.Delete(f,true) - with + with | :? System.IO.IOException -> printf "Failed to Remove folder '%s'" f | e-> printf "Failed to Remove folder '%s'" f raise e) - and internal SimpleOpenSolution(vs:SimpleVisualStudio) as this = + and internal SimpleOpenSolution(vs:SimpleVisualStudio) as this = let mutable curProjects : (string*SimpleOpenProject) list = [] let mutable prevProjects : Map = Map.empty member solution.Vs = vs - member solution.CleanUp() = + member solution.CleanUp() = curProjects |> List.iter (fun (_,p) -> p.CleanUp()) prevProjects |> Map.toList |> List.iter (fun (_,p) -> p.CleanUp()) member solution.OpenExistingProject behaviorHooks projdir projectname = @@ -906,11 +906,11 @@ module internal Salsa = | Some(p) -> prevProjects <- prevProjects.Remove fullname p | None -> failwith "project does not exist" - + interface OpenSolution with member solution.VS = vs :> _ - - interface IOpenSolution with + + interface IOpenSolution with member solution.Close() = curProjects |> List.iter (fun (fullname,p) -> (p :> IOpenProject).Close() @@ -922,16 +922,16 @@ module internal Salsa = // Create the physical project directory. let projdir = NewTempDirectory "salsa" vs.PushUndo(RemoveFolder(projdir)) - + // Put project in there. let fullname = Path.Combine(projdir, projectname+".fsproj") behaviorHooks.CreateProjectHook(fullname, [], [], [], [], [], null, null, "", null) vs.PushUndo(DeleteFile(fullname)) - + // Schedule obj\Debug and bin\Debug to be removed. vs.PushUndo(RemoveFolder(Path.Combine(projdir, "obj"))) vs.PushUndo(RemoveFolder(Path.Combine(projdir, "bin"))) - + // Create the hierarchy to go with this project. let hier = behaviorHooks.MakeHierarchyHook(projdir, fullname, projectname, vs.ConfigChangeNotifier, vs.ServiceProvider) @@ -939,8 +939,8 @@ module internal Salsa = let p = new SimpleOpenProject(this,hier,projdir,fullname,behaviorHooks) curProjects <- (fullname,p) :: curProjects p :> OpenProject - - and internal SimpleOpenProject(solution:SimpleOpenSolution,hier:IVsHierarchy,directory:string,projectName:string,behaviorHooks:ProjectBehaviorHooks) as this = + + and internal SimpleOpenProject(solution:SimpleOpenSolution,hier:IVsHierarchy,directory:string,projectName:string,behaviorHooks:ProjectBehaviorHooks) as this = let mutable configuration = "" let mutable preImportXml = "" let mutable errors:Error list = [] @@ -952,24 +952,24 @@ module internal Salsa = let mutable defines:string list = [] let mutable versionFile : string = null let mutable otherFlags : string = null - let CreateProjectFile() = + let CreateProjectFile() = behaviorHooks.CreateProjectHook(projectName , List.rev filenames, List.rev references, List.rev projectReferences, List.rev disabledWarnings, List.rev defines, versionFile, otherFlags, preImportXml, null) // Trigger the AdviseProjectSiteChanges callbacks on our project sites - match hier with - | :? IProvideProjectSite as f -> - match f.GetProjectSite() with - | :? MSBuildProjectSite as m -> + match hier with + | :? IProvideProjectSite as f -> + match f.GetProjectSite() with + | :? MSBuildProjectSite as m -> m.TriggerChanges() - | _ -> + | _ -> () - | _ -> + | _ -> () - + do behaviorHooks.InitializeProjectHook(this :> OpenProject) member project.Solution =solution - member project.Errors + member project.Errors with get() = errors and set(e) = errors <- e member project.CleanUp() = @@ -982,10 +982,10 @@ module internal Salsa = member project.Close() = List.iter (fun (f : SimpleOpenFile) -> f.Close()) files behaviorHooks.DestroyHook() - member project.Directory + member project.Directory with get() = directory member project.ProjectFile = Path.Combine(directory,projectName) - member project.AddFileFromText(filenameOnDisk, filenameInProject, buildAction, lines) = + member project.AddFileFromText(filenameOnDisk, filenameInProject, buildAction, lines) = // Record the fileName without path. filenames <- (filenameInProject,buildAction,None)::filenames // Create the physical file. @@ -994,7 +994,7 @@ module internal Salsa = CreateProjectFile() solution.Vs.PushUndo(DeleteFile(fileName)) SimpleFile(fileName) :> File - member project.AddLinkedFileFromText(filenameOnDisk, includeFilenameInProject, linkFilenameInProject, buildAction, lines) = + member project.AddLinkedFileFromText(filenameOnDisk, includeFilenameInProject, linkFilenameInProject, buildAction, lines) = // Record the fileName without path. filenames <- (includeFilenameInProject,buildAction, Some linkFilenameInProject)::filenames // Create the physical file. @@ -1003,7 +1003,7 @@ module internal Salsa = CreateProjectFile() solution.Vs.PushUndo(DeleteFile(fileName)) SimpleFile(fileName) :> File - member project.Build(target) = + member project.Build(target) = let outputWindowPane = solution.Vs.OutputWindowPane outputWindowPane.Clear() |> ignore let buildResult = behaviorHooks.BuildHook(projectName, target, outputWindowPane) @@ -1014,55 +1014,55 @@ module internal Salsa = project.Solution.Vs.FileChangeEx.AddedFile(executableOutput) // Notify clients of IVsFileChangeEx {buildResult with ExecutableOutput=executableOutput} member project.GetMainOutputAssembly() = - Path.Combine(directory,behaviorHooks.GetMainOutputAssemblyHook(projectName)) - member project.Save() = + Path.Combine(directory,behaviorHooks.GetMainOutputAssemblyHook(projectName)) + member project.Save() = behaviorHooks.SaveHook() - member project.AddAssemblyReference(reference,specificVersion) = + member project.AddAssemblyReference(reference,specificVersion) = references <- (reference,specificVersion)::references CreateProjectFile() - member project.AddDisabledWarning(code) = + member project.AddDisabledWarning(code) = disabledWarnings <- code::disabledWarnings CreateProjectFile() - member project.SetProjectDefines(definedConstants) = + member project.SetProjectDefines(definedConstants) = defines <- definedConstants CreateProjectFile() - member project.PlaceIntoProjectFileBeforeImport(xml) = + member project.PlaceIntoProjectFileBeforeImport(xml) = preImportXml <- preImportXml + xml CreateProjectFile() - - member project.AddProjectReference(referencedProject) = + + member project.AddProjectReference(referencedProject) = projectReferences <- (referencedProject:?>IOpenProject).ProjectFile :: projectReferences CreateProjectFile() - member project.SetVersionFile(file) = + member project.SetVersionFile(file) = versionFile <- file CreateProjectFile() - member project.SetOtherFlags(flags) = + member project.SetOtherFlags(flags) = otherFlags <- flags - CreateProjectFile() - member project.OpenFile(fileName) = + CreateProjectFile() + member project.OpenFile(fileName) = let fileName = Path.Combine(directory, fileName) - + // Opening a file that is already open does not create a new file it just opens that same file. match files |> List.tryFind(fun (opf:SimpleOpenFile)->opf.Filename = fileName) with - | Some(opf) -> + | Some(opf) -> let file = opf :> OpenFile opf.EnsureInitiallyFocusedInVs() file - | None -> + | None -> // Create the file with IVsTextView let lines = File.ReadAllLines(fileName) let view = VsMocks.createTextView() let linestarts = Array.create (lines.Length+1) 0 // One extra to save the state at the end of the file. VsMocks.setFileText fileName view lines (RecolorizeLines view solution.Vs.GetColorizer lines linestarts) (fun line->linestarts.[line]) - + // The invisible project does not have a hierarchy. - if hier <> null then + if hier <> null then // Put the file in the hierarchy behaviorHooks.AddFileToHierarchyHook(fileName, hier) - + // Put the file in the text manager - VsMocks.setActiveView (solution.Vs.LanguageService.ServiceProvider.TextManager) view - + VsMocks.setActiveView (solution.Vs.LanguageService.ServiceProvider.TextManager) view + // We no longer need the RDT, but keeping it compiling in Salsa/VsMocks in case we ever need it again // Put the document in the RDT let rdtId = nextRdtID() @@ -1071,17 +1071,17 @@ module internal Salsa = // solution.Vs.LanguageService.OnAfterFirstDocumentLock rdtId 1u 1u // Create the 'Source' - let file = SimpleOpenFile(project,fileName,lines,view,linestarts,rdtId) + let file = SimpleOpenFile(project,fileName,lines,view,linestarts,rdtId) let source = Source.CreateSourceTestable_DEPRECATED(file.RecolorizeWholeFile,file.RecolorizeLine,(fun () -> fileName),file.IsClosed,project.Solution.Vs.FileChangeEx, solution.Vs.LanguageService :> IDependencyFileChangeNotify_DEPRECATED) let _,buf = view.GetBuffer() - solution.Vs.AddSourceForBuffer(buf,source) + solution.Vs.AddSourceForBuffer(buf,source) let source = solution.Vs.LanguageService.CreateSource_DEPRECATED(buf) - + // Scan all lines with the colorizer let tcs:IVsTextColorState = downcast box(buf) let _ = tcs.ReColorizeLines(0,lines.Length-1) - + // dprintf "ScanStates=%A\n" linestarts // Return the file. files <- file :: files @@ -1089,83 +1089,83 @@ module internal Salsa = // Idle a bit to here (allows the Language Service to do any background processing) (solution.Vs :> IVisualStudio).TakeCoffeeBreak() file :> OpenFile - member project.Errors + member project.Errors with get() = errors member project.GetOpenFiles() = files |> List.map (fun f -> f :> OpenFile) member project.ConfigurationAndPlatform with get() = configuration - and set(s) = + and set(s) = configuration <- s behaviorHooks.ModifyConfigurationAndPlatformHook(s) and internal SimpleFile(fileName:string) = interface File member file.DeleteFileFromDisk() = File.Delete(fileName) - and internal SimpleOpenFile(project:SimpleOpenProject,fileName:string,lines:string array,view:IVsTextView,scanlines:int[],rdtId) = + and internal SimpleOpenFile(project:SimpleOpenProject,fileName:string,lines:string array,view:IVsTextView,scanlines:int[],rdtId) = let mutable lines = lines let mutable scanlines = scanlines let mutable cursor:Point = {line=1;col=1} let mutable isClosed = false let mutable combinedLines:string = null - + member file.GetFileName() = fileName - member file.GetProjectOptionsOfScript() = - project.Solution.Vs.LanguageService.FSharpChecker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString file.CombinedLines, previewEnabled=false, loadedTimeStamp=System.DateTime(2000,1,1), otherFlags=[| |]) + member file.GetProjectOptionsOfScript() = + project.Solution.Vs.LanguageService.FSharpChecker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString file.CombinedLines, previewEnabled=false, loadedTimeStamp=System.DateTime(2000,1,1), otherFlags=[| |]) |> Async.RunSynchronouslyImmediate |> fst // drop diagnostics - + member file.RecolorizeWholeFile() = () member file.RecolorizeLine (_line:int) = () member file.IsClosed() = isClosed - member file.Filename = + member file.Filename = VsTextLines.GetFilename(Com.ThrowOnFailure1(view.GetBuffer())) member file.OnIdle() = while file.Source.NeedsVisualRefresh do file.OnIdleTypeCheck() member file.CombinedLines : string = - if combinedLines = null then + if combinedLines = null then combinedLines<-String.Join("\n",lines) - combinedLines - member file.Source : IFSharpSource_DEPRECATED = + combinedLines + member file.Source : IFSharpSource_DEPRECATED = let _,buf = view.GetBuffer() - project.Solution.Vs.GetSourceForBuffer(buf) - + project.Solution.Vs.GetSourceForBuffer(buf) + /// When a file is opened, focus it as the topmost file in VS. member file.EnsureInitiallyFocusedInVs() = - project.Solution.Vs.FocusOpenFile(file) - - member file.TryExecuteBackgroundRequest(pr) = + project.Solution.Vs.FocusOpenFile(file) + + member file.TryExecuteBackgroundRequest(pr) = let ls = project.Solution.Vs.LanguageService - ls.BackgroundRequests.ExecuteBackgroundRequest(pr, file.Source) - if pr.ResultClearsDirtinessOfFile then + ls.BackgroundRequests.ExecuteBackgroundRequest(pr, file.Source) + if pr.ResultClearsDirtinessOfFile then file.Source.RecordViewRefreshed() - pr.ResultIntellisenseInfo + pr.ResultIntellisenseInfo - member file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting) = - match file.TryExecuteBackgroundRequest(pr) with - | null when canRetryAfterWaiting -> + member file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting) = + match file.TryExecuteBackgroundRequest(pr) with + | null when canRetryAfterWaiting -> // OK, no scope is available. Try once more after waiting. The background compile should notify us that the // file becomes dirty again (project.Solution.Vs :> IVisualStudio).TakeCoffeeBreak() - file.TryExecuteBackgroundRequest(pr) - | res -> + file.TryExecuteBackgroundRequest(pr) + | res -> res - - /// This is the periodic check that VS - member file.OnIdleTypeCheck() = + + /// This is the periodic check that VS + member file.OnIdleTypeCheck() = // Remove errors for this file only project.Errors <- project.Errors |> List.filter(fun err->err.Path <> file.Filename) let ls = project.Solution.Vs.LanguageService - - // Full check. - let sink = new AuthoringSink(BackgroundRequestReason.FullTypeCheck, 0, 0, maxErrors) - let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot + + // Full check. + let sink = new AuthoringSink(BackgroundRequestReason.FullTypeCheck, 0, 0, maxErrors) + let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(0,0,new TokenInfo(),file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing, System.IO.Path.GetFullPath(file.Filename), BackgroundRequestReason.FullTypeCheck, view,sink,null,file.Source.ChangeCount,false) pr.ResultSink.add_OnErrorAdded( - OnErrorAddedHandler(fun path subcategory msg context severity -> + OnErrorAddedHandler(fun path subcategory msg context severity -> project.Errors <- new Error(path, subcategory, msg, context, severity) :: project.Errors)) file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting=false) |> ignore - + member file.DoIntellisenseRequest(parseReason) = if parseReason = BackgroundRequestReason.MemberSelect then // In the actual product, the only thing that can trigger MemberSelect is the auto-popup caused by the "." or ".." tokens (see service.fs:TokenClassifications.tokenInfo) @@ -1174,7 +1174,7 @@ module internal Salsa = System.Diagnostics.Debug.Assert(colIndex > 0, "hm, how did we invoke at start of line?") let colIndex = colIndex - 1 // cursor is just right of the char we want to inspect if lines.[lineIndex].[colIndex] <> '.' then - // there could legally be whitespace or comments to the left, with a '.' left of that, and we have unit tests that do this, so accomodate that case as well, + // there could legally be whitespace or comments to the left, with a '.' left of that, and we have unit tests that do this, so accomodate that case as well, // at least in the approximate way unit tests do it if lines.[lineIndex].Substring(0,colIndex+1).EndsWith("*)") && lines.[lineIndex].Contains(".(*") then // ok, this is probably fine, have cases like "System.(*marker*)" @@ -1186,45 +1186,45 @@ module internal Salsa = let currentAuthoringScope = let ti = new TokenInfo() let sink = new AuthoringSink(parseReason, cursor.line-1, cursor.col-1, maxErrors) - let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot + let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest( cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing, System.IO.Path.GetFullPath(file.Filename), parseReason, view, sink, null, file.Source.ChangeCount, false) - + file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting=true) match currentAuthoringScope with - | null -> + | null -> System.Diagnostics.Debug.Assert(false, "No Authoring Scope was returned by ExecuteBackgroundRequest, even after waiting") - failwith "No Authoring Scope" - | _ -> + failwith "No Authoring Scope" + | _ -> currentAuthoringScope member file.GetCursorLocation() = (cursor.line, cursor.col) - member file.MoveCursorTo(line,col) = + member file.MoveCursorTo(line,col) = file.EnsureInitiallyFocusedInVs() if line=0 then failwith "Cursor points are 1-relative. Wrong line value." if col=0 then failwith "Cursor points are 1-relative. Wrong col value." cursor<-{line=line;col=col} - member file.MoveCursorToEndOfMarker(marker) = + member file.MoveCursorToEndOfMarker(marker) = file.EnsureInitiallyFocusedInVs() let _,tl = view.GetBuffer() cursor <- IsolateMarkerSite tl marker - member file.MoveCursorToStartOfMarker(marker) = + member file.MoveCursorToStartOfMarker(marker) = file.EnsureInitiallyFocusedInVs() let _,tl = view.GetBuffer() let c = IsolateMarkerSite tl marker cursor <- {line=c.line;col=c.col-marker.Length} // dprintf "Moved cursor to %A\n" cursor - - member file.GetQuickInfoAtCursor () = + + member file.GetQuickInfoAtCursor () = let (result, _) = file.GetQuickInfoAndSpanAtCursor() result - member file.GetQuickInfoAndSpanAtCursor () = + member file.GetQuickInfoAndSpanAtCursor () = let currentAuthoringScope = file.DoIntellisenseRequest BackgroundRequestReason.QuickInfo let textspan = new TextSpan () let result,textspan = currentAuthoringScope.GetDataTipText (cursor.line - 1, cursor.col - 1) @@ -1235,56 +1235,56 @@ module internal Salsa = if textspan.iStartIndex > textspan.iEndIndex then failwith (sprintf "GetDataTipText returned iStartIndex (%d) greater than iEndIndex (%d)" textspan.iStartIndex textspan.iEndIndex) result, textspan - member file.GetMatchingBracesForPositionAtCursor() = + member file.GetMatchingBracesForPositionAtCursor() = file.EnsureInitiallyFocusedInVs() let sink = let ti = new TokenInfo() let sink = new AuthoringSink(BackgroundRequestReason.MatchBraces, cursor.line-1, cursor.col-1, maxErrors) - let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot + let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest( cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing, System.IO.Path.GetFullPath(file.Filename), BackgroundRequestReason.MatchBraces, view, sink, null, file.Source.ChangeCount, false) - + file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting=false) |> ignore sink [| for o in sink.Braces do match o with - | (:? Microsoft.VisualStudio.FSharp.LanguageService.BraceMatch_DEPRECATED as m) -> + | (:? Microsoft.VisualStudio.FSharp.LanguageService.BraceMatch_DEPRECATED as m) -> yield (m.a, m.b) | x -> failwithf "Microsoft.VisualStudio.FSharp.LanguageService.BraceMatch expected, but got %A" (if box x = null then "null" else (x.GetType()).FullName) |] - - member file.GetParameterInfoAtCursor() = - let currentAuthoringScope = + + member file.GetParameterInfoAtCursor() = + let currentAuthoringScope = file.EnsureInitiallyFocusedInVs() let currentAuthoringScope = let ti = new TokenInfo() let sink = new AuthoringSink(BackgroundRequestReason.MethodTip, cursor.line-1, cursor.col-1, maxErrors) - let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot + let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest( cursor.line-1, cursor.col-1, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.ExplicitlyInvokedViaCtrlShiftSpace, System.IO.Path.GetFullPath(file.Filename), BackgroundRequestReason.MethodTip, view, sink, null, file.Source.ChangeCount, false) - + file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting=true) match currentAuthoringScope with - | null -> + | null -> System.Diagnostics.Debug.Assert(false, "No Authoring Scope was returned by ExecuteBackgroundRequest, even after waiting") - failwith "No Authoring Scope" - | _ -> + failwith "No Authoring Scope" + | _ -> currentAuthoringScope let methods = currentAuthoringScope.GetMethodListForAMethodTip() - methods + methods - member file.GetTokenTypeAtCursor() = + member file.GetTokenTypeAtCursor() = file.EnsureInitiallyFocusedInVs() let line = cursor.line-1 // Cursor is 1-relative let text = lines.[line] @@ -1293,7 +1293,7 @@ module internal Salsa = let attrs = Array.create text.Length 0u let result = ColorizeLine colorizer line text scanlines.[line] attrs if result <> scanlines.[line+1] then raise (new Exception("Retokenization of same line gave different results.")) - + let tokenColor = (int) (Mask attrs.[cursor.col-1] humanTextAttribute) match tokenColor with | 0 -> TokenType.Text @@ -1322,35 +1322,35 @@ module internal Salsa = member file.AutoCompleteAtCursorImpl(reason, ?filterText) = let filterText = defaultArg filterText "" let currentAuthoringScope = file.DoIntellisenseRequest(reason) - - let declarations = - let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot + + let declarations = + let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot currentAuthoringScope.GetDeclarations(snapshot, cursor.line-1, cursor.col-1, reason) |> Async.RunSynchronouslyImmediate - match declarations with + match declarations with | null -> [||] | declarations -> let count = declarations.GetCount(filterText) let result = Array.zeroCreate count - for i in 0..count-1 do + for i in 0..count-1 do let glyph = enum (declarations.GetGlyph(filterText,i)) result.[i] <- CompletionItem (declarations.GetDisplayText(filterText,i), declarations.GetName(filterText,i), declarations.GetNameInCode(filterText,i), (fun () -> declarations.GetDescription(filterText,i)), glyph) result member file.AutoCompleteAtCursor(?filterText) = file.AutoCompleteAtCursorImpl(BackgroundRequestReason.MemberSelect, ?filterText=filterText) member file.CompleteAtCursorForReason(reason) = file.AutoCompleteAtCursorImpl(reason) - - member file.CompletionBestMatchAtCursorFor(text, ?filterText) = + + member file.CompletionBestMatchAtCursorFor(text, ?filterText) = let filterText = defaultArg filterText "" let currentAuthoringScope = file.DoIntellisenseRequest(BackgroundRequestReason.MemberSelect) - let declarations = - let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot + let declarations = + let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot currentAuthoringScope.GetDeclarations(snapshot, cursor.line-1,cursor.col-1, BackgroundRequestReason.MemberSelect) |> Async.RunSynchronouslyImmediate - match declarations with + match declarations with | null -> None - | declarations -> + | declarations -> let (index, uniqueMatch, prefixMatch) = declarations.GetBestMatch(filterText, text) Some (declarations.GetName(filterText,index), uniqueMatch, prefixMatch) - + member file.GotoDefinitionAtCursor (forceGen : bool) = file.EnsureInitiallyFocusedInVs () let row = cursor.line - 1 @@ -1358,11 +1358,11 @@ module internal Salsa = let currentAuthoringScope = let ti = new TokenInfo () let sink = new AuthoringSink (BackgroundRequestReason.Goto, row, col, maxErrors) - let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot + let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(row, col, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing, System.IO.Path.GetFullPath file.Filename, BackgroundRequestReason.Goto, view, sink, null, file.Source.ChangeCount, false) file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting=true) (currentAuthoringScope :?> FSharpIntellisenseInfo_DEPRECATED).GotoDefinition (view, row, col) - + member file.GetF1KeywordAtCursor() = file.EnsureInitiallyFocusedInVs() let row = cursor.line - 1 @@ -1370,14 +1370,14 @@ module internal Salsa = let currentAuthoringScope = let ti = new TokenInfo () let sink = new AuthoringSink (BackgroundRequestReason.Goto, row, col, maxErrors) - let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot + let snapshot = VsActual.createTextBuffer(file.CombinedLines).CurrentSnapshot let pr = project.Solution.Vs.LanguageService.BackgroundRequests.CreateBackgroundRequest(row, col, ti, file.CombinedLines, snapshot, MethodTipMiscellany_DEPRECATED.Typing, System.IO.Path.GetFullPath file.Filename, BackgroundRequestReason.QuickInfo, view, sink, null, file.Source.ChangeCount, false) file.ExecuteBackgroundRequestForScope(pr,canRetryAfterWaiting=true) let mutable keyword = None let span = new Microsoft.VisualStudio.TextManager.Interop.TextSpan(iStartIndex=col,iStartLine=row,iEndIndex=col,iEndLine=row) let context = Salsa.VsMocks.Vs.VsUserContext (fun (_,key,value) -> (if key = "keyword" then keyword <- Some value); VSConstants.S_OK) - - currentAuthoringScope.GetF1KeywordString(span, context) + + currentAuthoringScope.GetF1KeywordString(span, context) keyword /// grab a particular line from a file @@ -1394,7 +1394,7 @@ module internal Salsa = match QuickParse.GetCompleteIdentifierIsland true lines.[cursor.line - 1] (cursor.col - 1) with | Some (s, col, _) -> Some (s, col) | None -> None - + member file.ReplaceAllText(replacementLines, takeCoffeeBreak) = file.EnsureInitiallyFocusedInVs() lines <- replacementLines|>List.toArray @@ -1414,16 +1414,16 @@ module internal Salsa = let _ = tcs.ReColorizeLines(0,lines.Length-1) file.Source.RecordChangeToView() // Check the file via OnIdle - if takeCoffeeBreak then + if takeCoffeeBreak then (projSolution.Vs :> IVisualStudio).TakeCoffeeBreak() () - + member file.SaveFileToDisk() = file.EnsureInitiallyFocusedInVs() let fullFileName = Path.Combine((project:>IOpenProject).Directory, file.Filename) - File.WriteAllLines(fullFileName, lines) + File.WriteAllLines(fullFileName, lines) project.Solution.Vs.FileChangeEx.ChangedFile(fullFileName) // Notify clients of IVsFileChangeEx - + // In Visual Studio, OnAfterFirstDocumentLock is called for "Save" and "Save All" // Model this here. This ultimately causes a ProjectSystem --> LanguageService // "project change" notification which starts the background build for a @@ -1436,25 +1436,25 @@ module internal Salsa = interface OpenFile with member file.VS = project.Solution.Vs :> _ - + /// Create a simple Salsa API. - let CreateSimple(ops) = - try + let CreateSimple(ops) = + try if SynchronizationContext.Current = null then let context = new SynchronizationContext() // This executes on the threadpool, but I can't figure out how to get the context for the form. - SynchronizationContext.SetSynchronizationContext(context) - + SynchronizationContext.SetSynchronizationContext(context) + let sp,configChangeNotifier = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier() - + let ls = FSharpLanguageServiceTestable() let rdt = box (VsMocks.createRdt()) let tm = box (VsMocks.createTextManager()) - let documentationProvider = + let documentationProvider = { new IDocumentationBuilder_DEPRECATED with - override doc.AppendDocumentationFromProcessedXML(appendTo,processedXml:string,showExceptions, showReturns, paramName) = + override doc.AppendDocumentationFromProcessedXML(appendTo,processedXml:string,showExceptions, showReturns, paramName) = appendTo.Add(FSharp.Compiler.Text.TaggedText.tagText processedXml) appendTo.Add(FSharp.Compiler.Text.TaggedText.lineBreak) - override doc.AppendDocumentation(appendTo,fileName:string,signature:string, showExceptions, showReturns, paramName) = + override doc.AppendDocumentation(appendTo,fileName:string,signature:string, showExceptions, showReturns, paramName) = appendTo.Add(FSharp.Compiler.Text.TaggedText.tagText (sprintf "[Filename:%s]" fileName)) appendTo.Add(FSharp.Compiler.Text.TaggedText.lineBreak) appendTo.Add(FSharp.Compiler.Text.TaggedText.tagText (sprintf "[Signature:%s]" signature)) @@ -1462,26 +1462,26 @@ module internal Salsa = if paramName.IsSome then appendTo.Add(FSharp.Compiler.Text.TaggedText.tagText (sprintf "[ParamName: %s]" paramName.Value)) appendTo.Add(FSharp.Compiler.Text.TaggedText.lineBreak) - } + } - let sp2 = - { new System.IServiceProvider with - member _.GetService(serviceType:Type) : obj = + let sp2 = + { new System.IServiceProvider with + member _.GetService(serviceType:Type) : obj = if serviceType = typeof then rdt else if serviceType = typeof then tm else raise (new Exception(sprintf "Salsa did not create service %A" serviceType)) } - + let vs = Privates.SimpleVisualStudio(configChangeNotifier,sp, ops) ls.Initialize (sp2,documentationProvider,VsMocks.createLanguagePreferences(),vs.GetSourceForBuffer) vs.LanguageService <- ls vs :> VisualStudio - with e -> + with e -> // Need to just print the error because the framework has not fully initialized the exception at this point. printf "Error in createSimple: %A" e - reraise() - + reraise() + // ------------------------------------------------------------------------------ - + let VsSimpl(vs:VisualStudio) = vs :?> Privates.SimpleVisualStudio let VsImpl(vs:VisualStudio) = vs :?> IVisualStudio let SolutionImpl(sol:OpenSolution) = sol :?> IOpenSolution @@ -1491,7 +1491,7 @@ module internal Salsa = /// Salsa tests which create .fsproj files for projects. - type MSBuildTestFlavor(useInstalledTargets) = + type MSBuildTestFlavor(useInstalledTargets) = let behaviorHooks = Privates.MSBuildBehaviorHooks(useInstalledTargets) :> ProjectBehaviorHooks interface VsOps with member ops.BehaviourHooks = behaviorHooks @@ -1507,7 +1507,7 @@ module internal Salsa = member ops.AddLinkedFileFromText (project:OpenProject,filenameOnDisk,includeFilenameInProject,linkFilenameInProject,buildAction,lines)=ProjectImpl(project).AddLinkedFileFromText(filenameOnDisk,includeFilenameInProject,linkFilenameInProject,buildAction,lines) member ops.AddAssemblyReference (project,reference,specificVersion) = ProjectImpl(project).AddAssemblyReference(reference,specificVersion) member ops.AddProjectReference (project1,project2) = ProjectImpl(project1).AddProjectReference(project2) - member ops.ProjectDirectory project = ProjectImpl(project).Directory + member ops.ProjectDirectory project = ProjectImpl(project).Directory member ops.ProjectFile project = ProjectImpl(project).ProjectFile member ops.SetVersionFile (project,file) = ProjectImpl(project).SetVersionFile(file) member ops.SetOtherFlags (project,flags) = ProjectImpl(project).SetOtherFlags(flags) @@ -1516,7 +1516,7 @@ module internal Salsa = member ops.GetErrors project = ProjectImpl(project).Errors member ops.BuildProject (project,target) = ProjectImpl(project).Build(target) member ops.GetMainOutputAssembly project = ProjectImpl(project).GetMainOutputAssembly() - member ops.SaveProject project = ProjectImpl(project).Save() + member ops.SaveProject project = ProjectImpl(project).Save() member ops.OpenFileViaOpenFile (vs,fileName) = VsSimpl(vs).OpenFileViaOpenFile(fileName,behaviorHooks) member ops.OpenFile (project,fileName) = ProjectImpl(project).OpenFile(fileName) member ops.SetProjectDefines (project,defines) = ProjectImpl(project).SetProjectDefines(defines) @@ -1548,21 +1548,21 @@ module internal Salsa = member ops.OnIdle vs = VsImpl(vs).OnIdle() member ops.ShiftKeyDown vs = VsImpl(vs).ShiftKeyDown() member ops.ShiftKeyUp vs = VsImpl(vs).ShiftKeyUp() - member ops.TakeCoffeeBreak vs = VsImpl(vs).TakeCoffeeBreak() + member ops.TakeCoffeeBreak vs = VsImpl(vs).TakeCoffeeBreak() member ops.ReplaceFileInMemory (file,contents,takeCoffeeBreak) = OpenFileSimpl(file).ReplaceAllText(contents, takeCoffeeBreak) member ops.SaveFileToDisk file = OpenFileSimpl(file).SaveFileToDisk() member ops.CreatePhysicalProjectFileInMemory (files, references, projectReferences, disabledWarnings, defines, versionFile, otherFlags, otherProjMisc, targetFrameworkVersion) = Privates.CreateMsBuildProjectText useInstalledTargets (files, references, projectReferences, disabledWarnings, defines, versionFile, otherFlags, otherProjMisc, targetFrameworkVersion) member ops.CleanUp vs = VsImpl(vs).CleanUp() member ops.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients vs = VsImpl(vs).ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() - member ops.AutoCompleteMemberDataTipsThrowsScope message = + member ops.AutoCompleteMemberDataTipsThrowsScope message = DeclarationListHelpers.ToolTipFault <- Some message { new System.IDisposable with member x.Dispose() = DeclarationListHelpers.ToolTipFault <- None } - member ops.OutOfConeFilesAreAddedAsLinks = false + member ops.OutOfConeFilesAreAddedAsLinks = false member ops.SupportsOutputWindowPane = false member ops.CleanInvisibleProject vs = VsImpl(vs).CleanInvisibleProject() let BuiltMSBuildBehaviourHooks() = Privates.MSBuildBehaviorHooks(false) :> ProjectBehaviorHooks - + /// Salsa tests which create .fsproj files using the freshly built version of Microsoft.FSharp.Targets and FSharp.Build let BuiltMSBuildTestFlavour() = MSBuildTestFlavor(false) :> VsOps diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs index c36379acdb4..af3b0dff438 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs @@ -14,10 +14,10 @@ open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem [] -module StandardSettings = +module StandardSettings = let standard40AssemblyRefs = [ "System"; "System.Core"; "System.Numerics" ] let queryAssemblyRefs = [ "System.Xml.Linq"; "System.Core" ] - type Expectation = + type Expectation = | QuickInfoExpected of string * string | AutoCompleteExpected of string * string | DotCompleteExpected of string * string @@ -25,11 +25,11 @@ module StandardSettings = let AC x y = AutoCompleteExpected(x,y) let DC x y = DotCompleteExpected(x,y) -type UsingMSBuild() as this = +type UsingMSBuild() as this = inherit LanguageServiceBaseTests() - let createFile (code : string list) fileKind refs otherFlags = - let (_, _, file) = + let createFile (code : string list) fileKind refs otherFlags = + let (_, _, file) = match code with | [code] when code.IndexOfAny([|'\r'; '\n'|]) <> -1 -> this.CreateSingleFileProject(code, fileKind = fileKind, references = refs, ?otherFlags=otherFlags) @@ -37,12 +37,12 @@ type UsingMSBuild() as this = this.CreateSingleFileProject(code, fileKind = fileKind, references = refs, ?otherFlags=otherFlags) file - let DoWithAutoCompleteUsingExtraRefs refs otherFlags coffeeBreak fileKind reason (code : string list) marker f = - // Up to 2 untyped parse operations are OK: we do an initial parse to provide breakpoint validation etc. + let DoWithAutoCompleteUsingExtraRefs refs otherFlags coffeeBreak fileKind reason (code : string list) marker f = + // Up to 2 untyped parse operations are OK: we do an initial parse to provide breakpoint validation etc. // This might be before the before the background builder is ready to process the foreground typecheck. - // In this case the background builder calls us back when its ready, and we then request a foreground typecheck + // In this case the background builder calls us back when its ready, and we then request a foreground typecheck let file = createFile code fileKind refs otherFlags - + if coffeeBreak then TakeCoffeeBreak(this.VS) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) @@ -55,7 +55,7 @@ type UsingMSBuild() as this = let DoWithAutoComplete coffeeBreak fileKind reason otherFlags (code : string list) marker f = DoWithAutoCompleteUsingExtraRefs [] otherFlags coffeeBreak fileKind reason code marker f - let AssertAutoCompleteContainsAux coffeeBreak fileName reason otherFlags code marker should shouldnot = + let AssertAutoCompleteContainsAux coffeeBreak fileName reason otherFlags code marker should shouldnot = DoWithAutoComplete coffeeBreak fileName reason otherFlags code marker (fun completions -> AssertCompListContainsAll(completions, should) AssertCompListDoesNotContainAny(completions, shouldnot)) @@ -63,54 +63,54 @@ type UsingMSBuild() as this = let AssertAutoCompleteContains = AssertAutoCompleteContainsAux true SourceFileKind.FS BackgroundRequestReason.MemberSelect None - let AssertAutoCompleteContainsNoCoffeeBreak = + let AssertAutoCompleteContainsNoCoffeeBreak = AssertAutoCompleteContainsAux false SourceFileKind.FS BackgroundRequestReason.MemberSelect None - let AutoCompleteInInterfaceFileContains = + let AutoCompleteInInterfaceFileContains = AssertAutoCompleteContainsAux true SourceFileKind.FSI BackgroundRequestReason.MemberSelect None - let AssertCtrlSpaceCompleteContains = + let AssertCtrlSpaceCompleteContains = AssertAutoCompleteContainsAux true SourceFileKind.FS BackgroundRequestReason.CompleteWord None - let AssertCtrlSpaceCompleteContainsWithOtherFlags otherFlags = + let AssertCtrlSpaceCompleteContainsWithOtherFlags otherFlags = AssertAutoCompleteContainsAux true SourceFileKind.FS BackgroundRequestReason.CompleteWord (Some otherFlags) - let AssertCtrlSpaceCompleteContainsNoCoffeeBreak = + let AssertCtrlSpaceCompleteContainsNoCoffeeBreak = AssertAutoCompleteContainsAux false SourceFileKind.FS BackgroundRequestReason.CompleteWord None - - let AssertCtrlSpaceCompletionListIsEmpty code marker = + + let AssertCtrlSpaceCompletionListIsEmpty code marker = DoWithAutoComplete true SourceFileKind.FS BackgroundRequestReason.CompleteWord None code marker AssertCompListIsEmpty - let AssertCtrlSpaceCompletionListIsEmptyNoCoffeeBreak code marker = + let AssertCtrlSpaceCompletionListIsEmptyNoCoffeeBreak code marker = DoWithAutoComplete false SourceFileKind.FS BackgroundRequestReason.CompleteWord None code marker AssertCompListIsEmpty - let AssertAutoCompleteCompletionListIsEmpty code marker = + let AssertAutoCompleteCompletionListIsEmpty code marker = DoWithAutoComplete true SourceFileKind.FS BackgroundRequestReason.MemberSelect None code marker AssertCompListIsEmpty - let AssertAutoCompleteCompletionListIsEmptyNoCoffeeBreak code marker = + let AssertAutoCompleteCompletionListIsEmptyNoCoffeeBreak code marker = DoWithAutoComplete false SourceFileKind.FS BackgroundRequestReason.MemberSelect None code marker AssertCompListIsEmpty let testAutoCompleteAdjacentToDot op = let text = sprintf "System.Console%s" op // First, test that pressing dot works. - AssertAutoCompleteContainsNoCoffeeBreak + AssertAutoCompleteContainsNoCoffeeBreak [ text ] "System.Console." [ "BackgroundColor" ] // should contain [ ] // should not contain - + let testAutoCompleteAdjacentToDotNegative op = let text = sprintf "System.Console%s" op // Next test that there is no completion after then end. - AssertCtrlSpaceCompleteContainsNoCoffeeBreak + AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ text ] text [ "abs" ] // should contain (top-level autocomplete on empty identifier) [ "BackgroundColor" ] // should not contain (from prior System.Console) - let customOperations = + let customOperations = [ "contains"; "count";"last"; "lastOrDefault"; "exactlyOne"; "exactlyOneOrDefault"; "headOrDefault"; "select"; "where" "minBy"; "maxBy"; "groupBy"; "sortBy"; "sortByDescending"; "thenBy"; "thenByDescending"; "groupValBy"; "join" "groupJoin"; "sumByNullable"; "minByNullable"; "maxByNullable"; "averageByNullable"; "averageBy" @@ -121,15 +121,15 @@ type UsingMSBuild() as this = let notAA l = None,l let stopWatch = new System.Diagnostics.Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - let time1 op a message = + let time1 op a message = ResetStopWatch() let result = op a //printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds result - let ShowErrors(project:OpenProject) = + let ShowErrors(project:OpenProject) = for error in (GetErrors(project)) do - printf "%s\n" (error.ToString()) + printf "%s\n" (error.ToString()) // There are some dot completion tests in this type as well, in the systematic tests for queries @@ -152,7 +152,7 @@ type UsingMSBuild() as this = MoveCursorToEndOfMarker(file, marker) let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" - AssertContains(tooltip, expected) + AssertContains(tooltip, expected) gpatcc.AssertExactly(0,0) member public this.AssertQuickInfoContainsAtEndOfMarker(code,marker,expected, ?addtlRefAssy : string list) = @@ -164,7 +164,7 @@ type UsingMSBuild() as this = static member intExpectedCompletions = [ "CompareTo"; // Members defined on System.Int32 "GetHashCode"] // Members defined on System.Object - + static member stringExpectedCompletions = [ "Substring"; // Methods of System.String "GetHashCode"] // Methods of System.Object @@ -181,13 +181,13 @@ type UsingMSBuild() as this = shouldContain shouldNotContain let s = programText.Insert(i+2, "type:") - AssertCtrlSpaceCompleteContains + AssertCtrlSpaceCompleteContains [ s ] "[ + (fun completions -> Assert.NotEqual(0,completions.Length) let found = completions |> Array.exists(fun (CompletionItem(s,_,_,_,_)) -> s = expected) - if not(found) then - failwithf "Expected: %A to contain %s" completions expected + if not(found) then + failwithf "Expected: %A to contain %s" completions expected ), ?addtlRefAssy = addtlRefAssy ) //**Help Function for checking Ctrl-Space Completion Contains the expected value ************* - member private this.AssertCtrlSpaceCompletion(fileContents : string list, marker, checkCompletion: (CompletionItem array -> unit), ?addtlRefAssy: string list) = + member private this.AssertCtrlSpaceCompletion(fileContents : string list, marker, checkCompletion: (CompletionItem array -> unit), ?addtlRefAssy: string list) = let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) MoveCursorToEndOfMarker(file,marker) let completions = CtrlSpaceCompleteAtCursor file checkCompletion completions - member private this.AutoCompletionListNotEmpty (fileContents : string list) marker = + member private this.AutoCompletionListNotEmpty (fileContents : string list) marker = let (_, _, file) = this.CreateSingleFileProject(fileContents) MoveCursorToEndOfMarker(file,marker) let completions = AutoCompleteAtCursor file Assert.NotEqual(0,completions.Length) - member public this.TestCompletionNotShowingWhenFastUpdate (firstSrc : string list) secondSrc marker = + member public this.TestCompletionNotShowingWhenFastUpdate (firstSrc : string list) secondSrc marker = let (_, _, file) = this.CreateSingleFileProject(firstSrc) MoveCursorToEndOfMarker(file,marker) - // Now delete the property and leave only dot at the end + // Now delete the property and leave only dot at the end // - user is typing fast so replace the content without background compilation - ReplaceFileInMemoryWithoutCoffeeBreak file secondSrc + ReplaceFileInMemoryWithoutCoffeeBreak file secondSrc let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." AssertCompListIsEmpty(completions) // Recheck after some time - after the background compilation runs - TakeCoffeeBreak(this.VS) + TakeCoffeeBreak(this.VS) let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." - AssertCompListIsEmpty(completions) + AssertCompListIsEmpty(completions) - /////Helper Functions + /////Helper Functions //DotCompList ContainAll At End Of Marker Helper Function member private this.VerifyDotCompListContainAllAtEndOfMarker(fileContents : string, marker : string, list : string list) = let (solution, project, file) = this.CreateSingleFileProject(fileContents) let completions = DotCompletionAtEndOfMarker file marker AssertCompListContainsAll(completions, list) - //DoesNotContainAny At Start Of Marker Helper Function + //DoesNotContainAny At Start Of Marker Helper Function member private this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker(fileContents : string, marker : string, list : string list, ?addtlRefAssy : string list) = let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) @@ -269,40 +269,24 @@ type UsingMSBuild() as this = AssertCompListIsEmpty(completions) - - - - - - - - - - - - - - - - @@ -312,7 +296,23 @@ type UsingMSBuild() as this = - + + + + + + + + + + + + + + + + + @@ -323,7 +323,7 @@ type UsingMSBuild() as this = [] member public this.``CtrlSpaceCompletion.Bug294974.Case1``() = - + AssertCtrlSpaceCompleteContains [ """ let xxx = [1] @@ -346,38 +346,38 @@ type UsingMSBuild() as this = - - member this.QueryExpressionFileExamples() = + + member this.QueryExpressionFileExamples() = [ """ module BasicTest let x = query { for x in [1;2;3] do (*TYPING*)""" """ module BasicTest - let x = query { for x in [1;2;3] do (*TYPING*) }""" + let x = query { for x in [1;2;3] do (*TYPING*) }""" """ module BasicTest let x = query { for x in [1;2;3] do - (*TYPING*)""" + (*TYPING*)""" """ module BasicTest let x = query { for x in [1;2;3] do if x > 3 then - (*TYPING*)""" + (*TYPING*)""" """ module BasicTest let x = query { for x in [1;2;3] do where (x > 3) - (*TYPING*)""" + (*TYPING*)""" """ module BasicTest let x = query { for x in [1;2;3] do sortBy x - (*TYPING*)""" + (*TYPING*)""" """ module BasicTest let x = query { for x in [1;2;3] do (*TYPING*) - sortBy x """ + sortBy x """ """ module BasicTest let x = query { for x in [1;2;3] do @@ -386,14 +386,14 @@ type UsingMSBuild() as this = - member this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, variations, knownFailures:list<_>) = + member this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, variations, knownFailures:list<_>) = let knownFailuresDict = set knownFailures - printfn "Building systematic tests, excluding %d known failures" knownFailures.Length - let tests = + printfn "Building systematic tests, excluding %d known failures" knownFailures.Length + let tests = [ for (suffixName,suffixText) in suffixes do for builderName in variations do - for (lineName, line, checks) in lines builderName do + for (lineName, line, checks) in lines builderName do for check in checks do let expectedToFail = knownFailuresDict.Contains (lineName, suffixName, builderName, check) if not expectedToFail then yield (lineName, suffixName, suffixText, builderName, line, check, expectedToFail) ] @@ -430,25 +430,25 @@ type UsingMSBuild() as this = let nSuccess = successes.Count printfn "%d TESTS, %d SUCCESS, %d FAILURE, %%%2.2f success rate" (nSuccess+nFail) successes.Count nFail (float nSuccess / float (nSuccess+nFail) * 100.0) - if failures.Count <> 0 then + if failures.Count <> 0 then printfn "EXTRA OBSERVED FAILURES: " printfn "[" for (lineName,suffixName,builderName,check) in failures do printfn " (\"%s\", \"%s\", \"%s\", %A) " lineName suffixName builderName check printfn "]" - - if unexpectedSuccesses.Count <> 0 then + + if unexpectedSuccesses.Count <> 0 then printfn "EXTRA OBSERVED SUCCESSES: " printfn "[" for (lineName,suffixName,builderName,check) in unexpectedSuccesses do printfn " (\"%s\", \"%s\", \"%s\", %A) " lineName suffixName builderName check printfn "]" - if failures.Count <> 0 || unexpectedSuccesses.Count <> 0 then + if failures.Count <> 0 || unexpectedSuccesses.Count <> 0 then raise <| new Exception("there were unexpected results, see console output for details") - + @@ -463,20 +463,20 @@ type UsingMSBuild() as this = MoveCursorToEndOfMarker(file, marker) let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." AssertCompListContainsAll(completions, expected) - - - - + + + + // Another test case for the same thing - this goes through a different code path (* Tests for autocomplete -------------------------------------------------------------- *) - + member public this.TestGenericAutoComplete(line, expected) = - let code = + let code = [ "type GT<'a> =" " static member P = 12" " static member Q = 13" @@ -502,7 +502,7 @@ type UsingMSBuild() as this = - + @@ -565,8 +565,8 @@ type UsingMSBuild() as this = [] - member public this.``OpenNamespaceOrModule.CompletionOnlyContainsNamespaceOrModule.Case1``() = - AssertAutoCompleteContains + member public this.``OpenNamespaceOrModule.CompletionOnlyContainsNamespaceOrModule.Case1``() = + AssertAutoCompleteContains [ "open System." ] "." // marker [ "Collections" ] // should contain (namespace) @@ -580,34 +580,34 @@ type UsingMSBuild() as this = - - + + [] - member public this.``Expressions.Sequence``() = - AssertAutoCompleteContains - [ + member public this.``Expressions.Sequence``() = + AssertAutoCompleteContains + [ "(seq { yield 1 })." ] "})." // marker [ "GetEnumerator" ] // should contain [ ] // should not contain - - - - - - - - + + + + + + + + (* Tests for various uses of ObsoleteAttribute ----------------------------------------- *) (* Members marked with obsolete shouldn't be visible, but we should support *) (* dot completions on them *) - + // Obsolete and CompilerMessage(IsError=true) should not appear. - member public this.AutoCompleteObsoleteTest testLine appendDot should shouldnot = - let code = + member public this.AutoCompleteObsoleteTest testLine appendDot should shouldnot = + let code = [ "[]" "module ObsoleteTop =" " let T = \"T\"" @@ -625,30 +625,30 @@ type UsingMSBuild() as this = "let mutable level = \"\"" "" ] let (_, _, file) = this.CreateSingleFileProject(code @ [ testLine ]) - + TakeCoffeeBreak(this.VS) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) - if not appendDot then + if not appendDot then // In this case, we want to check Ctrl+J completions // For "level <- O" this shows completions starting with O (e.g. Other) MoveCursorToEndOfMarker(file, testLine) let completions = CtrlSpaceCompleteAtCursor file AssertCompListContainsAll(completions, should) - AssertCompListDoesNotContainAny(completions, shouldnot) + AssertCompListDoesNotContainAny(completions, shouldnot) else // In this case, we quickly type "." and then get dot-completions // For "level <- Module" this shows completions from the "Module" (e.g. "Module.Other") // This simulates the case when the user quickly types "dot" after the file has been TCed before. - ReplaceFileInMemoryWithoutCoffeeBreak file (code @ [ testLine + "." ]) + ReplaceFileInMemoryWithoutCoffeeBreak file (code @ [ testLine + "." ]) MoveCursorToEndOfMarker(file, testLine + ".") let completions = AutoCompleteAtCursor file AssertCompListContainsAll(completions, should) - AssertCompListDoesNotContainAny(completions, shouldnot) + AssertCompListDoesNotContainAny(completions, shouldnot) gpatcc.AssertExactly(0,0) // When the module isn't empty, we should show completion for the module // (and not type-inference based completion on strings - therefore test for 'Chars') - + @@ -657,7 +657,7 @@ type UsingMSBuild() as this = member internal this.AutoCompleteDuplicatesTest (marker, shortName, fullName:string) = let code = - [ + [ "namespace A " "module Test = " " let foo n = n + 1" @@ -678,7 +678,7 @@ type UsingMSBuild() as this = let completions = AutoCompleteAtCursor file let (CompletionItem(_, _, _, descrFunc, _)) = completions |> Array.find (fun (CompletionItem(name, _, _, _, _)) -> name = shortName) let descr = descrFunc() - // Check whether the description contains the name only once + // Check whether the description contains the name only once let occurrences = (" " + descr + " ").Split([| fullName |], System.StringSplitOptions.None).Length - 1 AssertEqualWithMessage(1, occurrences, "The entry for '" + fullName + "' is duplicated.") @@ -687,16 +687,16 @@ type UsingMSBuild() as this = let occurrences = (" " + descr + " ").Split([| methodName |], System.StringSplitOptions.None).Length - 1 // This is some tag in the tooltip that also contains the overload name text if descr.Contains("[Signature:") then occurrences - 1 else occurrences - - - // FEATURE: Saving file N does not cause files 1 to N-1 to re-typecheck (but does cause files N to to + + + // FEATURE: Saving file N does not cause files 1 to N-1 to re-typecheck (but does cause files N to to [] member public this.``Performance.Bug5774``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - + let file1 = AddFileFromText(project,"File1.fs", [""]) let file1 = OpenFile(project,"File1.fs") //file1. @@ -707,7 +707,7 @@ type UsingMSBuild() as this = let file3 = AddFileFromText(project,"File3.fs", [""]) let file3 = OpenFile(project,"File3.fs") - // ensure that the incremental builder is running + // ensure that the incremental builder is running MoveCursorToEndOfMarker(file2,"x.") AutoCompleteAtCursor file2 |> ignore @@ -715,10 +715,10 @@ type UsingMSBuild() as this = // Start the key instrumentation let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) - + // Save file2 ReplaceFileInMemory file2 [""] - SaveFileToDisk file2 + SaveFileToDisk file2 let file3 = OpenFile(project,"File3.fs") TakeCoffeeBreak(this.VS) @@ -731,7 +731,7 @@ type UsingMSBuild() as this = let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") let file = AddFileFromText(project,"File1.fs", - [ + [ "let y = System.Deployment.Application." "()"]) let file = OpenFile(project, "File1.fs") @@ -739,17 +739,17 @@ type UsingMSBuild() as this = let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. - + // Now, add a reference to the given assembly. this.AddAssemblyReference(project,"System.Deployment") TakeCoffeeBreak(this.VS) let completions = AutoCompleteAtCursor(file) - Assert.NotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) /// FEATURE: Updating the active project configuration influences the language service [] - member public this.``AfterUpdateProjectConfiguration``() = + member public this.``AfterUpdateProjectConfiguration``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") @@ -759,7 +759,7 @@ type UsingMSBuild() as this = ") let file = AddFileFromText(project,"File1.fs", - [ + [ "let y = System.Deployment.Application." "()"]) let file = OpenFile(project, "File1.fs") @@ -767,16 +767,16 @@ type UsingMSBuild() as this = let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. - + // Now, update active configuration SetConfigurationAndPlatform(project, "Foo|x86") TakeCoffeeBreak(this.VS) let completions = AutoCompleteAtCursor(file) - Assert.NotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) /// FEATURE: Updating the active project platform influences the language service [] - member public this.``AfterUpdateProjectPlatform``() = + member public this.``AfterUpdateProjectPlatform``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") @@ -787,7 +787,7 @@ type UsingMSBuild() as this = ") SetConfigurationAndPlatform(project, "Debug|AnyCPU") let file = AddFileFromText(project,"File1.fs", - [ + [ "let y = System.Deployment.Application." "()"]) let file = OpenFile(project, "File1.fs") @@ -795,21 +795,21 @@ type UsingMSBuild() as this = let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. - + // Now, update active platform SetConfigurationAndPlatform(project, "Debug|x86") let completions = AutoCompleteAtCursor(file) - Assert.NotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) (* /// FEATURE: The fileName on disk and the fileName in the project can differ in case. [] member this.``Filenames.MayBeDifferentlyCased``() = - use _guard = this.UsingNewVS() + use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") let file = AddFileFromTextEx(project,"file1.fs","FILE1.FS",BuildAction.Compile, - [ + [ "let y = System.Deployment.Application." "()"]) let file = OpenFile(project, "file1.fs") @@ -817,39 +817,39 @@ type UsingMSBuild() as this = let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. - + // Now, add a reference to the given assembly. this.AddAssemblyReference(project,"System.Deployment") let completions = AutoCompleteAtCursor(file) - Assert.NotEqual(0, completions.Length, "Expected some items in the list after adding a reference.") + Assert.NotEqual(0, completions.Length, "Expected some items in the list after adding a reference.") *) - - - - - - + + + + + + // If there is a compile error that prevents a data tip from resolving then show that data tip. // Bunch of crud in empty list. This test asserts that unwanted things don't exist at the top level. - - - - - - - - + + + + + + + + // This was a bug in which the third level of dotting was ignored. // Test completions in an incomplete computation expression (case 1: for "let") - - - - + + + + [] - member public this.``VisualStudio.CloseAndReopenSolution``() = + member public this.``VisualStudio.CloseAndReopenSolution``() = use _guard = this.UsingNewVS() // This test exposes what was once a bug, where closing a solution and then re-opening // it caused the old stale IProjectSiteOption (that the LanguageService had cached) @@ -858,11 +858,11 @@ type UsingMSBuild() as this = let projName = "testproject" let project = CreateProject(solution,projName) let dir = ProjectDirectory(project) - let file = AddFileFromText(project,"File1.fs", - [ + let file = AddFileFromText(project,"File1.fs", + [ "let x = 0" "let y = x." - ]) + ]) let file = OpenFile(project, "File1.fs") MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." @@ -877,15 +877,15 @@ type UsingMSBuild() as this = Assert.True(completions.Length>0) [] - member this.``BadCompletionAfterQuicklyTyping.Bug72561``() = + member this.``BadCompletionAfterQuicklyTyping.Bug72561``() = let code = [ " " ] let (_, _, file) = this.CreateSingleFileProject(code) - + TakeCoffeeBreak(this.VS) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) // In this case, we quickly type "." and then get dot-completions // This simulates the case when the user quickly types "dot" after the file has been TCed before. - ReplaceFileInMemoryWithoutCoffeeBreak file ([ "[1]." ]) + ReplaceFileInMemoryWithoutCoffeeBreak file ([ "[1]." ]) MoveCursorToEndOfMarker(file, ".") // Note: no TakeCoffeeBreak(this.VS) let completions = AutoCompleteAtCursor file @@ -894,19 +894,19 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) let completions = AutoCompleteAtCursor file AssertCompListContainsAll(completions, ["Length"]) - AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) + AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) gpatcc.AssertExactly(0,0) [] - member this.``BadCompletionAfterQuicklyTyping.Bug72561.Noteworthy.NowWorks``() = + member this.``BadCompletionAfterQuicklyTyping.Bug72561.Noteworthy.NowWorks``() = let code = [ "123 " ] let (_, _, file) = this.CreateSingleFileProject(code) - + TakeCoffeeBreak(this.VS) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) // In this case, we quickly type "." and then get dot-completions // This simulates the case when the user quickly types "dot" after the file has been TCed before. - ReplaceFileInMemoryWithoutCoffeeBreak file ([ "[1]." ]) + ReplaceFileInMemoryWithoutCoffeeBreak file ([ "[1]." ]) MoveCursorToEndOfMarker(file, ".") // Note: no TakeCoffeeBreak(this.VS) let completions = AutoCompleteAtCursor file @@ -916,15 +916,15 @@ type UsingMSBuild() as this = let completions = AutoCompleteAtCursor file // ... we get the expected answer AssertCompListContainsAll(completions, ["Length"]) - AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) + AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) gpatcc.AssertExactly(0,0) [] - member this.``BadCompletionAfterQuicklyTyping.Bug130733.NowWorks``() = + member this.``BadCompletionAfterQuicklyTyping.Bug130733.NowWorks``() = let code = [ "let someCall(x) = null" "let xe = someCall(System.IO.StringReader() "] let (_, _, file) = this.CreateSingleFileProject(code) - + TakeCoffeeBreak(this.VS) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) // In this case, we quickly type "." and then get dot-completions @@ -946,13 +946,13 @@ type UsingMSBuild() as this = //*********************************************Previous Completion test and helper***** member private this.VerifyCompListDoesNotContainAnyAtStartOfMarker(fileContents : string, marker : string, list : string list) = let (solution, project, file) = this.CreateSingleFileProject(fileContents) - MoveCursorToStartOfMarker(file, marker) + MoveCursorToStartOfMarker(file, marker) let completions = AutoCompleteAtCursor(file) AssertCompListDoesNotContainAny(completions,list) member private this.VerifyCtrlSpaceListDoesNotContainAnyAtStartOfMarker(fileContents : string, marker : string, list : string list) = let (solution, project, file) = this.CreateSingleFileProject(fileContents) - MoveCursorToStartOfMarker(file, marker) + MoveCursorToStartOfMarker(file, marker) let completions = CtrlSpaceCompleteAtCursor file AssertCompListDoesNotContainAny(completions,list) @@ -970,23 +970,23 @@ type UsingMSBuild() as this = let completions = CtrlSpaceCompleteAtCursor file AssertCompListContainsAll(completions, list) - + member private this.VerifyAutoCompListIsEmptyAtEndOfMarker(fileContents : string, marker : string) = let (solution, project, file) = this.CreateSingleFileProject(fileContents) MoveCursorToEndOfMarker(file, marker) - let completions = AutoCompleteAtCursor(file) - AssertEqual(0,completions.Length) + let completions = AutoCompleteAtCursor(file) + AssertEqual(0,completions.Length) member private this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker(fileContents : string, marker : string) = let (solution, project, file) = this.CreateSingleFileProject(fileContents) MoveCursorToEndOfMarker(file, marker) - let completions = CtrlSpaceCompleteAtCursor(file) - AssertEqual(0,completions.Length) - - - - // Regression for bug 2116 -- Consider making selected item in completion list case-insensitive - + let completions = CtrlSpaceCompleteAtCursor(file) + AssertEqual(0,completions.Length) + + + + // Regression for bug 2116 -- Consider making selected item in completion list case-insensitive + @@ -994,7 +994,7 @@ type UsingMSBuild() as this = (*------------------------------------------IDE Query automation start -------------------------------------------------*) member private this.AssertAutoCompletionInQuery(fileContent : string list, marker:string,contained:string list) = let file = createFile fileContent SourceFileKind.FS ["System.Xml.Linq"] None - + let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file, marker) let completions = CompleteAtCursorForReason(file,BackgroundRequestReason.CompleteWord) @@ -1003,7 +1003,7 @@ type UsingMSBuild() as this = - + @@ -1051,18 +1051,18 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) let completions = DotCompletionAtStartOfMarker file2 marker - AssertCompListContainsAll(completions, list) + AssertCompListContainsAll(completions, list) - // Intellisense still appears on arguments when the operator is used in error + // Intellisense still appears on arguments when the operator is used in error -type UsingProjectSystem() = +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) - + diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs index 53519f50758..f4e1a4a6957 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs @@ -13,10 +13,10 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -type UsingMSBuild() as this = +type UsingMSBuild() as this = inherit LanguageServiceBaseTests() - let VerifyErrorListContainedExpectedStr(expectedStr:string,project : OpenProject) = + let VerifyErrorListContainedExpectedStr(expectedStr:string,project : OpenProject) = let convertNewlines (s:string) = s.Replace("\r\n", " ").Replace("\n", " ") let errorList = GetErrors(project) let GetErrorMessages(errorList : Error list) = @@ -33,8 +33,8 @@ type UsingMSBuild() as this = [for error in errorList do if (error.Severity = Microsoft.VisualStudio.FSharp.LanguageService.Severity.Warning) then yield error] - - let CheckErrorList (content : string) f : unit = + + let CheckErrorList (content : string) f : unit = let (_, project, file) = this.CreateSingleFileProject(content) Build(project) |> ignore @@ -45,19 +45,19 @@ type UsingMSBuild() as this = printfn "%s" err.Message f errors - let assertContains (errors : list) text = + let assertContains (errors : list) text = let ok = errors |> List.exists (fun err -> err.Message = text) Assert.True(ok, sprintf "Error list should contain '%s' message" text) let assertExpectedErrorMessages expected (actual: list) = let normalizeCR input = System.Text.RegularExpressions.Regex.Replace(input, @"\r\n|\n\r|\n|\r", "\r\n") - let actual = - actual + let actual = + actual |> Seq.map (fun e -> e.Message) |> String.concat Environment.NewLine |> normalizeCR let expected = expected |> String.concat Environment.NewLine |> normalizeCR - + Assert.Equal(expected, actual) //verify the error list Count @@ -69,61 +69,61 @@ type UsingMSBuild() as this = printfn "%A" error.Severity let s = error.ToString() errorTexts.AppendLine s |> ignore - printf "%s\n" s + printf "%s\n" s - if num <> errorList.Length then - failwithf "The error list number is not the expected %d but %d%s%s" - num + if num <> errorList.Length then + failwithf "The error list number is not the expected %d but %d%s%s" + num errorList.Length System.Environment.NewLine (errorTexts.ToString()) //Verify the warning list Count - member private this.VerifyWarningListCountAtOpenProject(fileContents : string, expectedNum : int, ?addtlRefAssy : string list) = + member private this.VerifyWarningListCountAtOpenProject(fileContents : string, expectedNum : int, ?addtlRefAssy : string list) = let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) - + TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) Assert.Equal(expectedNum,warnList.Length) - //verify no the error list - member private this.VerifyNoErrorListAtOpenProject(fileContents : string, ?addtlRefAssy : string list) = + //verify no the error list + member private this.VerifyNoErrorListAtOpenProject(fileContents : string, ?addtlRefAssy : string list) = let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) - + TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. - let errorList = GetErrors(project) + let errorList = GetErrors(project) for error in errorList do printfn "%A" error.Severity - printf "%s\n" (error.ToString()) + printf "%s\n" (error.ToString()) Assert.True(errorList.IsEmpty) - + //Verify the error list contained the expected string member private this.VerifyErrorListContainedExpectedString(fileContents : string, expectedStr : string, ?addtlRefAssy : string list) = let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) - + TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. - + VerifyErrorListContainedExpectedStr(expectedStr,project) //Verify error Count at specified file - member private this.VerifyCountAtSpecifiedFile(project : OpenProject ,num : int) = + member private this.VerifyCountAtSpecifiedFile(project : OpenProject ,num : int) = TakeCoffeeBreak(this.VS) let errorList = GetErrors(project) for error in errorList do printfn "%A" error.Severity - printf "%s\n" (error.ToString()) - if (num = errorList.Length) then + printf "%s\n" (error.ToString()) + if (num = errorList.Length) then () else failwithf "The error list number is not the expected %d" num - + [] //This is an verify action test & example member public this.``TestErrorMessage``() = let fileContent = """Console.WriteLine("test")""" let expectedStr = "The value, namespace, type or module 'Console' is not defined" this.VerifyErrorListContainedExpectedString(fileContent,expectedStr) - -type UsingProjectSystem() = + +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs index 7872714b264..5a5102757f2 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs @@ -12,17 +12,17 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -type UsingMSBuild() = +type UsingMSBuild() = inherit LanguageServiceBaseTests() //Verify the error list contained the expected string member private this.VerifyErrorListContainedExpectedString(fileContents : string, expectedStr : string) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (solution, project, file) = this.CreateSingleFileProject(fileContents) let errorList = GetErrors(project) let GetErrorMessages(errorList : Error list) = [ for i = 0 to errorList.Length - 1 do yield errorList.[i].Message] - + Assert.True(errorList |> GetErrorMessages |> Seq.exists (fun errorMessage -> @@ -30,7 +30,7 @@ type UsingMSBuild() = // Not a recovery case, but make sure we get a squiggle at the unfinished Main() [] - member public this.``ErrorRecovery.Bug4538_4``() = + member public this.``ErrorRecovery.Bug4538_4``() = let fileContent = """ type MyType() = override x.ToString() = "" @@ -41,5 +41,5 @@ type UsingMSBuild() = // Context project system -type UsingProjectSystem() = +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs index 0e4d9c18f39..59aa88985ee 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs @@ -21,14 +21,14 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -module IFSharpSource_DEPRECATED = +module IFSharpSource_DEPRECATED = [] - let MultipleSourceIsDirtyCallsChangeTimestamps() = + let MultipleSourceIsDirtyCallsChangeTimestamps() = let recolorizeWholeFile() = () let recolorizeLine (_line:int) = () let isClosed() = false - let depFileChangeNotify = + let depFileChangeNotify = { new IDependencyFileChangeNotify_DEPRECATED with member this.DependencyFileCreated _projectSite = () member this.DependencyFileChanged _filename = () } @@ -40,19 +40,19 @@ module IFSharpSource_DEPRECATED = let secondChangeCount = source.ChangeCount let secondDirtyTime = source.DirtyTime let lastTickCount = System.Environment.TickCount - + Assert.Equal(originalChangeCount + 1, secondChangeCount) Assert.NotEqual(secondDirtyTime, originalDirtyTime) - + // Here's the test. NeedsVisualRefresh is true now, we call RecordChangeToView() and it should cause a new changeCount and dirty time. - while System.Environment.TickCount = lastTickCount do + while System.Environment.TickCount = lastTickCount do System.Threading.Thread.Sleep 10 // Sleep a little to avoid grabbing the same 'Now' source.RecordChangeToView() let thirdChangeCount = source.ChangeCount let thirdDirtyTime = source.DirtyTime - + Assert.Equal(secondChangeCount + 1, thirdChangeCount) - Assert.NotEqual(thirdDirtyTime, secondDirtyTime) + Assert.NotEqual(thirdDirtyTime, secondDirtyTime) @@ -62,7 +62,7 @@ type UsingMSBuild() = let stopWatch = new System.Diagnostics.Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - let time1 op a message = + let time1 op a message = ResetStopWatch() let result = op a printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds @@ -103,12 +103,12 @@ type UsingMSBuild() = ) 0 [] - member public this.``ReconcileErrors.Test1``() = + member public this.``ReconcileErrors.Test1``() = let (_solution, project, file) = this.CreateSingleFileProject(["erroneous"]) Build project |> ignore TakeCoffeeBreak(this.VS) // Error list is populated on idle () - + /// FEATURE: (Project System only) Adding a file outside the project directory creates a link [] member public this.``ProjectSystem.FilesOutsideProjectDirectoryBecomeLinkedFiles``() = @@ -124,27 +124,27 @@ type UsingMSBuild() = Save(project) let projFileText = System.IO.File.ReadAllText(ProjectFile(project)) AssertMatchesRegex '<' @"\s*\s*link.fs" projFileText - + // This was a bug in ReplaceAllText (subsequent calls to SetMarker would fail) [] member public this.``Salsa.ReplaceAllText``() = - let code = - ["//"; + let code = + ["//"; "let x = \"A String Literal\""] let (_solution, _project, file) = this.CreateSingleFileProject(code) - + // Sanity check MoveCursorToStartOfMarker(file,"//") AssertEqual(TokenType.Comment, GetTokenTypeAtCursor(file)) MoveCursorToEndOfMarker(file,"let x = ") AssertEqual(TokenType.String, GetTokenTypeAtCursor(file)) - + // Replace file contents ReplaceFileInMemory file [ "let x = 42 // comment!"; "let y = \"A String Literal\""] - + // Verify able to move cursor and get correct results MoveCursorToEndOfMarker(file, "comment") AssertEqual(TokenType.Comment, GetTokenTypeAtCursor(file)) // Not a string, as was originally @@ -152,8 +152,8 @@ type UsingMSBuild() = AssertEqual(TokenType.String, GetTokenTypeAtCursor(file)) // Able to find new marker MoveCursorToStartOfMarker(file, "let y = ") AssertEqual(TokenType.Keyword, GetTokenTypeAtCursor(file)) // Check MoveCursorToStartOfMarker - - + + // Make sure that possible overloads (and other related errors) are shown in the error list [] @@ -172,14 +172,14 @@ type UsingMSBuild() = ["let p = new N.M.LineChart()" "p.Plot(sin, 0., 0.)"]) let build = time1 Build project "Time to build project" - - Assert.True(not build.BuildSucceeded, "Expected build to fail") - - if SupportsOutputWindowPane(this.VS) then - Helper.AssertListContainsInOrder(GetOutputWindowPaneLines(this.VS), + + Assert.True(not build.BuildSucceeded, "Expected build to fail") + + if SupportsOutputWindowPane(this.VS) then + Helper.AssertListContainsInOrder(GetOutputWindowPaneLines(this.VS), ["error FS0041: A unique overload for method 'Plot' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member N.M.LineChart.Plot : f:(float -> float) * xmin:float * xmax:float -> unit, member N.M.LineChart.Plot : f:System.Func * xmin:float * xmax:float -> unit"]) // Context project system -type UsingProjectSystem() = +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs index cd130c5d97a..c274a054764 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs @@ -17,7 +17,7 @@ open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.EditorServices open Xunit -type UsingMSBuild() = +type UsingMSBuild() = inherit LanguageServiceBaseTests() //GoToDefinitionSuccess Helper Function @@ -28,10 +28,10 @@ type UsingMSBuild() = let identifier = (GetIdentifierAtCursor file).Value |> fst //use marker to get the identifier let result = GotoDefinitionAtCursor file CheckGotoDefnResult - (GotoDefnSuccess identifier definitionCode) + (GotoDefnSuccess identifier definitionCode) file - result - + result + member private this.VerifyGotoDefnSuccessForNonIdentifierAtStartOfMarker(fileContents : string, marker: string, pos : int * int, ?extraRefs) = let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = extraRefs) MoveCursorToStartOfMarker (file, marker) @@ -41,10 +41,10 @@ type UsingMSBuild() = let line = GetLineNumber file (result.Span.iStartLine + 1) printfn "Actual line:%s, actual pos:%A" line actualPos Assert.Equal(pos, actualPos) - + //GoToDefinitionFail Helper Function member private this.VerifyGoToDefnFailAtStartOfMarker(fileContents : string, marker :string,?addtlRefAssy : string list) = - + this.VerifyGoToDefnFailAtStartOfMarker( fileContents = fileContents, marker = marker, @@ -74,20 +74,20 @@ type UsingMSBuild() = let result = GotoDefinitionAtCursor file if not result.Success then CheckGotoDefnResult - GotoDefnFailure + GotoDefnFailure file result else CheckGotoDefnResult - (GotoDefnSuccess identifier definitionCode) - file - result - + (GotoDefnSuccess identifier definitionCode) + file + result + + + - - /// run a GotoDefinition test where the expected result is a file that we @@ -132,13 +132,13 @@ type UsingMSBuild() = /// exp = (, ) option member this.GotoDefinitionTestWithSimpleFile (startLoc : string)(exp : (string * string) option) : unit = - this.SolutionGotoDefinitionTestWithSimpleFile startLoc exp + this.SolutionGotoDefinitionTestWithSimpleFile startLoc exp - member internal this.GotoDefinitionTestWithMarkup (lines : string list) = + member internal this.GotoDefinitionTestWithMarkup (lines : string list) = let origins = Dictionary() let targets = Dictionary() let lines = @@ -153,11 +153,11 @@ type UsingMSBuild() = cont <- false else let c = s.[index] - let nextIndex = s.IndexOf(c, index+1) + let nextIndex = s.IndexOf(c, index+1) let marker = s.Substring(index+1, nextIndex - (index+1)) - if c = '$' then + if c = '$' then origins.Add(marker, (lineNo+1,index+1)) // caret positions are 1-based, but... - else + else targets.Add(marker, (lineNo,index)) // ...spans are 0-based. Argh. Thank you, Salsa! builder.Remove(index, nextIndex - index + 1) |> ignore yield builder.ToString() @@ -174,14 +174,14 @@ type UsingMSBuild() = | Some (span,text) -> match targets.TryGetValue(marker) with | false, _ -> Assert.Fail(sprintf "%s: unexpected definition found" marker) - | true, (line1, col1) -> - Assert.True(span.iStartIndex = col1 && span.iStartLine = line1, + | true, (line1, col1) -> + Assert.True(span.iStartIndex = col1 && span.iStartLine = line1, sprintf "%s: wrong definition found expected %d %d but found %d %d %s" marker line1 col1 span.iStartLine span.iStartIndex text ) - + /// exp = (, ) option member internal this.SolutionGotoDefinitionTestWithSimpleFile (startLoc : string)(exp : (string * string) option) : unit = - let lines = + let lines = [ "" "let _ = 3" @@ -340,7 +340,7 @@ type UsingMSBuild() = " let rec ``let`` = (*loc-74*)" " function 0 -> 1" " | n -> n * ``let`` (n - 1) (*loc-75*)" - "let id77 = 0" + "let id77 = 0" "type C =" " val id77 (*loc-77*) : int" ] @@ -349,10 +349,10 @@ type UsingMSBuild() = - member internal this.SolutionGotoDefinitionTestWithLines lines (startLoc : string)(exp : (string * string) option) : unit = + member internal this.SolutionGotoDefinitionTestWithLines lines (startLoc : string)(exp : (string * string) option) : unit = // The test itself let (_, _, file) = this.CreateSingleFileProject(lines) - let fnm = + let fnm = GetNameOfOpenFile file |> Path.GetFileName MoveCursorToStartOfMarker (file, startLoc) @@ -371,9 +371,9 @@ type UsingMSBuild() = this.GotoDefinitionCheckResultAgainstAnotherFile proj exp res member this.GotoDefinitionFixupFilename (x : GotoDefnResult) : GotoDefnResult = - if x.Success then - GotoDefnResult.MakeSuccess(Path.GetFileName x.Url, x.Span) - else + if x.Success then + GotoDefnResult.MakeSuccess(Path.GetFileName x.Url, x.Span) + else GotoDefnResult.MakeError(x.ErrorDescription) // the format of the comments for each test displays the desired behaviour, @@ -474,14 +474,14 @@ type UsingMSBuild() = let n = s.IndexOf '$' let s = s.Remove (n, 1) match (QuickParse.GetCompleteIdentifierIsland tolerate s n, exp) with - | (Some (s1, _, _), Some s2) -> + | (Some (s1, _, _), Some s2) -> printfn "%s" "Received result, as expected." Assert.Equal (s1, s2) - | (None, None) -> + | (None, None) -> printfn "%s" "Received no result, as expected." - | (Some _, None) -> + | (Some _, None) -> Assert.Fail("Received result, but none was expected!") - | (None, Some _) -> + | (None, Some _) -> Assert.Fail("Expected result, but didn't receive one!") @@ -494,12 +494,12 @@ type UsingMSBuild() = - - + + // Context project system -type UsingProjectSystem() = +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs index c83363e4a99..cc67344646d 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs @@ -15,8 +15,8 @@ type UsingMSBuild() = inherit LanguageServiceBaseTests() (* Files for testing and tests --------------------------------------------------------- *) - - let NavigationFile1 = + + let NavigationFile1 = [ "module Example.Module" "" @@ -38,7 +38,7 @@ type UsingMSBuild() = "" " type EnumOneLine = (*5s*)| OUAaa = 0 | OUBbb = 3(*5e*)" ] - let NavigationFile2 = + let NavigationFile2 = [ "module A = " "" @@ -94,8 +94,8 @@ type UsingMSBuild() = " module OtherNested =" " let aa () =" " 1(*15e*) " ] - + // Context project system -type UsingProjectSystem() = +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs index 38f24f4ff4b..a6b0fbb3158 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs @@ -12,64 +12,64 @@ open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem [] -module ParamInfoStandardSettings = +module ParamInfoStandardSettings = let standard40AssemblyRefs = [| "System"; "System.Core"; "System.Numerics" |] let queryAssemblyRefs = [ "System.Xml.Linq"; "System.Core" ] -type UsingMSBuild() = +type UsingMSBuild() = inherit LanguageServiceBaseTests() let GetParamDisplays(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED) = [ for i = 0 to methods.GetCount() - 1 do yield [ for j = 0 to methods.GetParameterCount(i) - 1 do - let (name,display,description) = methods.GetParameterInfo(i,j) + let (name,display,description) = methods.GetParameterInfo(i,j) yield display ] ] - + let AssertEmptyMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option) = - Assert.True(resultMethodGroup.IsNone, "Expected an empty method group") - - let AssertMethodGroupDescriptionsDoNotContain(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED, expectNotToBeThere) = + Assert.True(resultMethodGroup.IsNone, "Expected an empty method group") + + let AssertMethodGroupDescriptionsDoNotContain(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED, expectNotToBeThere) = for i = 0 to methods.GetCount() - 1 do let description = methods.GetDescription(i) if (description.Contains(expectNotToBeThere)) then Console.WriteLine("Expected description {0} to not contain {1}", description, expectNotToBeThere) AssertNotContains(description,expectNotToBeThere) - + let AssertMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNamesSet:string list list) = Assert.True(resultMethodGroup.IsSome, "Expected a method group") let resultMethodGroup = resultMethodGroup.Value - Assert.Equal(expectedParamNamesSet.Length, resultMethodGroup.GetCount()) - Assert.True(resultMethodGroup + Assert.Equal(expectedParamNamesSet.Length, resultMethodGroup.GetCount()) + Assert.True(resultMethodGroup |> GetParamDisplays - |> Seq.forall (fun paramDisplays -> - expectedParamNamesSet |> List.exists (fun expectedParamNames -> - expectedParamNames.Length = paramDisplays.Length && - (expectedParamNames,paramDisplays) ||> List.forall2 (fun expectedParamName paramDisplay -> + |> Seq.forall (fun paramDisplays -> + expectedParamNamesSet |> List.exists (fun expectedParamNames -> + expectedParamNames.Length = paramDisplays.Length && + (expectedParamNames,paramDisplays) ||> List.forall2 (fun expectedParamName paramDisplay -> paramDisplay.Contains(expectedParamName))))) - - let AssertMethodGroupContain(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNames:string list) = + + let AssertMethodGroupContain(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNames:string list) = Assert.True(resultMethodGroup.IsSome, "Expected a method group") let resultMethodGroup = resultMethodGroup.Value Assert.True(resultMethodGroup |> GetParamDisplays |> Seq.exists (fun paramDisplays -> expectedParamNames.Length = paramDisplays.Length && - (expectedParamNames,paramDisplays) ||> List.forall2 (fun expectedParamName paramDisplay -> + (expectedParamNames,paramDisplays) ||> List.forall2 (fun expectedParamName paramDisplay -> paramDisplay.Contains(expectedParamName)))) - member private this.GetMethodListForAMethodTip(fileContents : string, marker : string, ?addtlRefAssy : string list) = + member private this.GetMethodListForAMethodTip(fileContents : string, marker : string, ?addtlRefAssy : string list) = let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) MoveCursorToStartOfMarker(file, marker) GetParameterInfoAtCursor(file) - //Verify all the overload method parameterInfo + //Verify all the overload method parameterInfo member private this.VerifyParameterInfoAtStartOfMarker(fileContents : string, marker : string, expectedParamNamesSet:string list list, ?addtlRefAssy :string list) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker,?addtlRefAssy=addtlRefAssy) AssertMethodGroup(methodstr,expectedParamNamesSet) - //Verify No parameterInfo at the marker + //Verify No parameterInfo at the marker member private this.VerifyNoParameterInfoAtStartOfMarker(fileContents : string, marker : string, ?addtlRefAssy : string list) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker,?addtlRefAssy=addtlRefAssy) AssertEmptyMethodGroup(methodstr) @@ -80,12 +80,12 @@ type UsingMSBuild() = AssertMethodGroupContain(methodstr,expectedParamNames) //Verify the parameterInfo of one of the list order - member private this.VerifyParameterInfoOverloadMethodIndex(fileContents : string, marker : string, index : int, expectedParams:string list, ?addtlRefAssy : string list) = + member private this.VerifyParameterInfoOverloadMethodIndex(fileContents : string, marker : string, index : int, expectedParams:string list, ?addtlRefAssy : string list) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker,?addtlRefAssy=addtlRefAssy) Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value - let paramDisplays = + let paramDisplays = [ for i = 0 to methodstr.GetParameterCount(index) - 1 do let (name,display,description) = methodstr.GetParameterInfo(index,i) yield display] @@ -123,20 +123,20 @@ type UsingMSBuild() = Assert.True(methodGroup.IsNone, "expected no method group") else AssertMethodGroup(methodGroup, methReq) - + member private this.ExtractLineInfo (line:string) = let idx, lines, foundDollar = line.Split([| '\r'; '\n' |], StringSplitOptions.RemoveEmptyEntries) |> List.ofArray |> List.foldBack (fun l (idx, lines, foundDollar) -> let i = l.IndexOf("$") - if i = -1 then (idx, l::lines, foundDollar) + if i = -1 then (idx, l::lines, foundDollar) else (l.Substring(0, i), l.Replace("$", "")::lines, true) ) <| ("", [], false) if not foundDollar then failwith "bad unit test: did not find '$' in input to mark cursor location!" idx, lines - + member public this.TestParameterInfoNegative (testLine, ?addtlRefAssy : string list) = let cursorPrefix, testLines = this.ExtractLineInfo testLine - let code = + let code = [ "open System" "open System.Threading" @@ -147,7 +147,7 @@ type UsingMSBuild() = let info = GetParameterInfoAtCursor file Assert.True(info.IsNone, "expected no parameter info") gpatcc.AssertExactly(0,0) - + member public this.TestParameterInfoLocation (testLine, expectedPos, ?addtlRefAssy : string list) = let cursorPrefix, testLines = this.ExtractLineInfo testLine let code = @@ -164,12 +164,12 @@ type UsingMSBuild() = // Tests the current behavior, we may want to specify it differently in the future // There are more comments below that explain particular tricky cases - + [] member public this.``Single.Locations.Simple``() = this.TestParameterInfoLocation("let a = System.Math.Sin($", 8) - + //This test verifies that ParamInfo location on a provided type with namespace that exposes static parameter that takes >1 argument works normally. //This test verifies that ParamInfo location on a provided type without the namespace that exposes static parameter that takes >1 argument works normally. //This test verifies that no ParamInfo in a string for a provided type that exposes static parameter that takes >1 argument works normally. @@ -177,12 +177,12 @@ type UsingMSBuild() = //This test verifies that no ParamInfo in a Comment for a provided type that exposes static parameter that takes >1 argument works normally. //The intent here to make sure the ParamInfo is not shown when inside a comment [] - member this.``Regression.LocationOfParams.AfterQuicklyTyping.Bug91373``() = + member this.``Regression.LocationOfParams.AfterQuicklyTyping.Bug91373``() = let code = [ "let f x = x " "let f1 y = y " "let z = f( " ] let (_, _, file) = this.CreateSingleFileProject(code) - + TakeCoffeeBreak(this.VS) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) @@ -201,10 +201,10 @@ type UsingMSBuild() = AssertEqual([|(2,10);(2,12);(2,13);(3,0)|], info.GetParameterLocations()) [] - member this.``LocationOfParams.AfterQuicklyTyping.CallConstructor``() = + member this.``LocationOfParams.AfterQuicklyTyping.CallConstructor``() = let code = [ "type Foo() = class end" ] let (_, _, file) = this.CreateSingleFileProject(code) - + TakeCoffeeBreak(this.VS) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) @@ -227,13 +227,13 @@ type UsingMSBuild() = This does not currently work, because the 'fallback to name environment' does weird QuickParse-ing and mangled the long id "Bar.Foo". We really need to rewrite some code paths here to use the real parse tree rather than QuickParse-ing. [] - member this.``ParameterInfo.LocationOfParams.AfterQuicklyTyping.CallConstructorViaLongId.Bug94333``() = + member this.``ParameterInfo.LocationOfParams.AfterQuicklyTyping.CallConstructorViaLongId.Bug94333``() = let solution = CreateSolution(this.VS) let project = CreateProject(solution,"testproject") let code = [ "module Bar = type Foo() = class end" ] let file = AddFileFromText(project,"File1.fs", code) let file = OpenFile(project,"File1.fs") - + TakeCoffeeBreak(this.VS) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) @@ -254,18 +254,18 @@ We really need to rewrite some code paths here to use the real parse tree rather let cursorPrefix, testLines = this.ExtractLineInfo testLine let testLinesAndLocs = testLines |> List.mapi (fun i s -> let r = new System.Text.StringBuilder(s) - let locs = + let locs = [while r.ToString().IndexOf('^') <> -1 do let c = r.ToString().IndexOf('^') r.Remove(c,1) |> ignore yield (i,c)] r.ToString(), locs) let testLines = testLinesAndLocs |> List.map fst - let expectedLocs = testLinesAndLocs |> List.map snd |> List.collect id |> List.toArray + let expectedLocs = testLinesAndLocs |> List.map snd |> List.collect id |> List.toArray // note: service.fs adds a new line character to the end of every file, so it reports the location of 'end of file' as first the char, 3 lines past the last line of the file - let expectedLocs = if defaultArg markAtEOF false then - Array.append expectedLocs [| (testLines.Length-1)+1, 0 |] - else + let expectedLocs = if defaultArg markAtEOF false then + Array.append expectedLocs [| (testLines.Length-1)+1, 0 |] + else expectedLocs let cursorPrefix = cursorPrefix.Replace("^","") @@ -275,7 +275,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let info = GetParameterInfoAtCursor file Assert.True(info.IsSome, "expected parameter info") let info = info.Value - AssertEqual(expectedLocs, info.GetParameterLocations()) + AssertEqual(expectedLocs, info.GetParameterLocations()) // These pin down known failing cases member public this.TestNoParameterInfo (testLine, ?additionalReferenceAssemblies) = @@ -283,7 +283,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let cursorPrefix = cursorPrefix.Replace("^","") let testLinesAndLocs = testLines |> List.mapi (fun i s -> let r = new System.Text.StringBuilder(s) - let locs = + let locs = [while r.ToString().IndexOf('^') <> -1 do let c = r.ToString().IndexOf('^') r.Remove(c,1) |> ignore @@ -331,9 +331,9 @@ We really need to rewrite some code paths here to use the real parse tree rather "^"+s, false else s, needMarkAtEnd - let allText = indent + startText + Environment.NewLine - + indent + p + Environment.NewLine - + testLine + Environment.NewLine + let allText = indent + startText + Environment.NewLine + + indent + p + Environment.NewLine + + testLine + Environment.NewLine + indent + s printfn "-----------------" printfn "%s" allText diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs index ce47668a6fd..5cb6ff0ca1f 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs @@ -13,31 +13,31 @@ open UnitTests.TestLib.ProjectSystem open Xunit [] -module QuickInfoStandardSettings = +module QuickInfoStandardSettings = let standard40AssemblyRefs = [ "System"; "System.Core"; "System.Numerics" ] let queryAssemblyRefs = [ "System.Xml.Linq"; "System.Core" ] -type UsingMSBuild() = +type UsingMSBuild() = inherit LanguageServiceBaseTests() - // Work around an innocuous 'feature' with how QuickInfo is displayed, lines which + // Work around an innocuous 'feature' with how QuickInfo is displayed, lines which // should have a "\r\n" just have a "\r" - let trimnewlines (str : string) = + let trimnewlines (str : string) = str.Replace("\r", "").Replace("\n", "") - + let stopWatch = new System.Diagnostics.Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - let time1 op a message = + let time1 op a message = ResetStopWatch() let result = op a //printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds result - let ShowErrors(project:OpenProject) = + let ShowErrors(project:OpenProject) = for error in (GetErrors(project)) do - printf "%s\n" (error.ToString()) + printf "%s\n" (error.ToString()) - let checkTooltip expected ((tooltip, span : TextSpan), (row, col)) = + let checkTooltip expected ((tooltip, span : TextSpan), (row, col)) = // Instrumentation: Show actual tooltip for debugging printfn "=== ACTUAL TOOLTIP START ===" printfn "%s" tooltip @@ -57,7 +57,7 @@ type UsingMSBuild() = let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToStartOfMarker(file, marker) let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" - AssertContains(trimnewlines tooltip, trimnewlines expected) + AssertContains(trimnewlines tooltip, trimnewlines expected) gpatcc.AssertExactly(0,0) member public this.CheckTooltip(code : string,marker,atStart, f, ?addtlRefAssy : string list) = @@ -72,7 +72,7 @@ type UsingMSBuild() = let tooltip = GetQuickInfoAndSpanAtCursor file f (tooltip, pos) gpatcc.AssertExactly(0,0) - + member public this.InfoInDeclarationTestQuickInfoImpl(code,marker,expected,atStart, ?addtlRefAssy : string list) = let check ((tooltip, _), _) = AssertContains(tooltip, expected) this.CheckTooltip(code, marker, atStart, check, ?addtlRefAssy=addtlRefAssy ) @@ -82,23 +82,23 @@ type UsingMSBuild() = member public this.AssertQuickInfoContainsAtStartOfMarker(code, marker, expected, ?addtlRefAssy : string list) = this.InfoInDeclarationTestQuickInfoImpl(code,marker,expected,true,?addtlRefAssy=addtlRefAssy) - + member public this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker (code : string) marker notexpected = let (_, _, file) = this.CreateSingleFileProject(code) - + let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file, marker) let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" - AssertNotContains(tooltip, notexpected) + AssertNotContains(tooltip, notexpected) gpatcc.AssertExactly(0,0) member public this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker (code : string) marker notexpected = let (_, _, file) = this.CreateSingleFileProject(code) - + let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToStartOfMarker(file, marker) let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" - AssertNotContains(tooltip, notexpected) + AssertNotContains(tooltip, notexpected) gpatcc.AssertExactly(0,0) member public this.AssertIdentifierInToolTipExactlyOnce (code : string) marker ident = @@ -107,7 +107,7 @@ type UsingMSBuild() = let count = tooltip.Split([| '='; '.'; ' '; '\t'; '('; ':'; ')'; '\n' |]) |> Array.filter ((=) ident) |> Array.length if (count <> 1) then Assert.Fail(sprintf "Identifier '%s' doesn't occur once in the tooltip '%s'" ident tooltip) - + let (_, _, file) = this.CreateSingleFileProject(code) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) @@ -116,43 +116,43 @@ type UsingMSBuild() = AssertIdentifierInToolTipExactlyOnce(ident, tooltip) gpatcc.AssertExactly(0,0) - member this.VerifyOrderOfNestedTypesInQuickInfo (source : string, marker : string, expectedExactOrder : string list, ?extraRefs : string list) = + member this.VerifyOrderOfNestedTypesInQuickInfo (source : string, marker : string, expectedExactOrder : string list, ?extraRefs : string list) = let (_, _, file) = this.CreateSingleFileProject(source, ?references = extraRefs) - + let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToStartOfMarker(file, "(*M*)") let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" AssertContainsInOrder(tooltip, expectedExactOrder) - - - - - + + + + + // Regression for 2948 - + // Regression for 2494 - - - - - - - - - - + + + + + + + + + + @@ -161,8 +161,8 @@ type UsingMSBuild() = member public this.``JustAfterIdentifier``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let f x = x + 1 ""","let f","int") - - + + // Disabled due to issue #11752 --- https://github.com/dotnet/fsharp/issues/11752 //[] @@ -170,7 +170,7 @@ type UsingMSBuild() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let projectLib = CreateProject(solution,"testlib") - let file = AddFileFromText(projectLib,"MyLibrary.fs", + let file = AddFileFromText(projectLib,"MyLibrary.fs", [ "module MyLibrary" "let x = 1" "module Nested =" @@ -179,7 +179,7 @@ type UsingMSBuild() = " let z = 3" ]) let project = CreateProject(solution,"testapp") - let file = AddFileFromText(project,"App.fs", + let file = AddFileFromText(project,"App.fs", [ "let a = MyLibrary.Nested.Deeper.z" ]) SetConfigurationAndPlatform(project, "Debug|AnyCPU") // we must set config/platform when building with ProjectReferences SetConfigurationAndPlatform(projectLib, "Debug|AnyCPU") // we must set config/platform when building with ProjectReferences @@ -194,7 +194,7 @@ type UsingMSBuild() = ShiftKeyUp(this.VS) MoveCursorToEndOfMarker(file, "MyLi") let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" - AssertMatchesRegex '\n' "module MyLibrary[Filename:.*\\bin\\Debug\\testlib.exe]\n[Signature:T:MyLibrary]" tooltip + AssertMatchesRegex '\n' "module MyLibrary[Filename:.*\\bin\\Debug\\testlib.exe]\n[Signature:T:MyLibrary]" tooltip MoveCursorToEndOfMarker(file, "Nes") let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" @@ -223,7 +223,7 @@ type UsingMSBuild() = member private this.QuickInfoResolutionTest lines queries = let code = [ yield! lines ] let (_, _, file) = this.CreateSingleFileProject(code) - TakeCoffeeBreak(this.VS) + TakeCoffeeBreak(this.VS) // Move along the entire length of the identifier checking that the tooltip text contains something familiar @@ -241,42 +241,32 @@ type UsingMSBuild() = "let test0c = System.Collections.Generic.KeyNotFoundException()" "type Test0d = System.Collections.Generic.List" "type Test0e = System.Collections.Generic.KeyNotFoundException"], - + // The quick info specification // Some of the expected quick info text - [("let test0 = ","System" ,"namespace System"); - ("let test0 = System.","Console" ,"Console ="); - ("let test0 = System.Console.","In" ,"System.Console.In"); - ("let test0 = System.Console.","In" ,"TextReader"); - ("let test0b = ","System" ,"namespace System"); - ("let test0b = System.","Collections" ,"namespace System.Collections"); - ("let test0b = System.Collections.","Generic" ,"namespace System.Collections.Generic"); - ("let test0b = System.Collections.Generic.","List" ,"List()"); // note resolves to constructor - ("let test0c = ","System" ,"namespace System"); - ("let test0c = System.","Collections" ,"namespace System.Collections"); - ("let test0c = System.Collections.","Generic" ,"namespace System.Collections.Generic"); - ("let test0c = System.Collections.Generic.","KeyNotFoundException" ,"KeyNotFoundException()"); // note resolves to constructor - ("type Test0d = ","System" ,"namespace System"); - ("type Test0d = System.","Collections" ,"namespace System.Collections"); - ("type Test0d = System.Collections.","Generic" ,"namespace System.Collections.Generic"); + [("let test0 = ","System" ,"namespace System"); + ("let test0 = System.","Console" ,"Console ="); + ("let test0 = System.Console.","In" ,"System.Console.In"); + ("let test0 = System.Console.","In" ,"TextReader"); + ("let test0b = ","System" ,"namespace System"); + ("let test0b = System.","Collections" ,"namespace System.Collections"); + ("let test0b = System.Collections.","Generic" ,"namespace System.Collections.Generic"); + ("let test0b = System.Collections.Generic.","List" ,"List()"); // note resolves to constructor + ("let test0c = ","System" ,"namespace System"); + ("let test0c = System.","Collections" ,"namespace System.Collections"); + ("let test0c = System.Collections.","Generic" ,"namespace System.Collections.Generic"); + ("let test0c = System.Collections.Generic.","KeyNotFoundException" ,"KeyNotFoundException()"); // note resolves to constructor + ("type Test0d = ","System" ,"namespace System"); + ("type Test0d = System.","Collections" ,"namespace System.Collections"); + ("type Test0d = System.Collections.","Generic" ,"namespace System.Collections.Generic"); ("type Test0d = System.Collections.Generic.","List" ,"Generic.List"); // note resolves to type - ("type Test0e = ","System" ,"namespace System"); - ("type Test0e = System.","Collections" ,"namespace System.Collections"); - ("type Test0e = System.Collections.","Generic" ,"namespace System.Collections.Generic"); + ("type Test0e = ","System" ,"namespace System"); + ("type Test0e = System.","Collections" ,"namespace System.Collections"); + ("type Test0e = System.Collections.","Generic" ,"namespace System.Collections.Generic"); ("type Test0e = System.Collections.Generic.","KeyNotFoundException","Generic.KeyNotFoundException"); // note resolves to type ] - - - - - - - - - - @@ -284,28 +274,38 @@ type UsingMSBuild() = - + + + + + + + + + + + // Check to see that two distinct projects can be present - + // In this bug, relative paths with .. in them weren't working. - + /// Complete a member completion and confirm that its data tip contains the fragments /// in rhsContainsOrder member public this.AssertMemberDataTipContainsInOrder(code : string list,marker,completionName,rhsContainsOrder) = let code = code |> Seq.collect (fun s -> s.Split [|'\r'; '\n'|]) |> List.ofSeq let (_, project, file) = this.CreateSingleFileProject(code, fileKind = SourceFileKind.FSX) - TakeCoffeeBreak(this.VS) (* why needed? *) + TakeCoffeeBreak(this.VS) (* why needed? *) MoveCursorToEndOfMarker(file,marker) let completions = CtrlSpaceCompleteAtCursor file match completions |> Array.tryFind (fun (CompletionItem(name, _, _, _, _)) -> name = completionName) with | Some(CompletionItem(_, _, _, descrFunc, _)) -> let descr = descrFunc() AssertContainsInOrder(descr,rhsContainsOrder) - | None -> + | None -> ShowErrors(project) failwith $"Could not find completion name '{completionName}'" @@ -322,7 +322,7 @@ type UsingMSBuild() = - + [] member public this.``Regression.OnMscorlibMethodInScript.Bug6489``() = this.AssertMemberDataTipContainsInOrder @@ -334,16 +334,16 @@ type UsingMSBuild() = ] , (* marker *) "actual.", - (* completed item *) - "CopyTo", + (* completed item *) + "CopyTo", (* expect to see in order... *) [ "[Filename"; "Reference Assemblies\Microsoft\Framework\.NETFramework"; "mscorlib.dll]"; "[Signature:M:System.Array.CopyTo(" ] - ) - - + ) + + @@ -516,7 +516,7 @@ type UsingMSBuild() = printf "First-%s\n" tooltip AssertContains(tooltip, expectedTip) - + member private this.AssertQuickInfoInQuery(code: string, mark : string, expectedstring : string) = use _guard = this.UsingNewVS() @@ -553,16 +553,16 @@ type UsingMSBuild() = let file2 = AddFileFromTextBlob(project,"File2.fs",code) let file1 = OpenFile(project,"File1.fs") let file2 = OpenFile(project,"File2.fs") - + let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToStartOfMarker(file2,mark) let tooltip = time1 GetQuickInfoAtCursor file2 "Time of first tooltip" printfn "%s" tooltip - AssertContains(tooltip, expectedstring) - gpatcc.AssertExactly(0,0) + AssertContains(tooltip, expectedstring) + gpatcc.AssertExactly(0,0) // Context project system -type UsingProjectSystem() = +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs index 43b5ec39b99..0ea1281cd5b 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs @@ -13,31 +13,31 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -type UsingMSBuild() as this = - inherit LanguageServiceBaseTests() +type UsingMSBuild() as this = + inherit LanguageServiceBaseTests() let notAA l = None,l - let createSingleFileFsx (code : string) = + let createSingleFileFsx (code : string) = let (_, p, f) = this.CreateSingleFileProject(code, fileKind = SourceFileKind.FSX) (p, f) - let createSingleFileFsxFromLines (code : string list) = + let createSingleFileFsxFromLines (code : string list) = let (_, p, f) = this.CreateSingleFileProject(code, fileKind = SourceFileKind.FSX) (p, f) (* Timings ----------------------------------------------------------------------------- *) let stopWatch = new System.Diagnostics.Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - let time1 op a message = + let time1 op a message = ResetStopWatch() let result = op a printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds result - let ShowErrors(project:OpenProject) = + let ShowErrors(project:OpenProject) = for error in (GetErrors(project)) do - printf "%s\n" (error.ToString()) + printf "%s\n" (error.ToString()) let AssertListContainsInOrder(s:string list,cs:string list) = let s : string array = Array.ofList s @@ -45,68 +45,68 @@ type UsingMSBuild() as this = AssertContainsInOrder(s,cs) /// Assert that there is no squiggle. - let AssertNoSquiggle(squiggleOption) = - match squiggleOption with + let AssertNoSquiggle(squiggleOption) = + match squiggleOption with | None -> () | Some(severity,message) -> Assert.Fail(sprintf "Expected no squiggle but got '%A' with message: %s" severity message) - let VerifyErrorListContainedExpectedStr(expectedStr:string,project : OpenProject) = + let VerifyErrorListContainedExpectedStr(expectedStr:string,project : OpenProject) = let errorList = GetErrors(project) let GetErrorMessages(errorList : Error list) = [ for i = 0 to errorList.Length - 1 do yield errorList.[i].Message] - + Assert.True(errorList |> GetErrorMessages |> Seq.exists (fun errorMessage -> errorMessage.Contains(expectedStr))) - let AssertNoErrorsOrWarnings(project:OpenProject) = + let AssertNoErrorsOrWarnings(project:OpenProject) = let count = List.length (GetErrors(project)) if count<>0 then printf "Saw %d errors and expected none.\n" count - printf "Errors are: \n" - for e in GetErrors project do + printf "Errors are: \n" + for e in GetErrors project do printf " path = <<<%s>>>\n" e.Path - printf " message = <<<%s> \n" e.Message + printf " message = <<<%s> \n" e.Message AssertEqual(0,count) let AssertExactlyCountErrorSeenContaining(project:OpenProject,text,expectedCount) = let nMatching = (GetErrors(project)) |> List.filter (fun e ->e.ToString().Contains(text)) |> List.length match nMatching with - | 0 -> + | 0 -> failwith (sprintf "No errors containing \"%s\"" text) | x when x = expectedCount -> () - | _ -> + | _ -> failwith (sprintf "Multiple errors containing \"%s\"" text) let AssertExactlyOneErrorSeenContaining(project:OpenProject,text) = AssertExactlyCountErrorSeenContaining(project,text,1) - /// Assert that a given squiggle is an Error (or warning) containing the given text - let AssertSquiggleIsErrorContaining,AssertSquiggleIsWarningContaining, AssertSquiggleIsErrorNotContaining,AssertSquiggleIsWarningNotContaining = - let AssertSquiggle expectedSeverity nameOfExpected nameOfNotExpected assertf (squiggleOption,containing) = + /// Assert that a given squiggle is an Error (or warning) containing the given text + let AssertSquiggleIsErrorContaining,AssertSquiggleIsWarningContaining, AssertSquiggleIsErrorNotContaining,AssertSquiggleIsWarningNotContaining = + let AssertSquiggle expectedSeverity nameOfExpected nameOfNotExpected assertf (squiggleOption,containing) = match squiggleOption with | None -> Assert.Fail("Expected a squiggle but none was seen.") | Some(severity,message) -> Assert.True((severity=expectedSeverity), sprintf "Expected %s but saw %s: %s" nameOfExpected nameOfNotExpected message) - assertf(message,containing) + assertf(message,containing) AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error "Error" "Warning" AssertContains, AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Warning "Warning" "Error" AssertContains, AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error "Error" "Warning" AssertNotContains, - AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Warning "Warning" "Error" AssertNotContains + AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Warning "Warning" "Error" AssertNotContains //Verify the error list in fsx file contained the expected string member private this.VerifyFSXErrorListContainedExpectedString(fileContents : string, expectedStr : string) = let (_, project, file) = this.CreateSingleFileProject(fileContents, fileKind = SourceFileKind.FSX) - VerifyErrorListContainedExpectedStr(expectedStr,project) + VerifyErrorListContainedExpectedStr(expectedStr,project) - //Verify no error list in fsx file + //Verify no error list in fsx file member private this.VerifyFSXNoErrorList(fileContents : string) = let (_, project, file) = this.CreateSingleFileProject(fileContents, fileKind = SourceFileKind.FSX) - AssertNoErrorsOrWarnings(project) + AssertNoErrorsOrWarnings(project) //Verify QuickInfo Contained In Fsx file member public this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile (code : string) marker expected = @@ -122,7 +122,7 @@ type UsingMSBuild() as this = MoveCursorToStartOfMarker(file, marker) let tooltip = GetQuickInfoAtCursor file AssertContains(tooltip, expected) - //Verify QuickInfo Not Contained In Fsx file + //Verify QuickInfo Not Contained In Fsx file member public this.AssertQuickInfoNotContainsAtEndOfMarkerInFsxFile code marker notexpected = let (_, _, file) = this.CreateSingleFileProject((code : string), fileKind = SourceFileKind.FSX) @@ -148,23 +148,23 @@ type UsingMSBuild() as this = ] let (_, file) = createSingleFileFsxFromLines code MoveCursorToEndOfMarker(file,"let xy") - AssertEqual(TokenType.Identifier ,GetTokenTypeAtCursor(file)) + AssertEqual(TokenType.Identifier ,GetTokenTypeAtCursor(file)) - // Ensure that basic compile of an .fsx works + // Ensure that basic compile of an .fsx works [] member public this.``Fsx.CompileFsx_1``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - + let file1 = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["printfn \"Hello world\""]) let build = time1 Build project "Time to build project" Assert.True(build.BuildSucceeded, "Expected build to succeed") ShowErrors(project) - - // Compile a script which #loads a source file. The build can't succeed without the loaded file. + + // Compile a script which #loads a source file. The build can't succeed without the loaded file. [] member public this.``Fsx.CompileFsx_2``() = use _guard = this.UsingNewVS() @@ -179,13 +179,13 @@ type UsingMSBuild() as this = ["#load \"File.fs\"" "printfn \"%d\" Namespace.Module.Value"]) let build = time1 Build project "Time to build project" - if SupportsOutputWindowPane(this.VS) then + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () Assert.True(build.BuildSucceeded, "Expected build to succeed") - - // Compile a script which #loads a source file. The build can't succeed without + + // Compile a script which #loads a source file. The build can't succeed without [] member public this.``Fsx.CompileFsx_3``() = use _guard = this.UsingNewVS() @@ -199,13 +199,13 @@ type UsingMSBuild() as this = let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["#load \"File.fs\"" "printfn \"%d\" Namespace.Module.Value"]) - let build = time1 Build project "Time to build project" - if SupportsOutputWindowPane(this.VS) then + let build = time1 Build project "Time to build project" + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.True(build.BuildSucceeded, "Expected build to succeed") - + Assert.True(build.BuildSucceeded, "Expected build to succeed") + // Must be explicitly referenced by compile. [] member public this.``Fsx.CompileFsx_Bug5416_1``() = @@ -214,13 +214,13 @@ type UsingMSBuild() as this = let project = CreateProject(solution,"testproject") let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["let x = fsi.CommandLineArgs"]) - let build = time1 Build project "Time to build project" - if SupportsOutputWindowPane(this.VS) then + let build = time1 Build project "Time to build project" + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.True(not(build.BuildSucceeded), "Expected build to fail") - + Assert.True(not(build.BuildSucceeded), "Expected build to fail") + // Must be explicitly referenced by compile. [] member public this.``Fsx.CompileFsx_Bug5416_2``() = @@ -242,16 +242,16 @@ type UsingMSBuild() as this = let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["let x = fsi.CommandLineArgs"]) - let build = time1 Build project "Time to build project" - if SupportsOutputWindowPane(this.VS) then + let build = time1 Build project "Time to build project" + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - if not(SupportsOutputWindowPane(this.VS)) then - Assert.True(build.BuildSucceeded, "Expected build to succeed") - - - // Ensure that #load order is preserved when #loading multiple files. + if not(SupportsOutputWindowPane(this.VS)) then + Assert.True(build.BuildSucceeded, "Expected build to succeed") + + + // Ensure that #load order is preserved when #loading multiple files. [] member public this.``Fsx.CompileFsx_5``() = use _guard = this.UsingNewVS() @@ -266,20 +266,20 @@ type UsingMSBuild() as this = ["namespace Namespace" "module Module2 =" " let Value = Module1.Value" - ]) + ]) let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, [ "#load \"File1.fs\"" "#load \"File2.fs\"" "printfn \"%d\" Namespace.Module2.Value"]) - let build = time1 Build project "Time to build project" - if SupportsOutputWindowPane(this.VS) then + let build = time1 Build project "Time to build project" + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.True(build.BuildSucceeded, "Expected build to succeed") - - // If an fs file is explicitly passed in to the compiler and also #loaded then + Assert.True(build.BuildSucceeded, "Expected build to succeed") + + // If an fs file is explicitly passed in to the compiler and also #loaded then // the command-line order is respected rather than the #load order [] member public this.``Fsx.CompileFsx_6``() = @@ -295,21 +295,21 @@ type UsingMSBuild() as this = ["namespace Namespace" "module Module2 =" " let Value = Module1.Value" - ]) + ]) let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, [ "#load \"File2.fs\"" // Wrong order "#load \"File1.fs\"" "printfn \"%d\" Namespace.Module2.Value"]) - let build = time1 Build project "Time to build project" - if SupportsOutputWindowPane(this.VS) then + let build = time1 Build project "Time to build project" + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.True(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") + + - - // If a #loaded file does not exist, there should be an error [] member public this.``Fsx.CompileFsx_7``() = @@ -320,15 +320,15 @@ type UsingMSBuild() as this = [ "#load \"NonexistentFile.fs\"" ]) - let build = time1 Build project "Time to build project" - if SupportsOutputWindowPane(this.VS) then + let build = time1 Build project "Time to build project" + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line - AssertListContainsInOrder(lines, ["error FS0079: Could not load file"; "NonexistentFile.fs"; "because it does not exist or is inaccessible"]) - - Assert.True(not(build.BuildSucceeded), "Expected build to fail") - - + AssertListContainsInOrder(lines, ["error FS0079: Could not load file"; "NonexistentFile.fs"; "because it does not exist or is inaccessible"]) + + Assert.True(not(build.BuildSucceeded), "Expected build to fail") + + // #r references should be respected. [] member public this.``Fsx.CompileFsx_8``() = @@ -340,14 +340,14 @@ type UsingMSBuild() as this = "#r \"System.Messaging\"" "let a = new System.Messaging.AccessControlEntry()" ]) - let build = time1 Build project "Time to build project" - if SupportsOutputWindowPane(this.VS) then + let build = time1 Build project "Time to build project" + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line - - Assert.True(build.BuildSucceeded, "Expected build to succeed") - - + + Assert.True(build.BuildSucceeded, "Expected build to succeed") + + // Missing script file should be a reasonable failure, not a callstack. [] member public this.``Fsx.CompileFsx_Bug5414``() = @@ -355,21 +355,21 @@ type UsingMSBuild() as this = let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile,[]) - DeleteFileFromDisk(this.VS, fsx) - + DeleteFileFromDisk(this.VS, fsx) + let build = Build project - if SupportsOutputWindowPane(this.VS) then + if SupportsOutputWindowPane(this.VS) then let lines = GetOutputWindowPaneLines(this.VS) - AssertListContainsInOrder(lines, + AssertListContainsInOrder(lines, ["Could not find file " - "Script.fsx"]) - for line in lines do + "Script.fsx"]) + for line in lines do printfn "%s" line AssertNotContains(line,"error MSB") // Microsoft.FSharp.Targets(135,9): error MSB6006: "fsc.exe" exited with code -532462766. - Assert.True(not(build.BuildSucceeded), "Expected build to fail") - - + Assert.True(not(build.BuildSucceeded), "Expected build to fail") + + member public this.TypeProviderDisposalSmokeTest(clearing) = use _guard = this.UsingNewVS() let providerAssemblyName = PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll") @@ -397,7 +397,7 @@ type UsingMSBuild() as this = let totalInvalidationHandlersAdded() = totalInvalidationHandlersAddedMeth.Invoke(null, [| |]) :?> int let totalInvalidationHandlersRemoved() = totalInvalidationHandlersRemovedMeth.Invoke(null, [| |]) :?> int - + let startCreations = totalCreations() let startDisposals = totalDisposals() let startInvalidationHandlersAdded = totalInvalidationHandlersAdded() @@ -409,12 +409,12 @@ type UsingMSBuild() as this = Assert.True(startCreations >= startDisposals, "Check0") Assert.True(startInvalidationHandlersAdded >= startInvalidationHandlersRemoved, "Check0") - for i in 1 .. 50 do + for i in 1 .. 50 do let solution = this.CreateSolution() - let project = CreateProject(solution,"testproject" + string (i % 20)) + let project = CreateProject(solution,"testproject" + string (i % 20)) this.AddAssemblyReference(project, PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")) let fileName = sprintf "File%d.fs" i - let file1 = AddFileFromText(project,fileName, ["let x" + string i + " = N1.T1()" ]) + let file1 = AddFileFromText(project,fileName, ["let x" + string i + " = N1.T1()" ]) let file = OpenFile(project,fileName) TakeCoffeeBreak(this.VS) AssertNoErrorsOrWarnings project // ...and not an error on the first line. @@ -426,9 +426,9 @@ type UsingMSBuild() as this = ignore (GetF1KeywordAtCursor file) let parmInfo = GetParameterInfoAtCursor file - let file1 = OpenFile(project,fileName) + let file1 = OpenFile(project,fileName) - // The disposals should be at least one less + // The disposals should be at least one less let c = countCreations() let d = countDisposals() @@ -439,15 +439,15 @@ type UsingMSBuild() as this = // even after we've moved on from it. Assert.True((c >= i), "Check3, countCreations() >= i, iteration " + string i + ", countCreations() = " + string c) - if not clearing then + if not clearing then // By default we hold 3 build incrementalBuilderCache entries and 5 typeCheckInfo entries, so if we're not clearing // there should be some roots to project builds still present - if i >= 3 then + if i >= 3 then Assert.True(c >= d + 3, "Check4a, c >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string d) printfn "Check4a2, i = %d, countInvalidationHandlersRemoved() = %d" i (countInvalidationHandlersRemoved()) // If we forcefully clear out caches and force a collection, then we can say much stronger things... - if clearing then + if clearing then ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(this.VS) let c = countCreations() let d = countDisposals() @@ -455,7 +455,7 @@ type UsingMSBuild() as this = // Creations should be equal to disposals after a `ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients` Assert.True((c = d), "Check4b, countCreations() = countDisposals(), iteration " + string i) Assert.True((countInvalidationHandlersAdded() = countInvalidationHandlersRemoved()), "Check4b2, all invalidation handlers removed, iteration " + string i) - + let c = countCreations() let d = countDisposals() Assert.True(c >= 50, "Check5, at end, countCreations() >= 50") @@ -477,6 +477,6 @@ type UsingMSBuild() as this = // Context project system -type UsingProjectSystem() = +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs index 4d13481f6f7..1329dd8fbe2 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs @@ -11,23 +11,23 @@ open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService -type UsingMSBuild() = +type UsingMSBuild() = inherit LanguageServiceBaseTests() (* Timings ----------------------------------------------------------------------------- *) let stopWatch = new System.Diagnostics.Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - let time1 op a message = + let time1 op a message = ResetStopWatch() let result = op a printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds result - let ShowErrors(project:OpenProject) = + let ShowErrors(project:OpenProject) = for error in (GetErrors(project)) do - printf "%s\n" (error.ToString()) + printf "%s\n" (error.ToString()) - let AssertNoErrorsOrWarnings(project:OpenProject) = + let AssertNoErrorsOrWarnings(project:OpenProject) = let count = List.length (GetErrors(project)) if count<>0 then printf "Saw %d errors and expected none.\n" count @@ -35,11 +35,11 @@ type UsingMSBuild() = let AssertNoErrorSeenContaining(project:OpenProject,text) = let matching = (GetErrors(project)) |> List.filter (fun e->e.ToString().Contains(text)) - match matching with + match matching with | [] -> () - | _ -> + | _ -> ShowErrors(project) - failwith (sprintf "Error seen containing \"%s\"" text) + failwith (sprintf "Error seen containing \"%s\"" text) // In this bug, if you clean the dependent project, the dependee started getting errors again about the unresolved assembly. // The desired behavior is like C#, which is if the assembly disappears from disk, we use cached results of last time it was there. @@ -48,12 +48,12 @@ type UsingMSBuild() = member public this.``Regression.NoError.Timestamps.Bug3368b``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() - // Handy for this test: + // Handy for this test: //Trace.Log <- "ChangeEvents;IncrementalBuildCommandLineMessages;SyncOp;CompilerServices" - + // Create the projects/ let project1 = CreateProject(solution,"testproject1") - let project2 = CreateProject(solution,"testproject2") + let project2 = CreateProject(solution,"testproject2") SetConfigurationAndPlatform(project1, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences SetConfigurationAndPlatform(project2, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences let file1 = AddFileFromText(project1,"File1.fs", [ @@ -61,7 +61,7 @@ type UsingMSBuild() = "printfn \"hi\""]) let file2 = AddFileFromText(project2,"File2.fs", [ "let yy = File1.xx" - "printfn \"hi\""]) + "printfn \"hi\""]) // Add a project-to-project reference. // WARNING: See bug 4434 - when unit testing this actually goes and builds project1!!!! AddProjectReference(project2,project1) @@ -72,8 +72,8 @@ type UsingMSBuild() = // Now build project1 printfn "building dependent project..." Build project1 |> ignore - TakeCoffeeBreak(this.VS) - + TakeCoffeeBreak(this.VS) + // Open files in editor. let file1 = OpenFile(project1,"File1.fs") let file2 = OpenFile(project2,"File2.fs") @@ -81,7 +81,7 @@ type UsingMSBuild() = // Now clean project1 printfn "cleaning dependent project..." BuildTarget(project1, "Clean") |> ignore - TakeCoffeeBreak(this.VS) + TakeCoffeeBreak(this.VS) AssertNoErrorsOrWarnings(project1) AssertNoErrorsOrWarnings(project2) // this is key, project2 remembers what used to be on disk, does not fail due to missing assembly @@ -93,28 +93,28 @@ type UsingMSBuild() = // Handy for this test: Trace.Log <- "ChangeEvents;IncrementalBuildCommandLineMessages" // Create the projects/ let project1 = CreateProject(solution,"testproject1") - let project2 = CreateProject(solution,"testproject2") + let project2 = CreateProject(solution,"testproject2") SetConfigurationAndPlatform(project1, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences SetConfigurationAndPlatform(project2, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences let file1 = AddFileFromText(project1,"File1.fs", []) let file2 = AddFileFromText(project2,"File2.fs", []) - - // Add a project-to-project reference. + + // Add a project-to-project reference. // WARNING: See bug 4434 - when unit testing this actually goes and builds project1!!!! AddProjectReference(project2,project1) - + // Open files in editor. let file1 = OpenFile(project1,"File1.fs") let file2 = OpenFile(project2,"File2.fs") - + // Wait for things to settle down and make sure there is an error - TakeCoffeeBreak(this.VS) + TakeCoffeeBreak(this.VS) // This assert no longer holds because project1 has inadvertently been built - see bug 4434 and comment above //AssertExactlyOneErrorSeenContaining(project2, "project1") - + // Now build project1 Build project1 |> ignore - TakeCoffeeBreak(this.VS) + TakeCoffeeBreak(this.VS) AssertNoErrorSeenContaining(project2, "project1") // FEATURE: OnIdle() will reprocess open dirty files, even if those file do not currently have editor focus @@ -122,19 +122,19 @@ type UsingMSBuild() = member public this.``Timestamps.Bug3368c``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() - // Handy for this test: + // Handy for this test: //Trace.Log <- "ChangeEvents;IncrementalBuildCommandLineMessages;SyncOp;CompilerServices" - + // Create the projects/ let project1 = CreateProject(solution,"testproject1") - let project2 = CreateProject(solution,"testproject2") + let project2 = CreateProject(solution,"testproject2") let file1 = AddFileFromText(project1,"File1.fs", [ "let xx = 42" "printfn \"hi\""]) let file2 = AddFileFromText(project2,"File2.fs", [ "let yy = File1.xx" "printfn \"hi\""]) - + // Add an assembly reference between the projects (a P2P would fall victim to 4434) let p1exe = BuildTarget(project1, "Clean") // just a handy way to get the filename of the exe that would be built this.AddAssemblyReference(project2, p1exe.ExecutableOutput) @@ -142,7 +142,7 @@ type UsingMSBuild() = // open a file to see the errors let file2 = OpenFile(project2,"File2.fs") TakeCoffeeBreak(this.VS) - + let errs = GetErrors(project2) Assert.True(List.length errs > 0, "There should be errors (unresolved reference)") @@ -154,8 +154,8 @@ type UsingMSBuild() = Build project1 |> ignore let errs = GetErrors(project2) Assert.True(List.length errs > 0, "There should be errors (unresolved reference)") - - TakeCoffeeBreak(this.VS) // the code that should clear out the errors is in LanguageService.cs:LanguageService.OnIdle(), + + TakeCoffeeBreak(this.VS) // the code that should clear out the errors is in LanguageService.cs:LanguageService.OnIdle(), // but unit tests do not call this FSharp.LanguageService.Base code; TakeCoffeeBreak(this.VS) just simulates // idle processing for the currently-focused file printfn "after idling, file2 errors should be cleared even though file2 is not focused" @@ -167,7 +167,7 @@ type UsingMSBuild() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project1 = CreateProject(solution,"testproject1") - + let file1 = AddFileFromText(project1,"File1.fs", [] ) @@ -178,7 +178,7 @@ type UsingMSBuild() = "File1.File1." "()"]) let file2 = OpenFile(project2,"File2.fs") - + // Build project1 which will later have the type being referenced by project2 let project1Dll = time1 Build project1 "Time to build project1" printfn "Output of building project1 was %s" project1Dll.ExecutableOutput @@ -191,9 +191,9 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file2,"File1.File1.") let completions = AutoCompleteAtCursor(file2) Assert.Equal(0, completions.Length) - + // Now modify project1's file and rebuild. - ReplaceFileInMemory file1 + ReplaceFileInMemory file1 [ "module File1 = " " let Mary x = \"\""] @@ -247,11 +247,11 @@ type UsingMSBuild() = Assert.Equal(0, completions.Length) // Now modify project1's file and rebuild. - ReplaceFileInMemory file1 + ReplaceFileInMemory file1 [ "module File1 = " " let Mary x = \"\""] - SaveFileToDisk file1 + SaveFileToDisk file1 time1 Build project1 "Time to build project1 second time" |> ignore TakeCoffeeBreak(this.VS) // Give enough time to catch up SwitchToFile this.VS file2 @@ -267,7 +267,7 @@ type UsingMSBuild() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project1 = CreateProject(solution,"testproject1") - + let file1 = AddFileFromText(project1,"File1.fs", [] ) @@ -280,11 +280,11 @@ type UsingMSBuild() = let file2 = OpenFile(project2,"File2.fs") SetConfigurationAndPlatform(project1, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences SetConfigurationAndPlatform(project2, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences - + // Build project1 which will later have the type being referenced by project2 let project1Dll = time1 Build project1 "Time to build project1" printf "Output of building project1 was %s\n" project1Dll.ExecutableOutput - + // Add a new reference project2->project1. There should be no completions because Mary doesn't exist yet. // // WARNING: See bug 4434 - when unit testing this actually goes and builds project1!!!! @@ -297,21 +297,21 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file2,"File1.File1.") let completions = AutoCompleteAtCursor(file2) Assert.Equal(0, completions.Length) - + // Now modify project1's file and rebuild. - ReplaceFileInMemory file1 + ReplaceFileInMemory file1 [ "module File1 = " " let Mary x = \"\""] - SaveFileToDisk file1 - time1 Build project1 "Time to build project1 second time" |> ignore - TakeCoffeeBreak(this.VS) // Give enough time to catch up + SaveFileToDisk file1 + time1 Build project1 "Time to build project1 second time" |> ignore + TakeCoffeeBreak(this.VS) // Give enough time to catch up SwitchToFile this.VS file2 MoveCursorToEndOfMarker(file2,"File1.File1.") - TakeCoffeeBreak(this.VS) // Give enough time to catch up + TakeCoffeeBreak(this.VS) // Give enough time to catch up let completions = AutoCompleteAtCursor(file2) Assert.NotEqual(0, completions.Length) - printfn "Completions=%A\n" completions + printfn "Completions=%A\n" completions //Allow the TimeStampTests run under different context @@ -323,5 +323,5 @@ open Xunit open Salsa.Salsa // Context project system -type UsingProjectSystem() = +type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs index a0cedaf030f..d535252e9b2 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs @@ -10,7 +10,7 @@ open System.Text.RegularExpressions open System.Xml.Linq open Xunit -// VS namespaces +// VS namespaces open Microsoft.VisualStudio open Microsoft.VisualStudio.Shell.Interop open Microsoft.VisualStudio.FSharp @@ -23,7 +23,7 @@ open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -type Config() = +type Config() = inherit TheTests() ///////////////////////////////// @@ -33,8 +33,8 @@ type Config() = [] member this.TargetPlatform () = - this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], - this.MSBuildProjectMultiPlatformBoilerplate "Library", + this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], + this.MSBuildProjectMultiPlatformBoilerplate "Library", (fun project ccn projFileName -> ccn((project :> IVsHierarchy), "Debug|x86") project.ComputeSourcesAndFlags() @@ -45,21 +45,21 @@ type Config() = [] member this.``Configs.EnsureAtLeastOneConfiguration`` () = - this.HelperEnsureAtLeastOne - @"" + this.HelperEnsureAtLeastOne + @"" [|"Debug"|] // the goal of the test - when no configs, "Debug" should magically appear [|"x86"|] [] member this.``Configs.EnsureAtLeastOnePlatform`` () = - this.HelperEnsureAtLeastOne + this.HelperEnsureAtLeastOne @"" [|"Release"|] [|"Any CPU"|] // the goal of the test - when no platforms, "AnyCPU" should magically appear [] member this.``Configs.EnsureAtLeastOneConfigurationAndPlatform`` () = - this.HelperEnsureAtLeastOne + this.HelperEnsureAtLeastOne "" [|"Debug"|] // first goal of the test - when no configs, "Debug" should magically appear [|"Any CPU"|] // second goal of the test - when no platforms, "AnyCPU" should magically appear @@ -74,7 +74,7 @@ type Config() = ") - this.HelperEnsureAtLeastOne + this.HelperEnsureAtLeastOne @"" [|"Debug"|] // the goal of the test - when no configs, "Debug" should magically appear [|"x86"|] @@ -84,7 +84,7 @@ type Config() = [] member this.``Configs.EnsureAtLeastOnePlatform.Imported`` () = // Take advantage of the fact that we always create projects one directory below TempPath - // The unit test failed due to the previous test use the same target name "foo.targets". + // The unit test failed due to the previous test use the same target name "foo.targets". // The vs record the platform config "x86", so the next test failed for the unexpected platform. let tmpTargets = Path.Combine(Path.GetTempPath(), "foo2.targets") try @@ -92,13 +92,13 @@ type Config() = @" ") - this.HelperEnsureAtLeastOne + this.HelperEnsureAtLeastOne @"" [|"Release"|] [|"Any CPU"|] // the goal of the test - when no platforms, "AnyCPU" should magically appear finally File.Delete tmpTargets - + [] member this.``Configs.Renaming`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], @@ -112,9 +112,9 @@ type Config() = let xDoc = XDocument.Load(new StringReader(fsprojFileText)) let expected = this.MSBuildProjectMultiConfigBoilerplate ["Buggy",""; "Release",""] let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) - TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) + TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - + [] member this.``Configs.Deleting`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], @@ -128,13 +128,13 @@ type Config() = let xDoc = XDocument.Load(new StringReader(fsprojFileText)) let expected = this.MSBuildProjectMultiConfigBoilerplate ["Release",""] let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) - TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) + TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) [] member this.``Configs.Adding`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], - (fun project projFileName -> + (fun project projFileName -> this.CheckConfigNames(project, [|"Debug";"Release"|]) project.ConfigProvider.AddCfgsOfCfgName("Buzz", "Debug", 0) |> AssertEqual VSConstants.S_OK this.CheckConfigNames(project, [|"Debug";"Release";"Buzz"|]) @@ -143,7 +143,7 @@ type Config() = let xDoc = XDocument.Load(new StringReader(fsprojFileText)) let expected = this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""; "Buzz",""] let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) - TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) + TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) [] member this.``Configs.AddingBaseless`` () = @@ -158,7 +158,7 @@ type Config() = let xDoc = XDocument.Load(new StringReader(fsprojFileText)) let expected = this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""; "Buzz",""] let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) - TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) + TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) [] @@ -174,10 +174,10 @@ type Config() = let xDoc = XDocument.Load(new StringReader(fsprojFileText)) let expected = this.MSBuildProjectMultiPlatform ["x86",""] let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) - TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) + TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - + [] member this.``Configs.Platforms.Adding`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], @@ -191,7 +191,7 @@ type Config() = let xDoc = XDocument.Load(new StringReader(fsprojFileText)) let expected = this.MSBuildProjectMultiPlatform ["Any CPU",""; "x86",""; "x64",""] let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) - TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) + TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) @@ -208,6 +208,6 @@ type Config() = let xDoc = XDocument.Load(new StringReader(fsprojFileText)) let expected = this.MSBuildProjectMultiPlatform ["Any CPU",""; "x86",""; "x64",""] let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) - TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) + TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs index 6c49aff3641..e4365907c94 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs @@ -10,7 +10,7 @@ open System.IO open System.Text open System.Text.RegularExpressions -// VS namespaces +// VS namespaces open Microsoft.VisualStudio open Microsoft.VisualStudio.Shell open Microsoft.VisualStudio.Shell.Interop @@ -24,7 +24,7 @@ open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -type Miscellaneous() = +type Miscellaneous() = inherit TheTests() //TODO: look for a way to remove the helper functions @@ -33,7 +33,7 @@ type Miscellaneous() = static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working + //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working member public this.EnsureThatUnhandledExceptionsCauseAnAssert() = this.MakeProjectAndDo([], ["System"], "", (fun proj -> let t = new System.Threading.Thread(new System.Threading.ThreadStart(fun () -> failwith "foo")) @@ -45,40 +45,40 @@ type Miscellaneous() = member public this.``Miscellaneous.CreatePropertiesObject`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) - use project = TheTests.CreateProject(projFile) + use project = TheTests.CreateProject(projFile) let prop = project.CreatePropertiesObject() Assert.Equal(typeof, prop.GetType()) ) - + [] member public this.``Miscellaneous.TestProperties`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) - use project = TheTests.CreateProject(projFile) + use project = TheTests.CreateProject(projFile) let prop = new FSharpProjectNodeProperties(project) - + prop.AssemblyName <- "a" - Assert.Equal("a", prop.AssemblyName) - + Assert.Equal("a", prop.AssemblyName) + // Output type and output file name prop.OutputType <- OutputType.Exe Assert.Equal(OutputType.Exe, prop.OutputType) Assert.Equal("a.exe", prop.OutputFileName) - + prop.OutputType <- OutputType.Library Assert.Equal(OutputType.Library, prop.OutputType) Assert.Equal("a.dll", prop.OutputFileName) - + prop.OutputType <- OutputType.WinExe Assert.Equal(OutputType.WinExe, prop.OutputType) Assert.Equal("a.exe", prop.OutputFileName) - ) - + ) + [] member public this.``Miscellaneous.CreateServices`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) - use project = TheTests.CreateProject(projFile) + use project = TheTests.CreateProject(projFile) let proj = project.CreateServices(typeof) Assert.Equal(typeof, proj.GetType()) let eproj = project.CreateServices(typeof) @@ -86,7 +86,7 @@ type Miscellaneous() = let badservice = project.CreateServices(typeof) Assert.Null(badservice) ) - + [] member public this.``Miscellaneous.FSharpFileNode.RelativeFilePath`` () = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> @@ -98,7 +98,7 @@ type Miscellaneous() = let path = file.RelativeFilePath Assert.Equal("orig1.fs", path) )) - + [] member public this.``Miscellaneous.FSharpFileNode.CreateServices`` () = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> @@ -113,8 +113,8 @@ type Miscellaneous() = Assert.Equal(typeof, eproj.GetType()) )) - - //[] + + //[] member public this.AttemptDragAndDrop() = printfn "starting..." let fsproj = "D:\Depot\staging\Test.fsproj" @@ -151,20 +151,20 @@ type Miscellaneous() = while not finished do match node with | :? FSharpFileNode as fileNode -> - printfn "file %s" fileNode.FileName + printfn "file %s" fileNode.FileName if fileNode.FileName = "aaa.fs" then finished <- true | _ -> - node <- node.NextSibling + node <- node.NextSibling if node = null then finished <- true Assert.NotEqual(node, null) let itemId = node.ID - + project.DragEnter(iOleDataObject, keyboardState, itemId, &dwEffect) |> ignore () - + [] member public this.``Automation.OutputGroup.OUTPUTLOC``() = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], @@ -197,7 +197,7 @@ type Miscellaneous() = File.AppendAllText(file, text) let dirName = Path.GetDirectoryName(file) let sp, cnn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier() - let project = TheTests.CreateProject(file, "false", cnn, sp) + let project = TheTests.CreateProject(file, "false", cnn, sp) use project = project let prjCfg = project.ConfigProvider.GetProjectConfiguration(new ConfigCanonicalName("Debug","AnyCPU")) :> IVsProjectCfg2 let count = [| 0u |] @@ -205,28 +205,28 @@ type Miscellaneous() = let ogs : IVsOutputGroup array = Array.create (int count.[0]) null prjCfg.get_OutputGroups(count.[0], ogs, count) |> ValidateOK let ogs : IVsOutputGroup2 array = ogs |> Array.map (fun x -> downcast x) - let ogInfos = + let ogInfos = [for og in ogs do let mutable canonicalName = "" og.get_CanonicalName(&canonicalName) |> ValidateOK let mutable description = "" - og.get_Description(&description) |> ValidateOK + og.get_Description(&description) |> ValidateOK let mutable displayName = "" - og.get_DisplayName(&displayName) |> ValidateOK + og.get_DisplayName(&displayName) |> ValidateOK let mutable keyOutput = "" let keyOutputResult = og.get_KeyOutput(&keyOutput) let count = [| 0u |] - og.get_Outputs(0u, null, count) |> ValidateOK + og.get_Outputs(0u, null, count) |> ValidateOK let os : IVsOutput2 array = Array.create (int count.[0]) null - og.get_Outputs(count.[0], os, count) |> ValidateOK + og.get_Outputs(count.[0], os, count) |> ValidateOK yield canonicalName, description, displayName, keyOutput, keyOutputResult, [ for o in os do let mutable canonicalName = "" - o.get_CanonicalName(&canonicalName) |> ValidateOK + o.get_CanonicalName(&canonicalName) |> ValidateOK let mutable url = "" - o.get_DeploySourceURL(&url) |> ValidateOK + o.get_DeploySourceURL(&url) |> ValidateOK let mutable displayName = "" - o.get_DisplayName(&displayName) |> ValidateOK + o.get_DisplayName(&displayName) |> ValidateOK let mutable relativeUrl = "" o.get_RootRelativeURL(&relativeUrl) |> ValidateOK yield canonicalName, url, displayName, relativeUrl] @@ -261,25 +261,25 @@ type Miscellaneous() = [] member public this.``BuildAndClean``() = - this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], - this.MSBuildProjectBoilerplate "Library", + this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], + this.MSBuildProjectBoilerplate "Library", (fun project ccn projFileName -> let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllLines(fooPath, ["module Foo"]) - + //ccn((project :> IVsHierarchy), "Debug|Any CPU") - let configName = "Debug" + let configName = "Debug" let (hr, configurationInterface) = project.ConfigProvider.GetCfgOfName(configName, ProjectConfig.Any_CPU) AssertEqual VSConstants.S_OK hr let config = configurationInterface :?> ProjectConfig let (hr, vsBuildableCfg) = config.get_BuildableProjectCfg() let buildableCfg = vsBuildableCfg :?> BuildableProjectConfig AssertEqual VSConstants.S_OK hr - + let mutable isCleaning = false let mutable success = false use event = new System.Threading.ManualResetEvent(false) - let (hr, cookie) = + let (hr, cookie) = buildableCfg.AdviseBuildStatusCallback( { new IVsBuildStatusCallback with member this.BuildBegin pfContinue = pfContinue <- 1; VSConstants.S_OK @@ -308,7 +308,7 @@ type Miscellaneous() = doBuild "Build" AssertEqual true (File.Exists (Path.Combine(project.ProjectFolder, "bin\\Debug\\Blah.dll"))) printfn "Output files present." - + isCleaning <- true printfn "Cleaning..." doBuild "Clean" @@ -318,8 +318,8 @@ type Miscellaneous() = finally buildableCfg.UnadviseBuildStatusCallback(cookie) |> AssertEqual VSConstants.S_OK )) - - + + //KnownFail: [] member public this.``ErrorReporting.EmptyModuleReportedAtTheLastLine``() = let (outputWindowPaneErrors : string list ref) = ref [] // output window pane errors @@ -332,21 +332,21 @@ type Miscellaneous() = File.AppendAllText(projFile, TheTests.SimpleFsprojText(compileItem, [], "")) use project = TheTests.CreateProject(projFile) let srcFile = (Path.GetDirectoryName projFile) + "\\" + "foo.fs" - File.AppendAllText(srcFile, "let foo () =\n printfn \"A\"\n") + File.AppendAllText(srcFile, "let foo () =\n printfn \"A\"\n") project.BuildToOutput("Build", vso, null) |> ignore // Build the project using vso as the output logger - let errors = List.filter (fun (s:string) -> s.Contains(expectedError)) !outputWindowPaneErrors + let errors = List.filter (fun (s:string) -> s.Contains(expectedError)) !outputWindowPaneErrors AssertEqual 1 (List.length errors) - ) + ) member public this.``DebuggingDLLFailsFunc``() = - this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], - this.MSBuildProjectBoilerplate "Library", + this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], + this.MSBuildProjectBoilerplate "Library", (fun project ccn projFileName -> ccn((project :> IVsHierarchy), "Debug|Any CPU") let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") let mutable configurationInterface : IVsCfg = null let hr = project.ConfigProvider.GetCfgOfName("Debug", "Any CPU", &configurationInterface) - AssertEqual VSConstants.S_OK hr + AssertEqual VSConstants.S_OK hr let config = configurationInterface :?> ProjectConfig config.DebugLaunch(0ul) |> ignore () @@ -358,8 +358,8 @@ type Miscellaneous() = [] member public this.``DebuggingEXESucceeds``() = - this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], - this.MSBuildProjectBoilerplate "Exe", + this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], + this.MSBuildProjectBoilerplate "Exe", (fun project ccn projFileName -> ccn((project :> IVsHierarchy), "Debug|Any CPU") let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") @@ -378,14 +378,14 @@ type Miscellaneous() = | _ -> failwith "" // DmiLom: Currently DebugLaunch() swallows most exceptions, in future if we improve DebugLaunch() we will expect it to throw a particular exception here () )) - + [] member public this.``IsDocumentInProject`` () = DoWithTempFile "Test.fsproj" (fun file -> - let fakeCsLibProjectFile = @"..\CsLib\CsLib.csproj" + let fakeCsLibProjectFile = @"..\CsLib\CsLib.csproj" File.AppendAllText(file, TheTests.FsprojTextWithProjectReferences(["foo.fs"; @"bar\baz.fs"],["System.dll";"Foo.Bar.Baz.dll"],[fakeCsLibProjectFile],"")) let sp, cnn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier() - let project = TheTests.CreateProject(file, "false", cnn, sp) + let project = TheTests.CreateProject(file, "false", cnn, sp) use project = project let checkInProject shouldBeInProject relPath = let mkDoc = Path.Combine(project.ProjectFolder, relPath) @@ -414,26 +414,26 @@ type Miscellaneous() = let regexStr = "" TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText // ensure it runs - let outputWindowPaneErrors : string list ref = ref [] + let outputWindowPaneErrors : string list ref = ref [] let vso = VsMocks.vsOutputWindowPane(outputWindowPaneErrors) let srcFile = (Path.GetDirectoryName projFileName) + "\\" + "foo.fs" - File.AppendAllText(srcFile, "let x = 5\n") + File.AppendAllText(srcFile, "let x = 5\n") project.BuildToOutput("Build", vso, null) |> ignore // Build the project using vso as the output logger printfn "Build output:" !outputWindowPaneErrors |> Seq.iter (printfn "%s") - let expectedRegex = new Regex("\\s*ProjectExt\\[.fsproj\\]") + let expectedRegex = new Regex("\\s*ProjectExt\\[.fsproj\\]") Assert.True(!outputWindowPaneErrors |> List.exists (fun s -> expectedRegex.IsMatch(s)), "did not see expected value in build output") )) - + [] - member public this.``BuildMacroValues`` () = + member public this.``BuildMacroValues`` () = let logger (message:string) = System.IO.File.AppendAllText(@"c:\temp\logfile.txt", (message + Environment.NewLine)) DoWithTempFile "MyAssembly.fsproj" (fun file -> File.AppendAllText(file, TheTests.FsprojTextWithProjectReferences([],[],[],"")) let sp, cnn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier() - use project = TheTests.CreateProject(file, "false", cnn, sp) + use project = TheTests.CreateProject(file, "false", cnn, sp) let targetPath = project.GetBuildMacroValue("TargetPath") let expectedTargetPath = Path.Combine(Path.GetDirectoryName(file), @"bin\Debug\MyAssembly.exe") AssertEqual expectedTargetPath targetPath @@ -458,7 +458,7 @@ type Miscellaneous() = Assert.NotNull(solutionExt) Assert.False ( (solutionExt = "*Undefined*"), "SolutionExt not defined") ) - + [] member public this.CreateFSharpManifestResourceName () = DoWithTempFile "Test.fsproj" (fun file -> @@ -467,11 +467,11 @@ type Miscellaneous() = let result = Salsa.Salsa.CreateFSharpManifestResourceName file "" "" |> List.sort let expected = ["Abc.resources", "Abc.resources"; - "Bar.de.resx", "Bar.de"; - "Bar.resx", "Bar"; + "Bar.de.resx", "Bar.de"; + "Bar.resx", "Bar"; "Xyz\Baz.ru.resx", "Xyz.Baz.ru"] |> List.sort if expected <> result then - Assert.Fail ((sprintf "%A" expected) + "<>" + (sprintf "%A" result)) + Assert.Fail ((sprintf "%A" expected) + "<>" + (sprintf "%A" result)) () ) @@ -501,9 +501,9 @@ type Miscellaneous() = prompt 3 ", - fun project configChangeNotifier projFile -> + fun project configChangeNotifier projFile -> let projFileText = File.ReadAllText(projFile) - // We need to add text _after_ the import of Microsoft.FSharp.Targets. + // We need to add text _after_ the import of Microsoft.FSharp.Targets. let i = projFileText.IndexOf("", i) let newProjFileText = projFileText.Insert(i+1, @" @@ -532,7 +532,7 @@ type Miscellaneous() = member public this.TestBuildActions () = DoWithTempFile "Test.fsproj" (fun file -> let text = TheTests.FsprojTextWithProjectReferences(["foo.fs";"Bar.resx"; "Bar.de.resx"; "Xyz\Baz.ru.resx"; "Abc.resources"],[],[],"") - + File.AppendAllText(file, text) let dirName = Path.GetDirectoryName(file) let targetsFile = Path.Combine(dirName, "My.targets") @@ -545,14 +545,14 @@ type Miscellaneous() = " File.AppendAllText(targetsFile, targetsText) let sp, cnn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier() - let project = TheTests.CreateProject(file, "false", cnn, sp) + let project = TheTests.CreateProject(file, "false", cnn, sp) use project = project let values = project.BuildActionConverter.GetStandardValues() let list = values |> Seq.cast |> Seq.map (fun (ba : BuildAction)-> ba.Name) |> Seq.toList - // expected list of build actions is union of standard actions, custom actions, and "extended" standard actions + // expected list of build actions is union of standard actions, custom actions, and "extended" standard actions // this is not exhaustive (exhaustive list is not static), but covers the main equivalence classes let expected = ["Compile"; "Content"; "EmbeddedResource"; "None"; "MyBuildAction"; "MyBuildAction3"; "Resource"] - if expected |> List.forall (fun i -> List.exists ((=)i) list) |> not then + if expected |> List.forall (fun i -> List.exists ((=)i) list) |> not then let s0 = sprintf "%A" expected let s1 = sprintf "%A" list Assert.Fail(s0 + "<>" + s1) @@ -564,12 +564,12 @@ type Miscellaneous() = let replace (pattern:string) (replacement:string) (input:string) = Regex.Replace(input, pattern, replacement) - let getBuildableNodeProps project caption = + let getBuildableNodeProps project caption = let node = TheTests.FindNodeWithCaption (project, caption) let props = node.CreatePropertiesObject() props :?> BuildableNodeProperties - let checkNotStandardBuildAction buildAction = + let checkNotStandardBuildAction buildAction = Assert.False(VSLangProj.prjBuildAction.prjBuildActionNone = buildAction, "Unexpected None match") Assert.False(VSLangProj.prjBuildAction.prjBuildActionCompile = buildAction, "Unexpected Compile match") Assert.False(VSLangProj.prjBuildAction.prjBuildActionContent = buildAction, "Unexpected Content match") @@ -578,7 +578,7 @@ type Miscellaneous() = DoWithTempFile "Test.fsproj" (fun file -> let text = TheTests.FsprojTextWithProjectReferences(["Compile.fs"; "None.fs"; "Resource.fs"; "SplashScreen.fs"; "Dude.fs"],[],[],"") - |> replace "Compile\s+Include='([a-zA-Z]+)\.fs'" "$1 Include='$1.fs'" + |> replace "Compile\s+Include='([a-zA-Z]+)\.fs'" "$1 Include='$1.fs'" File.AppendAllText(file, text) let sp, cnn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier() let project = TheTests.CreateProject(file, "false", cnn, sp) @@ -629,7 +629,7 @@ type Miscellaneous() = AssertEqual "Compile" e.ItemType Assert.True(exceptionThrown) ) - + [] member this.``WildcardsInProjectFile.OkCase`` () = DoWithTempFile "Test.fsproj"(fun file -> @@ -639,7 +639,7 @@ type Miscellaneous() = let fileName = Path.Combine(dirName, "Foo.fs") File.AppendAllText(fileName, "do ()") let sp, cnn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier() - let project = TheTests.CreateProject(file, "false", cnn, sp) + let project = TheTests.CreateProject(file, "false", cnn, sp) try project.ComputeSourcesAndFlags() let items = project.CompilationSourceFiles |> Array.toList @@ -653,12 +653,12 @@ type Miscellaneous() = project.Close() |> ignore ) -type Utilities() = +type Utilities() = (* Simulation of the code found in Xaml editor that we were crashing. The relevent code is pasted below. Note that they're assuming PKT is eight bytes. This need not be true and we don't enforce it from our side. We're just going to make sure to send an even number of characters (two per-byte). - + private static AssemblyName EnsureAssemblyName(Reference r) { if (r.Type != prjReferenceType.prjReferenceTypeAssembly) return null; @@ -669,9 +669,9 @@ type Utilities() = AssemblyName an = new AssemblyName(); // Reference.Name does not have to be the actual assembly name here (seen in Project ref cases) - // Identity (for Reference.Type == prjReferenceType.prjReferenceTypeAssembly) is the assembly name + // Identity (for Reference.Type == prjReferenceType.prjReferenceTypeAssembly) is the assembly name // without path or extension and is reserved so it can't be set in the project file by users - an.Name = r.Identity; + an.Name = r.Identity; an.CultureInfo = new CultureInfo(r.Culture); an.Version = new Version( r.MajorVersion, @@ -702,17 +702,17 @@ type Utilities() = return an; } - - - + + + *) - - let SimulateXamlEditorReceivingThroughDTE(publicToken:string) = + + let SimulateXamlEditorReceivingThroughDTE(publicToken:string) = printfn "Simulating xaml pkt parsing for %s" publicToken // ---------------------------------------------------------------------------------------------------- // Don't change code between these lines. Its simulating external code. // ---------------------------------------------------------------------------------------------------- - let ParseOneByte(i:int) = + let ParseOneByte(i:int) = let byteString = publicToken.Substring(i * 2, 2) System.Byte.Parse(byteString, NumberStyles.HexNumber, CultureInfo.InvariantCulture) |> ignore [0..7] |> List.iter ParseOneByte @@ -725,7 +725,7 @@ type Utilities() = [] member public this.``PublicKeyToken.0000000000000000``() = CheckPublicKeyToString([|0uy;0uy;0uy;0uy;0uy;0uy;0uy;0uy|], "0000000000000000") - + [] member public this.``PublicKeyToken.0000000000000001``() = CheckPublicKeyToString([|0uy;0uy;0uy;0uy;0uy;0uy;0uy;1uy|], "0000000000000001") @@ -733,7 +733,7 @@ type Utilities() = member public this.``PublicKeyToken.0a00000000000001``() = CheckPublicKeyToString([|0xauy;0uy;0uy;0uy;0uy;0uy;0uy;1uy|], "0a00000000000001") [] - member public this.``Parse MSBuild property of type Int64`` () = + member public this.``Parse MSBuild property of type Int64`` () = Assert.Equal(123L, ProjectNode.ParsePropertyValueToInt64("123").Value) Assert.Equal(255L, ProjectNode.ParsePropertyValueToInt64("0xFF").Value) Assert.Null(ProjectNode.ParsePropertyValueToInt64("")) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs index 9648701176b..23eadfe341f 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs @@ -16,9 +16,9 @@ open UnitTests.TestLib.ProjectSystem open Microsoft.VisualStudio.FSharp.ProjectSystem -type MultiTargeting() = +type MultiTargeting() = inherit TheTests() - + // Multitargeting tests. // For these test cases, we basically test adding a reference and checking the icon state. // It's worth pointing out that while we need a valid assembly, the version of the assembly @@ -63,14 +63,14 @@ type MultiTargeting() = let ref = l.[0] Assert.Equal(true, ref.CanShowDefaultIcon()) ) - + [] member public this.``Multitargeting.DetermineRuntimeAndSKU`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier40() let refLibPath = this.prepTest(projFile) use project = TheTests.CreateProject(projFile, "true", ccn, sp) - + let validate (fn : System.Runtime.Versioning.FrameworkName) eR eS = let (runtime, sku) = project.DetermineRuntimeAndSKU(fn.ToString()) Assert.Equal(eR, runtime) @@ -78,7 +78,7 @@ type MultiTargeting() = validate (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(4, 0))) "v4.0" ".NETFramework,Version=v4.0" validate (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(2, 0))) "v2.0.50727" null ) - + [] member public this.``Multitargeting.AppConfigNoStartupNode`` () = let root = XElement.Parse("") @@ -103,7 +103,7 @@ type MultiTargeting() = [] member public this.``Multitargeting.AppConfigVersionExistsRemoveSku`` () = let root = XElement.Parse("") - let dirty = LangConfigFile.PatchUpXml(root, "version", null) + let dirty = LangConfigFile.PatchUpXml(root, "version", null) Assert.True(dirty) Assert.True(root.ToString().Contains("")) @@ -146,10 +146,10 @@ type MultiTargeting() = member public this.``Multitargeting.AddAppConfigIfRetargetTo40Full`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier20() - + // add mock service for SLocalRegistry so that CreateInstance on it will return a text buffer sp.AddService (typeof, box(VsMocks.vsLocalRegistry (fun () -> VsMocks.Vs.MakeTextLines())), false) - + let refLibPath = this.prepTest(projFile) use project = TheTests.CreateProject(projFile, "true", ccn, sp) let fn = new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(4, 0)) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs index 56bde547a4e..98503c014e8 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs @@ -10,7 +10,7 @@ open System.Text.RegularExpressions open System.Xml.Linq open Xunit -// VS namespaces +// VS namespaces open Microsoft.VisualStudio open Microsoft.VisualStudio.Shell.Interop open Microsoft.VisualStudio.FSharp @@ -23,7 +23,7 @@ open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -type Project() = +type Project() = inherit TheTests() do @@ -36,7 +36,7 @@ type Project() = static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - [] + [] member public _.NewFolderOnProjectMenu() = printfn "starting..." let package = new FSharpProjectPackage() @@ -51,7 +51,7 @@ type Project() = AssertEqual x VSConstants.S_OK if (result &&& QueryStatusResult.ENABLED) <> QueryStatusResult.ENABLED then Assert.Fail("Unexpected: New Folder was not enabled") - () + () [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case1``() = @@ -69,13 +69,13 @@ type Project() = member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case2``() = let compileItems = [@"A\B\D\foo.fs"; @"A\B\C\bar.fs"] let expect = Tree("References", ANYTREE, - Tree("A", + Tree("A", Tree("B", - Tree("D", + Tree("D", Tree("foo.fs", Nil, Nil), Tree("C", Tree("bar.fs", Nil, Nil),Nil) - ), + ), Nil), Nil)) // no alphabetization of files or folders @@ -92,7 +92,7 @@ type Project() = let expect = Tree("References", ANYTREE, Tree("B", Tree("foo.fs", Nil, Nil), - Tree("A", + Tree("A", Tree("bar.fs", Nil, Nil), Nil ) @@ -111,7 +111,7 @@ type Project() = " let expect = Tree("References", ANYTREE, Tree("foo.fs", Nil, - Tree("A", + Tree("A", Tree("bar.fs", Nil, Nil), Nil ) @@ -135,7 +135,7 @@ type Project() = " let expect = Tree("References", ANYTREE, Tree("foo.fs", Nil, - Tree("A", + Tree("A", Tree("bar.fs", Nil, Tree("qux.fs", Nil, Nil) ), @@ -155,8 +155,8 @@ type Project() = project.AddLinkedItem(project, [| f |], Array.create 1 (new VSADDRESULT())) |> ValidateOK ) let expect = Tree("References", ANYTREE, - Tree("Folder", - Tree("foo.fs",Nil,Nil), + Tree("Folder", + Tree("foo.fs",Nil,Nil), Tree("bar.fs", Nil, Tree("qux.fs", Nil,Nil) ) @@ -181,7 +181,7 @@ type Project() = ) let expect = Tree("References", ANYTREE, Tree("bar.fs", Nil, - Tree("Folder", + Tree("Folder", Tree("foo.fs", Nil, Tree("qux.fs", Nil,Nil)), Nil))) TheTests.AssertSameTree(expect, project.FirstChild) @@ -204,8 +204,8 @@ type Project() = ) ) let expect = Tree("References", ANYTREE, - Tree("Folder", - Tree("foo.fs",Nil,Nil), + Tree("Folder", + Tree("foo.fs",Nil,Nil), Tree("bar.fs", Nil, Tree("qux.resx", Nil,Nil)))) TheTests.AssertSameTree(expect, project.FirstChild) @@ -215,7 +215,7 @@ type Project() = let regexStr = @"\s*\s*\s*\s*qux.resx" TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - + [] member public this.``Removal.ExcludeFileShouldDirtyProjectFileAndBeSeenOnDiskAfterSave``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) @@ -295,10 +295,10 @@ type Project() = member this.SampleEntities = [CompileItem @"foo.fs"; FolderItem @"AnEmptyFolder\"; LinkedCompileItem(@"..\blah.fs", @"link.fs"); OtherItem(@"Content", @"foo.txt")] member private this.SampleFileEntity = ([CompileItem "bar.fs"], fun t -> Tree("bar.fs", Nil, t)) - + member private this.SampleEmptyFolderEntity = ([FolderItem @"MyFolder\"], fun t -> Tree("MyFolder", Nil, t)) - member private this.SampleFolderWithItemsEntity = ([CompileItem @"MyFolder\x1.fs"; CompileItem @"MyFolder\Sub\x2.fs"; CompileItem @"MyFolder\x3.fs"], + member private this.SampleFolderWithItemsEntity = ([CompileItem @"MyFolder\x1.fs"; CompileItem @"MyFolder\Sub\x2.fs"; CompileItem @"MyFolder\x3.fs"], fun t -> Tree("MyFolder",Tree("x1.fs", Nil, Tree("Sub", Tree("x2.fs", Nil, Nil), Tree("x3.fs", Nil, Nil))), t)) [] @@ -309,19 +309,19 @@ type Project() = let WithAttrName name seq = Seq.filter (fun (e:XAttribute) -> e.Name.LocalName = name) seq let system = TheTests.FindNodeWithCaption(project, "System") let system = system :?> AssemblyReferenceNode - let a = [| false, (fun (e:XElement) -> + let a = [| false, (fun (e:XElement) -> let expected = XDocument.Load(new StringReader(@"False")).Root TheTests.AssertSimilarXml(expected, e)) - true, (fun (e:XElement) -> + true, (fun (e:XElement) -> let expected = XDocument.Load(new StringReader(@"True")).Root TheTests.AssertSimilarXml(expected, e) let inc = e.Attributes() |> WithAttrName "Include" |> Seq.head Assert.True(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) - false, (fun (e:XElement) -> + false, (fun (e:XElement) -> let expected = XDocument.Load(new StringReader(@"False")).Root TheTests.AssertSimilarXml(expected, e) let inc = e.Attributes() |> WithAttrName "Include" |> Seq.head - Assert.True(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) + Assert.True(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) |] let props = system.NodeProperties :?> AssemblyReferenceProperties for v, f in a do @@ -330,11 +330,11 @@ type Project() = SaveProject(project) let fsprojFileText = File.ReadAllText(fileName) let xDoc = XDocument.Load(new StringReader(fsprojFileText)) - let refNode = xDoc.Descendants() |> WithName "Reference" |> Seq.head + let refNode = xDoc.Descendants() |> WithName "Reference" |> Seq.head printfn "%s" fsprojFileText f refNode )) - + [] member public this.``FsprojFileToSolutionExplorer.FileRenaming.RenamingAFileDoesNotChangeOrderInSolutionExplorerOrMSBuild``() = for entity, treeMaker in [this.SampleFileEntity; this.SampleEmptyFolderEntity] do @@ -353,7 +353,7 @@ type Project() = let expect = Tree("References", ANYTREE, Tree("zzz.fs", Nil, treeMaker(Nil))) - TheTests.AssertSameTree(expect, project.FirstChild) + TheTests.AssertSameTree(expect, project.FirstChild) // test that it did not move in MSBuild SaveProject(project) let fsprojFileText = File.ReadAllText(fileName) @@ -382,7 +382,7 @@ type Project() = let expect = Tree("References", ANYTREE, Tree(entity.Caption(), Nil, otherTreeMaker(Nil))) - TheTests.AssertSameTree(expect, project.FirstChild) + TheTests.AssertSameTree(expect, project.FirstChild) // test that it moved up in MSBuild SaveProject(project) let fsprojFileText = File.ReadAllText(fileName) @@ -423,7 +423,7 @@ type Project() = let expect = Tree("References", ANYTREE, otherTreeMaker( Tree(entity.Caption(), Nil, Nil))) - TheTests.AssertSameTree(expect, project.FirstChild) + TheTests.AssertSameTree(expect, project.FirstChild) // test that it moved down in MSBuild SaveProject(project) let fsprojFileText = File.ReadAllText(fileName) @@ -454,7 +454,7 @@ type Project() = // ensure things look right at start let expect = Tree("References", ANYTREE, otherTreeMaker( - Tree("A", + Tree("A", Tree("foo.fs", Nil, Tree("B", Tree("qux.fs", Nil, Nil), @@ -468,7 +468,7 @@ type Project() = TheTests.MoveUp(foo) // test that it moved up in solution explorer let expect = Tree("References", ANYTREE, - Tree("A", + Tree("A", Tree("foo.fs", Nil, Tree("B", Tree("qux.fs", Nil, Nil), @@ -476,7 +476,7 @@ type Project() = Tree("zot.fs", Nil, Nil)))), otherTreeMaker( Tree("after.fs", Nil, Nil)))) - TheTests.AssertSameTree(expect, project.FirstChild) + TheTests.AssertSameTree(expect, project.FirstChild) // test that it moved up in MSBuild SaveProject(project) let fsprojFileText = File.ReadAllText(fileName) @@ -522,14 +522,14 @@ type Project() = // test that it moved down in solution explorer let expect = Tree("References", ANYTREE, otherTreeMaker( - Tree("A", + Tree("A", Tree("foo.fs", Nil, Tree("B", Tree("qux.fs", Nil, Nil), Tree("Empty", Nil, Tree("zot.fs", Nil, Nil)))), Tree("after.fs", Nil, Nil)))) - TheTests.AssertSameTree(expect, project.FirstChild) + TheTests.AssertSameTree(expect, project.FirstChild) // test that it moved down in MSBuild SaveProject(project) let fsprojFileText = File.ReadAllText(fileName) @@ -602,7 +602,7 @@ type Project() = try ErrorHandler.ThrowOnFailure(orig1.SetEditLabel("orig2.fs")) |> ignore // rename the file Assert.Fail("expected an exception") - with + with | e -> printfn "Got expected exception: %s" e.Message SaveProject(project) // TODO ensure no events were fired @@ -616,7 +616,7 @@ type Project() = finally File.Delete(absFilePath) )) - + [] member public this.``RenameFile.FailureToRenameInRDT.Bug616680.EnsureThatFileOrderDidNotChange``() = this.MakeProjectAndDo(["a.fs";"b.fs";"orig1.fs";"c.fs";"d.fs"], [], "", (fun project -> @@ -629,7 +629,7 @@ type Project() = try ErrorHandler.ThrowOnFailure(orig1.SetEditLabel("orig2.fs")) |> ignore // rename the file Assert.Fail("expected an exception") - with + with | e -> printfn "Got expected exception: %s" e.Message SaveProject(project) // TODO ensure no events were fired @@ -640,7 +640,7 @@ type Project() = let expect = Tree("References", ANYTREE, Tree("a.fs", Nil, Tree("b.fs", Nil, - Tree("orig1.fs", Nil, + Tree("orig1.fs", Nil, Tree("c.fs", Nil, Tree("d.fs", Nil, Nil)))))) TheTests.AssertSameTree(expect, project.FirstChild) @@ -660,16 +660,16 @@ type Project() = VsMocks.vsRunningDocumentTableFindAndLockDocumentVsHierarchyMock <- project try ErrorHandler.ThrowOnFailure(orig1.SetEditLabel(name2)) |> ignore // rename the file - with + with | e -> Assert.Fail("no exception expected") let orig2 = TheTests.FindNodeWithCaption(project, name2) AssertEqual orig1.ID orig2.ID - + finally File.Delete(absFilePath) )) - + [] member public this.``RenameFile.MainlineSuccessCase``() = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> @@ -680,7 +680,7 @@ type Project() = VsMocks.vsRunningDocumentTableFindAndLockDocumentVsHierarchyMock <- project try ErrorHandler.ThrowOnFailure(orig1.SetEditLabel("orig2.fs")) |> ignore // rename the file - with + with | e -> Assert.Fail("no exception expected") SaveProject(project) // TODO ensure IVsHierarchyEvents Delete/Add was fired @@ -695,7 +695,7 @@ type Project() = finally File.Delete(absFilePath) )) - + [] //ref bug https://github.com/dotnet/fsharp/issues/259 member public this.``RenameFile.InFolder``() = this.MakeProjectAndDo(["file1.fs"; @"Folder1\file2.fs"; @"Folder1\nested1.fs"], [], "", (fun project -> @@ -706,14 +706,14 @@ type Project() = let orig1 = TheTests.FindNodeWithCaption(project, "nested1.fs") let folder1 = TheTests.FindNodeWithCaption(project, "Folder1") VsMocks.vsRunningDocumentTableFindAndLockDocumentVsHierarchyMock <- project - + let added, deleted = ResizeArray(), ResizeArray() - let sink = + let sink = { new IVsHierarchyEvents with member x.OnInvalidateIcon _hicon = VSConstants.S_OK member x.OnInvalidateItems _itemidParent = VSConstants.S_OK - member x.OnItemAdded (itemidParent, itemidSiblingPrev, itemidAdded) = + member x.OnItemAdded (itemidParent, itemidSiblingPrev, itemidAdded) = added.Add(itemidParent, itemidSiblingPrev, itemidAdded) VSConstants.S_OK member x.OnItemDeleted (itemid) = @@ -745,10 +745,10 @@ type Project() = AssertEqual ["file1.fs"; @"Folder1\file2.fs"; @"Folder1\renamedNested2.fs"] msbuildInfo // ensure right in solution explorer - let expect = + let expect = Tree("References", ANYTREE, Tree("file1.fs", Nil, - Tree("Folder1", + Tree("Folder1", Tree("file2.fs", Nil, Tree("renamedNested2.fs", Nil, Nil)), Nil))) TheTests.AssertSameTree (expect, project.FirstChild) @@ -756,7 +756,7 @@ type Project() = finally if File.Exists(absFilePath) then File.Delete(absFilePath) )) - + (* Disabled for now - see https://github.com/dotnet/fsharp/pull/3071 - this is testing old project system features [] @@ -811,25 +811,25 @@ type Project() = VsMocks.vsRunningDocumentTableFindAndLockDocumentVsHierarchyMock <- project try ErrorHandler.ThrowOnFailure(node.SetEditLabel(Path.GetFileName(newFileName))) |> ignore // rename the file - with + with | e -> Assert.Fail("no exception expected, but got " + e.ToString()) - + // check that the OM has the updated build action let node = TheTests.FindNodeWithCaption(project, Path.GetFileName(newFileName)) :?> FSharpFileNode - let props = node.NodeProperties :?> FSharpFileNodeProperties + let props = node.NodeProperties :?> FSharpFileNodeProperties AssertEqual buildAction (GetTextFromBuildAction props.BuildAction) - + // check that the build action in the .fsproj file has the expected value SaveProject(project) let fsprojFileText = File.ReadAllText(Absolutize project.ProjectFile) printfn "%s" fsprojFileText let expectedRegexStr = "<" + buildAction + " Include=\"" + Path.GetFileName(newFileName) + "\" />" TheTests.HelpfulAssertMatches '<' expectedRegexStr fsprojFileText - + currentAbsoluteFilePath <- newFileName finally VsMocks.vsUIShellShowMessageBoxResult <- None - File.Delete(currentAbsoluteFilePath) + File.Delete(currentAbsoluteFilePath) )) *) @@ -840,19 +840,19 @@ type Project() = let vso = VsMocks.vsOutputWindowPane(outputWindowPaneErrors) let compileItem = ["foo.fs"] let expectedError = "foo\.fs\(1,1\): error FS0039: The value or constructor 'bar' is not defined." // expected error - + DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText(compileItem, [], "")) use project = TheTests.CreateProject(projFile) let srcFile = (Path.GetDirectoryName projFile) + "\\" + "foo.fs" File.AppendAllText(srcFile, "bar") ; // foo.fs will be cleaned up by parent call to DoWithTempFile project.BuildToOutput("Build", vso, null) |> ignore // Build the project using vso as the output logger - + let errors = List.filter (fun s -> (new Regex(expectedError)).IsMatch(s)) !outputWindowPaneErrors - + for e in errors do printfn "Output Window Pane Error: %s" e - + // there should be one and only one error for 'bar', located at (1,1) AssertEqual (List.length errors) 1 ) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs index d13a0988faa..3810cf3691e 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs @@ -31,9 +31,9 @@ type Vs18OrNewerFactAttribute() = | _ -> base.Skip <- "Test requires Visual Studio 18.0 or newer (VISUALSTUDIOVERSION not set)" -type ProjectItems() = +type ProjectItems() = inherit TheTests() - + //TODO: look for a way to remove the helper functions static let ANYTREE = Tree("",Nil,Nil) @@ -43,7 +43,7 @@ type ProjectItems() = let listener = project.Site.GetService(typeof) :?> Salsa.VsMocks.IVsTrackProjectDocuments2Listener project.ComputeSourcesAndFlags() - let containsSystemNumerics () = + let containsSystemNumerics () = project.CompilationOptions |> Array.exists (fun f -> f.IndexOf("System.Numerics") <> -1) @@ -51,8 +51,8 @@ type ProjectItems() = Assert.True(containsSystemNumerics (), "Project should contains reference to System.Numerics") let refContainer = project.GetReferenceContainer() - let reference = - refContainer.EnumReferences() + let reference = + refContainer.EnumReferences() |> Seq.find(fun r -> r.SimpleName = "System.Numerics") ( use _guard = listener.OnAfterRemoveFiles.Subscribe(fun _ -> wasCalled <- true) @@ -60,7 +60,7 @@ type ProjectItems() = ) Assert.False(wasCalled, "No events from IVsTrackProjectDocuments2 are expected") - Assert.False(containsSystemNumerics(), "Project should not contains reference to System.Numerics") + Assert.False(containsSystemNumerics(), "Project should not contains reference to System.Numerics") )) [] @@ -94,7 +94,7 @@ type ProjectItems() = finally File.Delete(absFilePath) )) - + [] member public this.``AddNewItemBelow.ItemAppearsInRightSpot``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> @@ -117,7 +117,7 @@ type ProjectItems() = finally File.Delete(absFilePath) )) - + [] member public this.``AddNewItemAbove.ItemAppearsInRightSpot.Case1``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> @@ -140,7 +140,7 @@ type ProjectItems() = finally File.Delete(absFilePath) )) - + [] member public this.``AddNewItemAbove.ItemAppearsInRightSpot.Case2``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs index 265e4f4d9be..51ac453f2df 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs @@ -16,7 +16,7 @@ open Microsoft.VisualStudio.FSharp.ProjectSystem open Microsoft.VisualStudio.Shell.Interop open System.Xml.Linq -type References() = +type References() = inherit TheTests() //TODO: look for a way to remove the helper functions @@ -57,12 +57,12 @@ type References() = let systemRef = proj.FirstChild.FirstChild :?> AssemblyReferenceNode Assert.True(systemRef.CanShowDefaultIcon()) )) - + [] - member this.``AddReference.StarredAssemblyName`` () = + member this.``AddReference.StarredAssemblyName`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) - use project = TheTests.CreateProject(projFile) + use project = TheTests.CreateProject(projFile) let assemblyName = new AssemblyName(typeof.Assembly.FullName) let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus, bstrFile = "*" + assemblyName.FullName) let refContainer = GetReferenceContainerNode(project) @@ -70,7 +70,7 @@ type References() = let l = new List() project.FindNodesOfType(l) Assert.Equal(1, l.Count) - Assert.Equal("System.Windows.Forms", l.[0].Caption) + Assert.Equal("System.Windows.Forms", l.[0].Caption) SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText @@ -83,7 +83,7 @@ type References() = // Let's create a run-of-the-mill project just to have a spare assembly around this.CreateDummyTestProjectBuildItAndDo(fun exe -> Assert.True(File.Exists exe, "failed to build exe") - this.MakeProjectAndDoWithProjectFile(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], + this.MakeProjectAndDoWithProjectFile(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], ".\\Test.dll", "v4.0", (fun project file -> let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode Assert.False(assemRef.CanShowDefaultIcon(), "reference should be banged out, does not resolve") @@ -100,7 +100,7 @@ type References() = // Let's create a run-of-the-mill project just to have a spare assembly around this.CreateDummyTestProjectBuildItAndDo(fun exe -> Assert.True(File.Exists exe, "failed to build exe") - this.MakeProjectAndDoWithProjectFile(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], + this.MakeProjectAndDoWithProjectFile(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], sprintf "%s" exe, "v4.0", (fun project file -> let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode Assert.True(assemRef.CanShowDefaultIcon(), "reference should not be banged out, does resolve") @@ -198,11 +198,11 @@ type References() = member this.ReferenceResolutionHelper(tab : AddReferenceDialogTab, fullPath : string, expectedFsprojRegex : string) = this.ReferenceResolutionHelper(tab, fullPath, expectedFsprojRegex, "v4.0", []) - + member this.ReferenceResolutionHelper(tab : AddReferenceDialogTab, fullPath : string, expectedFsprojRegex : string, targetFrameworkVersion : string, originalReferences : string list) = // Trace.Log <- "ProjectSystemReferenceResolution" // can be useful this.MakeProjectAndDo(["doesNotMatter.fs"], originalReferences, "", targetFrameworkVersion, (fun project -> - let cType = + let cType = match tab with | AddReferenceDialogTab.DotNetTab -> VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus | AddReferenceDialogTab.BrowseTab -> VSCOMPONENTTYPE.VSCOMPONENTTYPE_File @@ -220,21 +220,21 @@ type References() = member this.``ReferenceResolution.Bug4423.FxAssembly.NetTab.AddDuplicate1``() = let netDir = currentFrameworkDirectory try - this.ReferenceResolutionHelper(AddReferenceDialogTab.DotNetTab, - Path.Combine(netDir, "System.ServiceModel.Web.dll"), + this.ReferenceResolutionHelper(AddReferenceDialogTab.DotNetTab, + Path.Combine(netDir, "System.ServiceModel.Web.dll"), @"whatever, expectation does not matter, will throw before then", "v4.0", ["System.ServiceModel.Web"]) // assembly name Assert.Fail("adding a duplicate reference should have failed") - with e -> + with e -> TheTests.HelpfulAssertMatches ' ' "A reference to '.*' \\(with assembly name '.*'\\) could not be added. A reference to the component '.*' with the same assembly name already exists in the project." e.Message // see 5491 [] member this.``ReferenceResolution.Bug4423.FxAssembly.NetTab.AddDuplicate2``() = let netDir = currentFrameworkDirectory try - this.ReferenceResolutionHelper(AddReferenceDialogTab.DotNetTab, - Path.Combine(netDir, "System.ServiceModel.Web.dll"), + this.ReferenceResolutionHelper(AddReferenceDialogTab.DotNetTab, + Path.Combine(netDir, "System.ServiceModel.Web.dll"), @"whatever, expectation does not matter, will throw before then", "v4.0", ["System.ServiceModel.Web.dll"]) // filename @@ -253,7 +253,7 @@ type References() = + @"\s*" this.MakeProjectAndDo(["bar.fs"], [], "", "v4.5", (fun project -> let exeCopy = Path.Combine(project.ProjectFolder, "Test.exe") - File.Copy(exe, exeCopy, true) + File.Copy(exe, exeCopy, true) Assert.True(File.Exists exeCopy, "failed to build exe") let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exeCopy) let refContainer = GetReferenceContainerNode(project) @@ -265,7 +265,7 @@ type References() = // Finally, ensure that the reference works as expected project.Reload() let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode - Assert.True(assemRef.CanShowDefaultIcon(), "the reference could not be resolved") + Assert.True(assemRef.CanShowDefaultIcon(), "the reference could not be resolved") // Use the referenced DLL as a double-check let barPath = Path.Combine(project.ProjectFolder, "bar.fs") File.AppendAllText(barPath, "printfn \"%d\" Foo.Bar.x") // code that requires the referenced assembly to successfully compile @@ -277,7 +277,7 @@ type References() = [] member this.``ReferenceResolution.Bug4423.NonFxAssembly.BrowseTab.RelativeHintPath.OutsideProjectDir``() = this.MakeProjectAndDo(["foo.fs"], [], "", (fun project -> - // Let's create a run-of-the-mill + // Let's create a run-of-the-mill let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "namespace Foo\nmodule Bar =\n let x = 42") let buildResult = project.Build("Build") @@ -299,7 +299,7 @@ type References() = // Finally, ensure that the reference works as expected project.Reload() let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode - Assert.True(assemRef.CanShowDefaultIcon(), "the reference could not be resolved") + Assert.True(assemRef.CanShowDefaultIcon(), "the reference could not be resolved") // Use the referenced DLL as a double-check let barPath = Path.Combine(project.ProjectFolder, "bar.fs") File.AppendAllText(barPath, "printfn \"%d\" Foo.Bar.x") // code that requires the referenced assembly to successfully compile @@ -335,7 +335,7 @@ type References() = let refLibPath = Path.Combine(libDirName, Path.GetFileName(executingAssemblyPath)) File.Copy(executingAssemblyPath, refLibPath) File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [refLibPath], "")) - use project = TheTests.CreateProject(projFile) + use project = TheTests.CreateProject(projFile) let l = new List() project.FindNodesOfType(l) AssertEqual 1 l.Count @@ -365,7 +365,7 @@ type References() = ["$(LetterS)ystem.dll"; "System.Net.dll"], // [], // "S")) // other stuff - use project = TheTests.CreateProject(projFile) + use project = TheTests.CreateProject(projFile) let l = new List() project.FindNodesOfType(l) AssertEqual 2 l.Count @@ -374,13 +374,13 @@ type References() = AssertEqual "System.Net.dll" l.[1].Caption Assert.NotNull(l.[1].ResolvedAssembly) ) - + [] member this.``PathReferences.NonExistent`` () = DoWithTempFile "Test.fsproj"(fun projFile -> let refLibPath = @"c:\foo\baz\blahblah.dll" File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [refLibPath], "")) - use project = TheTests.CreateProject(projFile) + use project = TheTests.CreateProject(projFile) let l = new List() project.FindNodesOfType(l) AssertEqual 1 l.Count @@ -388,15 +388,15 @@ type References() = Assert.Null(l.[0].ResolvedAssembly) ) - + [] member this.``FsprojPreferencePage.ProjSupportsPrefReadWrite``() = let testProp = "AssemblyName" let compileItem = [@"foo.fs"] - + DoWithTempFile "Test.fsproj" (fun projFile -> - File.AppendAllText(projFile, TheTests.SimpleFsprojText(compileItem, [], "")) - use project = TheTests.CreateProject(projFile) + File.AppendAllText(projFile, TheTests.SimpleFsprojText(compileItem, [], "")) + use project = TheTests.CreateProject(projFile) // Read a known property from the project node - AssemblyName let propertyVal = project.GetProjectProperty(testProp, false) // Set the project property to something different (is currently "MyAssembly") @@ -405,18 +405,18 @@ type References() = // get the (hopefully) modified property name let propertyVal' = project.GetProjectProperty(testProp, false) let newProjFileName = (Path.GetDirectoryName projFile) + "\\" + "fooProj.fsproj" - - printfn "%s before modification: %s" testProp propertyVal - printfn "%s after modification: %s" testProp propertyVal' - + + printfn "%s before modification: %s" testProp propertyVal + printfn "%s after modification: %s" testProp propertyVal' + // Assert that the value has changed AssertNotEqual propertyVal propertyVal' - // Assert that the new value is what we expect it to be + // Assert that the new value is what we expect it to be AssertEqual newPropVal propertyVal' - + // Save as a new project file project.SaveMSBuildProjectFileAs(newProjFileName) ; // cleaned up by parent call to DoWithTempFile - + // look for the new property inside of the project file let contents = File.ReadAllText(newProjFileName) AssertContains contents newPropVal @@ -427,7 +427,7 @@ type References() = // On DEV 15 Preview 4 the VS IDE Test fails with : // System.InvalidOperationException : Operation is not valid due to the current state of the object. // [] // Disabled due to: https://github.com/dotnet/fsharp/issues/1460 - member this.``AddReference.COM`` () = + member this.``AddReference.COM`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) use project = TheTests.CreateProject(projFile) @@ -469,7 +469,7 @@ type References() = printfn "%O" fsproj let xn s = fsproj.Root.GetDefaultNamespace().GetName(s) let comReferencesXml = fsproj.Descendants(xn "COMReference") |> Seq.toList - + Assert.Equal(1, comReferencesXml |> List.length) let comRefXml = comReferencesXml |> List.head diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs index 56aaf84d713..54133327e35 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs @@ -12,14 +12,14 @@ open UnitTests.TestLib.ProjectSystem open Microsoft.VisualStudio.FSharp.ProjectSystem -type RoundTrip() = +type RoundTrip() = inherit TheTests() - + ///////////////////////////////// // project helpers static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - + member this.``FsprojRoundtrip.PositiveTest``(origItems : MSBuildItems, expectedItems : MSBuildItems) = // test that opening with origItems and saving yields expectedItems this.MakeProjectAndDoWithProjectFile([], [], origItems.ToString(), (fun project fileName -> @@ -87,7 +87,7 @@ type RoundTrip() = [] member public this.``FsprojRoundTrip.EmptyFoldersArePreservedWhenRestIsLegalButNotIdempotent``() = let origItems = [CompileItem @"bar.fs" - FolderItem @"A\Empty1\" + FolderItem @"A\Empty1\" FolderItem @"A\B\" // will get removed CompileItem @"A\B\C\foo.fs" FolderItem @"A\B\Empty2\" @@ -147,4 +147,4 @@ type RoundTrip() = FolderItem @"A\" // must be before anything below it CompileItem @"bar.fs"] this.``Fsproj.NegativeTest`` items - + diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs index b63ec3eed8e..584ed701bcd 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs @@ -10,7 +10,7 @@ open System.IO open System.Text open System.Text.RegularExpressions -// VS namespaces +// VS namespaces open Microsoft.VisualStudio open Microsoft.VisualStudio.Shell open Microsoft.VisualStudio.Shell.Interop @@ -24,7 +24,7 @@ open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -type UpToDate() = +type UpToDate() = inherit TheTests() [] @@ -332,13 +332,13 @@ type UpToDate() = member public this.UTDOptionsFlags () = this.MakeProjectAndDo(["file1.fs"], [], "", (fun project -> let configNameDebugx86 = ConfigCanonicalName("Debug", "x86") - let debugConfigx86 = project.ConfigProvider.GetProjectConfiguration(configNameDebugx86) - let buildableConfig = + let debugConfigx86 = project.ConfigProvider.GetProjectConfiguration(configNameDebugx86) + let buildableConfig = match debugConfigx86.get_BuildableProjectCfg() with | 0, bc -> bc | _ -> failwith "get_BuildableProjectCfg failed" - let testFlag flag expected = + let testFlag flag expected = let supported = Array.zeroCreate 1 let ready = Array.zeroCreate 1 buildableConfig.QueryStartUpToDateCheck(flag, supported, ready) |> ignore @@ -360,13 +360,13 @@ type UpToDate() = ", (fun project -> let configNameDebugx86 = ConfigCanonicalName("Debug", "x86") - let debugConfigx86 = project.ConfigProvider.GetProjectConfiguration(configNameDebugx86) - let buildableConfig = + let debugConfigx86 = project.ConfigProvider.GetProjectConfiguration(configNameDebugx86) + let buildableConfig = match debugConfigx86.get_BuildableProjectCfg() with | 0, bc -> bc | _ -> failwith "get_BuildableProjectCfg failed" - let testFlag flag expected = + let testFlag flag expected = let supported = Array.zeroCreate 1 let ready = Array.zeroCreate 1 buildableConfig.QueryStartUpToDateCheck(flag, supported, ready) |> ignore @@ -380,7 +380,7 @@ type UpToDate() = |> List.iter (fun (flag, expected) -> testFlag flag expected) )) -type ``UpToDate PreserveNewest`` () = +type ``UpToDate PreserveNewest`` () = [] member public this.IsUpToDatePreserveNewest () = @@ -389,7 +389,7 @@ type ``UpToDate PreserveNewest`` () = let logs = ref [] let outputPanel = VsMocks.vsOutputWindowPane(logs) let logger = OutputWindowLogger((fun () -> true), outputPanel) - + let tryTimestamp (path: string) (_l: OutputWindowLogger) = let toN = function Some d -> Nullable<_>(d) | None -> Nullable<_>() match path with @@ -399,7 +399,7 @@ type ``UpToDate PreserveNewest`` () = let u = ProjectConfig.IsUpToDatePreserveNewest(logger, (Func<_,_,_>(tryTimestamp)), input, output) u, !logs - + let now = System.DateTime.UtcNow let before = now.AddHours(-1.0) @@ -428,5 +428,5 @@ type ``UpToDate PreserveNewest`` () = logs |> List.exists (fun s -> s.Contains("animatedlogo.gif") && s.Contains("stale")) |> Assert.True - - () + + () diff --git a/vsintegration/tests/UnitTests/TestLib.LanguageService.fs b/vsintegration/tests/UnitTests/TestLib.LanguageService.fs index ecc8cc1479f..8d3ff12812c 100644 --- a/vsintegration/tests/UnitTests/TestLib.LanguageService.fs +++ b/vsintegration/tests/UnitTests/TestLib.LanguageService.fs @@ -12,7 +12,7 @@ open Salsa.VsOpsUtils open Salsa.VsMocks open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils -open System.Text.RegularExpressions +open System.Text.RegularExpressions open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Diagnostics open Microsoft.VisualStudio.FSharp @@ -29,20 +29,20 @@ type internal TextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSp type internal SourceFileKind = FS | FSI | FSX -type internal ISingleFileTestRunner = +type internal ISingleFileTestRunner = abstract CreateSingleFileProject : - content : string * - ?references : string list * - ?defines : string list * + content : string * + ?references : string list * + ?defines : string list * ?fileKind : SourceFileKind * - ?disabledWarnings : string list * + ?disabledWarnings : string list * ?fileName : string -> (OpenSolution * OpenProject * OpenFile) abstract CreateSingleFileProject : - content : string list * - ?references : string list * - ?defines : string list * + content : string list * + ?references : string list * + ?defines : string list * ?fileKind : SourceFileKind * - ?disabledWarnings : string list* + ?disabledWarnings : string list* ? fileName : string -> (OpenSolution * OpenProject * OpenFile) type internal Helper = @@ -54,10 +54,10 @@ type internal Helper = let bestMscorlib = mscorlibs |> List.sort |> List.rev |> List.head bestMscorlib :: allExceptMscorlib - static member ExhaustivelyScrutinize (sftr : ISingleFileTestRunner, lines:string list) = - let Impl kind = + static member ExhaustivelyScrutinize (sftr : ISingleFileTestRunner, lines:string list) = + let Impl kind = let (_solution, _project, file) = sftr.CreateSingleFileProject(lines, fileKind = kind) - let Check line col = + let Check line col = //printfn "line=%d col=%d" line col MoveCursorTo(file,line,col) let tooltip = GetQuickInfoAtCursor file @@ -71,39 +71,39 @@ type internal Helper = () let lines = lines |> List.toArray let lineCount = lines.Length - for line in 1..lineCount do + for line in 1..lineCount do let len = lines.[line-1].Length - for col in 1..len do + for col in 1..len do Check line col Impl SourceFileKind.FS Impl SourceFileKind.FSX static member AssertMemberDataTipContainsInOrder(sftr : ISingleFileTestRunner, code : string list,marker,completionName,rhsContainsOrder) = let (_solution, project, file) = sftr.CreateSingleFileProject(code, fileKind = SourceFileKind.FSX) - TakeCoffeeBreak(file.VS) (* why needed? *) + TakeCoffeeBreak(file.VS) (* why needed? *) MoveCursorToEndOfMarker(file,marker) let completions = AutoCompleteAtCursor file match completions |> Array.tryFind (fun (CompletionItem(name, _, _, _, _)) -> name = completionName) with | Some(CompletionItem(_, _, _, descrFunc, _)) -> let descr = descrFunc() AssertContainsInOrder(descr,rhsContainsOrder) - | None -> + | None -> Console.WriteLine("Could not find completion name '{0}'", completionName) for error in (GetErrors(project)) do printf "%s\n" (error.ToString()) - Assert.Fail() + Assert.Fail() (* Asserts ----------------------------------------------------------------------------- *) static member AssertEqualWithMessage(expected,actual,message) = - if expected<>actual then + if expected<>actual then printf "%s" message Assert.Fail(message) static member AssertEqual(expected,actual) = - if expected<>actual then + if expected<>actual then let message = sprintf "Expected %A but got %A." expected actual printf "%s" message Assert.Fail(message) - + static member AssertContains(s:string,c) = if not (s.Contains(c)) then printf "Expected '%s' to contain '%s'." s c @@ -111,14 +111,14 @@ type internal Helper = static member AssertArrayContainsPartialMatchOf(a:string array,c) = let found = ref false a |> Array.iter(fun s -> found := s.Contains(c) || !found) - if not(!found) then - printfn "Expected: %A" a + if not(!found) then + printfn "Expected: %A" a printfn "to contain '%s'." c - Assert.Fail() - static member AssertNotContains(s:string,c) = + Assert.Fail() + static member AssertNotContains(s:string,c) = if (s.Contains(c)) then printf "Expected '%s' to not contain '%s'." s c - Assert.Fail() + Assert.Fail() static member AssertMatches (r : Regex) (s:string) = if not (r.IsMatch(s)) then @@ -130,7 +130,7 @@ type internal Helper = match expects with | [] -> () | expect :: expects -> - let index = s.IndexOf((expect:string),(fromIndex:int)) + let index = s.IndexOf((expect:string),(fromIndex:int)) if index = -1 then let s= sprintf "Expected '%s' to contain '%s' after index %d." s expect fromIndex Console.WriteLine(s) @@ -153,62 +153,62 @@ type internal Helper = let r = regexStr.Substring(0,i) let regex = new Regex(r) AssertMatches regex s - i <- regexStr.IndexOf(c, i+1) + i <- regexStr.IndexOf(c, i+1) type internal GlobalParseAndTypeCheckCounter private(initialParseCount:int, initialTypeCheckCount:int, initialEventNum:int, vs) = static member StartNew(vs) = TakeCoffeeBreak(vs) let n = IncrementalBuilderEventTesting.GetCurrentIncrementalBuildEventNum() new GlobalParseAndTypeCheckCounter(FSharpChecker.ActualParseFileCount, FSharpChecker.ActualCheckFileCount, n, vs) - member private this.GetEvents() = + member private this.GetEvents() = TakeCoffeeBreak(vs) let n = IncrementalBuilderEventTesting.GetCurrentIncrementalBuildEventNum() IncrementalBuilderEventTesting.GetMostRecentIncrementalBuildEvents(n-initialEventNum) - member private this.SawIBCreated() = + member private this.SawIBCreated() = this.GetEvents() |> List.exists (function | IncrementalBuilderEventTesting.IBECreated -> true | _ -> false) - member private this.GetParsedFilesSet() = + member private this.GetParsedFilesSet() = this.GetEvents() |> List.choose (function | IncrementalBuilderEventTesting.IBEParsed(file) -> Some(file) | _ -> None) |> set - member private this.GetTypeCheckedFilesSet() = + member private this.GetTypeCheckedFilesSet() = this.GetEvents() |> List.choose (function | IncrementalBuilderEventTesting.IBETypechecked(file) -> Some(file) | _ -> None) |> set member this.AssertExactly(expectedParses, expectedTypeChecks) = - let actualParses = this.GetParsedFilesSet().Count + let actualParses = this.GetParsedFilesSet().Count let actualTypeChecks = this.GetTypeCheckedFilesSet().Count if (actualParses,actualTypeChecks) <> (expectedParses, expectedTypeChecks) then Assert.Fail(sprintf "Expected %d parses and %d typechecks, but got %d parses and %d typechecks." expectedParses expectedTypeChecks actualParses actualTypeChecks) member this.AssertExactly(expectedParses, expectedTypeChecks, expectedParsedFiles : list, expectedTypeCheckedFiles : list) = - this.AssertExactly(expectedParses, - expectedTypeChecks, - expectedParsedFiles |> List.map GetNameOfOpenFile, + this.AssertExactly(expectedParses, + expectedTypeChecks, + expectedParsedFiles |> List.map GetNameOfOpenFile, expectedTypeCheckedFiles |> List.map GetNameOfOpenFile, false) member this.AssertExactly((aap: string option,expectedParsedFiles:list), (aat: string option,expectedTypeCheckedFiles:list)) = this.AssertExactly((aap,expectedParsedFiles), (aat,expectedTypeCheckedFiles), false) member this.AssertExactly((aap,expectedParsedFiles) : string option * list, (aat,expectedTypeCheckedFiles) : string option * list, expectCreate : bool) = - let p = - match aap with + let p = + match aap with | Some(aap) -> aap :: (expectedParsedFiles |> List.map GetNameOfOpenFile) | _ -> (expectedParsedFiles |> List.map GetNameOfOpenFile) - let t = + let t = match aat with | Some(aat) -> aat :: (expectedTypeCheckedFiles |> List.map GetNameOfOpenFile) | _ -> (expectedTypeCheckedFiles |> List.map GetNameOfOpenFile) this.AssertExactly(p.Length, t.Length, p, t, expectCreate) member private this.AssertExactly(expectedParses, expectedTypeChecks, expectedParsedFiles : string list, expectedTypeCheckedFiles : string list, expectCreate : bool) = - let note,ok = + let note,ok = if expectCreate then if this.SawIBCreated() then ("The incremental builder was created, as expected",true) else ("The incremental builder was NOT deleted and recreated, even though we expected it to be",false) else if this.SawIBCreated() then ("The incremental builder was UNEXPECTEDLY deleted",false) else ("",true) let actualParsedFiles = this.GetParsedFilesSet() let actualTypeCheckedFiles = this.GetTypeCheckedFilesSet() - let actualParses = actualParsedFiles.Count + let actualParses = actualParsedFiles.Count let actualTypeChecks = actualTypeCheckedFiles.Count let expectedParsedFiles = expectedParsedFiles |> set let expectedTypeCheckedFiles = expectedTypeCheckedFiles |> set if (actualParses, actualTypeChecks, actualParsedFiles, actualTypeCheckedFiles) <> (expectedParses, expectedTypeChecks, expectedParsedFiles, expectedTypeCheckedFiles) then let detail = sprintf "ExpectedParse: %A\nActualParse: %A\n\nExpectedTypeCheck: %A\nActualTypeCheck: %A\n\n%s" expectedParsedFiles actualParsedFiles expectedTypeCheckedFiles actualTypeCheckedFiles note - let msg = + let msg = if (actualParses, actualTypeChecks) <> (expectedParses, expectedTypeChecks) then sprintf "Expected %d parses and %d typechecks, but got %d parses and %d typechecks.\n\n%s" expectedParses expectedTypeChecks actualParses actualTypeChecks detail else @@ -219,7 +219,7 @@ type internal GlobalParseAndTypeCheckCounter private(initialParseCount:int, init /// REVIEW: Should be able to get data tip when hovering over a class member method name ie "member private art.attemptUpgradeToMSBuild hierarchy" -(* Not Unittested Yet ----------------------------------------------------------------------------------------------------------------- *) +(* Not Unittested Yet ----------------------------------------------------------------------------------------------------------------- *) /// FEATURE: Pressing ctrl-j or ctrl-space will bring up the Intellisense completion list at the current cursor. /// FEATURE: String literals such as "My dog has fleas" will be colored in in String color. /// FEATURE: Source code files with extensions .fs and .ml are recognized by the language service. @@ -227,24 +227,24 @@ type internal GlobalParseAndTypeCheckCounter private(initialParseCount:int, init /// FEATURE: Double-clicking a word in a comment highlight just the word not the whole comment. /// FEATURE: During debugging user may hover over a tooltip and get debugging information about. For example, instance values. /// FEATURE: Character literals such as 'x' will be colored in in String color. -(* ------------------------------------------------------------------------------------------------------------------------------------ *) +(* ------------------------------------------------------------------------------------------------------------------------------------ *) /// FEATURE(nyi): As the user types part of an identifier, for example Console.Wr, he'll get an Intellisense list of members that match. /// FEATURE(nyi): The user can press ctrl-i to start an incremental search within the current document. /// FEATURE(nyi): Pressing ctrl-} will move cursor to the matching brace. This will work for all brace types. /// FEATURE(nyi): If a source file has a #r or #R reference then changes to the referenced assembly will be recognized by the language service. /// FEATURE(nyi): If a source file used to have a #r or #R reference and then the user removes it, that assembly will no longer be in scope. - + /// FEATURE(nyi): There is a navigation bar at the top of the text editor window that shows the user all the top-level and second-level constructs in the file. /// FEATURE(nyi): Types in the code will be colored with a special BoundType color /// FEATURE(nyi): Preprocessor-like keywords aside from #light\#if\#else\#endif will be colored with PreprocessorKeyword color. /// FEATURE(nyi): Intellisense for argument names. - + /// PS-FEATURE(nyi): The user may choose to enable mixed-mode debugging by selecting Project Settings\Debug\Enable unmanaged code debugging /// These are the driver tests. They're parameterized on /// various functions that abstract actions over vs. -type LanguageServiceBaseTests() = +type LanguageServiceBaseTests() = let mutable defaultSolution : OpenSolution = Unchecked.defaultof<_> let cache = System.Collections.Generic.Dictionary() @@ -256,13 +256,13 @@ type LanguageServiceBaseTests() = let mutable ops = BuiltMSBuildTestFlavour() let testStopwatch = new Stopwatch() - // Timings ----------------------------------------------------------------------------- + // Timings ----------------------------------------------------------------------------- let stopWatch = new Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - + let Init() = - let AssertNotAssemblyNameContains(a:System.Reflection.Assembly, text1:string, text2:string) = + let AssertNotAssemblyNameContains(a:System.Reflection.Assembly, text1:string, text2:string) = let fullname = sprintf "%A" a if fullname.Contains(text1) && fullname.Contains(text2) then // Can't throw an exception here because its in an event handler. @@ -274,7 +274,7 @@ type LanguageServiceBaseTests() = // We're worried about loading these when running against .NET 4.0: // Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a // Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - AssertNotAssemblyNameContains(args.LoadedAssembly,"Microsoft.Build", "Version=3.5.0.0") + AssertNotAssemblyNameContains(args.LoadedAssembly,"Microsoft.Build", "Version=3.5.0.0") () AppDomain.CurrentDomain.AssemblyLoad.Add AssertNotBackVersionAssembly @@ -282,7 +282,7 @@ type LanguageServiceBaseTests() = defaultVS <- ops.CreateVisualStudio() currentVS <- defaultVS - + defaultSolution <- GlobalFunctions.CreateSolution(defaultVS) cache.Clear() @@ -291,7 +291,7 @@ type LanguageServiceBaseTests() = if box currentVS <> box defaultVS then failwith "LanguageServiceBaseTests.Setup was called when 'active' instance of VS is not 'default' one - this may denote that tests contains errors" - + // reset state of default VS instance that can be shared among the tests ShiftKeyUp(currentVS) ops.CleanInvisibleProject(currentVS) @@ -303,40 +303,40 @@ type LanguageServiceBaseTests() = member internal _.VsOpts with set op = ops <- op - + member internal this.TestRunner : ISingleFileTestRunner = SingleFileTestRunner(this) :> _ member internal _.VS = currentVS member internal this.CreateSingleFileProject ( - content : string, - ?references : string list, - ?defines : string list, - ?fileKind : SourceFileKind, + content : string, + ?references : string list, + ?defines : string list, + ?fileKind : SourceFileKind, ?disabledWarnings : string list, ?fileName : string, ?otherFlags: string - ) = + ) = let content = content.Split( [|"\r\n"|], StringSplitOptions.None) |> List.ofArray this.CreateSingleFileProject(content, ?references = references, ?defines = defines, ?fileKind = fileKind, ?disabledWarnings = disabledWarnings, ?fileName = fileName, ?otherFlags = otherFlags) member internal _.CreateSingleFileProject ( - content : string list, - ?references : string list, - ?defines : string list, - ?fileKind : SourceFileKind, + content : string list, + ?references : string list, + ?defines : string list, + ?fileKind : SourceFileKind, ?disabledWarnings : string list, ?fileName : string, ?otherFlags: string - ) = + ) = assert (box currentVS = box defaultVS) - let mkKeyComponent l = + let mkKeyComponent l = defaultArg l [] |> Seq.sort |> String.concat "|" - let ext = + let ext = match fileKind with | Some SourceFileKind.FS -> ".fs" | Some SourceFileKind.FSI -> ".fsi" @@ -344,7 +344,7 @@ type LanguageServiceBaseTests() = | None -> ".fs" let fileName = (defaultArg fileName "File1") + ext - let key = + let key = let refs = mkKeyComponent references let defines = mkKeyComponent defines let warnings = mkKeyComponent disabledWarnings @@ -355,7 +355,7 @@ type LanguageServiceBaseTests() = ReplaceFileInMemory file [] SaveFileToDisk file TakeCoffeeBreak(currentVS) - + ReplaceFileInMemory file content SaveFileToDisk file TakeCoffeeBreak(currentVS) @@ -367,15 +367,15 @@ type LanguageServiceBaseTests() = for dw in (defaultArg disabledWarnings []) do GlobalFunctions.AddDisabledWarning(proj, dw) - if defines.IsSome then + if defines.IsSome then GlobalFunctions.SetProjectDefines(proj, defines.Value) - for r in (defaultArg references []) do + for r in (defaultArg references []) do GlobalFunctions.AddAssemblyReference(proj, r) - match otherFlags with + match otherFlags with | None -> () - | Some flags -> GlobalFunctions.SetOtherFlags(proj, flags) + | Some flags -> GlobalFunctions.SetOtherFlags(proj, flags) let content = String.concat Environment.NewLine content let _ = AddFileFromTextBlob(proj, fileName, content) @@ -386,13 +386,13 @@ type LanguageServiceBaseTests() = TakeCoffeeBreak(currentVS) defaultSolution, proj, file - - member internal _.CreateSolution() = + + member internal _.CreateSolution() = if (box currentVS = box defaultVS) then failwith "You are trying to modify default instance of VS. The only operation that is permitted on default instance is CreateSingleFileProject, perhaps you forgot to add line 'use _guard = this.WithNewVS()' at the beginning of the test?" GlobalFunctions.CreateSolution(currentVS) - member internal _.CloseSolution(sln : OpenSolution) = + member internal _.CloseSolution(sln : OpenSolution) = if (box currentVS = box defaultVS) then failwith "You are trying to modify default instance of VS. The only operation that is permitted on default instance is CreateSingleFileProject, perhaps you forgot to add line 'use _guard = this.WithNewVS()' at the beginning of the test?" if (box sln.VS <> box currentVS) then @@ -400,7 +400,7 @@ type LanguageServiceBaseTests() = GlobalFunctions.CloseSolution(sln) - member internal _.AddAssemblyReference(proj, ref) = + member internal _.AddAssemblyReference(proj, ref) = if (box currentVS = box defaultVS) then failwith "You are trying to modify default instance of VS. The only operation that is permitted on default instance is CreateSingleFileProject, perhaps you forgot to add line 'use _guard = this.WithNewVS()' at the beginning of the test?" @@ -410,22 +410,22 @@ type LanguageServiceBaseTests() = member _.Dispose() = if box currentVS <> box defaultVS then failwith "LanguageServiceBaseTests.Shutdown was called when 'active' instance of VS is not 'default' one - this may denote that tests contains errors" - + GlobalFunctions.Cleanup(defaultVS) cache.Clear() - member this.UsingNewVS() = + member this.UsingNewVS() = if box currentVS <> box defaultVS then failwith "LanguageServiceBaseTests.UsingNewVS was called when 'active' instance of VS is not 'default' one - this may denote that tests contains errors" currentVS <- ops.CreateVisualStudio() - { new System.IDisposable with - member _.Dispose() = + { new System.IDisposable with + member _.Dispose() = if box currentVS = box defaultVS then failwith "At this moment 'current' instance of VS cannot be the same as the 'default' one. This may denote that tests contains errors." GlobalFunctions.Cleanup(currentVS) currentVS <- defaultVS } - + member this.TearDown() = @@ -437,7 +437,7 @@ type LanguageServiceBaseTests() = System.Windows.MessageBox.Show(msg) |> ignore #endif // help find leaks per-test -// System.GC.Collect() +// System.GC.Collect() // System.GC.WaitForPendingFinalizers() () @@ -445,22 +445,22 @@ and internal SingleFileTestRunner(owner : LanguageServiceBaseTests) = interface ISingleFileTestRunner with member sftr.CreateSingleFileProject ( - content : string, - ?references : string list, - ?defines : string list, - ?fileKind : SourceFileKind, + content : string, + ?references : string list, + ?defines : string list, + ?fileKind : SourceFileKind, ?disabledWarnings : string list, ?fileName : string - ) = + ) = owner.CreateSingleFileProject(content, ?references = references, ?defines = defines, ?fileKind = fileKind, ?disabledWarnings = disabledWarnings, ?fileName = fileName) member sftr.CreateSingleFileProject ( - content : string list, - ?references : string list, - ?defines : string list, - ?fileKind : SourceFileKind, + content : string list, + ?references : string list, + ?defines : string list, + ?fileKind : SourceFileKind, ?disabledWarnings : string list, ?fileName : string - ) = + ) = owner.CreateSingleFileProject(content, ?references = references, ?defines = defines, ?fileKind = fileKind, ?disabledWarnings = disabledWarnings, ?fileName = fileName) diff --git a/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs b/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs index 69c2264669c..2f1b0ef691f 100644 --- a/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs +++ b/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs @@ -2,7 +2,7 @@ namespace UnitTests.TestLib.ProjectSystem -open System +open System open System.CodeDom open System.CodeDom.Compiler open System.Runtime.Serialization @@ -23,7 +23,7 @@ open Microsoft.VisualStudio.Shell.Interop open Microsoft.Build.Execution open Microsoft.Build.Framework - + #nowarn "52" // The value has been copied to ensure the original is not mutated open Xunit open UnitTests.TestLib.Utils @@ -31,7 +31,7 @@ open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers type internal UnitTestingFSharpProjectNode(package:FSharpProjectPackage) as this = - inherit FSharpProjectNode(package) + inherit FSharpProjectNode(package) do this.InteropSafeIVsHierarchy <- this this.InteropSafeIVsUIHierarchy <- this @@ -49,7 +49,7 @@ type Tree<'T> = | Tree of (*data*)'T * (*firstChild*)Tree<'T> * (*nextSibling*)Tree<'T> | Nil -type TheTests() = +type TheTests() = static let Net35RefAssemPathOnThisMachine() = let key = @"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\Microsoft .NET Framework 3.5 Reference Assemblies" let hklm = Registry.LocalMachine @@ -57,25 +57,25 @@ type TheTests() = rkey.GetValue("") :?> string static let ANYTREE = Tree("",Nil,Nil) - - + + ///////////////////////////////// // project helpers static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - static let DefaultBuildActionOfFilename(filename) : Salsa.BuildAction = - match Path.GetExtension(filename) with + static let DefaultBuildActionOfFilename(filename) : Salsa.BuildAction = + match Path.GetExtension(filename) with | ".fsx" -> Salsa.BuildAction.None | ".resx" | ".resources" -> Salsa.BuildAction.EmbeddedResource - | _ -> Salsa.BuildAction.Compile + | _ -> Salsa.BuildAction.Compile static let GetReferenceContainerNode(project : ProjectNode) = let l = new List() project.FindNodesOfType(l) - l.[0] - + l.[0] + ///////////////////////////////// /// helpers static member AssertMatches (r : Regex) (s:string) = @@ -95,7 +95,7 @@ type TheTests() = TheTests.AssertMatches (new Regex(regexStr)) s static member PrintHierarchy(node : HierarchyNode) = - let rec nSpaces n = + let rec nSpaces n = if n = 0 then "" else " " + nSpaces (n-1) let rec Print(node : HierarchyNode, level : int) = printfn "%s%s" (nSpaces level) node.Caption @@ -139,30 +139,30 @@ type TheTests() = let p = TheTests.CreateProject(filename, "false", configChangeNotifier, sp) // ensure that vs-style encoding is off p - + static member internal CreateProjectWithUTF8Output(filename: string) = let sp, configChangeNotifier = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier() let p = TheTests.CreateProject(filename, "true", configChangeNotifier, sp) p - + static member internal FindNodeWithCaption(project: UnitTestingFSharpProjectNode, caption) = let node = project.FirstChild let rec TryFind (n : HierarchyNode) = - if n = null then None - elif n.Caption = caption then Some(n) + if n = null then None + elif n.Caption = caption then Some(n) else match TryFind(n.FirstChild) with | None -> TryFind(n.NextSibling) | x -> x match TryFind node with | Some(x) -> x | None -> failwithf "did not find node with caption %s" caption - + static member MoveDown(node: HierarchyNode) = match node with - | :? FSharpFileNode - | :? FSharpFolderNode -> + | :? FSharpFileNode + | :? FSharpFolderNode -> TheTests.EnsureMoveDownEnabled(node) - node.ExecCommandOnNode(VSProjectConstants.guidFSharpProjectCmdSet, + node.ExecCommandOnNode(VSProjectConstants.guidFSharpProjectCmdSet, uint32 VSProjectConstants.MoveDownCmd.ID, uint32 0, new IntPtr(0), new IntPtr(0)) |> ignore | _ -> failwith "unexpected node type" @@ -170,10 +170,10 @@ type TheTests() = static member MoveUp(node: HierarchyNode) = match node with - | :? FSharpFileNode + | :? FSharpFileNode | :? FSharpFolderNode -> TheTests.EnsureMoveUpEnabled(node) - node.ExecCommandOnNode(VSProjectConstants.guidFSharpProjectCmdSet, + node.ExecCommandOnNode(VSProjectConstants.guidFSharpProjectCmdSet, uint32 VSProjectConstants.MoveUpCmd.ID, uint32 0, new IntPtr(0), new IntPtr(0)) |> ignore | _ -> failwith "unexpected node type" @@ -185,43 +185,43 @@ type TheTests() = ValidateOK(node.QueryStatusOnNode(VSProjectConstants.guidFSharpProjectCmdSet, uint32 VSProjectConstants.MoveDownCmd.ID, 0n, &qsr)) let expected = QueryStatusResult.SUPPORTED AssertEqual expected qsr - + static member EnsureMoveDownEnabled(node : HierarchyNode) = // Move Down appears on menu, and can be clicked let mutable qsr = new QueryStatusResult() ValidateOK(node.QueryStatusOnNode(VSProjectConstants.guidFSharpProjectCmdSet, uint32 VSProjectConstants.MoveDownCmd.ID, 0n, &qsr)) let expected = QueryStatusResult.SUPPORTED ||| QueryStatusResult.ENABLED AssertEqual expected qsr - + static member EnsureMoveUpDisabled(node : HierarchyNode) = // Move Up appears on menu, but is greyed out let mutable qsr = new QueryStatusResult() ValidateOK(node.QueryStatusOnNode(VSProjectConstants.guidFSharpProjectCmdSet, uint32 VSProjectConstants.MoveUpCmd.ID, 0n, &qsr)) let expected = QueryStatusResult.SUPPORTED AssertEqual expected qsr - + static member EnsureMoveUpEnabled(node : HierarchyNode) = // Move Up appears on menu, and can be clicked let mutable qsr = new QueryStatusResult() ValidateOK(node.QueryStatusOnNode(VSProjectConstants.guidFSharpProjectCmdSet, uint32 VSProjectConstants.MoveUpCmd.ID, 0n, &qsr)) let expected = QueryStatusResult.SUPPORTED ||| QueryStatusResult.ENABLED AssertEqual expected qsr - - static member SimpleFsprojText(compileItems : string list, references : string list, other : string) = + + static member SimpleFsprojText(compileItems : string list, references : string list, other : string) = TheTests.FsprojTextWithProjectReferences(compileItems, references, [], other) - - static member SimpleFsprojTextOtherFlags(compileItems : string list, references : string list, otherflags : string, other : string) = + + static member SimpleFsprojTextOtherFlags(compileItems : string list, references : string list, otherflags : string, other : string) = TheTests.FsprojTextWithProjectReferencesAndOtherFlags(compileItems, references, [], otherflags, other) - - static member public FsprojTextWithProjectReferences(compileItems : string list, references : string list, projectReferences : string list, other : string) = + + static member public FsprojTextWithProjectReferences(compileItems : string list, references : string list, projectReferences : string list, other : string) = let vsops = Salsa.Salsa.BuiltMSBuildTestFlavour() let references = references |> List.map (fun r->r,false) let items = [for i in compileItems -> (i,DefaultBuildActionOfFilename i, None)] let text = vsops.CreatePhysicalProjectFileInMemory(items, references, projectReferences, [], [], null, null, other, null) printfn "%s" text text - - static member public FsprojTextWithProjectReferencesAndOtherFlags(compileItems : string list, references : string list, projectReferences : string list, otherflags : string, other : string, targetFramework : string) = + + static member public FsprojTextWithProjectReferencesAndOtherFlags(compileItems : string list, references : string list, projectReferences : string list, otherflags : string, other : string, targetFramework : string) = let vsops = Salsa.Salsa.BuiltMSBuildTestFlavour() let references = references |> List.map (fun r->r,false) let items = [for i in compileItems -> (i,DefaultBuildActionOfFilename i, None)] @@ -229,7 +229,7 @@ type TheTests() = printfn "%s" text text - static member public FsprojTextWithProjectReferencesAndOtherFlags(compileItems : string list, references : string list, projectReferences : string list, otherflags : string, other : string) = + static member public FsprojTextWithProjectReferencesAndOtherFlags(compileItems : string list, references : string list, projectReferences : string list, otherflags : string, other : string) = TheTests.FsprojTextWithProjectReferencesAndOtherFlags(compileItems, references, projectReferences, otherflags, other, null) static member AssertSameTree(expectation : Tree, node : HierarchyNode) = @@ -240,9 +240,9 @@ type TheTests() = static member AssertSameTreeHelper(expectation : Tree, node : HierarchyNode) = match expectation with | Tree _ as x when Object.Equals(x, ANYTREE) -> () - | Nil -> + | Nil -> AssertEqual null node - | Tree(name,firstChild,nextSibling) -> + | Tree(name,firstChild,nextSibling) -> AssertEqual name node.Caption TheTests.AssertSameTreeHelper(firstChild, node.FirstChild) TheTests.AssertSameTreeHelper(nextSibling, node.NextSibling) @@ -258,12 +258,12 @@ type TheTests() = Some value else None - let initialContext = - sprintf "%sWhile expecting '\n%s\n' to match '\n%s\n', " - outerContext - (expectation.ToString(SaveOptions.None)) + let initialContext = + sprintf "%sWhile expecting '\n%s\n' to match '\n%s\n', " + outerContext + (expectation.ToString(SaveOptions.None)) (actual.ToString(SaveOptions.None)) - let Err s = + let Err s = sprintf "%sfound error:\n%s" initialContext s if expectation.Name.LocalName <> actual.Name.LocalName then Assert.Fail(Err <| sprintf "Expected element name '%s' but got '%s'" expectation.Name.LocalName actual.Name.LocalName) @@ -282,22 +282,22 @@ type TheTests() = Assert.Fail(Err <| sprintf "Expected '%d' sub-elements, but found '%d'" exLen actLen) (expectation.Elements(), actual.Elements()) ||> Seq.iter2 (fun x y -> Match(x,y,initialContext+"\n")) Match(expectation, actual, "") - + static member internal Sources (project : UnitTestingFSharpProjectNode) = let MakeRelativePath (file : string) = let projDir = project.ProjectFolder + "\\" - if file.StartsWith(projDir) then + if file.StartsWith(projDir) then file.Substring(projDir.Length) else file project.CompilationSourceFiles |> Array.toList |> List.map MakeRelativePath - + member internal this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifierDispose(dispose : bool, compileItems : string list, references : string list, other : string, targetFramework : string, f : UnitTestingFSharpProjectNode -> _ -> string -> unit) = UIStuff.SetupSynchronizationContext() DoWithTempFile "Test.fsproj" (fun file -> File.AppendAllText(file, TheTests.FsprojTextWithProjectReferencesAndOtherFlags(compileItems, references, [], null, other, targetFramework)) - let sp, cnn = + let sp, cnn = match targetFramework with | "v4.7.2" | "4.7.2" | "4.7" | "v4.7" -> VsMocks.MakeMockServiceProviderAndConfigChangeNotifier472() | "v4.6" | "4.6" -> VsMocks.MakeMockServiceProviderAndConfigChangeNotifier46() @@ -323,14 +323,14 @@ type TheTests() = member internal this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(compileItems : string list, references : string list, other : string, f : UnitTestingFSharpProjectNode -> _ -> string -> unit) = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(compileItems, references, other, null, f) - + member internal this.MakeProjectAndDoWithProjectFile(compileItems : string list, references: string list, other : string, targetFramework : string, f : UnitTestingFSharpProjectNode -> string -> unit) = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(compileItems, references, other, targetFramework, fun proj _ s -> f proj s) - + member internal this.MakeProjectAndDoWithProjectFile(compileItems : string list, references: string list, other : string, f : UnitTestingFSharpProjectNode -> string -> unit) = this.MakeProjectAndDoWithProjectFile(compileItems, references, other, null, f) - /// Create a project with the given "compileItems" and "other", then + /// Create a project with the given "compileItems" and "other", then /// call "f" on that project while the project file still exists on disk. member internal this.MakeProjectAndDo(compileItems : string list, references : string list, other : string, f : UnitTestingFSharpProjectNode -> unit) = this.MakeProjectAndDo(compileItems, references, other, null, f) @@ -346,12 +346,12 @@ type TheTests() = )) !project - + member this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems : string list, other : string, expectations : Tree) = use project = this.MakeProject(compileItems, [], other) :> HierarchyNode let node = project.FirstChild TheTests.AssertSameTree(expectations, node) - () + () member internal this.EnsureCausesNotification(project, code) = let ipsf = project :> IProvideProjectSite @@ -363,7 +363,7 @@ type TheTests() = static member MsBuildCompileItems(project : Microsoft.Build.Evaluation.Project) = [for bi in project.Items do if bi.ItemType = "Compile" then - yield bi.EvaluatedInclude] + yield bi.EvaluatedInclude] member this.MSBuildProjectBoilerplate (outputType : string) : string = let template = @" @@ -387,7 +387,7 @@ type TheTests() = " String.Format(template, outputType) - + member this.MSBuildProjectMultiPlatformBoilerplate (outputType : string) : string = let template = @" @@ -421,7 +421,7 @@ type TheTests() = " String.Format(template, outputType) - + member this.MSBuildProjectMultiConfigBoilerplate (configs : (string*string) list): string = let template = @" @@ -434,7 +434,7 @@ type TheTests() = 512 Blah " - let sb = new StringBuilder(template) + let sb = new StringBuilder(template) for (configName,customStr) in configs do let platTemplate = @" @@ -446,10 +446,10 @@ type TheTests() = AnyCPU {1} bin\{0}\ - " + " String.Format(platTemplate, configName, customStr) |> sb.Append |> ignore sb.ToString() - + member this.MSBuildProjectMultiPlatform (platforms : (string*string) list,?defaultPlatform): string = let platform = defaultArg defaultPlatform "AnyCPU" let template = @" @@ -463,7 +463,7 @@ type TheTests() = 512 Blah " - let sb = new StringBuilder(String.Format(template,platform)) + let sb = new StringBuilder(String.Format(template,platform)) for (platformName,customStr) in platforms do let platTemplate = @" @@ -475,7 +475,7 @@ type TheTests() = bin\Debug\ {1} {0} - " + " String.Format(platTemplate, platformName, customStr) |> sb.Append |> ignore sb.ToString() member internal this.CheckConfigNames (project:UnitTestingFSharpProjectNode, expectedNames : string[])= @@ -484,7 +484,7 @@ type TheTests() = project.ConfigProvider.GetCfgNames(uint32 cfgNames.Length, cfgNames, actual) |> AssertEqual VSConstants.S_OK AssertEqualMsg expectedNames cfgNames "List of config names is different" AssertEqualMsg expectedNames.Length (int actual.[0]) "List of config names is ok, but reported lengths disagree" - + member internal this.CheckPlatformNames(project:UnitTestingFSharpProjectNode, expectedNames : string[])= let platformNames = Array.create expectedNames.Length "" let actual = [| 0u |] @@ -499,7 +499,7 @@ type TheTests() = this.CheckPlatformNames(project, expectedPlatforms) this.CheckConfigNames(project, expectedConfigs) )) - + and (*type*) MSBuildItem = | FolderItem of string // Include="relativeDir" @@ -530,7 +530,7 @@ and (*type*) MSBuildItem = member this.IntoFolder(folder : string) = // return new copy of item in the folder Debug.Assert(folder.EndsWith("\\"), "folders should end with slash") match this with - | FolderItem(s) -> + | FolderItem(s) -> Debug.Assert(s.EndsWith("\\"), "folders should end with slash") FolderItem(folder + s) | CompileItem(s) -> CompileItem(folder + s) @@ -553,7 +553,7 @@ and (*type*) MSBuildItems = member this.Items() = match this with | MSBuildItems(l) -> l - + module LanguageServiceExtension = open UnitTests.TestLib.LanguageService open Salsa.Salsa @@ -565,12 +565,12 @@ module LanguageServiceExtension = member this.CreateProjectHookIsEnabled with get() = createProjectHookIsEnabled and set(x) = createProjectHookIsEnabled <- x /// A test flavour - this layers additional behaviour over the BuiltMSBuildTestFlavour - /// to exercise the unit-testable versions of the classes in FSharp.ProjectSystem.FSharp. - /// For example, when a CreateProject call is made, a UnitTestingFSharpProjectNode is + /// to exercise the unit-testable versions of the classes in FSharp.ProjectSystem.FSharp. + /// For example, when a CreateProject call is made, a UnitTestingFSharpProjectNode is /// created (in addition to the actions performed via the MSBuild layer). // // NOTE: The "BehaviourHooks" way of injecting functionality seems awkward. - type internal ProjectSystemTestFlavour() = + type internal ProjectSystemTestFlavour() = let msbuild = BuiltMSBuildTestFlavour() let hooks = msbuild.BehaviourHooks let projectDict = new Dictionary() @@ -580,13 +580,13 @@ module LanguageServiceExtension = member ops.AddAssemblyReference(project, assem, specificVersion) = let projInfo = projectDict.[project] let referencesFolder = projInfo.Project.FindChild(ReferenceContainerNode.ReferencesNodeVirtualName) :?> ReferenceContainerNode - let assem = + let assem = // mimic logic in ReferenceResolution.fs:MSBuildResolver.Resolve() - if Path.IsPathRooted(assem) then - assem + if Path.IsPathRooted(assem) then + assem elif not(assem.Contains("\\") || assem.Contains("/")) then assem - else + else Path.Combine(projInfo.Project.ProjectFolder, assem) let assem, isFullPath = if Path.IsPathRooted(assem) then @@ -609,8 +609,8 @@ module LanguageServiceExtension = let configChangeNotifier = ref None let projInfo = new ProjInfo() let NULL = Unchecked.defaultof - let newHooks = - { new ProjectBehaviorHooks with + let newHooks = + { new ProjectBehaviorHooks with // Note: CreateProjectHook will callback MakeHierarchyHook and then InitializeProjectHook member x.CreateProjectHook (projectFilename, files, references, projReferences, disabledWarnings, defines, versionFile, otherFlags, otherMSBuildStuff, targetFrameworkVersion: string) = @@ -620,15 +620,15 @@ module LanguageServiceExtension = () else // REVIEW: this is a workaround to get everything working for now; ideally we want to implement the VS gestures below - // so that they really happen in the project system, rather than just poking the .fsproj file and then doing + // so that they really happen in the project system, rather than just poking the .fsproj file and then doing // a 'reload' each time. But for now, this is good. projInfo.Project.Reload() - member x.InitializeProjectHook (openProject) = + member x.InitializeProjectHook (openProject) = hooks.InitializeProjectHook(openProject) projectDict.Add(openProject, projInfo) - member x.MakeHierarchyHook (projdir, fullname, projectname, ccn, serviceProvider) = + member x.MakeHierarchyHook (projdir, fullname, projectname, ccn, serviceProvider) = if projInfo.Project = NULL then let p = TheTests.CreateProject(fullname, "false", ccn, serviceProvider) projInfo.Project <- p @@ -639,7 +639,7 @@ module LanguageServiceExtension = member x.AddFileToHierarchyHook (filename, hier) = () - member x.BuildHook (projFileName, target, vsOutputWindowPane) = + member x.BuildHook (projFileName, target, vsOutputWindowPane) = if projInfo.Project = NULL then failwith "tried to build not-yet-created project" else @@ -647,12 +647,12 @@ module LanguageServiceExtension = projInfo.Project.BuildToOutput(target,vsOutputWindowPane, null) |> ignore // force build through project system for code coverage hooks.BuildHook(projFileName, target, vsOutputWindowPane) // use MSBuild to build and also return MainAssembly value - member x.GetMainOutputAssemblyHook baseName = hooks.GetMainOutputAssemblyHook baseName + member x.GetMainOutputAssemblyHook baseName = hooks.GetMainOutputAssemblyHook baseName member x.SaveHook () = if projInfo.Project = NULL then () else projInfo.Project.Save(null, 1, 0u) |> ignore member x.DestroyHook () = - if projInfo.Project = NULL then () else + if projInfo.Project = NULL then () else projInfo.Project.Close () |> ignore match projectDict |> Seq.tryFind(fun (KeyValue(k,v)) -> obj.ReferenceEquals(v, projInfo)) with | Some(KeyValue(k,v)) -> projectDict.Remove(k) |> ignore @@ -671,68 +671,68 @@ module LanguageServiceExtension = member ops.BehaviourHooks = hooks member ops.CreateVisualStudio () = msbuild.CreateVisualStudio () member ops.CreateSolution vs = msbuild.CreateSolution vs - member ops.GetOutputWindowPaneLines vs = msbuild.GetOutputWindowPaneLines vs - member ops.CloseSolution solution = msbuild.CloseSolution solution + member ops.GetOutputWindowPaneLines vs = msbuild.GetOutputWindowPaneLines vs + member ops.CloseSolution solution = msbuild.CloseSolution solution member ops.CreateProjectWithHooks (solution,hooks,projectBaseName) = msbuild.CreateProjectWithHooks (solution,hooks,projectBaseName) member ops.NewFile (vs,filename,buildAction, lines) = msbuild.NewFile (vs,filename,buildAction, lines) - member ops.DeleteFileFromDisk file = msbuild.DeleteFileFromDisk file - member ops.AddFileFromText (project,filenameOnDisk,filenameInProject,buildAction,lines) = msbuild.AddFileFromText (project,filenameOnDisk,filenameInProject,buildAction,lines) + member ops.DeleteFileFromDisk file = msbuild.DeleteFileFromDisk file + member ops.AddFileFromText (project,filenameOnDisk,filenameInProject,buildAction,lines) = msbuild.AddFileFromText (project,filenameOnDisk,filenameInProject,buildAction,lines) member ops.AddLinkedFileFromText (project,filenameOnDisk,includeFilenameInProject,linkFilenameInProject,buildAction,lines) = msbuild.AddLinkedFileFromText (project,filenameOnDisk,includeFilenameInProject,linkFilenameInProject,buildAction,lines) member ops.AddProjectReference (project1, project2) = msbuild.AddProjectReference (project1, project2) - member ops.ProjectDirectory project = msbuild.ProjectDirectory project - member ops.ProjectFile project = msbuild.ProjectFile project - member ops.SetVersionFile (project,file) = msbuild.SetVersionFile (project,file) - member ops.SetOtherFlags (project,flags) = msbuild.SetOtherFlags (project,flags) - member ops.SetConfigurationAndPlatform (project, configAndPlatform) = msbuild.SetConfigurationAndPlatform (project, configAndPlatform) - member ops.AddDisabledWarning (project, code) = msbuild.AddDisabledWarning (project, code) - member ops.GetErrors project = msbuild.GetErrors project - member ops.BuildProject (project,target) = msbuild.BuildProject (project,target) - member ops.GetMainOutputAssembly project = msbuild.GetMainOutputAssembly project - member ops.SaveProject project = msbuild.SaveProject project - member ops.OpenFileViaOpenFile (vs,filename) = msbuild.OpenFileViaOpenFile (vs,filename) - member ops.OpenFile (project,filename) = msbuild.OpenFile (project,filename) - member ops.SetProjectDefines (project, defines) = msbuild.SetProjectDefines (project, defines) + member ops.ProjectDirectory project = msbuild.ProjectDirectory project + member ops.ProjectFile project = msbuild.ProjectFile project + member ops.SetVersionFile (project,file) = msbuild.SetVersionFile (project,file) + member ops.SetOtherFlags (project,flags) = msbuild.SetOtherFlags (project,flags) + member ops.SetConfigurationAndPlatform (project, configAndPlatform) = msbuild.SetConfigurationAndPlatform (project, configAndPlatform) + member ops.AddDisabledWarning (project, code) = msbuild.AddDisabledWarning (project, code) + member ops.GetErrors project = msbuild.GetErrors project + member ops.BuildProject (project,target) = msbuild.BuildProject (project,target) + member ops.GetMainOutputAssembly project = msbuild.GetMainOutputAssembly project + member ops.SaveProject project = msbuild.SaveProject project + member ops.OpenFileViaOpenFile (vs,filename) = msbuild.OpenFileViaOpenFile (vs,filename) + member ops.OpenFile (project,filename) = msbuild.OpenFile (project,filename) + member ops.SetProjectDefines (project, defines) = msbuild.SetProjectDefines (project, defines) member ops.PlaceIntoProjectFileBeforeImport (project,xml) = msbuild.PlaceIntoProjectFileBeforeImport (project,xml) - member ops.GetOpenFiles project = msbuild.GetOpenFiles project - member ops.MoveCursorTo (file,line,col) = msbuild.MoveCursorTo (file,line,col) - member ops.GetCursorLocation file = msbuild.GetCursorLocation file - member ops.OpenExistingProject (vs,dir,projname) = msbuild.OpenExistingProject (vs,dir,projname) - member ops.MoveCursorToEndOfMarker (file,marker) = msbuild.MoveCursorToEndOfMarker (file,marker) - member ops.MoveCursorToStartOfMarker (file,marker) = msbuild.MoveCursorToStartOfMarker (file,marker) - member ops.GetNameOfOpenFile file = msbuild.GetNameOfOpenFile file - member ops.GetProjectOptionsOfScript file = msbuild.GetProjectOptionsOfScript file - member ops.GetQuickInfoAtCursor file = msbuild.GetQuickInfoAtCursor file - member ops.GetQuickInfoAndSpanAtCursor file = msbuild.GetQuickInfoAndSpanAtCursor file - member ops.GetMatchingBracesForPositionAtCursor file = msbuild.GetMatchingBracesForPositionAtCursor file - member ops.GetParameterInfoAtCursor file = msbuild.GetParameterInfoAtCursor file - member ops.GetTokenTypeAtCursor file = msbuild.GetTokenTypeAtCursor file - member ops.GetSquiggleAtCursor file = msbuild.GetSquiggleAtCursor file - member ops.GetSquigglesAtCursor file = msbuild.GetSquigglesAtCursor file - member ops.AutoCompleteAtCursor file = msbuild.AutoCompleteAtCursor file - member ops.CompleteAtCursorForReason (file,reason) = msbuild.CompleteAtCursorForReason (file,reason) - member ops.CompletionBestMatchAtCursorFor (file, value, filterText) = msbuild.CompletionBestMatchAtCursorFor (file, value, filterText) - member ops.GotoDefinitionAtCursor (file, forceGen) = msbuild.GotoDefinitionAtCursor (file, forceGen) - member ops.GetIdentifierAtCursor file = msbuild.GetIdentifierAtCursor file - member ops.GetF1KeywordAtCursor file = msbuild.GetF1KeywordAtCursor file - member ops.GetLineNumber (file, n) = msbuild.GetLineNumber (file, n) - member ops.GetAllLines file = msbuild.GetAllLines file - member ops.SwitchToFile (vs,file) = msbuild.SwitchToFile (vs,file) - member ops.OnIdle vs = msbuild.OnIdle vs - member ops.ShiftKeyDown vs = msbuild.ShiftKeyDown vs - member ops.ShiftKeyUp vs = msbuild.ShiftKeyUp vs - member ops.TakeCoffeeBreak vs = msbuild.TakeCoffeeBreak vs - member ops.ReplaceFileInMemory (file,contents,takeCoffeeBreak) = msbuild.ReplaceFileInMemory (file,contents,takeCoffeeBreak) - member ops.SaveFileToDisk file = msbuild.SaveFileToDisk file - member ops.CreatePhysicalProjectFileInMemory (files, references, projectReferences, disabledWarnings, defines, versionFile, otherFlags, otherProjMisc, targetFrameworkVersion) = msbuild.CreatePhysicalProjectFileInMemory (files, references, projectReferences, disabledWarnings, defines, versionFile, otherFlags, otherProjMisc, targetFrameworkVersion) - member ops.CleanUp vs = msbuild.CleanUp vs - member ops.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients vs = msbuild.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients vs - member ops.AutoCompleteMemberDataTipsThrowsScope message = msbuild.AutoCompleteMemberDataTipsThrowsScope message - member ops.CleanInvisibleProject vs = msbuild.CleanInvisibleProject vs - + member ops.GetOpenFiles project = msbuild.GetOpenFiles project + member ops.MoveCursorTo (file,line,col) = msbuild.MoveCursorTo (file,line,col) + member ops.GetCursorLocation file = msbuild.GetCursorLocation file + member ops.OpenExistingProject (vs,dir,projname) = msbuild.OpenExistingProject (vs,dir,projname) + member ops.MoveCursorToEndOfMarker (file,marker) = msbuild.MoveCursorToEndOfMarker (file,marker) + member ops.MoveCursorToStartOfMarker (file,marker) = msbuild.MoveCursorToStartOfMarker (file,marker) + member ops.GetNameOfOpenFile file = msbuild.GetNameOfOpenFile file + member ops.GetProjectOptionsOfScript file = msbuild.GetProjectOptionsOfScript file + member ops.GetQuickInfoAtCursor file = msbuild.GetQuickInfoAtCursor file + member ops.GetQuickInfoAndSpanAtCursor file = msbuild.GetQuickInfoAndSpanAtCursor file + member ops.GetMatchingBracesForPositionAtCursor file = msbuild.GetMatchingBracesForPositionAtCursor file + member ops.GetParameterInfoAtCursor file = msbuild.GetParameterInfoAtCursor file + member ops.GetTokenTypeAtCursor file = msbuild.GetTokenTypeAtCursor file + member ops.GetSquiggleAtCursor file = msbuild.GetSquiggleAtCursor file + member ops.GetSquigglesAtCursor file = msbuild.GetSquigglesAtCursor file + member ops.AutoCompleteAtCursor file = msbuild.AutoCompleteAtCursor file + member ops.CompleteAtCursorForReason (file,reason) = msbuild.CompleteAtCursorForReason (file,reason) + member ops.CompletionBestMatchAtCursorFor (file, value, filterText) = msbuild.CompletionBestMatchAtCursorFor (file, value, filterText) + member ops.GotoDefinitionAtCursor (file, forceGen) = msbuild.GotoDefinitionAtCursor (file, forceGen) + member ops.GetIdentifierAtCursor file = msbuild.GetIdentifierAtCursor file + member ops.GetF1KeywordAtCursor file = msbuild.GetF1KeywordAtCursor file + member ops.GetLineNumber (file, n) = msbuild.GetLineNumber (file, n) + member ops.GetAllLines file = msbuild.GetAllLines file + member ops.SwitchToFile (vs,file) = msbuild.SwitchToFile (vs,file) + member ops.OnIdle vs = msbuild.OnIdle vs + member ops.ShiftKeyDown vs = msbuild.ShiftKeyDown vs + member ops.ShiftKeyUp vs = msbuild.ShiftKeyUp vs + member ops.TakeCoffeeBreak vs = msbuild.TakeCoffeeBreak vs + member ops.ReplaceFileInMemory (file,contents,takeCoffeeBreak) = msbuild.ReplaceFileInMemory (file,contents,takeCoffeeBreak) + member ops.SaveFileToDisk file = msbuild.SaveFileToDisk file + member ops.CreatePhysicalProjectFileInMemory (files, references, projectReferences, disabledWarnings, defines, versionFile, otherFlags, otherProjMisc, targetFrameworkVersion) = msbuild.CreatePhysicalProjectFileInMemory (files, references, projectReferences, disabledWarnings, defines, versionFile, otherFlags, otherProjMisc, targetFrameworkVersion) + member ops.CleanUp vs = msbuild.CleanUp vs + member ops.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients vs = msbuild.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients vs + member ops.AutoCompleteMemberDataTipsThrowsScope message = msbuild.AutoCompleteMemberDataTipsThrowsScope message + member ops.CleanInvisibleProject vs = msbuild.CleanInvisibleProject vs + let internal ProjectSystemTestFlavour = ProjectSystemTestFlavour() - - + + diff --git a/vsintegration/tests/UnitTests/TestLib.Salsa.fs b/vsintegration/tests/UnitTests/TestLib.Salsa.fs index ac3636723eb..085d3e3d47e 100644 --- a/vsintegration/tests/UnitTests/TestLib.Salsa.fs +++ b/vsintegration/tests/UnitTests/TestLib.Salsa.fs @@ -12,50 +12,50 @@ open System.Text.RegularExpressions // Common asserts ------------------------------------------------------------- let AssertEqualWithMessage(expected, actual, message) = - if expected <> actual then + if expected <> actual then printf "%s" message Assert.Fail(message) - + let AssertEqual(expected,actual) = - if expected<>actual then + if expected<>actual then let message = sprintf "Expected:\n%A\n\nbut got:\n%A." expected actual printf "%s" message Assert.Fail(message) - + let AssertContainsInOrder(s:string,cs:string list) = let rec containsInOrderFrom fromIndex expects = match expects with | [] -> () | expect :: expects -> - let index = s.IndexOf((expect:string),(fromIndex:int)) + let index = s.IndexOf((expect:string),(fromIndex:int)) if index = -1 then Assert.Fail(sprintf "Expected:\n%s\n\nto contain:\n%s\n\nafter index: %d." s expect fromIndex) else printfn "At index %d seen '%s'." index expect containsInOrderFrom index expects containsInOrderFrom 0 cs - + let AssertContains(value: string, substring: string) = Assert.Contains(substring, value) - + let AssertArrayContainsPartialMatchOf(a:string array,c) = let found = ref false a |> Array.iter(fun s -> found := s.Contains(c) || !found) - if not(!found) then - printfn "Expected:\n%A" a + if not(!found) then + printfn "Expected:\n%A" a printfn "to contain\n%s" c - Assert.Fail() - -let AssertNotContains(s:string,c) = + Assert.Fail() + +let AssertNotContains(s:string,c) = if (s.Contains(c)) then printf "Expected:\n%s\n\nnot to not contain:\n%s." s c - Assert.Fail() - + Assert.Fail() + let AssertMatches (r : Regex) (s:string) = if not (r.IsMatch(s)) then printfn "Expected regex '%s' to match '%s'." (r.ToString()) s Assert.Fail() - + // Like AssertMatches, but runs for every prefix of regex up to each occurrence of 'c' // Is helpful so that, if long regex match fails, you see first prefix that fails let AssertMatchesRegex (c : char) (regexStr : string) (s:string) = @@ -65,7 +65,7 @@ let AssertMatchesRegex (c : char) (regexStr : string) (s:string) = let regex = new Regex(r) AssertMatches regex s i <- regexStr.IndexOf(c, i+1) - + // Common TestFixture methods ------------------------------------------------- open System.IO @@ -75,7 +75,7 @@ open UnitTests.TestLib.Utils // Non-controlled usage of these functions can easily lead to the violation of invariants in tests: // - modification of shared VS\solution is prohibited and the only permitted operation is CreateSingleFileProject // - modification of fresh VS instance is allowed, to denote that tests required fresh instance of VS add line 'use _guard - this.WithNewVS()' at the beginning of the test -module internal GlobalFunctions = +module internal GlobalFunctions = let CreateSolution(vs) = CreateSolution(vs) let CloseSolution(sol) = CloseSolution(sol) let Cleanup(vs) = Cleanup(vs) @@ -89,7 +89,7 @@ module internal GlobalFunctions = // hides existing global functions - so they can be accessed only from GlobalFunctions [] -module HiddenFunctions = +module HiddenFunctions = /// this function should not be called from the global namespace /// if you really need it - use qualified form: GlobalFunctions.CreateSolution let CreateSolution() : unit = failwith "Should not be called" diff --git a/vsintegration/tests/UnitTests/TestLib.Utils.fs b/vsintegration/tests/UnitTests/TestLib.Utils.fs index 49a5bfdf08a..6032c48b222 100644 --- a/vsintegration/tests/UnitTests/TestLib.Utils.fs +++ b/vsintegration/tests/UnitTests/TestLib.Utils.fs @@ -10,17 +10,17 @@ open Microsoft.VisualStudio module Asserts = (* Asserts ----------------------------------------------------------------------------- *) let AssertEqualMsg expected actual failureMsg = - if expected<>actual then + if expected<>actual then let message = sprintf "Expected\n%A\nbut got\n%A\n%s" expected actual failureMsg printfn "%s" message Assert.Fail(message) let AssertEqual expected actual = - if expected<>actual then + if expected<>actual then let message = sprintf "Expected\n%A\nbut got\n%A" expected actual printfn "%s" message Assert.Fail(message) let AssertNotEqual expected actual = - if expected=actual then + if expected=actual then let message = "Expected not equal, but were equal" printfn "%s" message Assert.Fail(message) @@ -56,19 +56,19 @@ module UIStuff = Microsoft.VisualStudio.FSharp.ProjectSystem.UIThread.InitUnitTestingMode() module FilesystemHelpers = - let pid = System.Diagnostics.Process.GetCurrentProcess().Id + let pid = System.Diagnostics.Process.GetCurrentProcess().Id /// Create a new temporary directory. - let rec NewTempDirectory (prefixName : String) = - let tick = Environment.TickCount + let rec NewTempDirectory (prefixName : String) = + let tick = Environment.TickCount let dir = Path.Combine(Path.GetTempPath(), sprintf "%s-%A-%d" prefixName tick pid) if Directory.Exists dir then NewTempDirectory prefixName - else + else let _ = Directory.CreateDirectory(dir) dir - + /// Create a temporary file name, invoke callback with that fileName, then clean up temp file. - let DoWithTempFile (fileName : string) (f : string (*filePath*) -> 'a) = + let DoWithTempFile (fileName : string) (f : string (*filePath*) -> 'a) = let dir = NewTempDirectory "fsc-tests" let filePath = Path.Combine(dir, fileName) let r = f filePath @@ -86,7 +86,7 @@ module FilesystemHelpers = DeleteAll(dir) r -module Spawn = +module Spawn = open System open System.IO open System.Diagnostics @@ -111,7 +111,7 @@ module Spawn = PrivilegedProcessorTime=proc.PrivilegedProcessorTime.TotalMilliseconds UserProcessorTime=proc.UserProcessorTime.TotalMilliseconds TotalProcessorTime=proc.TotalProcessorTime.TotalMilliseconds - } + } with :? InvalidOperationException as e -> // There is what appears to be an unresolvable race here. The process may exit while building the record. { PeakPagedMemorySize=0L @@ -120,8 +120,8 @@ module Spawn = PrivilegedProcessorTime=0.0 UserProcessorTime=0.0 TotalProcessorTime=0.0 - } - static member internal SampleProcess(proc:Process,original) = + } + static member internal SampleProcess(proc:Process,original) = try { PeakPagedMemorySize=max proc.PeakPagedMemorySize64 original.PeakPagedMemorySize PeakVirtualMemorySize=max proc.PeakVirtualMemorySize64 original.PeakVirtualMemorySize @@ -129,13 +129,13 @@ module Spawn = PrivilegedProcessorTime=max proc.PrivilegedProcessorTime.TotalMilliseconds original.PrivilegedProcessorTime UserProcessorTime=max proc.UserProcessorTime.TotalMilliseconds original.UserProcessorTime TotalProcessorTime=max proc.TotalProcessorTime.TotalMilliseconds original.TotalProcessorTime - } + } with :? InvalidOperationException as e -> // There is what appears to be an unresolvable race here. The process may exit while building the record. original let private spawnDetailed logOutputTo logErrorTo exitWith command fmt = - let spawn (arguments:string) = + let spawn (arguments:string) = if showSpawnedCommands then printfn "%s %s" command arguments let pi = ProcessStartInfo(command,arguments) @@ -151,7 +151,7 @@ module Spawn = proc.OutputDataReceived.Add(logOutputTo) proc.ErrorDataReceived.Add(logErrorTo) match proc.Start() with - | false -> + | false -> failwith(sprintf "Could not start process: %s %s " command arguments) | true -> proc.BeginOutputReadLine() @@ -161,58 +161,58 @@ module Spawn = stats <- ProcessResults.SampleProcess(proc,stats) exitWith command arguments proc.ExitCode stats - Printf.ksprintf spawn fmt + Printf.ksprintf spawn fmt - let private expectCodeOrRaise expectedCode command arguments (exitCode:int) _ = - if expectedCode<>exitCode then + let private expectCodeOrRaise expectedCode command arguments (exitCode:int) _ = + if expectedCode<>exitCode then failwith(sprintf "%s %s exited with code %d. Expected %d" command arguments exitCode expectedCode) () - let private expectCodeWithStatisticsOrExit expectedCode command arguments (exitCode:int) stats :ProcessResults = - if expectedCode<>exitCode then + let private expectCodeWithStatisticsOrExit expectedCode command arguments (exitCode:int) stats :ProcessResults = + if expectedCode<>exitCode then failwith(sprintf "%s %s exited with code %d. Expected %d" command arguments exitCode expectedCode) stats let private returnExitCode _ _ (exitCode:int) _= exitCode let ignoreDataReceived(_msg:DataReceivedEventArgs) = () - + /// Execute a command - let public Spawn command fmt = + let public Spawn command fmt = spawnDetailed ignoreDataReceived ignoreDataReceived (expectCodeOrRaise 0) command fmt /// Execute a command and expect a particular result code - let public SpawnExpectCode expectCode command fmt = + let public SpawnExpectCode expectCode command fmt = spawnDetailed ignoreDataReceived ignoreDataReceived (expectCodeOrRaise expectCode) command fmt /// Execute the command and return the exit code - let public SpawnReturnExitCode command fmt = + let public SpawnReturnExitCode command fmt = spawnDetailed ignoreDataReceived ignoreDataReceived returnExitCode command fmt /// Execute the command a return an array of textlines for the output and error. - let public SpawnToTextLines command fmt = + let public SpawnToTextLines command fmt = let outlock = obj() let captured = ref [] - let capture (msg:DataReceivedEventArgs) = + let capture (msg:DataReceivedEventArgs) = lock outlock (fun () -> captured := msg.Data :: !captured) - let exitWithResult command arguments actualCode _ = + let exitWithResult command arguments actualCode _ = actualCode, (!captured)|>List.rev|>Array.ofList spawnDetailed capture capture exitWithResult command fmt /// Execute a command and expect a particular result code. Return the processor statistics. - let public SpawnWithStatisticsExpectCode expectCode command fmt = + let public SpawnWithStatisticsExpectCode expectCode command fmt = spawnDetailed ignoreDataReceived ignoreDataReceived (expectCodeWithStatisticsOrExit expectCode) command fmt - let Batch batchText = + let Batch batchText = let outlock = obj() let mutable captured = [] - let capture (msg:DataReceivedEventArgs) = - lock outlock (fun () -> + let capture (msg:DataReceivedEventArgs) = + lock outlock (fun () -> captured <- msg.Data :: captured) - let exitWithResult command arguments actualCode _ = + let exitWithResult command arguments actualCode _ = actualCode, captured|>List.rev|>Array.ofList FilesystemHelpers.DoWithTempFile @@ -233,27 +233,27 @@ module Spawn = let code = SpawnReturnExitCode "robocopy" "%s %s /mir" source destination match code with | 0 | 1 | 2 | 3 -> () // Success. - | _ -> + | _ -> printfn "Robocopy %s %s /mir exited with code %d. Expected 0, 1, 2 or 3." source destination code exit code /// Submit a specific set of checked out files to Tfs. - let TfsSubmitSpecificFiles (files:string[]) comment = + let TfsSubmitSpecificFiles (files:string[]) comment = let files = String.Join(" ", files) // Submit the changes match SpawnToTextLines "tf_.exe" "submit %s /comment:\"%s\" /noprompt" files comment with - | 0,_ -> + | 0,_ -> printfn "Submitted files: %s" files - | 1,_ -> + | 1,_ -> printfn "No changes detected in files: %s" files | errorCode,lines -> - for line in lines do + for line in lines do printfn "%s" line eprintfn "tf submit returned error code %d" errorCode [] -module Helpers = +module Helpers = type DummyType = A | B let PathRelativeToTestAssembly p = Path.Combine(Path.GetDirectoryName(Uri(typeof.Assembly.CodeBase).LocalPath), p) @@ -308,7 +308,7 @@ namespace TestLibrary y : int } - let showPoint (p : Point) = sprintf "(%A,%A)" p.x p.y + let showPoint (p : Point) = sprintf "(%A,%A)" p.x p.y type Shape (initVertices : list) = let mutable vertices = initVertices diff --git a/vsintegration/tests/UnitTests/Tests.Build.fs b/vsintegration/tests/UnitTests/Tests.Build.fs index 6f87164333f..baf0825031c 100644 --- a/vsintegration/tests/UnitTests/Tests.Build.fs +++ b/vsintegration/tests/UnitTests/Tests.Build.fs @@ -48,10 +48,10 @@ type FauxHostObject() = interface ITaskHost // no members -type Build() = +type Build() = (* Asserts ----------------------------------------------------------------------------- *) let AssertEqual expected actual = - if expected<>actual then + if expected<>actual then let message = sprintf "Expected\n%A\nbut got\n%A" expected actual printfn "%s" message Assert.Fail(message) @@ -63,7 +63,7 @@ type Build() = let tool = new FSharp.Build.Fsc() printfn "By the way, the registry or app.config tool path is %s" tool.ToolPath tool.CodePage <- "65001" - AssertEqual "65001" tool.CodePage + AssertEqual "65001" tool.CodePage let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--codepage:65001" + Environment.NewLine + @@ -109,7 +109,7 @@ type Build() = let tool = new FSharp.Build.Fsc() tool.DefineConstants <- [| MakeTaskItem "FOO=3" MakeTaskItem "BAR=4" |] - AssertEqual 2 tool.DefineConstants.Length + AssertEqual 2 tool.DefineConstants.Length let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--define:FOO=3" + Environment.NewLine + @@ -169,7 +169,7 @@ type Build() = member public this.TestVersionFile() = let tool = new FSharp.Build.Fsc() tool.VersionFile <- "src/version" - AssertEqual "src/version" tool.VersionFile + AssertEqual "src/version" tool.VersionFile let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -184,7 +184,7 @@ type Build() = member public this.TestDocumentationFile() = let tool = new FSharp.Build.Fsc() tool.DocumentationFile <- "foo.xml" - AssertEqual "foo.xml" tool.DocumentationFile + AssertEqual "foo.xml" tool.DocumentationFile let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--doc:foo.xml" + Environment.NewLine + @@ -199,7 +199,7 @@ type Build() = member public this.TestGenerateInterfaceFile() = let tool = new FSharp.Build.Fsc() tool.GenerateInterfaceFile <- "foo.fsi" - AssertEqual "foo.fsi" tool.GenerateInterfaceFile + AssertEqual "foo.fsi" tool.GenerateInterfaceFile let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--sig:foo.fsi" + Environment.NewLine + @@ -214,7 +214,7 @@ type Build() = member public this.TestKeyFile() = let tool = new FSharp.Build.Fsc() tool.KeyFile <- "key.txt" - AssertEqual "key.txt" tool.KeyFile + AssertEqual "key.txt" tool.KeyFile let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--keyfile:key.txt" + Environment.NewLine + @@ -229,7 +229,7 @@ type Build() = member public this.TestNoFramework() = let tool = new FSharp.Build.Fsc() tool.NoFramework <- true - AssertEqual true tool.NoFramework + AssertEqual true tool.NoFramework let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--noframework" + Environment.NewLine + @@ -244,7 +244,7 @@ type Build() = member public this.TestOptimize() = let tool = new FSharp.Build.Fsc() tool.Optimize <- false - AssertEqual false tool.Optimize + AssertEqual false tool.Optimize let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize-" + Environment.NewLine + @@ -273,7 +273,7 @@ type Build() = member public this.TestOtherFlags() = let tool = new FSharp.Build.Fsc() tool.OtherFlags <- "--yadda yadda" - AssertEqual "--yadda yadda" tool.OtherFlags + AssertEqual "--yadda yadda" tool.OtherFlags let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -289,7 +289,7 @@ type Build() = member public this.TestOutputAssembly() = let tool = new FSharp.Build.Fsc() tool.OutputAssembly <- "oUt.dll" - AssertEqual "oUt.dll" tool.OutputAssembly + AssertEqual "oUt.dll" tool.OutputAssembly let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("-o:oUt.dll" + Environment.NewLine + @@ -304,7 +304,7 @@ type Build() = member public this.TestPdbFile() = let tool = new FSharp.Build.Fsc() tool.PdbFile <- "out.pdb" - AssertEqual "out.pdb" tool.PdbFile + AssertEqual "out.pdb" tool.PdbFile let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -319,7 +319,7 @@ type Build() = member public this.TestPlatform1() = let tool = new FSharp.Build.Fsc() tool.Platform <- "x64" - AssertEqual "x64" tool.Platform + AssertEqual "x64" tool.Platform let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -334,7 +334,7 @@ type Build() = member public this.TestPlatform3() = let tool = new FSharp.Build.Fsc() tool.Platform <- "x86" - AssertEqual "x86" tool.Platform + AssertEqual "x86" tool.Platform let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -350,7 +350,7 @@ type Build() = let tool = new FSharp.Build.Fsc() let dll = "c:\\sd\\staging\\tools\\xunit\\xunit.core.dll" tool.References <- [| MakeTaskItem dll |] - AssertEqual 1 tool.References.Length + AssertEqual 1 tool.References.Length let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -366,7 +366,7 @@ type Build() = let tool = new FSharp.Build.Fsc() let path = "c:\\sd\\staging\\tools\\xunit\\;c:\\Foo" tool.ReferencePath <- path - AssertEqual path tool.ReferencePath + AssertEqual path tool.ReferencePath let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -382,7 +382,7 @@ type Build() = let tool = new FSharp.Build.Fsc() let path = "c:\\program files;c:\\sd\\staging\\tools\\xunit;c:\\Foo" tool.ReferencePath <- path - AssertEqual path tool.ReferencePath + AssertEqual path tool.ReferencePath let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -397,7 +397,7 @@ type Build() = member public this.TestResources() = let tool = new FSharp.Build.Fsc() tool.Resources <- [| MakeTaskItem "Foo.resources" |] - AssertEqual 1 tool.Resources.Length + AssertEqual 1 tool.Resources.Length let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -414,7 +414,7 @@ type Build() = let src = "foo.fs" let iti = MakeTaskItem src tool.Sources <- [| iti; iti |] - AssertEqual 2 tool.Sources.Length + AssertEqual 2 tool.Sources.Length let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -431,7 +431,7 @@ type Build() = member public this.TestTargetType1() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Library" - AssertEqual "Library" tool.TargetType + AssertEqual "Library" tool.TargetType let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -446,7 +446,7 @@ type Build() = member public this.TestTargetType2() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Winexe" - AssertEqual "Winexe" tool.TargetType + AssertEqual "Winexe" tool.TargetType let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -461,7 +461,7 @@ type Build() = member public this.TestTargetType3() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Module" - AssertEqual "Module" tool.TargetType + AssertEqual "Module" tool.TargetType let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + @@ -512,7 +512,7 @@ type Build() = "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + "--nocopyfsharpcore") - cmd + cmd [] member public this.TestHighEntropyVA() = @@ -525,7 +525,7 @@ type Build() = "--flaterrors" + Environment.NewLine + "--highentropyva+" + Environment.NewLine + "--nocopyfsharpcore") - cmd + cmd [] member public this.TestSubsystemVersion() = @@ -539,7 +539,7 @@ type Build() = "--subsystemversion:6.02" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + "--nocopyfsharpcore") - cmd + cmd [] member public this.TestAllCombo() = @@ -553,7 +553,7 @@ type Build() = tool.VersionFile <- "src/version" tool.DocumentationFile <- "foo.xml" tool.GenerateInterfaceFile <- "foo.fsi" - tool.KeyFile <- "key.txt" + tool.KeyFile <- "key.txt" tool.NoFramework <- true tool.Optimize <- true tool.Tailcalls <- true @@ -575,7 +575,7 @@ type Build() = let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd - let expected = + let expected = "-o:out.dll" + Environment.NewLine + "--codepage:65001" + Environment.NewLine + "-g" + Environment.NewLine + @@ -636,7 +636,7 @@ type Build() = "--resource:MyRes.resources" "--resource:OtherRes.resources" "--versionfile:src/version" - "-r:ref.dll" + "-r:ref.dll" "-r:C:\\Program Files\\SpacesPath.dll" // note no internal quotes "--lib:c:\\foo,c:\\bar" "--target:exe" @@ -653,7 +653,7 @@ type Build() = "--yadda:yadda" "--other:internal quote" // note stripped internal quotes "blah" |] - AssertEqual expectedFlags hostObject.Flags + AssertEqual expectedFlags hostObject.Flags let expectedSources = [| "foo.fs"; "C:\\Program Files\\spaces.fs" |] AssertEqual expectedSources hostObject.Sources diff --git a/vsintegration/tests/UnitTests/Tests.InternalCollections.fs b/vsintegration/tests/UnitTests/Tests.InternalCollections.fs index 835eebcd771..0450301bf26 100644 --- a/vsintegration/tests/UnitTests/Tests.InternalCollections.fs +++ b/vsintegration/tests/UnitTests/Tests.InternalCollections.fs @@ -6,10 +6,10 @@ open System open System.IO open Xunit open Internal.Utilities.Collections - - -type MruCache = - new() = { } + + +type MruCache = + new() = { } member private rb.NumToString = function | 0->"Zero" | 1->"One" @@ -18,7 +18,7 @@ type MruCache = | 6->"Six" | 7->"Seven" | 8->"Eight" | 9->"Nine" | _ -> failwith "Out of range" - + member private rb.NumToStringBox n = box (rb.NumToString n) #if DISABLED_OLD_UNITTESTS @@ -113,35 +113,35 @@ type MruCache = #endif type AccessToken() = class end - -type AgedLookup() = + +type AgedLookup() = let mutable hold197 : byte [] = null let mutable hold198 : byte [] = null let mutable hold199 : byte [] = null let atok = AccessToken() - let WeakRefTest n = + let WeakRefTest n = let al = AgedLookup(n, (fun (x,y) -> x = y)) - - let AssertCached(i,o:byte array) = + + let AssertCached(i,o:byte array) = match al.TryPeekKeyValue(atok,i) with | Some(_,x) -> Assert.True(obj.ReferenceEquals(o,x), sprintf "Object in cache (%d) does not agree with expectation (%d)" x.[0] i) | None -> Assert.True(false, "Object fell out of cache") - - let AssertExistsInCached(i) = + + let AssertExistsInCached(i) = match al.TryPeekKeyValue(atok,i) with | Some _ -> () - | None -> Assert.True(false, "Object fell out of cache") - - let AssertNotCached(i) = + | None -> Assert.True(false, "Object fell out of cache") + + let AssertNotCached(i) = match al.TryPeekKeyValue(atok,i) with - | Some _ -> Assert.True(false, "Expected key to have fallen out of cache") - | None -> () - + | Some _ -> Assert.True(false, "Expected key to have fallen out of cache") + | None -> () + let f() = try // Add some large objects - for i in 150..199 do + for i in 150..199 do let mutable large : byte array = Array.create (5 * 1024 * 1024) (byte i) if i = 197 then hold197<-large if i = 198 then hold198<-large @@ -150,13 +150,13 @@ type AgedLookup() = large<-null finally printfn "ensure these objects are never on the stack of the top-level test" - f() + f() // At this point, item 0 should be long gone. AssertNotCached(0) - + // Also, hold197-hold199 may be strongly held depending on the value of 'n' passed to this test. - GC.Collect() + GC.Collect() let f() = try AssertCached(197,hold197) @@ -164,7 +164,7 @@ type AgedLookup() = AssertCached(199,hold199) finally printfn "ensure these objects are never on the stack of the top-level test" - f() + f() // Release a strongly held item (unless n=0) and see that it hasn't fallen out hold199 <- null @@ -173,46 +173,46 @@ type AgedLookup() = try AssertCached(197,hold197) AssertCached(198,hold198) - if n>0 then + if n>0 then AssertExistsInCached(199) // hold19 should be held - else + else AssertNotCached(199) finally printfn "ensure these objects are never on the stack of the top-level test" - f() - + f() + // Release a strongly held item (unless n<=1) and see that it hasn't fallen out hold198 <- null GC.Collect() let f() = try AssertCached(197,hold197) - if n>1 then + if n>1 then AssertExistsInCached(198) // hold198 should be held - else - AssertNotCached(198) + else + AssertNotCached(198) finally printfn "ensure these objects are never on the stack of the top-level test" - f() - + f() + // Release a strongly held item (unless n<=2) and see that it hasn't fallen out hold197 <- null GC.Collect() let f() = try - if n>2 then + if n>2 then AssertExistsInCached(197) // hold197 should be held else - AssertNotCached(197) + AssertNotCached(197) finally printfn "ensure these objects are never on the stack of the top-level test" - f() - + f() + // Let go of everything else. al.Clear(atok) GC.Collect() - - + + [] member public rb.WeakRef0() = WeakRefTest 0 [] member public rb.WeakRef1() = WeakRefTest 1 [] member public rb.WeakRef2() = WeakRefTest 2 diff --git a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs index ff00a933e26..0d814ec7a10 100644 --- a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs +++ b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs @@ -33,14 +33,14 @@ module MefHelpers = let loadedImports = resolvedImports.Select(fun p -> Assembly.LoadFrom(p)).ToList() let result = loadedImports.ToDictionary(fun k -> Path.GetFileNameWithoutExtension(k.Location)) - result.Values + result.Values |> Seq.append [|self|] |> Seq.append MefHostServices.DefaultAssemblies |> Array.ofSeq let createExportProvider() = let resolver = Resolver.DefaultInstance - let catalog = + let catalog = let asms = getAssemblies() let partDiscovery = PartDiscovery.Combine(new AttributedPartDiscoveryV1(resolver), new AttributedPartDiscovery(resolver, isNonPublicSupported = true)); let parts = partDiscovery.CreatePartsAsync(asms).Result @@ -149,7 +149,7 @@ type TestHostWorkspaceServices(hostServices: HostServices, workspace: Workspace) Lazy<_, _>((fun () -> x.Value.CreateService(this)), x.Metadata) ) - let otherServices1 = + let otherServices1 = Seq.append factories1 services1 let otherServicesMap1 = @@ -205,7 +205,7 @@ type RoslynTestHelpers private () = let docInfo = DocumentInfo.Create( docId, - docFilePath, + docFilePath, filePath=docFilePath, loader = new FileTextLoader(docFilePath, Encoding.Default), sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) @@ -214,8 +214,8 @@ type RoslynTestHelpers private () = ProjectInfo.Create( projId, VersionStamp.Create(DateTime.UtcNow), - projName, - "test.dll", + projName, + "test.dll", LanguageNames.FSharp, documents = [docInfo], filePath = projFilePath diff --git a/vsintegration/tests/UnitTests/Tests.TaskReporter.fs b/vsintegration/tests/UnitTests/Tests.TaskReporter.fs index d644a6c3237..c7cad21764a 100644 --- a/vsintegration/tests/UnitTests/Tests.TaskReporter.fs +++ b/vsintegration/tests/UnitTests/Tests.TaskReporter.fs @@ -20,12 +20,12 @@ open Salsa.VsMocks type TextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan type DocumentTask = Microsoft.VisualStudio.FSharp.LanguageService.DocumentTask -type TaskReporterTests() = - static let err(line) : 'a = - printfn "err() called on line %s with %s" line System.Environment.StackTrace +type TaskReporterTests() = + static let err(line) : 'a = + printfn "err() called on line %s with %s" line System.Environment.StackTrace failwith "not implemented" - let mockOleComponentManager = + let mockOleComponentManager = { new Microsoft.VisualStudio.OLE.Interop.IOleComponentManager with member x.FContinueIdle() = 1 member x.FCreateSubComponentManager(piunkOuter, piunkServProv, riid, ppvObj) = err(__LINE__) @@ -41,26 +41,26 @@ type TaskReporterTests() = member x.FSetTrackingComponent(dwComponentID, fTrack) = err(__LINE__) member x.FUpdateComponentRegistration(dwComponentID, pcrinfo) = err(__LINE__) member x.OnComponentEnterState(dwComponentID, uStateID, uContext, cpicmExclude, rgpicmExclude, dwReserved) = err(__LINE__) - member x.QueryService(guidService, iid, ppvObj) = err(__LINE__) + member x.QueryService(guidService, iid, ppvObj) = err(__LINE__) } (* Asserts ----------------------------------------------------------------------------- *) let AssertEqual expected actual = - if expected<>actual then + if expected<>actual then let message = sprintf "Expected\n%A\nbut got\n%A" expected actual printfn "%s" message Assert.Fail(message) - + let AssertNotEqual expected actual = if expected = actual then let message = sprintf "Did not want\n%A\nbut got it anyway" expected printfn "%s" message Assert.Fail(message) - + let GetNewDocumentTask filePath subcategory span errorMessage taskPriority taskCategory taskErrorCategory = - let dt = new Microsoft.VisualStudio.FSharp.LanguageService.DocumentTask(null, - Salsa.VsMocks.Vs.MakeTextLines(), + let dt = new Microsoft.VisualStudio.FSharp.LanguageService.DocumentTask(null, + Salsa.VsMocks.Vs.MakeTextLines(), Microsoft.VisualStudio.TextManager.Interop.MARKERTYPE.MARKER_CODESENSE_ERROR, span, filePath, @@ -70,10 +70,10 @@ type TaskReporterTests() = dt.Category <- taskCategory ; dt.ErrorCategory <- taskErrorCategory ; dt - + let CreateTaskListProvider() = let tasks : Task array ref = ref [||] - + { new Microsoft.VisualStudio.FSharp.LanguageService.ITaskListProvider with member tl.Count() = (!tasks).Length member tl.GetTask i = (!tasks).[i] @@ -83,7 +83,7 @@ type TaskReporterTests() = member tl.Clear() = tasks := [||] member tl.Refresh() = () } - + let CreateErrorReporter() = UIStuff.SetupSynchronizationContext() let errorReporter = new Microsoft.VisualStudio.FSharp.LanguageService.TaskReporter("unit test (taskreporter.unittests.fs)") @@ -92,278 +92,278 @@ type TaskReporterTests() = // One File Tests // For the next two, add tasks to the task list more than once to ensure that - // hashing is occurring correctly + // hashing is occurring correctly [] - member public this.``ErrorList.LanguageServiceErrorsProperlyCoalesced``() = + member public this.``ErrorList.LanguageServiceErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let documentTask = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + // add a language service error errorReporter.AddTask(documentTask) |> ignore - + // add the error to the language service again errorReporter.AddTask(documentTask) |> ignore - + errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore AssertEqual (errorReporter.TaskListProvider.Count()) 1 () - - - + + + [] - member public this.``ErrorList.ProjectSystemErrorsProperlyCoalesced``() = + member public this.``ErrorList.ProjectSystemErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let documentTask = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + // add a project system error errorReporter.AddTask(documentTask) |> ignore - + // add the error to the project system again errorReporter.AddTask(documentTask) |> ignore - + errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore AssertEqual (errorReporter.TaskListProvider.Count()) 1 - + () - + /// Test for multiple identical errors being properly coalesced in the error list (bug 2151) [] - member public this.``ErrorList.ErrorsProperlyCoalesced``() = + member public this.``ErrorList.ErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let documentTask = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + // add a language service error errorReporter.AddTask(documentTask) |> ignore - + // add a project system error errorReporter.AddTask(documentTask) |> ignore - + errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore AssertEqual (errorReporter.TaskListProvider.Count()) 1 () - - // modify the span, and check to see if we have two tasks now instead of one + + // modify the span, and check to see if we have two tasks now instead of one [] - member public this.``ErrorList.ProjectSystemErrorsProperlyCoalesced2``() = + member public this.``ErrorList.ProjectSystemErrorsProperlyCoalesced2``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let documentTask1 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + span.iStartLine <- 2; span.iEndLine <- 2; - + let documentTask2 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + // add the errors errorReporter.AddTask(documentTask1) |> ignore errorReporter.AddTask(documentTask2) |> ignore - + errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore AssertEqual (errorReporter.TaskListProvider.Count()) 2 () - + /// Ensure that text line markers are only created when a task is output to the task list [] - member public this.``ErrorList.TextLineMarkersCreatedOnce``() = + member public this.``ErrorList.TextLineMarkersCreatedOnce``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let documentTask = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error let documentTask2 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + // ensure that the tasks don't have a text line marker yet AssertEqual documentTask.TextLineMarker null AssertEqual documentTask2.TextLineMarker null - + // add a language service error errorReporter.AddTask(documentTask) |> ignore - + // add a project system error errorReporter.AddTask(documentTask2) |> ignore - + errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore AssertEqual (errorReporter.TaskListProvider.Count()) 1 - + // ensure that the task now has a text line marker AssertNotEqual documentTask.TextLineMarker null - + // now, make sure that the rejected task does not have a text line marker AssertEqual documentTask2.TextLineMarker null - - () - + + () + // Two file tests - - - - + + + + // both files open - // errors in each file, build - no duplicates + // errors in each file, build - no duplicates [] - member public this.``ErrorList.TwoFilesBothOpen``() = + member public this.``ErrorList.TwoFilesBothOpen``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let documentTask1 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error let documentTask2 = GetNewDocumentTask @"c:\bar.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + // add the errors errorReporter.AddTask(documentTask1) |> ignore errorReporter.AddTask(documentTask2) |> ignore - + errorReporter.OutputTaskList() - + // ensure that we now have two distinct tasks in the task list errorReporter.DoIdle(mockOleComponentManager) |> ignore AssertEqual (errorReporter.TaskListProvider.Count()) 2 - + // are the tasks ordered correctly? let task1 = errorReporter.TaskListProvider.GetTask(0) :?> DocumentTask let task2 = errorReporter.TaskListProvider.GetTask(1) :?> DocumentTask AssertEqual documentTask1 task2 // reordered based on filename - AssertEqual documentTask2 task1 - () - + AssertEqual documentTask2 task1 + () + // file open, one file closed // - error in closed file [] - member public this.``ErrorList.TwoFilesOneOpenErrorInOpen``() = + member public this.``ErrorList.TwoFilesOneOpenErrorInOpen``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let documentTask1 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error let documentTask2 = GetNewDocumentTask @"c:\bar.fs" "typecheck" span "bar error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - let documentTask3 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + let documentTask3 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error + // add the background task ("foo.fs" is opened) errorReporter.AddTask(documentTask1) |> ignore - + // now simulate a build - add task 2, and task 3 (which is the same as task 1) errorReporter.AddTask(documentTask2) |> ignore errorReporter.AddTask(documentTask3) |> ignore - + // get "all" tasks - if working correctly - the three tasks will have been coalesced into two (tasks 1 and 3 will be the same) errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore // ensure that we now have two distinct tasks in the task list AssertEqual (errorReporter.TaskListProvider.Count()) 2 - + // are the tasks ordered correctly? let task1 = errorReporter.TaskListProvider.GetTask(0) :?> DocumentTask let task2 = errorReporter.TaskListProvider.GetTask(1) :?> DocumentTask AssertEqual documentTask3 task2 // reordered based on filename - AssertEqual documentTask2 task1 - () - + AssertEqual documentTask2 task1 + () + // all files open - build, then fix - no errors left [] - member public this.``ErrorList.TwoFilesCorrectError``() = + member public this.``ErrorList.TwoFilesCorrectError``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let documentTask1 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error let documentTask2 = GetNewDocumentTask @"c:\bar.fs" "typecheck" span "bar error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error let documentTask3 = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error let documentTask4 = GetNewDocumentTask @"c:\bar.fs" "typecheck" span "bar error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + // add the background tasks ("foo.fs" and "bar".fs are opened) errorReporter.AddTask(documentTask1) |> ignore errorReporter.AddTask(documentTask2) |> ignore - + // now simulate a build - add task 3, and task 4 (which are the same as tasks 1 and 2) errorReporter.AddTask(documentTask3) |> ignore errorReporter.AddTask(documentTask4) |> ignore - + errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore // after the "build", we shouldn't have any build tasks, since they already belong to the LS let backgroundTasks = errorReporter.GetBackgroundTasks(); let buildTasks = errorReporter.GetBuildTasks(); - + // ensure that we now have two distinct tasks in the task list AssertEqual (errorReporter.TaskListProvider.Count()) 2 AssertEqual (backgroundTasks.GetLength(0)) 2 AssertEqual (buildTasks.GetLength(0)) 0 - + // are the tasks ordered correctly? let task1 = errorReporter.TaskListProvider.GetTask(0) :?> DocumentTask let task2 = errorReporter.TaskListProvider.GetTask(1) :?> DocumentTask AssertEqual documentTask1 task2 // reordered based on filename AssertEqual documentTask2 task1 - + // simulate a fix by clearing out the c:\foo.fs errors errorReporter.ClearBackgroundTasksForFile(@"c:\foo.fs") errorReporter.OutputTaskList() errorReporter.DoIdle(mockOleComponentManager) |> ignore let task1 = errorReporter.TaskListProvider.GetTask(0) :?> DocumentTask AssertEqual (errorReporter.TaskListProvider.Count()) 1 - AssertEqual task1 documentTask2 - () - - + AssertEqual task1 documentTask2 + () + + // Make sure a 'typecheck' is treated as a background task [] - member public this.``ErrorList.BackgroundTaskIsClassified``() = + member public this.``ErrorList.BackgroundTaskIsClassified``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let dt = GetNewDocumentTask @"c:\foo.fs" "typecheck" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + errorReporter.AddTask(dt) |> ignore - + errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore let backgroundTasks = errorReporter.GetBackgroundTasks(); let buildTasks = errorReporter.GetBuildTasks(); - + // There should be one error in the list. AssertEqual (errorReporter.TaskListProvider.Count()) 1 - + // It should be a background task. AssertEqual (backgroundTasks.GetLength(0)) 1 - + // There should be no build tasks. AssertEqual (buildTasks.GetLength(0)) 0 - - () - - + + () + + // Make sure a 'ilxgen' is treated as a build task [] - member public this.``ErrorList.BuildTaskIsClassified``() = + member public this.``ErrorList.BuildTaskIsClassified``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) let dt = GetNewDocumentTask @"c:\foo.fs" "ilxgen" span "foo error!" TaskPriority.High TaskCategory.BuildCompile TaskErrorCategory.Error - + errorReporter.AddTask(dt) |> ignore - + errorReporter.OutputTaskList() - + errorReporter.DoIdle(mockOleComponentManager) |> ignore let backgroundTasks = errorReporter.GetBackgroundTasks(); let buildTasks = errorReporter.GetBuildTasks(); - + // There should be one error in the list. AssertEqual (errorReporter.TaskListProvider.Count()) 1 - + // It should be a build task. AssertEqual (buildTasks.GetLength(0)) 1 - + // There should be no background tasks. AssertEqual (backgroundTasks.GetLength(0)) 0 - - () + + () *) diff --git a/vsintegration/tests/UnitTests/Tests.Watson.fs b/vsintegration/tests/UnitTests/Tests.Watson.fs index e5c19d5e22d..9c3c2a79525 100644 --- a/vsintegration/tests/UnitTests/Tests.Watson.fs +++ b/vsintegration/tests/UnitTests/Tests.Watson.fs @@ -8,15 +8,15 @@ open FSharp.Compiler open FSharp.Compiler.IO open FSharp.Compiler.AbstractIL.ILBinaryReader open FSharp.Compiler.CodeAnalysis -open Internal.Utilities.Library +open Internal.Utilities.Library open FSharp.Compiler.CompilerConfig open FSharp.Compiler.Driver open Xunit open System.IO -type Check = +type Check = static member public FscLevelException<'TException when 'TException :> exn>(simulationCode) = - try + try try #if DEBUG FSharp.Compiler.CompilerDiagnostics.showAssertForUnexpectedException := false @@ -33,139 +33,139 @@ type Check = let ctok = AssumeCompilationThreadWithoutEvidence () let _code = CompileFromCommandLineArguments (ctok, argv, LegacyMSBuildReferenceResolver.getResolver(), false, ReduceMemoryFlag.No, CopyFSharpCoreFlag.No, FSharp.Compiler.DiagnosticsLogger.QuitProcessExiter, ConsoleLoggerProvider(), None, None) () - with - | :? 'TException as e -> + with + | :? 'TException as e -> let msg = e.ToString(); if msg.Contains("ReportTime") || msg.Contains("CheckOneInput") then () else printfn "%s" msg Assert.Fail("The correct callstack was not reported to watson.") | (FSharp.Compiler.DiagnosticsLogger.ReportedError (Some (FSharp.Compiler.DiagnosticsLogger.InternalError (msg, range) as e))) - | (FSharp.Compiler.DiagnosticsLogger.InternalError (msg, range) as e) -> + | (FSharp.Compiler.DiagnosticsLogger.InternalError (msg, range) as e) -> printfn "InternalError Exception: %s, range = %A, stack = %s" msg range (e.ToString()) Assert.Fail("An InternalError exception occurred.") - finally + finally #if DEBUG FSharp.Compiler.CompilerDiagnostics.showAssertForUnexpectedException := true #endif FileSystem.FileDeleteShim("watson-test.fs") -module WatsonTests = +module WatsonTests = [] let FscOutOfMemory() = Check.FscLevelException("fsc-oom") [] - let FscArgumentNull() = Check.FscLevelException("fsc-an") - + let FscArgumentNull() = Check.FscLevelException("fsc-an") + [] - let FscInvalidOperation() = Check.FscLevelException("fsc-invop") + let FscInvalidOperation() = Check.FscLevelException("fsc-invop") // As of .NET 4.0 some exception types cannot be caught. As a result, we cannot test this case. I did visually confirm a Watson report is sent, though. // [] -// let FscAccessViolation() = Check.FscLevelException("fsc-ac") +// let FscAccessViolation() = Check.FscLevelException("fsc-ac") [] - let FscArgumentOutOfRange() = Check.FscLevelException("fsc-aor") + let FscArgumentOutOfRange() = Check.FscLevelException("fsc-aor") [] - let FscDivideByZero() = Check.FscLevelException("fsc-dv0") + let FscDivideByZero() = Check.FscLevelException("fsc-dv0") [] - let FscNotFiniteNumber() = Check.FscLevelException("fsc-nfn") + let FscNotFiniteNumber() = Check.FscLevelException("fsc-nfn") [] - let FscOverflow() = Check.FscLevelException("fsc-oe") + let FscOverflow() = Check.FscLevelException("fsc-oe") [] - let FscArrayTypeMismatch() = Check.FscLevelException("fsc-atmm") + let FscArrayTypeMismatch() = Check.FscLevelException("fsc-atmm") [] - let FscBadImageFormat() = Check.FscLevelException("fsc-bif") + let FscBadImageFormat() = Check.FscLevelException("fsc-bif") [] - let FscKeyNotFound() = Check.FscLevelException("fsc-knf") + let FscKeyNotFound() = Check.FscLevelException("fsc-knf") [] - let FscIndexOutOfRange() = Check.FscLevelException("fsc-ior") + let FscIndexOutOfRange() = Check.FscLevelException("fsc-ior") [] - let FscInvalidCast() = Check.FscLevelException("fsc-ic") + let FscInvalidCast() = Check.FscLevelException("fsc-ic") [] - let FscInvalidProgram() = Check.FscLevelException("fsc-ip") + let FscInvalidProgram() = Check.FscLevelException("fsc-ip") [] - let FscMemberAccess() = Check.FscLevelException("fsc-ma") + let FscMemberAccess() = Check.FscLevelException("fsc-ma") [] - let FscNotImplemented() = Check.FscLevelException("fsc-ni") + let FscNotImplemented() = Check.FscLevelException("fsc-ni") [] - let FscNullReference() = Check.FscLevelException("fsc-nr") + let FscNullReference() = Check.FscLevelException("fsc-nr") [] - let FscOperationCancelled() = Check.FscLevelException("fsc-oc") - + let FscOperationCancelled() = Check.FscLevelException("fsc-oc") + //[] - //let FscFailure() = Check.FscLevelException("fsc-fail") - + //let FscFailure() = Check.FscLevelException("fsc-fail") + [] let TypeCheckOutOfMemory() = Check.FscLevelException("tc-oom") [] - let TypeCheckArgumentNull() = Check.FscLevelException("tc-an") - + let TypeCheckArgumentNull() = Check.FscLevelException("tc-an") + [] - let TypeCheckInvalidOperation() = Check.FscLevelException("tc-invop") + let TypeCheckInvalidOperation() = Check.FscLevelException("tc-invop") // As of .NET 4.0 some exception types cannot be caught. As a result, we cannot test this case. I did visually confirm a Watson report is sent, though. // [] -// let TypeCheckAccessViolation() = Check.FscLevelException("tc-ac") +// let TypeCheckAccessViolation() = Check.FscLevelException("tc-ac") [] - let TypeCheckArgumentOutOfRange() = Check.FscLevelException("tc-aor") + let TypeCheckArgumentOutOfRange() = Check.FscLevelException("tc-aor") [] - let TypeCheckDivideByZero() = Check.FscLevelException("tc-dv0") + let TypeCheckDivideByZero() = Check.FscLevelException("tc-dv0") [] - let TypeCheckNotFiniteNumber() = Check.FscLevelException("tc-nfn") + let TypeCheckNotFiniteNumber() = Check.FscLevelException("tc-nfn") [] - let TypeCheckOverflow() = Check.FscLevelException("tc-oe") + let TypeCheckOverflow() = Check.FscLevelException("tc-oe") [] - let TypeCheckArrayTypeMismatch() = Check.FscLevelException("tc-atmm") + let TypeCheckArrayTypeMismatch() = Check.FscLevelException("tc-atmm") [] - let TypeCheckBadImageFormat() = Check.FscLevelException("tc-bif") + let TypeCheckBadImageFormat() = Check.FscLevelException("tc-bif") [] - let TypeCheckKeyNotFound() = Check.FscLevelException("tc-knf") + let TypeCheckKeyNotFound() = Check.FscLevelException("tc-knf") [] - let TypeCheckIndexOutOfRange() = Check.FscLevelException("tc-ior") + let TypeCheckIndexOutOfRange() = Check.FscLevelException("tc-ior") [] - let TypeCheckInvalidCast() = Check.FscLevelException("tc-ic") + let TypeCheckInvalidCast() = Check.FscLevelException("tc-ic") [] - let TypeCheckInvalidProgram() = Check.FscLevelException("tc-ip") + let TypeCheckInvalidProgram() = Check.FscLevelException("tc-ip") [] - let TypeCheckMemberAccess() = Check.FscLevelException("tc-ma") + let TypeCheckMemberAccess() = Check.FscLevelException("tc-ma") [] - let TypeCheckNotImplemented() = Check.FscLevelException("tc-ni") + let TypeCheckNotImplemented() = Check.FscLevelException("tc-ni") [] - let TypeCheckNullReference() = Check.FscLevelException("tc-nr") + let TypeCheckNullReference() = Check.FscLevelException("tc-nr") [] - let TypeCheckOperationCancelled() = Check.FscLevelException("tc-oc") + let TypeCheckOperationCancelled() = Check.FscLevelException("tc-oc") [] - let TypeCheckFailure() = Check.FscLevelException("tc-fail") + let TypeCheckFailure() = Check.FscLevelException("tc-fail") diff --git a/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs b/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs index b11bdd9ef8c..e956f76be5b 100644 --- a/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs +++ b/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs @@ -20,11 +20,11 @@ type XmlDocComments() = member public this.AssertQuickInfoContainsAtStartOfMarker code marker expected = let (_solution, _project, file) = this.CreateSingleFileProject(code : string) MoveCursorToStartOfMarker(file, marker) - let tooltip = GetQuickInfoAtCursor file + let tooltip = GetQuickInfoAtCursor file printfn "%A" tooltip - AssertContains(trimnewlines tooltip, trimnewlines expected) + AssertContains(trimnewlines tooltip, trimnewlines expected) - member private this.TestMalFormedXML(marker : string) = + member private this.TestMalFormedXML(marker : string) = let fileContent1 = """ namespace XML module Doc = @@ -56,7 +56,7 @@ type XmlDocComments() = let project1 = CreateProject(solution, "FSLibrary") let project2 = CreateProject(solution, "FSClient") let file1 = AddFileFromTextBlob(project1,"File1.fs", fileContent1) - AddProjectReference(project2,project1) + AddProjectReference(project2,project1) Build(project1) |> fun result -> Assert.True(result.BuildSucceeded) let file2 = AddFileFromTextBlob(project2,"File2.fs", fileContent2) @@ -65,30 +65,30 @@ type XmlDocComments() = GetQuickInfoAtCursor file [] - member this.``MalFormedXML.FromXMLDoc``() = + member this.``MalFormedXML.FromXMLDoc``() = let expected = "XML comment" let tooltip = this.TestMalFormedXML("(*Marker1*)") printfn "%A" tooltip - AssertContains(trimnewlines tooltip, trimnewlines expected) + AssertContains(trimnewlines tooltip, trimnewlines expected) [] - member this.``MalFormedXML.FromCurrentProject``() = + member this.``MalFormedXML.FromCurrentProject``() = let expected = "'summary'" let tooltip = this.TestMalFormedXML("(*Marker2*)") printfn "%A" tooltip - AssertContains(trimnewlines tooltip, trimnewlines expected) + AssertContains(trimnewlines tooltip, trimnewlines expected) [] - member this.``MalFormedXML.NoXMLComment.Bug5858``() = + member this.``MalFormedXML.NoXMLComment.Bug5858``() = let notexpected = "summary" let notexpected2 = "param name=" let tooltip = this.TestMalFormedXML("(*Marker3*)") printfn "%A" tooltip - AssertNotContains(tooltip, notexpected) - AssertNotContains(tooltip, notexpected2) + AssertNotContains(tooltip, notexpected) + AssertNotContains(tooltip, notexpected2) [] - member this.Test() = + member this.Test() = let fileContent = """ //local custom type value /// diff --git a/vsintegration/tests/UnitTests/UnusedOpensTests.fs b/vsintegration/tests/UnitTests/UnusedOpensTests.fs index b77d7e257ef..0207ae73143 100644 --- a/vsintegration/tests/UnitTests/UnusedOpensTests.fs +++ b/vsintegration/tests/UnitTests/UnusedOpensTests.fs @@ -11,7 +11,7 @@ open FSharp.Compiler.Text let private filePath = "C:\\test.fs" -let private projectOptions : FSharpProjectOptions = +let private projectOptions : FSharpProjectOptions = { ProjectFileName = "C:\\test.fsproj" ProjectId = None SourceFiles = [| filePath |] @@ -30,15 +30,15 @@ let (=>) (source: string) (expectedRanges: ((*line*)int * ((*start column*)int * let sourceLines = source.Split ([|"\r\n"; "\n"; "\r"|], StringSplitOptions.None) let _, checkFileAnswer = checker.ParseAndCheckFileInProject(filePath, 0, FSharp.Compiler.Text.SourceText.ofString source, projectOptions) |> Async.RunSynchronously - + let checkFileResults = match checkFileAnswer with | FSharpCheckFileAnswer.Aborted -> failwithf "ParseAndCheckFileInProject aborted" | FSharpCheckFileAnswer.Succeeded(checkFileResults) -> checkFileResults let unusedOpenRanges = UnusedOpens.getUnusedOpens (checkFileResults, fun lineNum -> sourceLines.[Line.toZ lineNum]) |> Async.RunSynchronously - - unusedOpenRanges + + unusedOpenRanges |> List.map (fun x -> x.StartLine, (x.StartColumn, x.EndColumn)) |> fun actual -> Assert.Equal<(int * (int * int)) list>(expectedRanges, actual) @@ -74,7 +74,7 @@ module Nested = """ => [ 5, (9, 18) ] -[] +[] let ``unused open declaration due to partially qualified symbol``() = """ module TopModule @@ -203,7 +203,7 @@ open NormalModule.AutoOpenModule1.NestedNormalModule let _ = Class() """ => [ 13, (5, 52) ] - + [] let ``open declaration is not marked as unused if there is a shortened attribute symbol from it``() = """ @@ -212,7 +212,7 @@ open System type Class() = class end """ => [] - + [] let ``open declaration is not marked as unused if an extension property is used``() = """ @@ -268,7 +268,7 @@ module M = open M type Site (x: Class -> unit) = class end """ - => [] + => [] [] let ``open declaration is marked as unused if nothing from it is used``() = @@ -291,7 +291,7 @@ open Extensions let _ = DateTime.ExtensionMethod """ => [] - + [] let ``static extension property applied to a type results that both namespaces /where the type is declared and where the extension is declared/ is not marked as unused``() = """ @@ -328,7 +328,7 @@ let _ = func1() let _ = func2() """ => [] - + [] let ``open module with ModuleSuffix attribute value applied is not marked as unused if a symbol declared in it is used``() = """ @@ -461,7 +461,7 @@ module M = let _ = InternalModuleWithSuffix.func1() """ => [ 6, (9, 33) ] - + [] let ``redundant opening a module is marks as unused``() = """ @@ -519,7 +519,7 @@ let ``a type which has more than one DisplayName causes the namespace it's defin """ open System let _ = IntPtr.Zero -""" +""" => [] [] @@ -604,7 +604,7 @@ module Module = => [] [] -let ``record fields should be taken into account``() = +let ``record fields should be taken into account``() = """ module M1 = type Record = { Field: int } @@ -615,7 +615,7 @@ module M2 = => [] [] -let ``handle type alias``() = +let ``handle type alias``() = """ module TypeAlias = type MyInt = int @@ -626,7 +626,7 @@ module Usage = => [] [] -let ``handle override members``() = +let ``handle override members``() = """ type IInterface = abstract Property: int @@ -668,7 +668,7 @@ open M let _ = 1 """ => [ 4, (5, 6) ] - + [] let ``type in type parameter constraint should be taken into account``() = """ @@ -727,8 +727,8 @@ open System.Linq module Test = let xs = [] let _ = xs.ToList() -""" - => [] +""" + => [] [] let ``namespace which contains types with C# extension methods is marked as unused if no extension is used``() = @@ -737,8 +737,8 @@ open System.Linq module Test = let xs = [] -""" - => [ 2, (5, 16) ] +""" + => [ 2, (5, 16) ] [] let ``a type from an auto open module is taken into account``() = @@ -815,7 +815,7 @@ open type System.Console WriteLine("Hello World") """ => [] - + [] let ``unused open C# type``() = """ @@ -824,7 +824,7 @@ open type System.Console printfn "%s" "Hello World" """ => [2, (10, 24)] - + [] let ``used open type from module``() = """ @@ -837,7 +837,7 @@ open type MyModule.Thingy printfn "%A" Thing """ => [] - + [] let ``unused open type from module``() = """ diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs index 684ae3a6c84..8d9a29407d8 100644 --- a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -71,18 +71,18 @@ module WorkspaceTests = let getDocumentId (workspace: Workspace) filePath = let solution = workspace.CurrentSolution - solution.GetDocumentIdsWithFilePath(filePath) + solution.GetDocumentIdsWithFilePath(filePath) |> Seq.exactlyOne let getDocument (workspace: Workspace) filePath = let solution = workspace.CurrentSolution - solution.GetDocumentIdsWithFilePath(filePath) + solution.GetDocumentIdsWithFilePath(filePath) |> Seq.exactlyOne |> solution.GetDocument let openDocument (workspace: Workspace) (filePath: string) = let docId = - workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) + workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) |> Seq.exactlyOne use waitHandle = new ManualResetEventSlim(false) use _sub = workspace.DocumentOpened.Subscribe(fun _ -> @@ -97,9 +97,9 @@ module WorkspaceTests = let doc = getDocument workspace filePath // The adhoc workspaces do not listen for files changing on disk, // so we simulate the update here. - let newSolution = + let newSolution = doc.Project.Solution.WithDocumentTextLoader( - doc.Id, + doc.Id, new FileTextLoader(doc.FilePath, Encoding.Default), PreservationMode.PreserveIdentity) workspace.TryApplyChanges(newSolution) |> ignore @@ -113,9 +113,9 @@ module WorkspaceTests = try compileFileAsDll workspace filePath dllPath - let newMetadataReference = + let newMetadataReference = PortableExecutableReference.CreateFromFile( - dllPath, + dllPath, MetadataReferenceProperties.Assembly ) // The adhoc workspaces do not listen for files changing on disk, @@ -168,14 +168,14 @@ module WorkspaceTests = let assertEmptyDocumentDiagnostics (workspace: Workspace) (filePath: string) = let doc = getDocument workspace filePath let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertEmptyDocumentDiagnostics") |> CancellableTask.runSynchronouslyWithoutCancellation - + Assert.Empty(parseResults.Diagnostics) Assert.Empty(checkResults.Diagnostics) let assertHasDocumentDiagnostics (workspace: Workspace) (filePath: string) = let doc = getDocument workspace filePath let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertHasDocumentDiagnostics") |> CancellableTask.runSynchronouslyWithoutCancellation - + Assert.Empty(parseResults.Diagnostics) Assert.NotEmpty(checkResults.Diagnostics) @@ -193,7 +193,7 @@ module WorkspaceTests = // member _.FilePath: string = mainProj.FilePath -// member _.HasProjectReference(filePath: string): bool = +// member _.HasProjectReference(filePath: string): bool = // mainProj.ProjectReferences // |> Seq.exists (fun x -> // let projRef = mainProj.Solution.GetProject(x.ProjectId) @@ -207,7 +207,7 @@ module WorkspaceTests = // member _.ProjectReferenceCount: int = mainProj.ProjectReferences.Count() -// member _.SetProjectReferences(projRefs: seq): unit = +// member _.SetProjectReferences(projRefs: seq): unit = // let currentProj = mainProj // let mutable solution = currentProj.Solution @@ -218,9 +218,9 @@ module WorkspaceTests = // projRefs // |> Seq.iter (fun projRef -> -// solution <- +// solution <- // solution.AddProjectReference( -// currentProj.Id, +// currentProj.Id, // ProjectReference(projRef.Id) // ) // ) @@ -233,7 +233,7 @@ module WorkspaceTests = // member _.HasMetadataReference(referencePath: string): bool = // mainProj.MetadataReferences -// |> Seq.exists (fun x -> +// |> Seq.exists (fun x -> // match x with // | :? PortableExecutableReference as r -> // String.Equals(r.FilePath, referencePath, StringComparison.OrdinalIgnoreCase) @@ -251,9 +251,9 @@ module WorkspaceTests = // referencePaths // |> Seq.iter (fun referencePath -> -// solution <- +// solution <- // solution.AddMetadataReference( -// currentProj.Id, +// currentProj.Id, // PortableExecutableReference.CreateFromFile( // referencePath, // MetadataReferenceProperties.Assembly @@ -269,7 +269,7 @@ module WorkspaceTests = // member _.AddSourceFile(_: string, _: SourceCodeKind): unit = () // type TestFSharpWorkspaceProjectContextFactory(workspace: Workspace, miscFilesWorkspace: Workspace) = - + // interface IFSharpWorkspaceProjectContextFactory with // member _.CreateProjectContext(filePath: string, uniqueName: string): IFSharpWorkspaceProjectContext = // match miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) |> Seq.tryExactlyOne with @@ -293,14 +293,14 @@ module WorkspaceTests = // let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) -// let filePath = -// createOnDiskScript +// let filePath = +// createOnDiskScript // """ //module Script1 //let x = 1 // """ - + // try // let projInfo = createProjectInfoWithFileOnDisk filePath // addProject miscFilesWorkspace projInfo @@ -331,27 +331,27 @@ module WorkspaceTests = // let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) -// let filePath1 = -// createOnDiskScript +// let filePath1 = +// createOnDiskScript // """ //module Script1 //let x = 1 // """ -// let filePath2 = -// createOnDiskScript +// let filePath2 = +// createOnDiskScript // $""" //module Script2 //#load "{ Path.GetFileName(filePath1) }" //let x = Script1.x // """ - + // try // let projInfo2 = createProjectInfoWithFileOnDisk filePath2 // addProject miscFilesWorkspace projInfo2 -// openDocument miscFilesWorkspace filePath2 +// openDocument miscFilesWorkspace filePath2 // assertEmptyDocumentDiagnostics workspace filePath2 // finally @@ -366,21 +366,21 @@ module WorkspaceTests = // let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) -// let filePath1 = -// createOnDiskScript +// let filePath1 = +// createOnDiskScript // """ //module Script1 // """ -// let filePath2 = -// createOnDiskScript +// let filePath2 = +// createOnDiskScript // $""" //module Script2 //#load "{ Path.GetFileName(filePath1) }" //let x = Script1.x // """ - + // try // let projInfo1 = createProjectInfoWithFileOnDisk filePath1 // let projInfo2 = createProjectInfoWithFileOnDisk filePath2 @@ -389,8 +389,8 @@ module WorkspaceTests = // addProject miscFilesWorkspace projInfo2 // openDocument miscFilesWorkspace filePath1 -// openDocument miscFilesWorkspace filePath2 - +// openDocument miscFilesWorkspace filePath2 + // assertEmptyDocumentDiagnostics workspace filePath1 // assertHasDocumentDiagnostics workspace filePath2 @@ -415,21 +415,21 @@ module WorkspaceTests = // let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) -// let filePath1 = -// createOnDiskScript +// let filePath1 = +// createOnDiskScript // """ //module Script1 // """ -// let filePath2 = -// createOnDiskScript +// let filePath2 = +// createOnDiskScript // $""" //module Script2 //#load "{ Path.GetFileName(filePath1) }" //let x = Script1.x // """ - + // try // let projInfo1 = createProjectInfoWithFileOnDisk filePath1 // let projInfo2 = createProjectInfoWithFileOnDisk filePath2 @@ -438,9 +438,9 @@ module WorkspaceTests = // addProject miscFilesWorkspace projInfo2 // openDocument miscFilesWorkspace filePath2 -// openDocument miscFilesWorkspace filePath1 - -// assertHasDocumentDiagnostics workspace filePath2 +// openDocument miscFilesWorkspace filePath1 + +// assertHasDocumentDiagnostics workspace filePath2 // assertEmptyDocumentDiagnostics workspace filePath1 // updateDocumentOnDisk workspace filePath1 @@ -464,7 +464,7 @@ module WorkspaceTests = // let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) -// let dllPath1 = +// let dllPath1 = // createOnDiskCompiledScriptAsDll workspace // """ //module Script1 @@ -472,21 +472,21 @@ module WorkspaceTests = //let x = 1 // """ -// let filePath1 = -// createOnDiskScript +// let filePath1 = +// createOnDiskScript // $""" //module Script2 //#r "{ Path.GetFileName(dllPath1) }" //let x = Script1.x // """ - + // try // let projInfo1 = createProjectInfoWithFileOnDisk filePath1 // addProject miscFilesWorkspace projInfo1 -// openDocument miscFilesWorkspace filePath1 +// openDocument miscFilesWorkspace filePath1 // assertEmptyDocumentDiagnostics workspace filePath1 From c065d766c5cf3f18817ee44f400fba082bdb1d26 Mon Sep 17 00:00:00 2001 From: Andrii Chebukin Date: Sat, 29 Aug 2026 03:42:11 +0200 Subject: [PATCH 2/2] Add the whitespace-removal commit to .git-blame-ignore-revs Note: dotnet/fsharp squash-merges PRs, so this SHA points at the branch commit and will need rewriting to the squashed commit SHA afterwards -- the same caveat the file's own header documents for the existing entries. The companion src-only PR's SHA should be added in that same follow-up. Co-Authored-By: Claude Opus 5 (1M context) --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 7a3d952c25d..604b1110322 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -7,3 +7,6 @@ # Spelling, https://github.com/dotnet/fsharp/pull/16212 23e91e1322363a7e9c34baaeabbf0391c4b7eafd + +# Remove all trailing whitespaces, https://github.com/dotnet/fsharp/pull/20355 +b64623e8bb20ff2676e8c90813d2e2c72d9a81fb